1 | /******************************************************************************* |
---|---|
2 | * Copyright (c) 2007 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.AST; |
19 | import org.eclipse.jdt.core.dom.CompilationUnit; |
20 | |
21 | public class SettingsProperty extends ASTAttribute { |
22 | |
23 | private final CompilationUnit fRoot; |
24 | |
25 | public SettingsProperty(CompilationUnit root) { |
26 | fRoot= root; |
27 | } |
28 | |
29 | @Override |
30 | public Object getParent() { |
31 | return fRoot; |
32 | } |
33 | |
34 | @Override |
35 | public Object[] getChildren() { |
36 | AST ast= fRoot.getAST(); |
37 | Object[] res= { |
38 | new GeneralAttribute(this, "apiLevel", String.valueOf(ast.apiLevel())), |
39 | new GeneralAttribute(this, "hasResolvedBindings", String.valueOf(ast.hasResolvedBindings())), |
40 | new GeneralAttribute(this, "hasStatementsRecovery", String.valueOf(ast.hasStatementsRecovery())), |
41 | new GeneralAttribute(this, "hasBindingsRecovery", String.valueOf(ast.hasBindingsRecovery())), |
42 | }; |
43 | return res; |
44 | } |
45 | |
46 | @Override |
47 | public String getLabel() { |
48 | return "> AST settings"; //$NON-NLS-1$ |
49 | } |
50 | |
51 | @Override |
52 | public Image getImage() { |
53 | return null; |
54 | } |
55 | |
56 | /* |
57 | * @see java.lang.Object#equals(java.lang.Object) |
58 | */ |
59 | @Override |
60 | public boolean equals(Object obj) { |
61 | if (this == obj) |
62 | return true; |
63 | if (obj == null || !obj.getClass().equals(getClass())) { |
64 | return false; |
65 | } |
66 | return true; |
67 | } |
68 | |
69 | /* |
70 | * @see java.lang.Object#hashCode() |
71 | */ |
72 | @Override |
73 | public int hashCode() { |
74 | return 19; |
75 | } |
76 | } |
77 |
Members