Java Code Examples for org.eclipse.jdt.core.dom.ASTNode#COMPILATION_UNIT
The following examples show how to use
org.eclipse.jdt.core.dom.ASTNode#COMPILATION_UNIT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaTextBufferNode.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Returns the corresponding place holder type for the given element. * @return a place holder type (see ASTRewrite) or -1 if there is no corresponding placeholder */ static final int getPlaceHolderType(ITypedElement element) { if (element instanceof DocumentRangeNode) { JavaNode jn= (JavaNode) element; switch (jn.getTypeCode()) { case JavaNode.PACKAGE: return ASTNode.PACKAGE_DECLARATION; case JavaNode.CLASS: case JavaNode.INTERFACE: return ASTNode.TYPE_DECLARATION; case JavaNode.ENUM: return ASTNode.ENUM_DECLARATION; case JavaNode.ANNOTATION: return ASTNode.ANNOTATION_TYPE_DECLARATION; case JavaNode.CONSTRUCTOR: case JavaNode.METHOD: return ASTNode.METHOD_DECLARATION; case JavaNode.FIELD: return ASTNode.FIELD_DECLARATION; case JavaNode.INIT: return ASTNode.INITIALIZER; case JavaNode.IMPORT: case JavaNode.IMPORT_CONTAINER: return ASTNode.IMPORT_DECLARATION; case JavaNode.CU: return ASTNode.COMPILATION_UNIT; } } return -1; }
Example 2
Source File: JavaAddElementFromHistoryImpl.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Returns the corresponding place holder type for the given element. * @return a place holder type (see ASTRewrite) or -1 if there is no corresponding placeholder */ private int getPlaceHolderType(ITypedElement element) { if (element instanceof DocumentRangeNode) { JavaNode jn= (JavaNode) element; switch (jn.getTypeCode()) { case JavaNode.PACKAGE: return ASTNode.PACKAGE_DECLARATION; case JavaNode.CLASS: case JavaNode.INTERFACE: return ASTNode.TYPE_DECLARATION; case JavaNode.ENUM: return ASTNode.ENUM_DECLARATION; case JavaNode.ANNOTATION: return ASTNode.ANNOTATION_TYPE_DECLARATION; case JavaNode.CONSTRUCTOR: case JavaNode.METHOD: return ASTNode.METHOD_DECLARATION; case JavaNode.FIELD: return ASTNode.FIELD_DECLARATION; case JavaNode.INIT: return ASTNode.INITIALIZER; case JavaNode.IMPORT: case JavaNode.IMPORT_CONTAINER: return ASTNode.IMPORT_DECLARATION; case JavaNode.CU: return ASTNode.COMPILATION_UNIT; } } return -1; }
Example 3
Source File: CreateTypeMemberOperation.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
protected StructuralPropertyDescriptor getChildPropertyDescriptor(ASTNode parent) { switch (parent.getNodeType()) { case ASTNode.COMPILATION_UNIT: return CompilationUnit.TYPES_PROPERTY; case ASTNode.ENUM_DECLARATION: return EnumDeclaration.BODY_DECLARATIONS_PROPERTY; case ASTNode.ANNOTATION_TYPE_DECLARATION: return AnnotationTypeDeclaration.BODY_DECLARATIONS_PROPERTY; default: return TypeDeclaration.BODY_DECLARATIONS_PROPERTY; } }