JavaScript Development Tools
Release 3.2

org.eclipse.wst.jsdt.launching
Class JREContainerInitializer

java.lang.Object
  extended by org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer
      extended by org.eclipse.wst.jsdt.launching.JREContainerInitializer
All Implemented Interfaces:
IJsGlobalScopeContainer, IJsGlobalScopeContainerInitializer

public class JREContainerInitializer
extends JsGlobalScopeContainerInitializer

Resolves a container for a JRE includepath container entry. Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.


Field Summary
static String JsECMA_NAME
           
 
Fields inherited from class org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer
ATTRIBUTE_NOT_SUPPORTED, ATTRIBUTE_READ_ONLY
 
Fields inherited from interface org.eclipse.wst.jsdt.core.IJsGlobalScopeContainer
K_APPLICATION, K_DEFAULT_SYSTEM, K_SYSTEM
 
Constructor Summary
JREContainerInitializer()
           
 
Method Summary
 boolean allowAttachJsDoc()
           
 boolean canUpdateJsGlobalScopeContainer(IPath containerPath, IJavaScriptProject project)
          The container can be updated if it refers to an existing VM.
 String[] containerSuperTypes()
          returns a String of all SuperTypes provided by this library.
static String decodeEnvironmentId(String id)
           
static String encodeEnvironmentId(String id)
          Escapes foward slashes in environment id.
 String getDescription(IPath containerPath, IJavaScriptProject project)
          Returns a readable description for a container path.
static String getExecutionEnvironmentId(IPath path)
          Returns the segment from the path containing the execution environment id or null
 String getInferenceID()
          Get the id of the inference provider for this library
 int getKind()
          Answers the kind of this container.
 LibraryLocation getLibraryLocation()
           
static String getVMName(IPath path)
          Returns the VM name from the given container ID path.
static 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.
 
Methods inherited from class org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer
getAccessRulesStatus, getAttributeStatus, getComparisonID, getContainer, getDescription, getFailureContainer, getHostPath, getIncludepathEntries, getPath, getSourceAttachmentStatus, removeFromProject, resolvedLibraryImport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JsECMA_NAME

public static final String JsECMA_NAME
Constructor Detail

JREContainerInitializer

public JREContainerInitializer()
Method Detail

initialize

public void initialize(IPath containerPath,
                       IJavaScriptProject project)
                throws CoreException
Description copied from interface: IJsGlobalScopeContainerInitializer
Binds a includepath container to a 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:

The effects of using other JavaScript model APIs are unspecified.

Specified by:
initialize in interface IJsGlobalScopeContainerInitializer
Overrides:
initialize in class JsGlobalScopeContainerInitializer
Parameters:
containerPath - a two-segment path (ID/hint) identifying the container that needs to be resolved
project - the JavaScript project in which context the container is to be resolved. This allows generic containers to be bound with project specific values.
Throws:
CoreException - if an exception occurs during the initialization
See Also:
JsGlobalScopeContainerInitializer.initialize(IPath, IJavaScriptProject)

getKind

public int getKind()
Description copied from interface: IJsGlobalScopeContainer
Answers the kind of this container. Can be either: Typically, system containers should be placed first on a build path.

Specified by:
getKind in interface IJsGlobalScopeContainer
Overrides:
getKind in class JsGlobalScopeContainerInitializer
Returns:
the kind of this container

resolveVM

public static IVMInstall resolveVM(IPath containerPath)
Returns the VM install associated with the container path, or null if it does not exist.


getExecutionEnvironmentId

public static String getExecutionEnvironmentId(IPath path)
Returns the segment from the path containing the execution environment id or null

Parameters:
path - container path
Returns:
ee id

isExecutionEnvironment

public static boolean isExecutionEnvironment(IPath path)
Returns whether the given path identifies a vm by exeuction environment.

Parameters:
path -
Returns:
whether the given path identifies a vm by exeuction environment

encodeEnvironmentId

public static String encodeEnvironmentId(String id)
Escapes foward slashes in environment id.

Parameters:
id -
Returns:
esaped name

decodeEnvironmentId

public static String decodeEnvironmentId(String id)

getVMTypeId

public static String getVMTypeId(IPath path)
Returns the VM type identifier from the given container ID path.

Returns:
the VM type identifier from the given container ID path

getVMName

public static String getVMName(IPath path)
Returns the VM name from the given container ID path.

Returns:
the VM name from the given container ID path

canUpdateJsGlobalScopeContainer

public boolean canUpdateJsGlobalScopeContainer(IPath containerPath,
                                               IJavaScriptProject project)
The container can be updated if it refers to an existing VM.

Specified by:
canUpdateJsGlobalScopeContainer in interface IJsGlobalScopeContainerInitializer
Overrides:
canUpdateJsGlobalScopeContainer in class JsGlobalScopeContainerInitializer
Parameters:
containerPath - the path of the container which requires to be updated
project - the project for which the container is to be updated
Returns:
returns true if the container can be updated
See Also:
org.eclipse.jdt.core.JsGlobalScopeContainerInitializer#canUpdateJsGlobalScopeContainer(org.eclipse.core.runtime.IPath, org.eclipse.IJavaScriptProject.core.IJavaProject)

requestJsGlobalScopeContainerUpdate

public void requestJsGlobalScopeContainerUpdate(IPath containerPath,
                                                IJavaScriptProject project,
                                                IJsGlobalScopeContainer containerSuggestion)
                                         throws CoreException
Description copied from interface: IJsGlobalScopeContainerInitializer
Request a registered container definition to be updated according to a container suggestion. The container suggestion only acts as a place-holder to pass along the information to update the matching container definition(s) held by the container initializer. In particular, it is not expected to store the container suggestion as is, but rather adjust the actual container definition based on suggested changes.

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.

Specified by:
requestJsGlobalScopeContainerUpdate in interface IJsGlobalScopeContainerInitializer
Overrides:
requestJsGlobalScopeContainerUpdate in class JsGlobalScopeContainerInitializer
Parameters:
containerPath - the path of the container which requires to be updated
project - the project for which the container is to be updated
containerSuggestion - a suggestion to update the corresponding container definition
Throws:
CoreException - when JavaScriptCore#setJsGlobalScopeContainer would throw any.
See Also:
org.eclipse.jdt.core.JsGlobalScopeContainerInitializer#requestJsGlobalScopeContainerUpdate(org.eclipse.core.runtime.IPath, org.eclipse.IJavaScriptProject.core.IJavaProject, org.eclipse.jdt.core.IJsGlobalScopeContainer)

getDescription

public String getDescription(IPath containerPath,
                             IJavaScriptProject project)
Description copied from interface: IJsGlobalScopeContainerInitializer
Returns a readable description for a container path. A readable description for a container path can be used for improving the display of references to container, without actually needing to resolve them. A good implementation should answer a description consistent with the description of the associated target container (see IJsGlobalScopeContainer.getDescription()).

Specified by:
getDescription in interface IJsGlobalScopeContainerInitializer
Overrides:
getDescription in class JsGlobalScopeContainerInitializer
Parameters:
containerPath - the path of the container which requires a readable description
project - the project from which the container is referenced
Returns:
a string description of the container
See Also:
org.eclipse.jdt.core.JsGlobalScopeContainerInitializer#getDescription(org.eclipse.core.runtime.IPath, org.eclipse.IJavaScriptProject.core.IJavaProject)

getLibraryLocation

public LibraryLocation getLibraryLocation()

allowAttachJsDoc

public boolean allowAttachJsDoc()
Specified by:
allowAttachJsDoc in interface IJsGlobalScopeContainerInitializer
Overrides:
allowAttachJsDoc in class JsGlobalScopeContainerInitializer

containerSuperTypes

public String[] containerSuperTypes()
Description copied from interface: IJsGlobalScopeContainerInitializer
returns a String of all SuperTypes provided by this library.

Specified by:
containerSuperTypes in interface IJsGlobalScopeContainerInitializer
Overrides:
containerSuperTypes in class JsGlobalScopeContainerInitializer

getInferenceID

public String getInferenceID()
Description copied from interface: IJsGlobalScopeContainerInitializer
Get the id of the inference provider for this library

Specified by:
getInferenceID in interface IJsGlobalScopeContainerInitializer
Overrides:
getInferenceID in class JsGlobalScopeContainerInitializer
Returns:
inference provider id

JavaScript Development Tools
Release 3.2

Copyright (c) IBM Corp. and others 2000, 2010. All Rights Reserved.