| 1 | /******************************************************************************* |
|---|---|
| 2 | * Copyright (c) 2000, 2005 IBM Corporation and others. |
| 3 | * |
| 4 | * This program and the accompanying materials |
| 5 | * are made available under the terms of the Eclipse Public License 2.0 |
| 6 | * which accompanies this distribution, and is available at |
| 7 | * https://www.eclipse.org/legal/epl-2.0/ |
| 8 | * |
| 9 | * SPDX-License-Identifier: EPL-2.0 |
| 10 | * |
| 11 | * Contributors: |
| 12 | * IBM Corporation - initial API and implementation |
| 13 | *******************************************************************************/ |
| 14 | package org.eclipse.jdt.astview.views; |
| 15 | |
| 16 | import org.eclipse.swt.graphics.Image; |
| 17 | |
| 18 | import org.eclipse.jdt.core.dom.ASTNode; |
| 19 | |
| 20 | /** |
| 21 | * |
| 22 | */ |
| 23 | public abstract class ASTAttribute { |
| 24 | |
| 25 | protected static final Object[] EMPTY= new Object[0]; |
| 26 | |
| 27 | public abstract Object getParent(); |
| 28 | public abstract Object[] getChildren(); |
| 29 | public abstract String getLabel(); |
| 30 | public abstract Image getImage(); |
| 31 | |
| 32 | public ASTNode getParentASTNode() { |
| 33 | Object parent= getParent(); |
| 34 | while (parent instanceof ASTAttribute) { |
| 35 | parent= ((ASTAttribute) parent).getParent(); |
| 36 | } |
| 37 | if (parent instanceof ASTNode) { |
| 38 | return (ASTNode) parent; |
| 39 | } |
| 40 | return null; |
| 41 | } |
| 42 | |
| 43 | } |
| 44 |
Members