Eclipse JDT
Release 3.2

org.eclipse.jdt.core
Class JavaCore

java.lang.Object
  extended byorg.eclipse.core.runtime.Plugin
      extended byorg.eclipse.jdt.core.JavaCore
All Implemented Interfaces:
BundleActivator

public final class JavaCore
extends Plugin

The plug-in runtime class for the Java model plug-in containing the core (UI-free) support for Java projects.

Like all plug-in runtime classes (subclasses of Plugin), this class is automatically instantiated by the platform when the plug-in gets activated. Clients must not attempt to instantiate plug-in runtime classes directly.

The single instance of this class can be accessed from any plug-in declaring the Java model plug-in as a prerequisite via JavaCore.getJavaCore(). The Java model plug-in will be activated automatically if not already active.


Field Summary
static String ABORT
          Possible configurable option value.
protected static String ATT_HANDLE_ID
          Name of the handle id attribute in a Java marker.
static String BUILDER_ID
          The identifier for the Java builder (value "org.eclipse.jdt.core.javabuilder").
static String CLEAN
          Possible configurable option value.
static String CLEAR_ALL
          Possible configurable option value.
static String CODEASSIST_ARGUMENT_PREFIXES
          Possible configurable option ID.
static String CODEASSIST_ARGUMENT_SUFFIXES
          Possible configurable option ID.
static String CODEASSIST_CAMEL_CASE_MATCH
          Possible configurable option ID.
static String CODEASSIST_DEPRECATION_CHECK
          Possible configurable option ID.
static String CODEASSIST_DISCOURAGED_REFERENCE_CHECK
          Possible configurable option ID.
static String CODEASSIST_FIELD_PREFIXES
          Possible configurable option ID.
static String CODEASSIST_FIELD_SUFFIXES
          Possible configurable option ID.
static String CODEASSIST_FORBIDDEN_REFERENCE_CHECK
          Possible configurable option ID.
static String CODEASSIST_IMPLICIT_QUALIFICATION
          Possible configurable option ID.
static String CODEASSIST_LOCAL_PREFIXES
          Possible configurable option ID.
static String CODEASSIST_LOCAL_SUFFIXES
          Possible configurable option ID.
static String CODEASSIST_STATIC_FIELD_PREFIXES
          Possible configurable option ID.
static String CODEASSIST_STATIC_FIELD_SUFFIXES
          Possible configurable option ID.
static String CODEASSIST_VISIBILITY_CHECK
          Possible configurable option ID.
static String COMPACT
          Possible configurable option value.
static String COMPILER_CODEGEN_INLINE_JSR_BYTECODE
          Possible configurable option ID.
static String COMPILER_CODEGEN_TARGET_PLATFORM
          Possible configurable option ID.
static String COMPILER_CODEGEN_UNUSED_LOCAL
          Possible configurable option ID.
static String COMPILER_COMPLIANCE
          Possible configurable option ID.
static String COMPILER_DOC_COMMENT_SUPPORT
          Possible configurable option ID.
static String COMPILER_LINE_NUMBER_ATTR
          Possible configurable option ID.
static String COMPILER_LOCAL_VARIABLE_ATTR
          Possible configurable option ID.
static String COMPILER_PB_ANNOTATION_SUPER_INTERFACE
          Possible configurable option ID.
static String COMPILER_PB_ASSERT_IDENTIFIER
          Possible configurable option ID.
static String COMPILER_PB_AUTOBOXING
          Possible configurable option ID.
static String COMPILER_PB_BOOLEAN_METHOD_THROWING_EXCEPTION
          Possible configurable option ID.
static String COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION
          Possible configurable option ID.
static String COMPILER_PB_DEPRECATION
          Possible configurable option ID.
static String COMPILER_PB_DEPRECATION_IN_DEPRECATED_CODE
          Possible configurable option ID.
static String COMPILER_PB_DEPRECATION_WHEN_OVERRIDING_DEPRECATED_METHOD
          Possible configurable option ID.
static String COMPILER_PB_DISCOURAGED_REFERENCE
          Possible configurable option ID.
static String COMPILER_PB_EMPTY_STATEMENT
          Possible configurable option ID.
static String COMPILER_PB_ENUM_IDENTIFIER
          Possible configurable option ID.
static String COMPILER_PB_FALLTHROUGH_CASE
          Possible configurable option ID.
static String COMPILER_PB_FATAL_OPTIONAL_ERROR
          Possible configurable option ID.
static String COMPILER_PB_FIELD_HIDING
          Possible configurable option ID.
static String COMPILER_PB_FINAL_PARAMETER_BOUND
          Possible configurable option ID.
static String COMPILER_PB_FINALLY_BLOCK_NOT_COMPLETING
          Possible configurable option ID.
static String COMPILER_PB_FORBIDDEN_REFERENCE
          Possible configurable option ID.
static String COMPILER_PB_HIDDEN_CATCH_BLOCK
          Possible configurable option ID.
static String COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD
          Possible configurable option ID.
static String COMPILER_PB_INCOMPLETE_ENUM_SWITCH
          Possible configurable option ID.
static String COMPILER_PB_INCONSISTENT_NULL_CHECK
          Deprecated. use COMPILER_PB_NULL_REFERENCE instead
static String COMPILER_PB_INDIRECT_STATIC_ACCESS
          Possible configurable option ID.
static String COMPILER_PB_INVALID_IMPORT
          Deprecated. - discontinued since turning off would violate language specs
static String COMPILER_PB_INVALID_JAVADOC
          Possible configurable option ID.
static String COMPILER_PB_INVALID_JAVADOC_TAGS
          Possible configurable option ID.
static String COMPILER_PB_INVALID_JAVADOC_TAGS__DEPRECATED_REF
          Possible configurable option ID.
static String COMPILER_PB_INVALID_JAVADOC_TAGS__NOT_VISIBLE_REF
          Possible configurable option ID.
static String COMPILER_PB_INVALID_JAVADOC_TAGS_VISIBILITY
          Possible configurable option ID.
static String COMPILER_PB_LOCAL_VARIABLE_HIDING
          Possible configurable option ID.
static String COMPILER_PB_MAX_PER_UNIT
          Possible configurable option ID.
static String COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME
          Possible configurable option ID.
static String COMPILER_PB_MISSING_DEPRECATED_ANNOTATION
          Possible configurable option ID.
static String COMPILER_PB_MISSING_JAVADOC_COMMENTS
          Possible configurable option ID.
static String COMPILER_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING
          Possible configurable option ID.
static String COMPILER_PB_MISSING_JAVADOC_COMMENTS_VISIBILITY
          Possible configurable option ID.
static String COMPILER_PB_MISSING_JAVADOC_TAGS
          Possible configurable option ID.
static String COMPILER_PB_MISSING_JAVADOC_TAGS_OVERRIDING
          Possible configurable option ID.
static String COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY
          Possible configurable option ID.
static String COMPILER_PB_MISSING_OVERRIDE_ANNOTATION
          Possible configurable option ID.
static String COMPILER_PB_MISSING_SERIAL_VERSION
          Possible configurable option ID.
static String COMPILER_PB_NO_EFFECT_ASSIGNMENT
          Possible configurable option ID.
static String COMPILER_PB_NON_NLS_STRING_LITERAL
          Possible configurable option ID.
static String COMPILER_PB_NULL_REFERENCE
          Possible configurable option ID.
static String COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD
          Possible configurable option ID.
static String COMPILER_PB_PARAMETER_ASSIGNMENT
          Possible configurable option ID.
static String COMPILER_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT
          Possible configurable option ID.
static String COMPILER_PB_RAW_TYPE_REFERENCE
          Possible configurable option ID.
static String COMPILER_PB_SPECIAL_PARAMETER_HIDING_FIELD
          Possible configurable option ID.
static String COMPILER_PB_STATIC_ACCESS_RECEIVER
          Possible configurable option ID.
static String COMPILER_PB_SUPPRESS_WARNINGS
          Possible configurable option ID.
static String COMPILER_PB_SYNTHETIC_ACCESS_EMULATION
          Possible configurable option ID.
static String COMPILER_PB_TYPE_PARAMETER_HIDING
          Possible configurable option ID.
static String COMPILER_PB_UNCHECKED_TYPE_OPERATION
          Possible configurable option ID.
static String COMPILER_PB_UNDOCUMENTED_EMPTY_BLOCK
          Possible configurable option ID.
static String COMPILER_PB_UNHANDLED_WARNING_TOKEN
          Possible configurable option ID.
static String COMPILER_PB_UNNECESSARY_ELSE
          Possible configurable option ID.
static String COMPILER_PB_UNNECESSARY_TYPE_CHECK
          Possible configurable option ID.
static String COMPILER_PB_UNQUALIFIED_FIELD_ACCESS
          Possible configurable option ID.
static String COMPILER_PB_UNREACHABLE_CODE
          Deprecated. - discontinued since turning off would violate language specs
static String COMPILER_PB_UNSAFE_TYPE_OPERATION
          Deprecated. - got renamed into COMPILER_PB_UNCHECKED_TYPE_OPERATION
static String COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION
          Possible configurable option ID.
static String COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING
          Possible configurable option ID.
static String COMPILER_PB_UNUSED_IMPORT
          Possible configurable option ID.
static String COMPILER_PB_UNUSED_LABEL
          Possible configurable option ID.
static String COMPILER_PB_UNUSED_LOCAL
          Possible configurable option ID.
static String COMPILER_PB_UNUSED_PARAMETER
          Possible configurable option ID.
static String COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT
          Possible configurable option ID.
static String COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE
          Possible configurable option ID.
static String COMPILER_PB_UNUSED_PRIVATE_MEMBER
          Possible configurable option ID.
static String COMPILER_PB_VARARGS_ARGUMENT_NEED_CAST
          Possible configurable option ID.
static String COMPILER_SOURCE
          Possible configurable option ID.
static String COMPILER_SOURCE_FILE_ATTR
          Possible configurable option ID.
static String COMPILER_TASK_CASE_SENSITIVE
          Possible configurable option ID.
static String COMPILER_TASK_PRIORITIES
          Possible configurable option ID.
static String COMPILER_TASK_PRIORITY_HIGH
          Possible configurable option value for COMPILER_TASK_PRIORITIES.
static String COMPILER_TASK_PRIORITY_LOW
          Possible configurable option value for COMPILER_TASK_PRIORITIES.
static String COMPILER_TASK_PRIORITY_NORMAL
          Possible configurable option value for COMPILER_TASK_PRIORITIES.
static String COMPILER_TASK_TAGS
          Possible configurable option ID.
static String COMPUTE
          Possible configurable option value.
static String CORE_CIRCULAR_CLASSPATH
          Possible configurable option ID.
static String CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS
          Possible configurable option ID.
static String CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS
          Possible configurable option ID.
static String CORE_ENCODING
          Possible configurable option ID.
static String CORE_INCOMPATIBLE_JDK_LEVEL
          Possible configurable option ID.
static String CORE_INCOMPLETE_CLASSPATH
          Possible configurable option ID.
static String CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER
          Possible configurable option ID.
static String CORE_JAVA_BUILD_DUPLICATE_RESOURCE
          Possible configurable option ID.
static String CORE_JAVA_BUILD_INVALID_CLASSPATH
          Possible configurable option ID.
static String CORE_JAVA_BUILD_ORDER
          Possible configurable option ID.
static String CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER
          Possible configurable option ID.
static String CORE_JAVA_BUILD_RESOURCE_COPY_FILTER
          Possible configurable option ID.
static String DEFAULT
          Possible configurable option value.
static String DEFAULT_TASK_PRIORITIES
          Default task priority
static String DEFAULT_TASK_PRIORITY
          Deprecated. - should use #DEFAULT_TASK_PRIORITIES instead
static String DEFAULT_TASK_TAG
          Deprecated. - should use #DEFAULT_TASK_TAGS instead
static String DEFAULT_TASK_TAGS
          Default task tag
static String DISABLED
          Possible configurable option value.
static String DO_NOT_GENERATE
          Possible configurable option value.
static String DO_NOT_INSERT
          Possible configurable option value.
static String ENABLED
          Possible configurable option value.
static String ERROR
          Possible configurable option value.
static String FORMATTER_CLEAR_BLANK_LINES
          Deprecated. Use DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE instead
static String FORMATTER_COMPACT_ASSIGNMENT
          Deprecated. Use DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR instead
static String FORMATTER_LINE_SPLIT
          Deprecated. Use DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT instead
static String FORMATTER_NEWLINE_CONTROL
          Deprecated. Use DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT instead.
static String FORMATTER_NEWLINE_ELSE_IF
          Deprecated. Use DefaultCodeFormatterConstants.FORMATTER_COMPACT_ELSE_IF instead
static String FORMATTER_NEWLINE_EMPTY_BLOCK
          Deprecated. Use DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK instead
static String FORMATTER_NEWLINE_OPENING_BRACE
          Deprecated. Use DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK , DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION instead
static String FORMATTER_SPACE_CASTEXPRESSION
          Deprecated. Use DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST instead
static String FORMATTER_TAB_CHAR
          Deprecated. Use DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR} instead
static String FORMATTER_TAB_SIZE
          Deprecated. Use DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE instead
static String GENERATE
          Possible configurable option value.
static String IGNORE
          Possible configurable option value.
static String INSERT
          Possible configurable option value.
static String JAVA_SOURCE_CONTENT_TYPE
          Value of the content-type for Java source files.
static String MODEL_ID
          The identifier for the Java model (value "org.eclipse.jdt.core.javamodel").
static String NATURE_ID
          The identifier for the Java nature (value "org.eclipse.jdt.core.javanature").
static String NEVER
          Possible configurable option value.
static String NORMAL
          Possible configurable option value.
static String OPTIMIZE_OUT
          Possible configurable option value.
static String PLUGIN_ID
          The plug-in identifier of the Java core support (value "org.eclipse.jdt.core").
static String PRESERVE
          Possible configurable option value.
static String PRESERVE_ONE
          Possible configurable option value.
static String PRIVATE
          Possible configurable option value.
static String PROTECTED
          Possible configurable option value.
static String PUBLIC
          Possible configurable option value.
static String SPACE
          Possible configurable option value.
static String TAB
          Possible configurable option value.
static String TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC
          Possible configurable option ID.
static String USER_LIBRARY_CONTAINER_ID
          Name of the User Library Container id.
static String VERSION_1_1
          Possible configurable option value.
static String VERSION_1_2
          Possible configurable option value.
static String VERSION_1_3
          Possible configurable option value.
static String VERSION_1_4
          Possible configurable option value.
static String VERSION_1_5
          Possible configurable option value.
static String VERSION_1_6
          Possible configurable option value.
static String WARNING
          Possible configurable option value.
 
Fields inherited from class org.eclipse.core.runtime.Plugin
PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME
 
Constructor Summary
JavaCore()
          Creates the Java core plug-in.
 
Method Summary
static void addElementChangedListener(IElementChangedListener listener)
          Adds the given listener for changes to Java elements.
static void addElementChangedListener(IElementChangedListener listener, int eventMask)
          Adds the given listener for changes to Java elements.
static void addJavaElementMarkerAttributes(Map attributes, IJavaElement element)
          Configures the given marker attribute map for the given Java element.
static void addPreProcessingResourceChangedListener(IResourceChangeListener listener)
          Deprecated. use addPreProcessingResourceChangedListener(listener, IResourceChangeEvent.POST_CHANGE) instead
static void addPreProcessingResourceChangedListener(IResourceChangeListener listener, int eventMask)
          Adds the given listener for resource change events of the given types to the Java core.
 void configureJavaElementMarker(IMarker marker, IJavaElement element)
          Configures the given marker for the given Java element.
static IJavaElement create(IFile file)
          Returns the Java element corresponding to the given file, or null if unable to associate the given file with a Java element.
static IJavaElement create(IFolder folder)
          Returns the package fragment or package fragment root corresponding to the given folder, or null if unable to associate the given folder with a Java element.
static IJavaProject create(IProject project)
          Returns the Java project corresponding to the given project.
static IJavaElement create(IResource resource)
          Returns the Java element corresponding to the given resource, or null if unable to associate the given resource with a Java element.
static IJavaModel create(IWorkspaceRoot root)
          Returns the Java model.
static IJavaElement create(String handleIdentifier)
          Returns the Java model element corresponding to the given handle identifier generated by IJavaElement.getHandleIdentifier(), or null if unable to create the associated element.
static IJavaElement create(String handleIdentifier, WorkingCopyOwner owner)
          Returns the Java model element corresponding to the given handle identifier generated by IJavaElement.getHandleIdentifier(), or null if unable to create the associated element.
static IClassFile createClassFileFrom(IFile file)
          Creates and returns a class file element for the given .class file.
static ICompilationUnit createCompilationUnitFrom(IFile file)
          Creates and returns a compilation unit element for the given source file (i.e. a file with one of the Java-like extensions).
static IPackageFragmentRoot createJarPackageFragmentRootFrom(IFile file)
          Creates and returns a handle for the given JAR file.
static IClasspathContainer getClasspathContainer(IPath containerPath, IJavaProject project)
          Answers the project specific value for a given classpath container.
static ClasspathContainerInitializer getClasspathContainerInitializer(String containerID)
          Helper method finding the classpath container initializer registered for a given classpath container ID or null if none was found while iterating over the contributions to extension point to the extension point "org.eclipse.jdt.core.classpathContainerInitializer".
static IPath getClasspathVariable(String variableName)
          Returns the path held in the given classpath variable.
static ClasspathVariableInitializer getClasspathVariableInitializer(String variable)
          Helper method finding the classpath variable initializer registered for a given classpath variable name or null if none was found while iterating over the contributions to extension point to the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
static String[] getClasspathVariableNames()
          Returns the names of all known classpath variables.
static Hashtable getDefaultOptions()
          Returns a table of all known configurable options with their default values.
static String getEncoding()
          Returns the workspace root default charset encoding.
static JavaCore getJavaCore()
          Returns the single instance of the Java core plug-in runtime class.
static String[] getJavaLikeExtensions()
          Returns the list of known Java-like extensions.
static String getOption(String optionName)
          Helper method for returning one option value only.
static Hashtable getOptions()
          Returns the table of the current options.
static Plugin getPlugin()
          Returns the single instance of the Java core plug-in runtime class.
static IClasspathEntry getResolvedClasspathEntry(IClasspathEntry entry)
          This is a helper method, which returns the resolved classpath entry denoted by a given entry (if it is a variable entry).
static IPath getResolvedVariablePath(IPath variablePath)
          Resolve a variable path (helper method).
static IWorkingCopy[] getSharedWorkingCopies(IBufferFactory factory)
          Deprecated. - should use #getWorkingCopies(WorkingCopyOwner) instead
static String[] getUserLibraryNames()
          Returns the names of all defined user libraries.
static ICompilationUnit[] getWorkingCopies(WorkingCopyOwner owner)
          Returns the working copies that have the given owner.
static void initializeAfterLoad(IProgressMonitor monitor)
          Initializes JavaCore internal structures to allow subsequent operations (such as the ones that need a resolved classpath) to run full speed.
static boolean isJavaLikeFileName(String fileName)
          Returns whether the given file name's extension is a Java-like extension.
static boolean isReferencedBy(IJavaElement element, IMarker marker)
          Returns whether the given marker references the given Java element.
static boolean isReferencedBy(IJavaElement element, IMarkerDelta markerDelta)
          Returns whether the given marker delta references the given Java element.
static IAccessRule newAccessRule(IPath filePattern, int kind)
          Creates and returns a new access rule with the given file pattern and kind.
static IClasspathAttribute newClasspathAttribute(String name, String value)
          Creates and returns a new classpath attribute with the given name and the given value.
static IClasspathEntry newContainerEntry(IPath containerPath)
          Creates and returns a new classpath entry of kind CPE_CONTAINER for the given path.
static IClasspathEntry newContainerEntry(IPath containerPath, boolean isExported)
          Creates and returns a new classpath entry of kind CPE_CONTAINER for the given path.
static IClasspathEntry newContainerEntry(IPath containerPath, IAccessRule[] accessRules, IClasspathAttribute[] extraAttributes, boolean isExported)
          Creates and returns a new classpath entry of kind CPE_CONTAINER for the given path.
static IClasspathEntry newLibraryEntry(IPath path, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath)
          Creates and returns a new non-exported classpath entry of kind CPE_LIBRARY for the JAR or folder identified by the given absolute path.
static IClasspathEntry newLibraryEntry(IPath path,