org.eclipse.jdt.internal.core
Class JavaModelManager

java.lang.Object
  extended by org.eclipse.jdt.internal.core.JavaModelManager
All Implemented Interfaces:
java.util.EventListener, ISaveParticipant, org.eclipse.core.runtime.content.IContentTypeManager.IContentTypeChangeListener

public class JavaModelManager
extends java.lang.Object
implements ISaveParticipant, org.eclipse.core.runtime.content.IContentTypeManager.IContentTypeChangeListener

The JavaModelManager manages instances of IJavaModel. IElementChangedListeners register with the JavaModelManager, and receive ElementChangedEvents for all IJavaModels.

The single instance of JavaModelManager is available from the static method JavaModelManager.getJavaModelManager().


Nested Class Summary
static class JavaModelManager.CompilationParticipants
           
static class JavaModelManager.EclipsePreferencesListener
          Update the classpath variable cache
static class JavaModelManager.PerProjectInfo
           
static class JavaModelManager.PerWorkingCopyInfo
           
 
Field Summary
 java.lang.ThreadLocal abortOnMissingSource
           
static java.lang.String ANNOTATION_PROCESSOR_MANAGER_EXTPOINT_ID
          Name of the extension point for contributing the Java 6 annotation processor manager
static int BATCH_INITIALIZATION_FINISHED
           
static int BATCH_INITIALIZATION_IN_PROGRESS
           
 int batchContainerInitializations
           
 BatchInitializationMonitor batchContainerInitializationsProgress
           
static java.lang.String COMPILATION_PARTICIPANT_EXTPOINT_ID
          Name of the extension point for contributing a compilation participant
 JavaModelManager.CompilationParticipants compilationParticipants
           
static java.lang.String COMPLETION_PERF
           
static IClasspathContainer CONTAINER_INITIALIZATION_IN_PROGRESS
           
static java.lang.String CONTAINER_INITIALIZER_PERF
           
 java.util.Hashtable containerInitializersCache
           
 java.util.HashMap containers
          Classpath containers pool
static java.lang.String CP_CONTAINER_PREFERENCES_PREFIX
           
static java.lang.String CP_ENTRY_IGNORE
           
static org.eclipse.core.runtime.IPath CP_ENTRY_IGNORE_PATH
           
static boolean CP_RESOLVE_VERBOSE
           
static boolean CP_RESOLVE_VERBOSE_ADVANCED
           
static boolean CP_RESOLVE_VERBOSE_FAILURE
           
static java.lang.String CP_USERLIBRARY_PREFERENCES_PREFIX
           
static java.lang.String CP_VARIABLE_PREFERENCES_PREFIX
           
static java.lang.String CPCONTAINER_INITIALIZER_EXTPOINT_ID
          Name of the extension point for contributing classpath container initializers
static java.lang.String CPVARIABLE_INITIALIZER_EXTPOINT_ID
          Name of the extension point for contributing classpath variable initializers
static java.lang.String DELTA_LISTENER_PERF
           
 DeltaProcessingState deltaState
          Holds the state used for delta processing.
 java.util.HashMap deprecatedVariables
           
static java.lang.String FORMATTER_EXTPOINT_ID
          Name of the extension point for contributing a source code formatter
 IndexManager indexManager
           
static int NEED_BATCH_INITIALIZATION
           
static int NO_BATCH_INITIALIZATION
           
static ICompilationUnit[] NO_WORKING_COPY
           
static boolean PERF_CONTAINER_INITIALIZER
           
static boolean PERF_VARIABLE_INITIALIZER
           
 org.eclipse.core.runtime.preferences.IEclipsePreferences[] preferencesLookup
           
 java.util.HashMap previousSessionContainers
           
 java.util.HashMap previousSessionVariables
           
 java.util.HashSet readOnlyVariables
           
static java.lang.String RECONCILE_PERF
           
 java.util.Map rootPathToAttachments
           
static java.lang.String SELECTION_PERF
           
static java.lang.String TRUE
           
static org.eclipse.core.runtime.IPath VARIABLE_INITIALIZATION_IN_PROGRESS
          Special value used for recognizing ongoing initialization and breaking initialization cycles
static java.lang.String VARIABLE_INITIALIZER_PERF
           
 java.util.HashMap variables
          Classpath variables pool
 java.util.HashSet variablesWithInitializer
           
static boolean VERBOSE
           
 JavaWorkspaceScope workspaceScope
           
static boolean ZIP_ACCESS_VERBOSE
           
 
Method Summary
 java.lang.String cacheToString(java.lang.String prefix)
           
 void cacheZipFiles()
          Starts caching ZipFiles.
 void closeZipFile(java.util.zip.ZipFile zipFile)
           
 void configurePluginDebugOptions()
          Configure the plugin with respect to option settings defined in ".options" file
static boolean conflictsWithOutputLocation(org.eclipse.core.runtime.IPath folderPath, JavaProject project)
          Returns whether the given full path (for a package) conflicts with the output location of the given project.
 IClasspathContainer containerGet(IJavaProject project, org.eclipse.core.runtime.IPath containerPath)
           
 IClasspathContainer containerGetDefaultToPreviousSession(IJavaProject project, org.eclipse.core.runtime.IPath containerPath)
           
 void containerPut(IJavaProject project, org.eclipse.core.runtime.IPath containerPath, IClasspathContainer container)
           
 boolean containerPutIfInitializingWithSameEntries(org.eclipse.core.runtime.IPath containerPath, IJavaProject[] projects, IClasspathContainer[] respectiveContainers)
           
 void containerRemove(IJavaProject project)
           
 void contentTypeChanged(org.eclipse.core.runtime.content.IContentTypeManager.ContentTypeChangeEvent event)
           
static IJavaElement create(IFile file, IJavaProject project)
          Returns the Java element corresponding to the given file, its project being the given project.
static IJavaElement create(IFolder folder, IJavaProject project)
          Returns the package fragment or package fragment root corresponding to the given folder, its parent or great parent being the given project.
static IJavaElement create(IResource resource, IJavaProject project)
          Returns the Java element corresponding to the given resource, or null if unable to associate the given resource with a Java element.
 AbstractAnnotationProcessorManager createAnnotationProcessorManager()
           
static IClassFile createClassFileFrom(IFile file, IJavaProject project)
          Creates and returns a class file element for the given .class file, its project being the given project.
static ICompilationUnit createCompilationUnitFrom(IFile file, IJavaProject project)
          Creates and returns a compilation unit element for the given .java file, its project being the given project.
static IPackageFragmentRoot createJarPackageFragmentRootFrom(IFile file, IJavaProject project)
          Creates and returns a handle for the given JAR file, its project being the given project.
static IJavaElement determineIfOnClasspath(IResource resource, IJavaProject project)
          Returns the package fragment root represented by the resource, or the package fragment the given resource is located in, or null if the given resource is not on the classpath of the given project.
 int discardPerWorkingCopyInfo(CompilationUnit workingCopy)
           
 void doneSaving(ISaveContext context)
          Tells this participant that the workspace save operation is now complete and it is free to go about its normal business.
static void doNotUse()
           
 void flushZipFiles()
          Flushes ZipFiles cache if there are no more clients.
 boolean forceBatchInitializations(boolean initAfterLoad)
           
 IClasspathContainer getClasspathContainer(org.eclipse.core.runtime.IPath containerPath, IJavaProject project)
           
 java.util.Hashtable getDefaultOptions()
           
 org.eclipse.core.runtime.preferences.IEclipsePreferences getDefaultPreferences()
          Get default eclipse preference for JavaCore plugin.
 DeltaProcessor getDeltaProcessor()
           
static DeltaProcessingState getDeltaState()
           
 IJavaElement getExistingElement(IJavaElement element)
          Returns the existing element in the cache that is equal to the given element.
static ExternalFoldersManager getExternalManager()
           
static IndexManager getIndexManager()
           
 java.lang.Object getInfo(IJavaElement element)
          Returns the info for the element.
 org.eclipse.core.runtime.preferences.IEclipsePreferences getInstancePreferences()
          Get workspace eclipse preference for JavaCore plug-in.
 JavaModel getJavaModel()
          Returns the handle to the active Java Model.
static JavaModelManager getJavaModelManager()
          Returns the singleton JavaModelManager
 java.lang.Object getLastBuiltState(IProject project, org.eclipse.core.runtime.IProgressMonitor monitor)
          Returns the last built state for the given project, or null if there is none.
 java.lang.String getOption(java.lang.String optionName)
           
 java.util.Hashtable getOptions()
           
 JavaModelManager.PerProjectInfo getPerProjectInfo(IProject project, boolean create)
           
 JavaModelManager.PerProjectInfo getPerProjectInfoCheckExistence(IProject project)
           
 JavaModelManager.PerWorkingCopyInfo getPerWorkingCopyInfo(CompilationUnit workingCopy, boolean create, boolean recordUsage, IProblemRequestor problemRequestor)
           
 IClasspathContainer getPreviousSessionContainer(org.eclipse.core.runtime.IPath containerPath, IJavaProject project)
          Returns a persisted container from previous session if any.
 org.eclipse.core.runtime.IPath getPreviousSessionVariable(java.lang.String variableName)
          Returns a persisted container from previous session if any
static java.lang.String[] getRegisteredContainerIDs()
          Returns the name of the container IDs for which an CP container initializer is registered through an extension point
static java.lang.String[] getRegisteredVariableNames()
          Returns the name of the variables for which an CP variable initializer is registered through an extension point
 java.util.HashMap getTemporaryCache()
          Returns the temporary cache for newly opened elements for the current thread.
static UserLibraryManager getUserLibraryManager()
           
 ICompilationUnit[] getWorkingCopies(WorkingCopyOwner owner, boolean addPrimary)
           
 JavaWorkspaceScope getWorkspaceScope()
           
 java.util.zip.ZipFile getZipFile(org.eclipse.core.runtime.IPath path)
          Returns the open ZipFile at the given path.
 boolean hasTemporaryCache()
           
 void initializePreferences()
          Initialize preferences lookups for JavaCore plug-in.
 char[] intern(char[] array)
           
 java.lang.String intern(java.lang.String s)
           
 boolean isClasspathBeingResolved(IJavaProject project)
           
 void loadVariablesAndContainers()
           
 void prepareToSave(ISaveContext context)
          Tells this participant that the workspace is about to be saved.
static void recreatePersistedContainer(java.lang.String propertyName, java.lang.String containerString, boolean addToContainerValues)
           
 void rememberScope(AbstractSearchScope scope)
          Remembers the given scope in a weak set (so no need to remove it: it will be removed by the garbage collector)
 java.lang.Object removeInfoAndChildren(JavaElement element)
           
 void removePerProjectInfo(JavaProject javaProject)
           
 void resetProjectOptions(JavaProject javaProject)
           
 void resetProjectPreferences(JavaProject javaProject)
           
 void resetTemporaryCache()
           
 void rollback(ISaveContext context)
          Tells this participant to rollback its important state.
 void saving(ISaveContext context)
          Tells this participant to save its important state because the workspace is being saved, as described in the supplied save context.
 void secondaryTypeAdding(java.lang.String path, char[] typeName, char[] packageName)
          Add a secondary type in temporary indexing cache for a project got from given path.
 java.util.Map secondaryTypes(IJavaProject project, boolean waitForIndexes, org.eclipse.core.runtime.IProgressMonitor monitor)
          Get all secondary types for a project and store result in per project info cache.
 void secondaryTypesRemoving(IFile file, boolean cleanIndexCache)
          Remove from secondary types cache all types belonging to a given file.
 void setClasspathBeingResolved(IJavaProject project, boolean classpathIsResolved)
           
 void setLastBuiltState(IProject project, java.lang.Object state)
          Sets the last built state for the given project, or null to reset it.
 void setOptions(java.util.Hashtable newOptions)
           
 void shutdown()
           
 void startup()
           
 org.eclipse.core.runtime.IPath variableGet(java.lang.String variableName)
           
 java.lang.String[] variableNames()
           
 void variablePreferencesPut(java.lang.String variableName, org.eclipse.core.runtime.IPath variablePath)
           
 void variablePut(java.lang.String variableName, org.eclipse.core.runtime.IPath variablePath)
           
 boolean variablePutIfInitializingWithSameValue(java.lang.String[] variableNames, org.eclipse.core.runtime.IPath[] variablePaths)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

variables

public java.util.HashMap variables
Classpath variables pool


variablesWithInitializer

public java.util.HashSet variablesWithInitializer

deprecatedVariables

public java.util.HashMap deprecatedVariables

readOnlyVariables

public java.util.HashSet readOnlyVariables

previousSessionVariables

public java.util.HashMap previousSessionVariables

containers

public java.util.HashMap containers
Classpath containers pool


previousSessionContainers

public java.util.HashMap previousSessionContainers

NO_BATCH_INITIALIZATION

public static final int NO_BATCH_INITIALIZATION
See Also:
Constant Field Values

NEED_BATCH_INITIALIZATION

public static final int NEED_BATCH_INITIALIZATION
See Also:
Constant Field Values

BATCH_INITIALIZATION_IN_PROGRESS

public static final int BATCH_INITIALIZATION_IN_PROGRESS
See Also:
Constant Field Values

BATCH_INITIALIZATION_FINISHED

public static final int BATCH_INITIALIZATION_FINISHED
See Also:
Constant Field Values

batchContainerInitializations

public int batchContainerInitializations

batchContainerInitializationsProgress

public BatchInitializationMonitor batchContainerInitializationsProgress

containerInitializersCache

public java.util.Hashtable containerInitializersCache

workspaceScope

public JavaWorkspaceScope workspaceScope

rootPathToAttachments

public java.util.Map rootPathToAttachments

CP_VARIABLE_PREFERENCES_PREFIX

public static final java.lang.String CP_VARIABLE_PREFERENCES_PREFIX
See Also:
Constant Field Values

CP_CONTAINER_PREFERENCES_PREFIX

public static final java.lang.String CP_CONTAINER_PREFERENCES_PREFIX
See Also:
Constant Field Values

CP_USERLIBRARY_PREFERENCES_PREFIX

public static final java.lang.String CP_USERLIBRARY_PREFERENCES_PREFIX
See Also:
Constant Field Values

CP_ENTRY_IGNORE

public static final java.lang.String CP_ENTRY_IGNORE
See Also:
Constant Field Values

CP_ENTRY_IGNORE_PATH

public static final org.eclipse.core.runtime.IPath CP_ENTRY_IGNORE_PATH

TRUE

public static final java.lang.String TRUE
See Also:
Constant Field Values

CPVARIABLE_INITIALIZER_EXTPOINT_ID

public static final java.lang.String CPVARIABLE_INITIALIZER_EXTPOINT_ID
Name of the extension point for contributing classpath variable initializers

See Also:
Constant Field Values

CPCONTAINER_INITIALIZER_EXTPOINT_ID

public static final java.lang.String CPCONTAINER_INITIALIZER_EXTPOINT_ID
Name of the extension point for contributing classpath container initializers

See Also:
Constant Field Values

FORMATTER_EXTPOINT_ID

public static final java.lang.String FORMATTER_EXTPOINT_ID
Name of the extension point for contributing a source code formatter

See Also:
Constant Field Values

COMPILATION_PARTICIPANT_EXTPOINT_ID

public static final java.lang.String COMPILATION_PARTICIPANT_EXTPOINT_ID
Name of the extension point for contributing a compilation participant

See Also:
Constant Field Values

ANNOTATION_PROCESSOR_MANAGER_EXTPOINT_ID

public static final java.lang.String ANNOTATION_PROCESSOR_MANAGER_EXTPOINT_ID
Name of the extension point for contributing the Java 6 annotation processor manager

See Also:
Constant Field Values

VARIABLE_INITIALIZATION_IN_PROGRESS

public static final org.eclipse.core.runtime.IPath VARIABLE_INITIALIZATION_IN_PROGRESS
Special value used for recognizing ongoing initialization and breaking initialization cycles


CONTAINER_INITIALIZATION_IN_PROGRESS

public static final IClasspathContainer CONTAINER_INITIALIZATION_IN_PROGRESS

COMPLETION_PERF

public static final java.lang.String COMPLETION_PERF
See Also:
Constant Field Values

SELECTION_PERF

public static final java.lang.String SELECTION_PERF
See Also:
Constant Field Values

DELTA_LISTENER_PERF

public static final java.lang.String DELTA_LISTENER_PERF
See Also:
Constant Field Values

VARIABLE_INITIALIZER_PERF

public static final java.lang.String VARIABLE_INITIALIZER_PERF
See Also:
Constant Field Values

CONTAINER_INITIALIZER_PERF

public static final java.lang.String CONTAINER_INITIALIZER_PERF
See Also:
Constant Field Values

RECONCILE_PERF

public static final java.lang.String RECONCILE_PERF
See Also:
Constant Field Values

PERF_VARIABLE_INITIALIZER

public static boolean PERF_VARIABLE_INITIALIZER

PERF_CONTAINER_INITIALIZER

public static boolean PERF_CONTAINER_INITIALIZER

NO_WORKING_COPY

public static final ICompilationUnit[] NO_WORKING_COPY

preferencesLookup

public final org.eclipse.core.runtime.preferences.IEclipsePreferences[] preferencesLookup

compilationParticipants

public final JavaModelManager.CompilationParticipants compilationParticipants

abortOnMissingSource

public java.lang.ThreadLocal abortOnMissingSource

deltaState

public DeltaProcessingState deltaState
Holds the state used for delta processing.


indexManager

public IndexManager indexManager

VERBOSE

public static boolean VERBOSE

CP_RESOLVE_VERBOSE

public static boolean CP_RESOLVE_VERBOSE

CP_RESOLVE_VERBOSE_ADVANCED

public static boolean CP_RESOLVE_VERBOSE_ADVANCED

CP_RESOLVE_VERBOSE_FAILURE

public static boolean CP_RESOLVE_VERBOSE_FAILURE

ZIP_ACCESS_VERBOSE

public static boolean ZIP_ACCESS_VERBOSE
Method Detail

conflictsWithOutputLocation

public static boolean conflictsWithOutputLocation(org.eclipse.core.runtime.IPath folderPath,
                                                  JavaProject project)
Returns whether the given full path (for a package) conflicts with the output location of the given project.


containerGet

public IClasspathContainer containerGet(IJavaProject project,
                                        org.eclipse.core.runtime.IPath containerPath)

containerGetDefaultToPreviousSession

public IClasspathContainer containerGetDefaultToPreviousSession(IJavaProject project,
                                                                org.eclipse.core.runtime.IPath containerPath)

containerPut

public void containerPut(IJavaProject project,
                         org.eclipse.core.runtime.IPath containerPath,
                         IClasspathContainer container)

containerRemove

public void containerRemove(IJavaProject project)

containerPutIfInitializingWithSameEntries

public boolean containerPutIfInitializingWithSameEntries(org.eclipse.core.runtime.IPath containerPath,
                                                         IJavaProject[] projects,
                                                         IClasspathContainer[] respectiveContainers)

create

public static IJavaElement create(IResource resource,
                                  IJavaProject project)
Returns the Java element corresponding to the given resource, or null if unable to associate the given resource with a Java element.

The resource must be one of:

Creating a Java element has the side effect of creating and opening all of the element's parents if they are not yet open.


create

public static IJavaElement create(IFile file,
                                  IJavaProject project)
Returns the Java element corresponding to the given file, its project being the given project. Returns null if unable to associate the given file with a Java element.

The file must be one of:

Creating a Java element has the side effect of creating and opening all of the element's parents if they are not yet open.


create

public static IJavaElement create(IFolder folder,
                                  IJavaProject project)
Returns the package fragment or package fragment root corresponding to the given folder, its parent or great parent being the given project. or null if unable to associate the given folder with a Java element.

Note that a package fragment root is returned rather than a default package.

Creating a Java element has the side effect of creating and opening all of the element's parents if they are not yet open.


createClassFileFrom

public static IClassFile createClassFileFrom(IFile file,
                                             IJavaProject project)
Creates and returns a class file element for the given .class file, its project being the given project. Returns null if unable to recognize the class file.


createCompilationUnitFrom

public static ICompilationUnit createCompilationUnitFrom(IFile file,
                                                         IJavaProject project)
Creates and returns a compilation unit element for the given .java file, its project being the given project. Returns null if unable to recognize the compilation unit.


createJarPackageFragmentRootFrom

public static IPackageFragmentRoot createJarPackageFragmentRootFrom(IFile file,
                                                                    IJavaProject project)
Creates and returns a handle for the given JAR file, its project being the given project. The Java model associated with the JAR's project may be created as a side effect. Returns null if unable to create a JAR package fragment root. (for example, if the JAR file represents a non-Java resource)


determineIfOnClasspath

public static IJavaElement determineIfOnClasspath(IResource resource,
                                                  IJavaProject project)
Returns the package fragment root represented by the resource, or the package fragment the given resource is located in, or null if the given resource is not on the classpath of the given project.


cacheZipFiles

public void cacheZipFiles()
Starts caching ZipFiles. Ignores if there are already clients.


closeZipFile

public void closeZipFile(java.util.zip.ZipFile zipFile)

configurePluginDebugOptions

public void configurePluginDebugOptions()
Configure the plugin with respect to option settings defined in ".options" file


createAnnotationProcessorManager

public AbstractAnnotationProcessorManager createAnnotationProcessorManager()

discardPerWorkingCopyInfo

public int discardPerWorkingCopyInfo(CompilationUnit workingCopy)
                              throws JavaModelException
Throws:
JavaModelException

doneSaving

public void doneSaving(ISaveContext context)
Description copied from interface: ISaveParticipant
Tells this participant that the workspace save operation is now complete and it is free to go about its normal business. Exceptions are not expected to be thrown at this point, so they should be handled internally.

Note: This method is called by the platform; it is not intended to be called directly by clients.

Specified by:
doneSaving in interface ISaveParticipant
Parameters:
context - the save context object
See Also:
ISaveParticipant

flushZipFiles

public void flushZipFiles()
Flushes ZipFiles cache if there are no more clients.


forceBatchInitializations

public boolean forceBatchInitializations(boolean initAfterLoad)

getClasspathContainer

public IClasspathContainer getClasspathContainer(org.eclipse.core.runtime.IPath containerPath,
                                                 IJavaProject project)
                                          throws JavaModelException
Throws:
JavaModelException

getDeltaProcessor

public DeltaProcessor getDeltaProcessor()

getDeltaState

public static DeltaProcessingState getDeltaState()

getExternalManager

public static ExternalFoldersManager getExternalManager()

getIndexManager

public static IndexManager getIndexManager()

getInfo

public java.lang.Object getInfo(IJavaElement element)
Returns the info for the element.


getExistingElement

public IJavaElement getExistingElement(IJavaElement element)
Returns the existing element in the cache that is equal to the given element.


getInstancePreferences

public org.eclipse.core.runtime.preferences.IEclipsePreferences getInstancePreferences()
Get workspace eclipse preference for JavaCore plug-in.


getDefaultOptions

public java.util.Hashtable getDefaultOptions()

getDefaultPreferences

public org.eclipse.core.runtime.preferences.IEclipsePreferences getDefaultPreferences()
Get default eclipse preference for JavaCore plugin.


getJavaModel

public final JavaModel getJavaModel()
Returns the handle to the active Java Model.


getJavaModelManager

public static final JavaModelManager getJavaModelManager()
Returns the singleton JavaModelManager


getLastBuiltState

public java.lang.Object getLastBuiltState(IProject project,
                                          org.eclipse.core.runtime.IProgressMonitor monitor)
Returns the last built state for the given project, or null if there is none. Deserializes the state if necessary. For use by image builder and evaluation support only


getOption

public java.lang.String getOption(java.lang.String optionName)

getOptions

public java.util.Hashtable getOptions()

getPerProjectInfo

public JavaModelManager.PerProjectInfo getPerProjectInfo(IProject project,
                                                         boolean create)

getPerProjectInfoCheckExistence

public JavaModelManager.PerProjectInfo getPerProjectInfoCheckExistence(IProject project)
                                                                throws JavaModelException
Throws:
JavaModelException

getPerWorkingCopyInfo

public JavaModelManager.PerWorkingCopyInfo getPerWorkingCopyInfo(CompilationUnit workingCopy,
                                                                 boolean create,
                                                                 boolean recordUsage,
                                                                 IProblemRequestor problemRequestor)

getPreviousSessionContainer

public IClasspathContainer getPreviousSessionContainer(org.eclipse.core.runtime.IPath containerPath,
                                                       IJavaProject project)
Returns a persisted container from previous session if any. Note that it is not the original container from previous session (i.e. it did not get serialized) but rather a summary of its entries recreated for CP initialization purpose. As such it should not be stored into container caches.


getPreviousSessionVariable

public org.eclipse.core.runtime.IPath getPreviousSessionVariable(java.lang.String variableName)
Returns a persisted container from previous session if any


getTemporaryCache

public java.util.HashMap getTemporaryCache()
Returns the temporary cache for newly opened elements for the current thread. Creates it if not already created.


getRegisteredVariableNames

public static java.lang.String[] getRegisteredVariableNames()
Returns the name of the variables for which an CP variable initializer is registered through an extension point


getRegisteredContainerIDs

public static java.lang.String[] getRegisteredContainerIDs()
Returns the name of the container IDs for which an CP container initializer is registered through an extension point


getUserLibraryManager

public static UserLibraryManager getUserLibraryManager()

getWorkingCopies

public ICompilationUnit[] getWorkingCopies(WorkingCopyOwner owner,
                                           boolean addPrimary)

getWorkspaceScope

public JavaWorkspaceScope getWorkspaceScope()

getZipFile

public java.util.zip.ZipFile getZipFile(org.eclipse.core.runtime.IPath path)
                                 throws org.eclipse.core.runtime.CoreException
Returns the open ZipFile at the given path. If the ZipFile does not yet exist, it is created, opened, and added to the cache of open ZipFiles. The path must be a file system path if representing an external zip/jar, or it must be an absolute workspace relative path if representing a zip/jar inside the workspace.

Throws:
org.eclipse.core.runtime.CoreException - If unable to create/open the ZipFile

hasTemporaryCache

public boolean hasTemporaryCache()

initializePreferences

public void initializePreferences()
Initialize preferences lookups for JavaCore plug-in.


intern

public char[] intern(char[] array)

intern

public java.lang.String intern(java.lang.String s)

isClasspathBeingResolved

public boolean isClasspathBeingResolved(IJavaProject project)

setClasspathBeingResolved

public void setClasspathBeingResolved(IJavaProject project,
                                      boolean classpathIsResolved)

loadVariablesAndContainers

public void loadVariablesAndContainers()
                                throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException

prepareToSave

public void prepareToSave(ISaveContext context)
Description copied from interface: ISaveParticipant
Tells this participant that the workspace is about to be saved. In preparation, the participant is expected to suspend its normal operation until further notice. saving will be next, followed by either doneSaving or rollback depending on whether the workspace save was successful.

Note: This method is called by the platform; it is not intended to be called directly by clients.

Specified by:
prepareToSave in interface ISaveParticipant
Parameters:
context - the save context object
See Also:
ISaveParticipant

recreatePersistedContainer

public static void recreatePersistedContainer(java.lang.String propertyName,
                                              java.lang.String containerString,
                                              boolean addToContainerValues)

rememberScope

public void rememberScope(AbstractSearchScope scope)
Remembers the given scope in a weak set (so no need to remove it: it will be removed by the garbage collector)


removeInfoAndChildren

public java.lang.Object removeInfoAndChildren(JavaElement element)
                                       throws JavaModelException
Throws:
JavaModelException

removePerProjectInfo

public void removePerProjectInfo(JavaProject javaProject)

resetProjectOptions

public void resetProjectOptions(JavaProject javaProject)

resetProjectPreferences

public void resetProjectPreferences(JavaProject javaProject)

doNotUse

public static final void doNotUse()

resetTemporaryCache

public void resetTemporaryCache()

rollback

public void rollback(ISaveContext context)
Description copied from interface: ISaveParticipant
Tells this participant to rollback its important state. The context's previous state number indicates what it was prior to the failed save. Exceptions are not expected to be thrown at this point, so they should be handled internally.

Note: This method is called by the platform; it is not intended to be called directly by clients.

Specified by:
rollback in interface ISaveParticipant
Parameters:
context - the save context object
See Also:
ISaveParticipant

saving

public void saving(ISaveContext context)
            throws org.eclipse.core.runtime.CoreException
Description copied from interface: ISaveParticipant
Tells this participant to save its important state because the workspace is being saved, as described in the supplied save context.

Note: This method is called by the platform; it is not intended to be called directly by clients.

The basic contract for this method is the same for full saves, snapshots and project saves: the participant must absolutely guarantee that any important user data it has gathered will not be irrecoverably lost in the event of a crash. The only difference is in the space-time tradeoffs that the participant should make.

For instance, the Java IDE gathers various user preferences and would want to make sure that the current settings are safe and sound after a save (if not saved immediately). The Java IDE would likely save computed image builder state on full saves, because this would allow the Java IDE to be restarted later and not have to recompile the world at that time. On the other hand, the Java IDE would not save the image builder state on a snapshot because that information is non-essential; in the unlikely event of a crash, the image should be rebuilt either from scratch or from the last saved state.

The following snippet shows how a plug-in participant would write its important state to a file whose name is based on the save number for this save operation.

     Plugin plugin = ...; // known
     int saveNumber = context.getSaveNumber();
     String saveFileName = "save-" + Integer.toString(saveNumber);
     File f = plugin.getStateLocation().append(saveFileName).toFile();
     plugin.writeImportantState(f);
     context.map(new Path("save"), new Path(saveFileName));
     context.needSaveNumber();
     context.needDelta(); // optional
 
When the plug-in is reactivated in a subsequent workspace session, it needs to re-register to participate in workspace saves. When it does so, it is handed back key information about what state it had last saved. If it's interested, it can also ask for a resource delta describing all resource changes that have happened since then, if this information is still available. The following snippet shows what a participant plug-in would need to do if and when it is reactivated:
     IWorkspace ws = ...; // known
     Plugin plugin = ...; // known
     ISaveParticipant saver = ...; // known
     ISavedState ss = ws.addSaveParticipant(plugin, saver);
     if (ss == null) {
         // activate for very first time
         plugin.buildState();
     } else {
         String saveFileName = ss.lookup(new Path("save"));
         File f = plugin.getStateLocation().append(saveFileName).toFile();
         plugin.readImportantState(f);
         IResourceChangeListener listener = new IResourceChangeListener() {
             public void resourceChanged(IResourceChangeEvent event) {
                 IResourceDelta delta = event.getDelta();
                 if (delta != null) {
                     // fast reactivation using delta
                     plugin.updateState(delta);
                 } else {
                     // slower reactivation without benefit of delta
                     plugin.rebuildState();
                 }
         };
         ss.processResourceChangeEvents(listener);
     }
 

Specified by:
saving in interface ISaveParticipant
Parameters:
context - the save context object
Throws:
org.eclipse.core.runtime.CoreException - if this method fails
See Also:
ISaveParticipant

secondaryTypeAdding

public void secondaryTypeAdding(java.lang.String path,
                                char[] typeName,
                                char[] packageName)
Add a secondary type in temporary indexing cache for a project got from given path. Current secondary types cache is not modified as we want to wait that indexing was finished before taking new secondary types into account. Indexing cache is a specific entry in secondary types cache which key is INDEXED_SECONDARY_TYPES and value a map with same structure than secondary types cache itself.

See Also:
secondaryTypes(IJavaProject, boolean, IProgressMonitor)

secondaryTypes

public java.util.Map secondaryTypes(IJavaProject project,
                                    boolean waitForIndexes,
                                    org.eclipse.core.runtime.IProgressMonitor monitor)
                             throws JavaModelException
Get all secondary types for a project and store result in per project info cache. This cache is an Hashtable>: - key: package name - value: + key: type name + value: java model handle for the secondary type Hashtable was used to protect callers from possible concurrent access. Note that this map may have a specific entry which key is INDEXED_SECONDARY_TYPES and value is a map containing all secondary types created during indexing. When this key is in cache and indexing is finished, returned map is merged with the value of this special key. If indexing is not finished and caller does not wait for the end of indexing, returned map is the current secondary types cache content which may be invalid...

Parameters:
project - Project we want get secondary types from
Returns:
HashMap Table of secondary type names->path for given project
Throws:
JavaModelException

secondaryTypesRemoving

public void secondaryTypesRemoving(IFile file,
                                   boolean cleanIndexCache)
Remove from secondary types cache all types belonging to a given file. Clean secondary types cache built while indexing if requested. Project's secondary types cache is found using file location.

Parameters:
file - File to remove

setLastBuiltState

public void setLastBuiltState(IProject project,
                              java.lang.Object state)
Sets the last built state for the given project, or null to reset it.


setOptions

public void setOptions(java.util.Hashtable newOptions)

startup

public void startup()
             throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException

shutdown

public void shutdown()

variableGet

public org.eclipse.core.runtime.IPath variableGet(java.lang.String variableName)

variableNames

public java.lang.String[] variableNames()

variablePut

public void variablePut(java.lang.String variableName,
                        org.eclipse.core.runtime.IPath variablePath)

variablePreferencesPut

public void variablePreferencesPut(java.lang.String variableName,
                                   org.eclipse.core.runtime.IPath variablePath)

variablePutIfInitializingWithSameValue

public boolean variablePutIfInitializingWithSameValue(java.lang.String[] variableNames,
                                                      org.eclipse.core.runtime.IPath[] variablePaths)

contentTypeChanged

public void contentTypeChanged(org.eclipse.core.runtime.content.IContentTypeManager.ContentTypeChangeEvent event)
Specified by:
contentTypeChanged in interface org.eclipse.core.runtime.content.IContentTypeManager.IContentTypeChangeListener

cacheToString

public java.lang.String cacheToString(java.lang.String prefix)