|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.wst.jsdt.ui.JavaScriptUI
public final class JavaScriptUI
Central access point for the JavaScript UI plug-in (id "org.eclipse.wst.jsdt.ui"
).
This class provides static methods for:
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 | |
---|---|
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_ACTION_SET2
|
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_HIERARCHYPERSPECTIVE
The id of the JavaScript hierarchy perspective (value "org.eclipse.wst.jsdt.ui.JavaHierarchyPerspective" ). |
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 | |
---|---|
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,
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,
org.eclipse.wst.jsdt.ui.dialogs.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 |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ID_PLUGIN
"org.eclipse.wst.jsdt.ui"
).
public static final java.lang.String ID_PERSPECTIVE
"org.eclipse.wst.jsdt.ui.JavaPerspective"
).
public static final java.lang.String ID_HIERARCHYPERSPECTIVE
"org.eclipse.wst.jsdt.ui.JavaHierarchyPerspective"
).
public static final java.lang.String ID_ACTION_SET
"org.eclipse.wst.jsdt.ui.JavaActionSet"
).
public static final java.lang.String ID_ACTION_SET2
public static final java.lang.String ID_ELEMENT_CREATION_ACTION_SET
"org.eclipse.wst.jsdt.ui.JavaElementCreationActionSet"
).
public static final java.lang.String ID_CODING_ACTION_SET
"org.eclipse.wst.jsdt.ui.CodingActionSet"
).
public static final java.lang.String ID_OPEN_ACTION_SET
"org.eclipse.wst.jsdt.ui.A_OpenActionSet"
).
public static final java.lang.String ID_SEARCH_ACTION_SET
org.eclipse.wst.jsdt.ui.SearchActionSet"
).
public static final java.lang.String ID_CU_EDITOR
"org.eclipse.wst.jsdt.ui.CompilationUnitEditor"
).
public static final java.lang.String ID_CF_EDITOR
"org.eclipse.wst.jsdt.ui.ClassFileEditor"
).
public static final java.lang.String ID_SNIPPET_EDITOR
"org.eclipse.wst.jsdt.ui.SnippetEditor"
).
public static final java.lang.String ID_PACKAGES
"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
.
IPackagesViewPart
,
org.eclipse.ui.IWorkbenchPage#findView(java.lang.String)
,
org.eclipse.ui.IWorkbenchPage#showView(java.lang.String)
,
Constant Field Valuespublic static final java.lang.String ID_TYPE_HIERARCHY
"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
.
ITypeHierarchyViewPart
,
org.eclipse.ui.IWorkbenchPage#findView(java.lang.String)
,
org.eclipse.ui.IWorkbenchPage#showView(java.lang.String)
,
Constant Field Valuespublic static final java.lang.String ID_SOURCE_VIEW
"org.eclipse.wst.jsdt.ui.SourceView"
).
org.eclipse.ui.IWorkbenchPage#findView(java.lang.String)
,
org.eclipse.ui.IWorkbenchPage#showView(java.lang.String)
,
Constant Field Valuespublic static final java.lang.String ID_JAVADOC_VIEW
"org.eclipse.wst.jsdt.ui.JavadocView"
).
org.eclipse.ui.IWorkbenchPage#findView(java.lang.String)
,
org.eclipse.ui.IWorkbenchPage#showView(java.lang.String)
,
Constant Field Valuespublic static java.lang.String ID_BROWSING_PERSPECTIVE
"org.eclipse.wst.jsdt.ui.JavaBrowsingPerspective"
).
public static java.lang.String ID_PROJECTS_VIEW
"org.eclipse.wst.jsdt.ui.ProjectsView"
).
public static java.lang.String ID_PACKAGES_VIEW
"org.eclipse.wst.jsdt.ui.PackagesView"
).
public static java.lang.String ID_TYPES_VIEW
"org.eclipse.wst.jsdt.ui.TypesView"
).
public static java.lang.String ID_MEMBERS_VIEW
"org.eclipse.wst.jsdt.ui.MembersView"
).
Method Detail |
---|
public static ISharedImages getSharedImages()
public static SelectionDialog createPackageDialog(Shell parent, IJavaScriptProject project, int style, java.lang.String filter) throws JavaScriptModelException
Window.open
,
and subsequently extracting the selected package (of type
IPackageFragment
) via SelectionDialog.getResult
.
parent
- the parent shell of the dialog to be createdproject
- the JavaScript projectstyle
- 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.
JavaScriptModelException
- if the selection dialog could not be openedpublic static SelectionDialog createPackageDialog(Shell parent, IRunnableContext context, IJavaScriptSearchScope scope, boolean multipleSelection, boolean removeDuplicates, java.lang.String filter)
Window.open
,
and subsequently extracting the selected package (of type
IPackageFragment
) via SelectionDialog.getResult
.
parent
- the parent shell of the dialog to be createdcontext
- the runnable context to run the search inscope
- the scope defining the available packages.multipleSelection
- true if multiple selection is allowedremoveDuplicates
- true if only one package is shown per package namefilter
- 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.
public static SelectionDialog createPackageDialog(Shell parent, IJavaScriptProject project, int style) throws JavaScriptModelException
Window.open
,
and subsequently extracting the selected package (of type
IPackageFragment
) via SelectionDialog.getResult
.
parent
- the parent shell of the dialog to be createdproject
- the JavaScript projectstyle
- 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.
JavaScriptModelException
- if the selection dialog could not be openedpublic static SelectionDialog createPackageDialog(Shell parent, IPackageFragmentRoot root, java.lang.String filter) throws JavaScriptModelException
Window.open
,
and subsequently extracting the selected package (of type
IPackageFragment
) via SelectionDialog.getResult
.
parent
- the parent shell of the dialog to be createdroot
- the package fragment rootfilter
- 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.
JavaScriptModelException
- if the selection dialog could not be openedpublic static SelectionDialog createPackageDialog(Shell parent, IPackageFragmentRoot root) throws JavaScriptModelException
Window.open
,
and subsequently extracting the selected package (of type
IPackageFragment
) via SelectionDialog.getResult
.
parent
- the parent shell of the dialog to be createdroot
- the package fragment root
JavaScriptModelException
- if the selection dialog could not be openedpublic static SelectionDialog createTypeDialog(Shell parent, IRunnableContext context, IProject project, int style, boolean multipleSelection) throws JavaScriptModelException
Window.open
,
and subsequently extracting the selected type(s) (of type
IType
) via SelectionDialog.getResult
.
parent
- the parent shell of the dialog to be createdcontext
- the runnable context used to show progress when the dialog
is being populatedproject
- the JavaScript projectstyle
- 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
JavaScriptModelException
- if the selection dialog could not be openedpublic static SelectionDialog createTypeDialog(Shell parent, IRunnableContext context, IJavaScriptSearchScope scope, int style, boolean multipleSelection, java.lang.String filter) throws JavaScriptModelException
Window.open
,
and subsequently extracting the selected type(s) (of type
IType
) via SelectionDialog.getResult
.
parent
- the parent shell of the dialog to be createdcontext
- the runnable context used to show progress when the dialog
is being populatedscope
- the scope that limits which types are includedstyle
- 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 allowedfilter
- 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.
JavaScriptModelException
- if the selection dialog could not be openedpublic static SelectionDialog createTypeDialog(Shell parent, IRunnableContext context, IJavaScriptSearchScope scope, int style, boolean multipleSelection, java.lang.String filter, org.eclipse.wst.jsdt.ui.dialogs.TypeSelectionExtension extension) throws JavaScriptModelException
Window.open
,
and subsequently extracting the selected type(s) (of type
IType
) via SelectionDialog.getResult
.
parent
- the parent shell of the dialog to be createdcontext
- the runnable context used to show progress when the dialog
is being populatedscope
- the scope that limits which types are includedstyle
- 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 allowedfilter
- 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
JavaScriptModelException
- if the selection dialog could not be openedpublic static IEditorPart openInEditor(IJavaScriptElement element) throws JavaScriptModelException, PartInitException
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.
element
- the input element; either a compilation unit
(IJavaScriptUnit
) or a class file (IClassFile
) or source references inside.
null
if the element is not a ISourceReference
or the
file was opened in an external editor.
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 resourcepublic static IEditorPart openInEditor(IJavaScriptElement element, boolean activate, boolean reveal) throws JavaScriptModelException, PartInitException
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.
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.
null
if the element is not a ISourceReference
or the
file was opened in an external editor.
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 resourcepublic static void revealInEditor(IEditorPart part, IJavaScriptElement element)
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.
part
- the editor displaying a compilation unit or class fileelement
- the element to be revealedpublic static IWorkingCopyManager getWorkingCopyManager()
public static IJavaScriptElement getEditorInputJavaElement(IEditorInput editorInput)
editorInput
- the editor input
editorInput
or null
if nonepublic static IDocumentProvider getDocumentProvider()
IDocumentProvider
public static java.net.URL getLibraryJSdocLocation(IIncludePathEntry entry)
null
if no
location is available. Note that only classpath entries of kind IIncludePathEntry.CPE_LIBRARY
and
IIncludePathEntry.CPE_VARIABLE
support Javadoc locations.
entry
- the classpath entry to get the Javadoc location for
null
if no Javadoc location is available
java.lang.IllegalArgumentException
- Thrown when the entry is null
or not of kind
IIncludePathEntry.CPE_LIBRARY
or IIncludePathEntry.CPE_VARIABLE
.public static void setProjectJSdocLocation(IJavaScriptProject project, java.net.URL url)
project
- the projecturl
- the Javadoc location to set. This location should contain index.html and
a file 'package-list'. null
clears the current documentation
location.public static java.net.URL getProjectJSdocLocation(IJavaScriptProject project)
null
if no
location is available. This location is used for all types located in the project's
source folders.
project
- the project
null
public static java.net.URL getJSdocBaseLocation(IJavaScriptElement element) throws JavaScriptModelException
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.
element
- the element for which the documentation URL is requested.
JavaScriptModelException
- thrown when the element can not be accessedpublic static java.net.URL getJSdocLocation(IJavaScriptElement element, boolean includeAnchor) throws JavaScriptModelException
null
if no javadoc location has been attached to the element's library or
project.
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.
JavaScriptModelException
- thrown when the element can not be accessedpublic static Transfer getJavaElementClipboardTransfer()
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() } );
public static IColorManager getColorManager()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |