org.eclipse.wst.jsdt.ui

## Class JavaScriptUI

- java.lang.Object
- - org.eclipse.wst.jsdt.ui.JavaScriptUI

    public final class JavaScriptUI
    extends java.lang.Object

Central access point for the JavaScript UI plug-in (id `"org.eclipse.wst.jsdt.ui"`). This class provides static methods for:

- creating various kinds of selection dialogs to present a collection of JavaScript elements to the user and let them make a selection.
- opening a JavaScript editor on a compilation unit.

This class provides static methods and fields only; it is not intended to be instantiated or subclassed by clients.

* 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
`static java.lang.String` `ID_ACTION_SET` The id of the JavaScript action set (value `"org.eclipse.wst.jsdt.ui.JavaActionSet"`).
`static java.lang.String` `ID_BROWSING_PERSPECTIVE` The id of the JavaScript Browsing Perspective (value `"org.eclipse.wst.jsdt.ui.JavaBrowsingPerspective"`).
`static java.lang.String` `ID_CF_EDITOR` The editor part id of the editor that presents JavaScript binary class files (value `"org.eclipse.wst.jsdt.ui.ClassFileEditor"`).
`static java.lang.String` `ID_CODING_ACTION_SET` The id of the JavaScript Coding action set (value `"org.eclipse.wst.jsdt.ui.CodingActionSet"`).
`static java.lang.String` `ID_CU_EDITOR` The editor part id of the editor that presents JavaScript compilation units (value `"org.eclipse.wst.jsdt.ui.CompilationUnitEditor"`).
`static java.lang.String` `ID_ELEMENT_CREATION_ACTION_SET` The id of the JavaScript Element Creation action set (value `"org.eclipse.wst.jsdt.ui.JavaElementCreationActionSet"`).
`static java.lang.String` `ID_JAVADOC_VIEW` The view part id of the Javadoc view (value `"org.eclipse.wst.jsdt.ui.JavadocView"`).
`static java.lang.String` `ID_MEMBERS_VIEW` The view part id of the JavaScript Browsing Members view (value `"org.eclipse.wst.jsdt.ui.MembersView"`).
`static java.lang.String` `ID_OPEN_ACTION_SET` The id of the JavaScript action set for open actions (value `"org.eclipse.wst.jsdt.ui.A_OpenActionSet"`).
`static java.lang.String` `ID_PACKAGES` The view part id of the Packages view (value `"org.eclipse.wst.jsdt.ui.PackageExplorer"`).
`static java.lang.String` `ID_PACKAGES_VIEW` The view part id of the JavaScript Browsing Packages view (value `"org.eclipse.wst.jsdt.ui.PackagesView"`).
`static java.lang.String` `ID_PERSPECTIVE` The id of the JavaScript perspective (value `"org.eclipse.wst.jsdt.ui.JavaPerspective"`).
`static java.lang.String` `ID_PLUGIN` The id of the JavaScript plug-in (value `"org.eclipse.wst.jsdt.ui"`).
`static java.lang.String` `ID_PROJECTS_VIEW` The view part id of the JavaScript Browsing Projects view (value `"org.eclipse.wst.jsdt.ui.ProjectsView"`).
`static java.lang.String` `ID_SEARCH_ACTION_SET` The id of the JavaScript Search action set (value `org.eclipse.wst.jsdt.ui.SearchActionSet"`).
`static java.lang.String` `ID_SNIPPET_EDITOR` The editor part id of the code snippet editor (value `"org.eclipse.wst.jsdt.ui.SnippetEditor"`).
`static java.lang.String` `ID_SOURCE_VIEW` The view part id of the source (declaration) view (value `"org.eclipse.wst.jsdt.ui.SourceView"`).
`static java.lang.String` `ID_TYPE_HIERARCHY` The view part id of the type hierarchy part (value `"org.eclipse.wst.jsdt.ui.TypeHierarchy"`).
`static java.lang.String` `ID_TYPES_VIEW` The view part id of the JavaScript Browsing Types view (value `"org.eclipse.wst.jsdt.ui.TypesView"`).

### Method Summary

All Methods Static Methods Concrete Methods
`static SelectionDialog` `createPackageDialog(Shell parent, IJavaScriptProject project, int style)` Creates a selection dialog that lists all packages of the given JavaScript project.
`static SelectionDialog` `createPackageDialog(Shell parent, IJavaScriptProject project, int style, java.lang.String filter)` Creates a selection dialog that lists all packages of the given JavaScript project.
`static SelectionDialog` `createPackageDialog(Shell parent, IPackageFragmentRoot root)` Creates a selection dialog that lists all packages under the given package fragment root.
`static SelectionDialog` `createPackageDialog(Shell parent, IPackageFragmentRoot root, java.lang.String filter)` Creates a selection dialog that lists all packages under the given package fragment root.
`static SelectionDialog` `createPackageDialog(Shell parent, IRunnableContext context, IJavaScriptSearchScope scope, boolean multipleSelection, boolean removeDuplicates, java.lang.String filter)` Creates a selection dialog that lists all packages of the given JavaScript search scope.
`static SelectionDialog` `createTypeDialog(Shell parent, IRunnableContext context, IJavaScriptSearchScope scope, int style, boolean multipleSelection)` Creates a selection dialog that lists all types in the given scope.
`static SelectionDialog` `createTypeDialog(Shell parent, IRunnableContext context, IJavaScriptSearchScope scope, int style, boolean multipleSelection, java.lang.String filter)` Creates a selection dialog that lists all types in the given scope.
`static SelectionDialog` `createTypeDialog(Shell parent, IRunnableContext context, IJavaScriptSearchScope scope, int style, boolean multipleSelection, java.lang.String filter, TypeSelectionExtension extension)` Creates a selection dialog that lists all types in the given scope.
`static SelectionDialog` `createTypeDialog(Shell parent, IRunnableContext context, IProject project, int style, boolean multipleSelection)` Creates a selection dialog that lists all types in the given project.
`static IColorManager` `getColorManager()` Returns the color manager the JavaScript UI plug-in which is used to manage any Java-specific colors needed for such things like syntax highlighting.
`static IDocumentProvider` `getDocumentProvider()` Returns the DocumentProvider used for JavaScript compilation units.
`static IJavaScriptElement` `getEditorInputJavaElement(IEditorInput editorInput)` Returns the JavaScript element wrapped by the given editor input.
`static Transfer` `getJavaElementClipboardTransfer()` Returns the transfer instance used to copy/paste JavaScript elements to and from the clipboard.
`static java.net.URL` `getJSdocBaseLocation(IJavaScriptElement element)` Returns the Javadoc base URL for an element.
`static java.net.URL` `getJSdocLocation(IJavaScriptElement element, boolean includeAnchor)` Returns the Javadoc URL for an element.
`static java.net.URL` `getLibraryJSdocLocation(IIncludePathEntry entry)` Returns the Javadoc location for library's classpath entry or `null` if no location is available.
`static java.net.URL` `getProjectJSdocLocation(IJavaScriptProject project)` Returns the Javadoc location for a JavaScript project or `null` if no location is available.
`static ISharedImages` `getSharedImages()` Returns the shared images for the JavaScript UI.
`static IWorkingCopyManager` `getWorkingCopyManager()` Returns the working copy manager for the JavaScript UI plug-in.
`static IEditorPart` `openInEditor(IJavaScriptElement element)` Opens an editor on the given JavaScript element in the active page.
`static IEditorPart` `openInEditor(IJavaScriptElement element, boolean activate, boolean reveal)` Opens an editor on the given JavaScript element in the active page.
`static void` `revealInEditor(IEditorPart part, IJavaScriptElement element)` Reveals the given JavaScript element in the given editor.
`static void` `setProjectJSdocLocation(IJavaScriptProject project, java.net.URL url)` Sets the Javadoc location for a JavaScript project.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### ID_PLUGIN

    public static final java.lang.String ID_PLUGIN

The id of the JavaScript plug-in (value `"org.eclipse.wst.jsdt.ui"`).

See Also:
  Constant Field Values

#### ID_PERSPECTIVE

    public static final java.lang.String ID_PERSPECTIVE

The id of the JavaScript perspective (value `"org.eclipse.wst.jsdt.ui.JavaPerspective"`).

See Also:
  Constant Field Values

#### ID_ACTION_SET

    public static final java.lang.String ID_ACTION_SET

The id of the JavaScript action set (value `"org.eclipse.wst.jsdt.ui.JavaActionSet"`).

See Also:
  Constant Field Values

#### ID_ELEMENT_CREATION_ACTION_SET

    public static final java.lang.String ID_ELEMENT_CREATION_ACTION_SET

The id of the JavaScript Element Creation action set (value `"org.eclipse.wst.jsdt.ui.JavaElementCreationActionSet"`).

See Also:
  Constant Field Values

#### ID_CODING_ACTION_SET

    public static final java.lang.String ID_CODING_ACTION_SET

The id of the JavaScript Coding action set (value `"org.eclipse.wst.jsdt.ui.CodingActionSet"`).

See Also:
  Constant Field Values

#### ID_OPEN_ACTION_SET

    public static final java.lang.String ID_OPEN_ACTION_SET

The id of the JavaScript action set for open actions (value `"org.eclipse.wst.jsdt.ui.A_OpenActionSet"`).

See Also:
  Constant Field Values

#### ID_SEARCH_ACTION_SET

    public static final java.lang.String ID_SEARCH_ACTION_SET

The id of the JavaScript Search action set (value `org.eclipse.wst.jsdt.ui.SearchActionSet"`).

See Also:
  Constant Field Values

#### ID_CU_EDITOR

    public static final java.lang.String ID_CU_EDITOR

The editor part id of the editor that presents JavaScript compilation units (value `"org.eclipse.wst.jsdt.ui.CompilationUnitEditor"`).

See Also:
  Constant Field Values

#### ID_CF_EDITOR

    public static final java.lang.String ID_CF_EDITOR

The editor part id of the editor that presents JavaScript binary class files (value `"org.eclipse.wst.jsdt.ui.ClassFileEditor"`).

See Also:
  Constant Field Values

#### ID_SNIPPET_EDITOR

    public static final java.lang.String ID_SNIPPET_EDITOR

The editor part id of the code snippet editor (value `"org.eclipse.wst.jsdt.ui.SnippetEditor"`).

See Also:
  Constant Field Values

#### ID_PACKAGES

    public static final java.lang.String ID_PACKAGES

The view part id of the Packages view (value `"org.eclipse.wst.jsdt.ui.PackageExplorer"`).

When this id is used to access a view part with `IWorkbenchPage.findView` or `showView`, the returned `IViewPart` can be safely cast to an `IPackagesViewPart`.

See Also:
  `IPackagesViewPart`, `org.eclipse.ui.IWorkbenchPage#findView(java.lang.String)`, `org.eclipse.ui.IWorkbenchPage#showView(java.lang.String)`, Constant Field Values

#### ID_TYPE_HIERARCHY

    public static final java.lang.String ID_TYPE_HIERARCHY

The view part id of the type hierarchy part (value `"org.eclipse.wst.jsdt.ui.TypeHierarchy"`).

When this id is used to access a view part with `IWorkbenchPage.findView` or `showView`, the returned `IViewPart` can be safely cast to an `ITypeHierarchyViewPart`.

See Also:
  `ITypeHierarchyViewPart`, `org.eclipse.ui.IWorkbenchPage#findView(java.lang.String)`, `org.eclipse.ui.IWorkbenchPage#showView(java.lang.String)`, Constant Field Values

#### ID_SOURCE_VIEW

    public static final java.lang.String ID_SOURCE_VIEW

The view part id of the source (declaration) view (value `"org.eclipse.wst.jsdt.ui.SourceView"`).

See Also:
  `org.eclipse.ui.IWorkbenchPage#findView(java.lang.String)`, `org.eclipse.ui.IWorkbenchPage#showView(java.lang.String)`, Constant Field Values

#### ID_JAVADOC_VIEW

    public static final java.lang.String ID_JAVADOC_VIEW

The view part id of the Javadoc view (value `"org.eclipse.wst.jsdt.ui.JavadocView"`).

See Also:
  `org.eclipse.ui.IWorkbenchPage#findView(java.lang.String)`, `org.eclipse.ui.IWorkbenchPage#showView(java.lang.String)`, Constant Field Values

#### ID_BROWSING_PERSPECTIVE

    public static java.lang.String ID_BROWSING_PERSPECTIVE

The id of the JavaScript Browsing Perspective (value `"org.eclipse.wst.jsdt.ui.JavaBrowsingPerspective"`).

#### ID_PROJECTS_VIEW

    public static java.lang.String ID_PROJECTS_VIEW

The view part id of the JavaScript Browsing Projects view (value `"org.eclipse.wst.jsdt.ui.ProjectsView"`).

#### ID_PACKAGES_VIEW

    public static java.lang.String ID_PACKAGES_VIEW

The view part id of the JavaScript Browsing Packages view (value `"org.eclipse.wst.jsdt.ui.PackagesView"`).

#### ID_TYPES_VIEW

    public static java.lang.String ID_TYPES_VIEW

The view part id of the JavaScript Browsing Types view (value `"org.eclipse.wst.jsdt.ui.TypesView"`).

#### ID_MEMBERS_VIEW

    public static java.lang.String ID_MEMBERS_VIEW

The view part id of the JavaScript Browsing Members view (value `"org.eclipse.wst.jsdt.ui.MembersView"`).

### Method Detail

#### getSharedImages

    public static ISharedImages getSharedImages()

Returns the shared images for the JavaScript UI.

Returns:
  the shared images manager

#### createPackageDialog

    public static SelectionDialog createPackageDialog(Shell parent,
                                                      IJavaScriptProject project,
                                                      int style,
                                                      java.lang.String filter)
                                               throws JavaScriptModelException

Creates a selection dialog that lists all packages of the given JavaScript project. The caller is responsible for opening the dialog with `Window.open`, and subsequently extracting the selected package (of type `IPackageFragment`) via `SelectionDialog.getResult`.

Parameters:
  `parent` - the parent shell of the dialog to be created
  `project` - the JavaScript project
  `style` - flags defining the style of the dialog; the valid flags are: `IJavaScriptElementSearchConstants.CONSIDER_BINARIES`, indicating that packages from binary package fragment roots should be included in addition to those from source package fragment roots; `IJavaScriptElementSearchConstants.CONSIDER_REQUIRED_PROJECTS`, indicating that packages from required projects should be included as well.
  `filter` - the initial pattern to filter the set of packages. For example "com" shows all packages starting with "com". The meta character '?' representing any character and '*' representing any string are supported. Clients can pass an empty string if no filtering is required.
Returns:
  a new selection dialog
Throws:
  `JavaScriptModelException` - if the selection dialog could not be opened

#### createPackageDialog

    public static SelectionDialog createPackageDialog(Shell parent,
                                                      IRunnableContext context,
                                                      IJavaScriptSearchScope scope,
                                                      boolean multipleSelection,
                                                      boolean removeDuplicates,
                                                      java.lang.String filter)

Creates a selection dialog that lists all packages of the given JavaScript search scope. The caller is responsible for opening the dialog with `Window.open`, and subsequently extracting the selected package (of type `IPackageFragment`) via `SelectionDialog.getResult`.

Parameters:
  `parent` - the parent shell of the dialog to be created
  `context` - the runnable context to run the search in
  `scope` - the scope defining the available packages.
  `multipleSelection` - true if multiple selection is allowed
  `removeDuplicates` - true if only one package is shown per package name
  `filter` - the initial pattern to filter the set of packages. For example "com" shows all packages starting with "com". The meta character '?' representing any character and '*' representing any string are supported. Clients can pass an empty string if no filtering is required.
Returns:
  a new selection dialog

#### createPackageDialog

    public static SelectionDialog createPackageDialog(Shell parent,
                                                      IJavaScriptProject project,
                                                      int style)
                                               throws JavaScriptModelException

Creates a selection dialog that lists all packages of the given JavaScript project. The caller is responsible for opening the dialog with `Window.open`, and subsequently extracting the selected package (of type `IPackageFragment`) via `SelectionDialog.getResult`.

Parameters:
  `parent` - the parent shell of the dialog to be created
  `project` - the JavaScript project
  `style` - flags defining the style of the dialog; the valid flags are: `IJavaScriptElementSearchConstants.CONSIDER_BINARIES`, indicating that packages from binary package fragment roots should be included in addition to those from source package fragment roots; `IJavaScriptElementSearchConstants.CONSIDER_REQUIRED_PROJECTS`, indicating that packages from required projects should be included as well.
Returns:
  a new selection dialog
Throws:
  `JavaScriptModelException` - if the selection dialog could not be opened

#### createPackageDialog

    public static SelectionDialog createPackageDialog(Shell parent,
                                                      IPackageFragmentRoot root,
                                                      java.lang.String filter)
                                               throws JavaScriptModelException

Creates a selection dialog that lists all packages under the given package fragment root. The caller is responsible for opening the dialog with `Window.open`, and subsequently extracting the selected package (of type `IPackageFragment`) via `SelectionDialog.getResult`.

Parameters:
  `parent` - the parent shell of the dialog to be created
  `root` - the package fragment root
  `filter` - the initial pattern to filter the set of packages. For example "com" shows all packages starting with "com". The meta character '?' representing any character and '*' representing any string are supported. Clients can pass an empty string if no filtering is required.
Returns:
  a new selection dialog
Throws:
  `JavaScriptModelException` - if the selection dialog could not be opened

#### createPackageDialog

    public static SelectionDialog createPackageDialog(Shell parent,
                                                      IPackageFragmentRoot root)
                                               throws JavaScriptModelException

Creates a selection dialog that lists all packages under the given package fragment root. The caller is responsible for opening the dialog with `Window.open`, and subsequently extracting the selected package (of type `IPackageFragment`) via `SelectionDialog.getResult`.

Parameters:
  `parent` - the parent shell of the dialog to be created
  `root` - the package fragment root
Returns:
  a new selection dialog
Throws:
  `JavaScriptModelException` - if the selection dialog could not be opened

#### createTypeDialog

    public static SelectionDialog createTypeDialog(Shell parent,
                                                   IRunnableContext context,
                                                   IProject project,
                                                   int style,
                                                   boolean multipleSelection)
                                            throws JavaScriptModelException

Creates a selection dialog that lists all types in the given project. The caller is responsible for opening the dialog with `Window.open`, and subsequently extracting the selected type(s) (of type `IType`) via `SelectionDialog.getResult`.

Parameters:
  `parent` - the parent shell of the dialog to be created
  `context` - the runnable context used to show progress when the dialog is being populated
  `project` - the JavaScript project
  `style` - flags defining the style of the dialog; the only valid values are `IJavaScriptElementSearchConstants.CONSIDER_CLASSES`, `IJavaScriptElementSearchConstants.CONSIDER_INTERFACES`, `IJavaScriptElementSearchConstants.CONSIDER_ANNOTATION_TYPES`, `IJavaScriptElementSearchConstants.CONSIDER_ENUMS`, `IJavaScriptElementSearchConstants.CONSIDER_ALL_TYPES`, `IJavaScriptElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES` `IJavaScriptElementSearchConstants.CONSIDER_CLASSES_AND_ENUMS`. Please note that the bitwise OR combination of the elementary constants is not supported.
  `multipleSelection` - `true` if multiple selection is allowed
Returns:
  a new selection dialog
Throws:
  `JavaScriptModelException` - if the selection dialog could not be opened

#### createTypeDialog

    public static SelectionDialog createTypeDialog(Shell parent,
                                                   IRunnableContext context,
                                                   IJavaScriptSearchScope scope,
                                                   int style,
                                                   boolean multipleSelection)
                                            throws JavaScriptModelException

Creates a selection dialog that lists all types in the given scope. The caller is responsible for opening the dialog with `Window.open`, and subsequently extracting the selected type(s) (of type `IType`) via `SelectionDialog.getResult`.

Parameters:
  `parent` - the parent shell of the dialog to be created
  `context` - the runnable context used to show progress when the dialog is being populated
  `scope` - the scope that limits which types are included
  `style` - flags defining the style of the dialog; the only valid values are `IJavaScriptElementSearchConstants.CONSIDER_CLASSES`, `IJavaScriptElementSearchConstants.CONSIDER_INTERFACES`, `IJavaScriptElementSearchConstants.CONSIDER_ANNOTATION_TYPES`, `IJavaScriptElementSearchConstants.CONSIDER_ENUMS`, `IJavaScriptElementSearchConstants.CONSIDER_ALL_TYPES`, `IJavaScriptElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES` `IJavaScriptElementSearchConstants.CONSIDER_CLASSES_AND_ENUMS`. Please note that the bitwise OR combination of the elementary constants is not supported.
  `multipleSelection` - `true` if multiple selection is allowed
Returns:
  a new selection dialog
Throws:
  `JavaScriptModelException` - if the selection dialog could not be opened

#### createTypeDialog

    public static SelectionDialog createTypeDialog(Shell parent,
                                                   IRunnableContext context,
                                                   IJavaScriptSearchScope scope,
                                                   int style,
                                                   boolean multipleSelection,
                                                   java.lang.String filter)
                                            throws JavaScriptModelException

Creates a selection dialog that lists all types in the given scope. The caller is responsible for opening the dialog with `Window.open`, and subsequently extracting the selected type(s) (of type `IType`) via `SelectionDialog.getResult`.

Parameters:
  `parent` - the parent shell of the dialog to be created
  `context` - the runnable context used to show progress when the dialog is being populated
  `scope` - the scope that limits which types are included
  `style` - flags defining the style of the dialog; the only valid values are `IJavaScriptElementSearchConstants.CONSIDER_CLASSES`, `IJavaScriptElementSearchConstants.CONSIDER_INTERFACES`, `IJavaScriptElementSearchConstants.CONSIDER_ANNOTATION_TYPES`, `IJavaScriptElementSearchConstants.CONSIDER_ENUMS`, `IJavaScriptElementSearchConstants.CONSIDER_ALL_TYPES`, `IJavaScriptElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES` `IJavaScriptElementSearchConstants.CONSIDER_CLASSES_AND_ENUMS`. Please note that the bitwise OR combination of the elementary constants is not supported.
  `multipleSelection` - `true` if multiple selection is allowed
  `filter` - the initial pattern to filter the set of types. For example "Abstract" shows all types starting with "abstract". The meta character '?' representing any character and '*' representing any string are supported. Clients can pass an empty string if no filtering is required.
Returns:
  a new selection dialog
Throws:
  `JavaScriptModelException` - if the selection dialog could not be opened

#### createTypeDialog

    public static SelectionDialog createTypeDialog(Shell parent,
                                                   IRunnableContext context,
                                                   IJavaScriptSearchScope scope,
                                                   int style,
                                                   boolean multipleSelection,
                                                   java.lang.String filter,
                                                   TypeSelectionExtension extension)
                                            throws JavaScriptModelException

Creates a selection dialog that lists all types in the given scope. The caller is responsible for opening the dialog with `Window.open`, and subsequently extracting the selected type(s) (of type `IType`) via `SelectionDialog.getResult`.

Parameters:
  `parent` - the parent shell of the dialog to be created
  `context` - the runnable context used to show progress when the dialog is being populated
  `scope` - the scope that limits which types are included
  `style` - flags defining the style of the dialog; the only valid values are `IJavaScriptElementSearchConstants.CONSIDER_CLASSES`, `IJavaScriptElementSearchConstants.CONSIDER_INTERFACES`, `IJavaScriptElementSearchConstants.CONSIDER_ANNOTATION_TYPES`, `IJavaScriptElementSearchConstants.CONSIDER_ENUMS`, `IJavaScriptElementSearchConstants.CONSIDER_ALL_TYPES`, `IJavaScriptElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES` `IJavaScriptElementSearchConstants.CONSIDER_CLASSES_AND_ENUMS`. Please note that the bitwise OR combination of the elementary constants is not supported.
  `multipleSelection` - `true` if multiple selection is allowed
  `filter` - the initial pattern to filter the set of types. For example "Abstract" shows all types starting with "abstract". The meta character '?' representing any character and '*' representing any string are supported. Clients can pass an empty string if no filtering is required.
  `extension` - a user interface extension to the type selection dialog or `null` if no extension is desired
Returns:
  a new selection dialog
Throws:
  `JavaScriptModelException` - if the selection dialog could not be opened

#### openInEditor

    public static IEditorPart openInEditor(IJavaScriptElement element)
                                    throws JavaScriptModelException,
                                           PartInitException

Opens an editor on the given JavaScript element in the active page. Valid elements are all JavaScript elements that are `ISourceReference`. For elements inside a compilation unit or class file, the parent is opened in the editor is opened and the element revealed. If there already is an open JavaScript editor for the given element, it is returned.

Parameters:
  `element` - the input element; either a compilation unit (`IJavaScriptUnit`) or a class file (`IClassFile`) or source references inside.
Returns:
  returns the editor part of the opened editor or `null` if the element is not a `ISourceReference` or the file was opened in an external editor.
Throws:
  `PartInitException` - if the editor could not be initialized or no workbench page is active
  `JavaScriptModelException` - if this element does not exist or if an exception occurs while accessing its underlying resource

#### openInEditor

    public static IEditorPart openInEditor(IJavaScriptElement element,
                                           boolean activate,
                                           boolean reveal)
                                    throws JavaScriptModelException,
                                           PartInitException

Opens an editor on the given JavaScript element in the active page. Valid elements are all JavaScript elements that are `ISourceReference`. For elements inside a compilation unit or class file, the parent is opened in the editor is opened. If there already is an open JavaScript editor for the given element, it is returned.

Parameters:
  `element` - the input element; either a compilation unit (`IJavaScriptUnit`) or a class file (`IClassFile`) or source references inside.
  `activate` - if set, the editor will be activated.
  `reveal` - if set, the element will be revealed.
Returns:
  returns the editor part of the opened editor or `null` if the element is not a `ISourceReference` or the file was opened in an external editor.
Throws:
  `PartInitException` - if the editor could not be initialized or no workbench page is active
  `JavaScriptModelException` - if this element does not exist or if an exception occurs while accessing its underlying resource

#### revealInEditor

    public static void revealInEditor(IEditorPart part,
                                      IJavaScriptElement element)

Reveals the given JavaScript element in the given editor. If the element is not an instance of `ISourceReference` this method result in a NOP. If it is a source reference no checking is done if the editor displays a compilation unit or class file that contains the source reference element. The editor simply reveals the source range denoted by the given element.

Parameters:
  `part` - the editor displaying a compilation unit or class file
  `element` - the element to be revealed

#### getWorkingCopyManager

    public static IWorkingCopyManager getWorkingCopyManager()

Returns the working copy manager for the JavaScript UI plug-in.

Returns:
  the working copy manager for the JavaScript UI plug-in

#### getEditorInputJavaElement

    public static IJavaScriptElement getEditorInputJavaElement(IEditorInput editorInput)

Returns the JavaScript element wrapped by the given editor input.

Parameters:
  `editorInput` - the editor input
Returns:
  the JavaScript element wrapped by `editorInput` or `null` if none

#### getDocumentProvider

    public static IDocumentProvider getDocumentProvider()

Returns the DocumentProvider used for JavaScript compilation units.

Returns:
  the DocumentProvider for JavaScript compilation units.
See Also:
  `IDocumentProvider`

#### getLibraryJSdocLocation

    public static java.net.URL getLibraryJSdocLocation(IIncludePathEntry entry)

Returns the Javadoc location for library's classpath entry or `null` if no location is available. Note that only classpath entries of kind `IIncludePathEntry.CPE_LIBRARY` and `IIncludePathEntry.CPE_VARIABLE` support Javadoc locations.

Parameters:
  `entry` - the classpath entry to get the Javadoc location for
Returns:
  the Javadoc location or`null` if no Javadoc location is available
Throws:
  `java.lang.IllegalArgumentException` - Thrown when the entry is `null` or not of kind `IIncludePathEntry.CPE_LIBRARY` or `IIncludePathEntry.CPE_VARIABLE`.

#### setProjectJSdocLocation

    public static void setProjectJSdocLocation(IJavaScriptProject project,
                                               java.net.URL url)

Sets the Javadoc location for a JavaScript project. This location is used for all types located in the project's source folders.

Parameters:
  `project` - the project
  `url` - the Javadoc location to set. This location should contain index.html and a file 'package-list'. `null` clears the current documentation location.

#### getProjectJSdocLocation

    public static java.net.URL getProjectJSdocLocation(IJavaScriptProject project)

Returns the Javadoc location for a JavaScript project or `null` if no location is available. This location is used for all types located in the project's source folders.

Parameters:
  `project` - the project
Returns:
  the Javadoc location for a JavaScript project or `null`

#### getJSdocBaseLocation

    public static java.net.URL getJSdocBaseLocation(IJavaScriptElement element)
                                             throws JavaScriptModelException

Returns the Javadoc base URL for an element. The base location contains the index file. This location doesn't have to exist. Returns `null` if no javadoc location has been attached to the element's library or project. Example of a returned URL is http://www.junit.org/junit/javadoc.

Parameters:
  `element` - the element for which the documentation URL is requested.
Returns:
  the base location
Throws:
  `JavaScriptModelException` - thrown when the element can not be accessed

#### getJSdocLocation

    public static java.net.URL getJSdocLocation(IJavaScriptElement element,
                                                boolean includeAnchor)
                                         throws JavaScriptModelException

Returns the Javadoc URL for an element. Example of a returned URL is http://www.junit.org/junit/javadoc/junit/extensions/TestSetup.html. This returned location doesn't have to exist. Returns `null` if no javadoc location has been attached to the element's library or project.

Parameters:
  `element` - the element for which the documentation URL is requested.
  `includeAnchor` - If set, the URL contains an anchor for member references: http://www.junit.org/junit/javadoc/junit/extensions/TestSetup.html#run(junit.framework.TestResult). Note that this involves type resolving and is a more expensive call than without anchor.
Returns:
  the Javadoc URL for the element
Throws:
  `JavaScriptModelException` - thrown when the element can not be accessed

#### getJavaElementClipboardTransfer

    public static Transfer getJavaElementClipboardTransfer()

Returns the transfer instance used to copy/paste JavaScript elements to and from the clipboard. Objects managed by this transfer instance are of type `IJavaScriptElement[]`. So to access data from the clipboard clients should use the following code snippet:

       IJavaScriptElement[] elements=
         (IJavaScriptElement[])clipboard.getContents(JavaScriptUI.getJavaElementClipboardTransfer());

To put elements into the clipboard use the following snippet:

        IJavaScriptElement[] javaElements= ...;
        clipboard.setContents(
         new Object[] { javaElements },
         new Transfer[] { JavaScriptUI.getJavaElementClipboardTransfer() } );

Returns:
  returns the transfer object used to copy/paste JavaScript elements to and from the clipboard

#### getColorManager

    public static IColorManager getColorManager()

Returns the color manager the JavaScript UI plug-in which is used to manage any Java-specific colors needed for such things like syntax highlighting.

Returns:
  the color manager to be used for JavaScript text viewers