|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IJavaScriptModel
Represent the root JavaScript element corresponding to the workspace.
Since there is only one such root element, it is commonly referred to as
the JavaScript model element.
The JavaScript model element needs to be opened before it can be navigated or manipulated.
The JavaScript model element has no parent (it is the root of the JavaScript element
hierarchy). Its children are IJavaScriptProject
s.
This interface provides methods for performing copy, move, rename, and delete operations on multiple JavaScript elements.
This interface is not intended to be implemented by clients. An instance
of one of these handles can be created via
JavaScriptCore.create(workspace.getRoot())
.
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 |
---|
Fields inherited from interface org.eclipse.wst.jsdt.core.IJavaScriptElement |
---|
CLASS_FILE, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVASCRIPT_MODEL, JAVASCRIPT_PROJECT, JAVASCRIPT_UNIT, LOCAL_VARIABLE, METHOD, PACKAGE_DECLARATION, PACKAGE_FRAGMENT, PACKAGE_FRAGMENT_ROOT, TYPE, TYPE_PARAMETER |
Method Summary | |
---|---|
boolean |
contains(IResource resource)
Returns whether this JavaScript model contains an IJavaScriptElement whose
resource is the given resource or a non-JavaScript resource which is the given resource. |
void |
copy(IJavaScriptElement[] elements,
IJavaScriptElement[] containers,
IJavaScriptElement[] siblings,
java.lang.String[] renamings,
boolean replace,
IProgressMonitor monitor)
Copies the given elements to the specified container(s). |
void |
delete(IJavaScriptElement[] elements,
boolean force,
IProgressMonitor monitor)
Deletes the given elements, forcing the operation if necessary and specified. |
IJavaScriptProject |
getJavaScriptProject(java.lang.String name)
Returns the JavaScript project with the given name. |
IJavaScriptProject[] |
getJavaScriptProjects()
Returns the JavaScript projects in this JavaScript model, or an empty array if there are none. |
java.lang.Object[] |
getNonJavaScriptResources()
Returns an array of non-JavaScript resources (that is, non-JavaScript projects) in the workspace. |
IWorkspace |
getWorkspace()
Returns the workspace associated with this JavaScript model. |
void |
move(IJavaScriptElement[] elements,
IJavaScriptElement[] containers,
IJavaScriptElement[] siblings,
java.lang.String[] renamings,
boolean replace,
IProgressMonitor monitor)
Moves the given elements to the specified container(s). |
void |
refreshExternalArchives(IJavaScriptElement[] elementsScope,
IProgressMonitor monitor)
Triggers an update of the JavaScriptModel with respect to the referenced external archives. |
void |
rename(IJavaScriptElement[] elements,
IJavaScriptElement[] destinations,
java.lang.String[] names,
boolean replace,
IProgressMonitor monitor)
Renames the given elements as specified. |
Methods inherited from interface org.eclipse.wst.jsdt.core.IJavaScriptElement |
---|
exists, getAncestor, getAttachedJavadoc, getCommonSuperType, getCorrespondingResource, getDisplayName, getElementName, getElementType, getHandleIdentifier, getHostPath, getJavaScriptModel, getJavaScriptProject, getOpenable, getParent, getPath, getPrimaryElement, getResource, getSchedulingRule, getUnderlyingResource, isReadOnly, isStructureKnown, isVirtual |
Methods inherited from interface org.eclipse.wst.jsdt.core.ILookupScope |
---|
newNameLookup, newNameLookup, newSearchableNameEnvironment, newSearchableNameEnvironment |
Methods inherited from interface org.eclipse.wst.jsdt.core.IOpenable |
---|
close, findRecommendedLineSeparator, getBuffer, hasUnsavedChanges, isConsistent, isOpen, makeConsistent, open, save |
Methods inherited from interface org.eclipse.wst.jsdt.core.IParent |
---|
getChildren, hasChildren |
Method Detail |
---|
boolean contains(IResource resource)
IJavaScriptElement
whose
resource is the given resource or a non-JavaScript resource which is the given resource.
Note: no existency check is performed on the argument resource. If it is not accessible
(see IResource.isAccessible()
) yet but would be located in JavaScript model
range, then it will return true
.
If the resource is accessible, it can be reached by navigating the JavaScript model down using the
getChildren()
and/or getNonJavaResources()
methods.
resource
- the resource to check
void copy(IJavaScriptElement[] elements, IJavaScriptElement[] containers, IJavaScriptElement[] siblings, java.lang.String[] renamings, boolean replace, IProgressMonitor monitor) throws JavaScriptModelException
Optionally, each copy can positioned before a sibling
element. If null
is specified for a given sibling, the copy
is inserted as the last child of its associated container.
Optionally, each copy can be renamed. If
null
is specified for the new name, the copy
is not renamed.
Optionally, any existing child in the destination container with
the same name can be replaced by specifying true
for
force. Otherwise an exception is thrown in the event that a name
collision occurs.
elements
- the elements to copycontainers
- the container, or list of containerssiblings
- the list of siblings element any of which may be
null
; or null
renamings
- the list of new names any of which may be
null
; or null
replace
- true
if any existing child in a target container
with the target name should be replaced, and false
to throw an
exception in the event of a name collisionmonitor
- a progress monitor
JavaScriptModelException
- if an element could not be copied. Reasons include:
CoreException
occurred while updating an underlying resourceINVALID_DESTINATION
)INVALID_SIBLING
)INVALID_NAME
)replace
has been specified as false
(NAME_COLLISION
)READ_ONLY
) void delete(IJavaScriptElement[] elements, boolean force, IProgressMonitor monitor) throws JavaScriptModelException
elements
- the elements to deleteforce
- a flag controlling whether underlying resources that are not
in sync with the local file system will be toleratedmonitor
- a progress monitor
JavaScriptModelException
- if an element could not be deleted. Reasons include:
CoreException
occurred while updating an underlying resourceREAD_ONLY
) IJavaScriptProject getJavaScriptProject(java.lang.String name)
name
- the name of the JavaScript project
IJavaScriptProject[] getJavaScriptProjects() throws JavaScriptModelException
JavaScriptModelException
- if this request fails.java.lang.Object[] getNonJavaScriptResources() throws JavaScriptModelException
Non-JavaScript projects include all projects that are closed (even if they have the JavaScript nature).
IProject
s) contained
in the workspace.
JavaScriptModelException
- if this element does not exist or if an
exception occurs while accessing its corresponding resourceIWorkspace getWorkspace()
void move(IJavaScriptElement[] elements, IJavaScriptElement[] containers, IJavaScriptElement[] siblings, java.lang.String[] renamings, boolean replace, IProgressMonitor monitor) throws JavaScriptModelException
Optionally, each element can positioned before a sibling
element. If null
is specified for sibling, the element
is inserted as the last child of its associated container.
Optionally, each element can be renamed. If
null
is specified for the new name, the element
is not renamed.
Optionally, any existing child in the destination container with
the same name can be replaced by specifying true
for
force. Otherwise an exception is thrown in the event that a name
collision occurs.
elements
- the elements to movecontainers
- the container, or list of containerssiblings
- the list of siblings element any of which may be
null
; or null
renamings
- the list of new names any of which may be
null
; or null
replace
- true
if any existing child in a target container
with the target name should be replaced, and false
to throw an
exception in the event of a name collisionmonitor
- a progress monitor
JavaScriptModelException
- if an element could not be moved. Reasons include:
CoreException
occurred while updating an underlying resourceINVALID_DESTINATION
)INVALID_SIBLING
)INVALID_NAME
)replace
has been specified as false
(NAME_COLLISION
)READ_ONLY
) java.lang.IllegalArgumentException
- any element or container is null
void refreshExternalArchives(IJavaScriptElement[] elementsScope, IProgressMonitor monitor) throws JavaScriptModelException
null
along is equivalent to refreshing the entire mode).
The elements can be:
In case an archive is used by multiple projects, the delta issued will account for all of them. This means that even if a project was not part of the elements scope, it may still be notified of changes if it is referencing a library comprised in the scope.
elementsScope
- - a collection of elements defining the scope of the refreshmonitor
- - a progress monitor used to report progress
JavaScriptModelException
- in one of the corresponding situation:
IJavaScriptElementDelta
void rename(IJavaScriptElement[] elements, IJavaScriptElement[] destinations, java.lang.String[] names, boolean replace, IProgressMonitor monitor) throws JavaScriptModelException
elements
- the elements to renamedestinations
- the container, or list of containersnames
- the list of new namesreplace
- true
if an existing child in a target container
with the target name should be replaced, and false
to throw an
exception in the event of a name collisionmonitor
- a progress monitor
JavaScriptModelException
- if an element could not be renamed. Reasons include:
CoreException
occurred while updating an underlying resource
INVALID_NAME
)
replace
has been specified as false
(NAME_COLLISION
)
READ_ONLY
)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |