public class JREContainerInitializer extends JsGlobalScopeContainerInitializer
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
JsECMA_NAME |
ATTRIBUTE_NOT_SUPPORTED, ATTRIBUTE_READ_ONLY
K_APPLICATION, K_DEFAULT_SYSTEM, K_SYSTEM
Constructor and Description |
---|
JREContainerInitializer() |
Modifier and Type | Method and Description |
---|---|
boolean |
allowAttachJsDoc() |
boolean |
canUpdateJsGlobalScopeContainer(IPath containerPath,
IJavaScriptProject project)
The container can be updated if it refers to an existing VM.
|
java.lang.String[] |
containerSuperTypes()
returns a String of all SuperTypes provided by this library.
|
static java.lang.String |
decodeEnvironmentId(java.lang.String id) |
static java.lang.String |
encodeEnvironmentId(java.lang.String id)
Escapes foward slashes in environment id.
|
java.lang.String |
getDescription(IPath containerPath,
IJavaScriptProject project)
Returns a readable description for a container path.
|
static java.lang.String |
getExecutionEnvironmentId(IPath path)
Returns the segment from the path containing the execution environment id
or
null |
java.lang.String |
getInferenceID()
Get the id of the inference provider for this library
|
int |
getKind()
Answers the kind of this container.
|
LibraryLocation |
getLibraryLocation() |
static java.lang.String |
getVMName(IPath path)
Returns the VM name from the given container ID path.
|
static java.lang.String |
getVMTypeId(IPath path)
Returns the VM type identifier from the given container ID path.
|
void |
initialize(IPath containerPath,
IJavaScriptProject project)
Binds a includepath container to a
IJsGlobalScopeContainer for a given project,
or silently fails if unable to do so. |
static boolean |
isExecutionEnvironment(IPath path)
Returns whether the given path identifies a vm by exeuction environment.
|
void |
requestJsGlobalScopeContainerUpdate(IPath containerPath,
IJavaScriptProject project,
IJsGlobalScopeContainer containerSuggestion)
Request a registered container definition to be updated according to a container suggestion.
|
static IVMInstall |
resolveVM(IPath containerPath)
Returns the VM install associated with the container path, or
null
if it does not exist. |
getAccessRulesStatus, getAttributeStatus, getComparisonID, getContainer, getDescription, getFailureContainer, getHostPath, getIncludepathEntries, getPath, getSourceAttachmentStatus, removeFromProject, resolvedLibraryImport
public void initialize(IPath containerPath, IJavaScriptProject project) throws CoreException
IJsGlobalScopeContainerInitializer
IJsGlobalScopeContainer
for a given project,
or silently fails if unable to do so.
A container is identified by a container path, which must be formed of two segments. The first segment is used as a unique identifier (which this initializer did register onto), and the second segment can be used as an additional hint when performing the resolution.
The initializer is invoked if a container path needs to be resolved for a given project, and no
value for it was recorded so far. The implementation of the initializer would typically set the
corresponding container using JavaScriptCore#setJsGlobalScopeContainer
.
A container initialization can be indirectly performed while attempting to resolve a project
includepath using IJavaScriptProject#getResolvedClasspath(
; or directly when using
JavaScriptCore#getJsGlobalScopeContainer
. During the initialization process, any attempt
to further obtain the same container will simply return null
so as to avoid an
infinite regression of initializations.
A container initialization may also occur indirectly when setting a project includepath, as the operation needs to resolve the includepath for validation purpose. While the operation is in progress, a referenced container initializer may be invoked. If the initializer further tries to access the referring project includepath, it will not see the new assigned includepath until the operation has completed. Note that once the JavaScript change notification occurs (at the end of the operation), the model has been updated, and the project includepath can be queried normally.
This method is called by the JavaScript model to give the party that defined this particular kind of includepath container the chance to install includepath container objects that will be used to convert includepath container entries into simpler includepath entries. The method is typically called exactly once for a given JavaScript project and includepath container entry. This method must not be called by other clients.
There are a wide variety of conditions under which this method may be invoked. To ensure that the implementation does not interfere with correct functioning of the JavaScript model, the implementation should use only the following JavaScript model APIs:
JavaScriptCore#setJsGlobalScopeContainer(IPath, IJavaScriptProject[], IJsGlobalScopeContainer[], org.eclipse.core.runtime.IProgressMonitor)
JavaScriptCore.getJsGlobalScopeContainer(IPath, IJavaScriptProject)
JavaScriptCore#create(org.eclipse.core.resources.IWorkspaceRoot)
JavaScriptCore#create(org.eclipse.core.resources.IProject)
IJavaScriptModel.getJavaScriptProjects()
initialize
in interface IJsGlobalScopeContainerInitializer
initialize
in class JsGlobalScopeContainerInitializer
containerPath
- a two-segment path (ID/hint) identifying the container that needs
to be resolvedproject
- the JavaScript project in which context the container is to be resolved.
This allows generic containers to be bound with project specific values.CoreException
- if an exception occurs during the initializationJsGlobalScopeContainerInitializer.initialize(IPath, IJavaScriptProject)
public int getKind()
IJsGlobalScopeContainer
K_APPLICATION
if this container maps to an application libraryK_SYSTEM
if this container maps to a system libraryK_DEFAULT_SYSTEM
if this container maps to a default system library (library
implicitly contributed by the runtime).getKind
in interface IJsGlobalScopeContainer
getKind
in class JsGlobalScopeContainerInitializer
public static IVMInstall resolveVM(IPath containerPath)
null
if it does not exist.public static java.lang.String getExecutionEnvironmentId(IPath path)
null
path
- container pathpublic static boolean isExecutionEnvironment(IPath path)
path
- public static java.lang.String encodeEnvironmentId(java.lang.String id)
id
- public static java.lang.String decodeEnvironmentId(java.lang.String id)
public static java.lang.String getVMTypeId(IPath path)
public static java.lang.String getVMName(IPath path)
public boolean canUpdateJsGlobalScopeContainer(IPath containerPath, IJavaScriptProject project)
canUpdateJsGlobalScopeContainer
in interface IJsGlobalScopeContainerInitializer
canUpdateJsGlobalScopeContainer
in class JsGlobalScopeContainerInitializer
containerPath
- the path of the container which requires to be updatedproject
- the project for which the container is to be updatedtrue
if the container can be updatedorg.eclipse.jdt.core.JsGlobalScopeContainerInitializer#canUpdateJsGlobalScopeContainer(org.eclipse.core.runtime.IPath, org.eclipse.IJavaScriptProject.core.IJavaProject)
public void requestJsGlobalScopeContainerUpdate(IPath containerPath, IJavaScriptProject project, IJsGlobalScopeContainer containerSuggestion) throws CoreException
IJsGlobalScopeContainerInitializer
IMPORTANT: In reaction to receiving an update request, a container initializer will update the corresponding
container definition (after reconciling changes) at its earliest convenience, using
JavaScriptCore#setJsGlobalScopeContainer(IPath, IJavaScriptProject[], IJsGlobalScopeContainer[], IProgressMonitor)
.
Until it does so, the update will not be reflected in the JavaScript Model.
In order to anticipate whether the container initializer allows to update its containers, the predicate
JavaScriptCore#canUpdateJsGlobalScopeContainer
should be used.
requestJsGlobalScopeContainerUpdate
in interface IJsGlobalScopeContainerInitializer
requestJsGlobalScopeContainerUpdate
in class JsGlobalScopeContainerInitializer
containerPath
- the path of the container which requires to be updatedproject
- the project for which the container is to be updatedcontainerSuggestion
- a suggestion to update the corresponding container definitionCoreException
- when JavaScriptCore#setJsGlobalScopeContainer
would throw any.org.eclipse.jdt.core.JsGlobalScopeContainerInitializer#requestJsGlobalScopeContainerUpdate(org.eclipse.core.runtime.IPath, org.eclipse.IJavaScriptProject.core.IJavaProject, org.eclipse.jdt.core.IJsGlobalScopeContainer)
public java.lang.String getDescription(IPath containerPath, IJavaScriptProject project)
IJsGlobalScopeContainerInitializer
IJsGlobalScopeContainer.getDescription()
).getDescription
in interface IJsGlobalScopeContainerInitializer
getDescription
in class JsGlobalScopeContainerInitializer
containerPath
- the path of the container which requires a readable descriptionproject
- the project from which the container is referencedorg.eclipse.jdt.core.JsGlobalScopeContainerInitializer#getDescription(org.eclipse.core.runtime.IPath, org.eclipse.IJavaScriptProject.core.IJavaProject)
public LibraryLocation getLibraryLocation()
public boolean allowAttachJsDoc()
allowAttachJsDoc
in interface IJsGlobalScopeContainerInitializer
allowAttachJsDoc
in class JsGlobalScopeContainerInitializer
public java.lang.String[] containerSuperTypes()
IJsGlobalScopeContainerInitializer
containerSuperTypes
in interface IJsGlobalScopeContainerInitializer
containerSuperTypes
in class JsGlobalScopeContainerInitializer
public java.lang.String getInferenceID()
IJsGlobalScopeContainerInitializer
getInferenceID
in interface IJsGlobalScopeContainerInitializer
getInferenceID
in class JsGlobalScopeContainerInitializer
Copyright (c) IBM Corp. and others 2000, 2010. All Rights Reserved.