public final class JavaUI extends Object
"org.eclipse.jdt.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.
Modifier and Type | Field and Description |
---|---|
static String |
ATTR_CMDLINE
Deprecated.
As of 1.0
|
static String |
ID_ACTION_SET
The id of the Java action set
(value
"org.eclipse.jdt.ui.JavaActionSet" ). |
static String |
ID_BROWSING_PERSPECTIVE
The id of the Java Browsing Perspective
(value
"org.eclipse.jdt.ui.JavaBrowsingPerspective" ). |
static String |
ID_CF_EDITOR
The editor part id of the editor that presents Java binary class files
(value
"org.eclipse.jdt.ui.ClassFileEditor" ). |
static String |
ID_CLASSPATH_VARIABLES_PREFERENCE_PAGE
The preference page id of the class path variables preference page
(value
"org.eclipse.jdt.ui.preferences.ClasspathVariablesPreferencePage" ). |
static String |
ID_CODING_ACTION_SET
The id of the Java Coding action set
(value
"org.eclipse.jdt.ui.CodingActionSet" ). |
static String |
ID_COMPILER_COMPLIANCE_PROPERTY_PAGE |
static String |
ID_CU_EDITOR
The editor part id of the editor that presents Java compilation units
(value
"org.eclipse.jdt.ui.CompilationUnitEditor" ). |
static String |
ID_ELEMENT_CREATION_ACTION_SET
The id of the Java Element Creation action set
(value
"org.eclipse.jdt.ui.JavaElementCreationActionSet" ). |
static String |
ID_HIERARCHYPERSPECTIVE
The id of the Java hierarchy perspective
(value
"org.eclipse.jdt.ui.JavaHierarchyPerspective" ). |
static String |
ID_JAVA_BUILD_PREFERENCE_PROPERTY_PAGE |
static String |
ID_JAVADOC_VIEW
The view part id of the Javadoc view
(value
"org.eclipse.jdt.ui.JavadocView" ). |
static String |
ID_MEMBERS_VIEW
The view part id of the Java Browsing Members view
(value
"org.eclipse.jdt.ui.MembersView" ). |
static String |
ID_MODULE_INFO_CF_EDITOR
The editor part id of the module-info.class editor (value
"org.eclipse.jdt.ui.ModuleInfoClassFileEditor" ). |
static String |
ID_MODULE_INFO_CF_EDITOR_NO_SOURCE
The editor part id of the module-info.class editor with no source (value
"org.eclipse.jdt.ui.ModuleInfoClassFileEditorNoSource" ). |
static String |
ID_MODULE_INFO_EDITOR
The editor part id of the module-info.java editor (value
"org.eclipse.jdt.ui.ModuleInfoEditor" ). |
static String |
ID_OPEN_ACTION_SET
The id of the Java action set for open actions
(value
"org.eclipse.jdt.ui.A_OpenActionSet" ). |
static String |
ID_PACKAGES
The view part id of the Packages view
(value
"org.eclipse.jdt.ui.PackageExplorer" ). |
static String |
ID_PACKAGES_VIEW
The view part id of the Java Browsing Packages view
(value
"org.eclipse.jdt.ui.PackagesView" ). |
static String |
ID_PERSPECTIVE
The id of the Java perspective
(value
"org.eclipse.jdt.ui.JavaPerspective" ). |
static String |
ID_PLUGIN
The id of the Java plug-in (value
"org.eclipse.jdt.ui" ). |
static String |
ID_PROJECTS_VIEW
The view part id of the Java Browsing Projects view
(value
"org.eclipse.jdt.ui.ProjectsView" ). |
static String |
ID_SEARCH_ACTION_SET
The id of the Java Search action set
(value
org.eclipse.jdt.ui.SearchActionSet" ). |
static String |
ID_SNIPPET_EDITOR
The editor part id of the code snippet editor
(value
"org.eclipse.jdt.ui.SnippetEditor" ). |
static String |
ID_SOURCE_VIEW
The view part id of the source (declaration) view
(value
"org.eclipse.jdt.ui.SourceView" ). |
static String |
ID_TYPE_HIERARCHY
The view part id of the type hierarchy part
(value
"org.eclipse.jdt.ui.TypeHierarchy" ). |
static String |
ID_TYPES_VIEW
The view part id of the Java Browsing Types view
(value
"org.eclipse.jdt.ui.TypesView" ). |
static String |
ID_USER_LIBRARY_PREFERENCE_PAGE
The preference page id of the user library preference page
(value
"org.eclipse.jdt.ui.preferences.UserLibraryPreferencePage" ). |
Modifier and Type | Method and Description |
---|---|
static SelectionDialog |
createMainTypeDialog(Shell parent,
IRunnableContext context,
IJavaSearchScope scope,
int style,
boolean multipleSelection)
Creates a selection dialog that lists all types in the given scope containing
a standard
main method. |
static SelectionDialog |
createMainTypeDialog(Shell parent,
IRunnableContext context,
IJavaSearchScope scope,
int style,
boolean multipleSelection,
String filter)
Creates a selection dialog that lists all types in the given scope containing
a standard
main method. |
static SelectionDialog |
createPackageDialog(Shell parent,
IJavaProject project,
int style)
Creates a selection dialog that lists all packages of the given Java project.
|
static SelectionDialog |
createPackageDialog(Shell parent,
IJavaProject project,
int style,
String filter)
Creates a selection dialog that lists all packages of the given Java 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,
String filter)
Creates a selection dialog that lists all packages under the given package
fragment root.
|
static SelectionDialog |
createPackageDialog(Shell parent,
IRunnableContext context,
IJavaSearchScope scope,
boolean multipleSelection,
boolean removeDuplicates,
String filter)
Creates a selection dialog that lists all packages of the given Java search scope.
|
static SelectionDialog |
createTypeDialog(Shell parent,
IRunnableContext context,
IJavaSearchScope scope,
int style,
boolean multipleSelection)
Creates a selection dialog that lists all types in the given scope.
|
static SelectionDialog |
createTypeDialog(Shell parent,
IRunnableContext context,
IJavaSearchScope scope,
int style,
boolean multipleSelection,
String filter)
Creates a selection dialog that lists all types in the given scope.
|
static SelectionDialog |
createTypeDialog(Shell parent,
IRunnableContext context,
IJavaSearchScope scope,
int style,
boolean multipleSelection,
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 IBufferFactory |
getBufferFactory()
Deprecated.
IBufferFactory has been replaced by WorkingCopyOwner .
The Java UI plug-in uses the primary working copy owner that can be accessed with null in
API's that require an owner |
static IColorManager |
getColorManager()
Returns the color manager the Java 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 Java compilation units.
|
static IJavaElement |
getEditorInputJavaElement(IEditorInput editorInput)
Returns the Java element wrapped by the given editor input.
|
static ITypeRoot |
getEditorInputTypeRoot(IEditorInput editorInput)
Returns the
ITypeRoot wrapped by the given editor input. |
static URL |
getJavadocBaseLocation(IJavaElement element)
Returns the Javadoc base URL for an element.
|
static URL |
getJavadocLocation(IJavaElement element,
boolean includeAnchor)
Returns the Javadoc URL for an element.
|
static Transfer |
getJavaElementClipboardTransfer()
Returns the transfer instance used to copy/paste Java elements to
and from the clipboard.
|
static URL |
getLibraryJavadocLocation(IClasspathEntry entry)
Returns the Javadoc location for library's classpath entry or
null if no
location is available. |
static URL |
getLibraryJavadocLocation(IPath archivePath)
Deprecated.
Javadoc is now attached to the classpath entry. Use
getJavadocBaseLocation(IJavaElement)
with the archive's IPackageFragmentRoot or use getLibraryJavadocLocation(IClasspathEntry)
with the archive's IClasspathEntry . |
static URL |
getProjectJavadocLocation(IJavaProject project)
Returns the Javadoc location for a Java project or
null if no
location is available. |
static ISharedImages |
getSharedImages()
Returns the shared images for the Java UI.
|
static IWorkingCopy[] |
getSharedWorkingCopies()
Deprecated.
Use
JavaCore.getWorkingCopies(org.eclipse.jdt.core.WorkingCopyOwner) instead with null as
argument for owner. |
static IWorkingCopy[] |
getSharedWorkingCopiesOnClasspath()
Deprecated.
Use
JavaCore.getWorkingCopies(org.eclipse.jdt.core.WorkingCopyOwner) instead and filter the list
with IJavaProject.isOnClasspath(IJavaElement) . |
static IWorkingCopyManager |
getWorkingCopyManager()
Returns the working copy manager for the Java UI plug-in.
|
static IEditorPart |
openInEditor(IJavaElement element)
Opens an editor on the given Java element in the active page.
|
static IEditorPart |
openInEditor(IJavaElement element,
boolean activate,
boolean reveal)
Opens an editor on the given Java element in the active page.
|
static void |
revealInEditor(IEditorPart part,
IJavaElement element)
Reveals the given java element in the given editor.
|
static void |
revealInEditor(IEditorPart part,
ISourceReference element)
Deprecated.
use
revealInEditor(IEditorPart, IJavaElement) instead |
static void |
setLibraryJavadocLocation(IPath archivePath,
URL url)
Deprecated.
Javadoc is now attached to the classpath entry.
Evaluate the libraries classpath entry and reconfigure the Javadoc location there.
|
static void |
setLibraryJavadocLocations(IPath[] archivePaths,
URL[] urls)
Deprecated.
Javadoc is now attached to the classpath entry.
Evaluate the libraries classpath entry and reconfigure the Javadoc location there.
|
static void |
setProjectJavadocLocation(IJavaProject project,
URL url)
Sets the Javadoc location for a Java project.
|
public static final String ID_PLUGIN
"org.eclipse.jdt.ui"
).public static final String ID_PERSPECTIVE
"org.eclipse.jdt.ui.JavaPerspective"
).public static final String ID_HIERARCHYPERSPECTIVE
"org.eclipse.jdt.ui.JavaHierarchyPerspective"
).public static final String ID_ACTION_SET
"org.eclipse.jdt.ui.JavaActionSet"
).public static final String ID_ELEMENT_CREATION_ACTION_SET
"org.eclipse.jdt.ui.JavaElementCreationActionSet"
).public static final String ID_CODING_ACTION_SET
"org.eclipse.jdt.ui.CodingActionSet"
).public static final String ID_OPEN_ACTION_SET
"org.eclipse.jdt.ui.A_OpenActionSet"
).public static final String ID_SEARCH_ACTION_SET
org.eclipse.jdt.ui.SearchActionSet"
).public static final String ID_CU_EDITOR
"org.eclipse.jdt.ui.CompilationUnitEditor"
).public static final String ID_CF_EDITOR
"org.eclipse.jdt.ui.ClassFileEditor"
).public static final String ID_SNIPPET_EDITOR
"org.eclipse.jdt.ui.SnippetEditor"
).public static final String ID_MODULE_INFO_EDITOR
"org.eclipse.jdt.ui.ModuleInfoEditor"
).public static final String ID_MODULE_INFO_CF_EDITOR
"org.eclipse.jdt.ui.ModuleInfoClassFileEditor"
).public static final String ID_MODULE_INFO_CF_EDITOR_NO_SOURCE
"org.eclipse.jdt.ui.ModuleInfoClassFileEditorNoSource"
).public static final String ID_PACKAGES
"org.eclipse.jdt.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
.
public static final String ID_TYPE_HIERARCHY
"org.eclipse.jdt.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
.
public static final String ID_SOURCE_VIEW
"org.eclipse.jdt.ui.SourceView"
).public static final String ID_JAVADOC_VIEW
"org.eclipse.jdt.ui.JavadocView"
).public static String ID_BROWSING_PERSPECTIVE
"org.eclipse.jdt.ui.JavaBrowsingPerspective"
).public static String ID_PROJECTS_VIEW
"org.eclipse.jdt.ui.ProjectsView"
).public static String ID_PACKAGES_VIEW
"org.eclipse.jdt.ui.PackagesView"
).public static String ID_TYPES_VIEW
"org.eclipse.jdt.ui.TypesView"
).public static String ID_MEMBERS_VIEW
"org.eclipse.jdt.ui.MembersView"
).public static final String ID_USER_LIBRARY_PREFERENCE_PAGE
"org.eclipse.jdt.ui.preferences.UserLibraryPreferencePage"
).public static final String ID_CLASSPATH_VARIABLES_PREFERENCE_PAGE
"org.eclipse.jdt.ui.preferences.ClasspathVariablesPreferencePage"
).public static final String ID_COMPILER_COMPLIANCE_PROPERTY_PAGE
public static final String ID_JAVA_BUILD_PREFERENCE_PROPERTY_PAGE
@Deprecated public static final String ATTR_CMDLINE
public static ISharedImages getSharedImages()
public static SelectionDialog createPackageDialog(Shell parent, IJavaProject project, int style, String filter) throws JavaModelException
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 Java projectstyle
- flags defining the style of the dialog; the valid flags are:
IJavaElementSearchConstants.CONSIDER_BINARIES
, indicating that
packages from binary package fragment roots should be included in addition
to those from source package fragment roots;
IJavaElementSearchConstants.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.JavaModelException
- if the selection dialog could not be openedpublic static SelectionDialog createPackageDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, boolean multipleSelection, boolean removeDuplicates, 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, IJavaProject project, int style) throws JavaModelException
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 Java projectstyle
- flags defining the style of the dialog; the valid flags are:
IJavaElementSearchConstants.CONSIDER_BINARIES
, indicating that
packages from binary package fragment roots should be included in addition
to those from source package fragment roots;
IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS
, indicating that
packages from required projects should be included as well.JavaModelException
- if the selection dialog could not be openedpublic static SelectionDialog createPackageDialog(Shell parent, IPackageFragmentRoot root, String filter) throws JavaModelException
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.JavaModelException
- if the selection dialog could not be openedpublic static SelectionDialog createPackageDialog(Shell parent, IPackageFragmentRoot root) throws JavaModelException
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 rootJavaModelException
- if the selection dialog could not be openedpublic static SelectionDialog createTypeDialog(Shell parent, IRunnableContext context, IProject project, int style, boolean multipleSelection) throws JavaModelException
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 Java projectstyle
- flags defining the style of the dialog; the only valid values are
IJavaElementSearchConstants.CONSIDER_CLASSES
,
IJavaElementSearchConstants.CONSIDER_INTERFACES
,
IJavaElementSearchConstants.CONSIDER_ANNOTATION_TYPES
,
IJavaElementSearchConstants.CONSIDER_ENUMS
,
IJavaElementSearchConstants.CONSIDER_ALL_TYPES
,
IJavaElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES
,
IJavaElementSearchConstants.CONSIDER_CLASSES_AND_ENUMS
, and
IJavaElementSearchConstants.CONSIDER_INTERFACES_AND_ANNOTATIONS
. Please note that
the bitwise OR combination of the elementary constants is not supported.multipleSelection
- true
if multiple selection is allowedJavaModelException
- if the selection dialog could not be openedpublic static SelectionDialog createTypeDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, int style, boolean multipleSelection) throws JavaModelException
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
IJavaElementSearchConstants.CONSIDER_CLASSES
,
IJavaElementSearchConstants.CONSIDER_INTERFACES
,
IJavaElementSearchConstants.CONSIDER_ANNOTATION_TYPES
,
IJavaElementSearchConstants.CONSIDER_ENUMS
,
IJavaElementSearchConstants.CONSIDER_ALL_TYPES
,
IJavaElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES
,
IJavaElementSearchConstants.CONSIDER_CLASSES_AND_ENUMS
, and
IJavaElementSearchConstants.CONSIDER_INTERFACES_AND_ANNOTATIONS
. Please note that
the bitwise OR combination of the elementary constants is not supported.multipleSelection
- true
if multiple selection is allowedJavaModelException
- if the selection dialog could not be openedpublic static SelectionDialog createTypeDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, int style, boolean multipleSelection, String filter) throws JavaModelException
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
IJavaElementSearchConstants.CONSIDER_CLASSES
,
IJavaElementSearchConstants.CONSIDER_INTERFACES
,
IJavaElementSearchConstants.CONSIDER_ANNOTATION_TYPES
,
IJavaElementSearchConstants.CONSIDER_ENUMS
,
IJavaElementSearchConstants.CONSIDER_ALL_TYPES
,
IJavaElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES
,
IJavaElementSearchConstants.CONSIDER_CLASSES_AND_ENUMS
, and
IJavaElementSearchConstants.CONSIDER_INTERFACES_AND_ANNOTATIONS
. 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.JavaModelException
- if the selection dialog could not be openedpublic static SelectionDialog createTypeDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, int style, boolean multipleSelection, String filter, TypeSelectionExtension extension) throws JavaModelException
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
IJavaElementSearchConstants.CONSIDER_CLASSES
,
IJavaElementSearchConstants.CONSIDER_INTERFACES
,
IJavaElementSearchConstants.CONSIDER_ANNOTATION_TYPES
,
IJavaElementSearchConstants.CONSIDER_ENUMS
,
IJavaElementSearchConstants.CONSIDER_ALL_TYPES
,
IJavaElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES
,
IJavaElementSearchConstants.CONSIDER_CLASSES_AND_ENUMS
, and
IJavaElementSearchConstants.CONSIDER_INTERFACES_AND_ANNOTATIONS
. 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 desiredJavaModelException
- if the selection dialog could not be openedpublic static SelectionDialog createMainTypeDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, int style, boolean multipleSelection, String filter)
main
method.
The caller is responsible for opening the dialog with 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
IJavaElementSearchConstants.CONSIDER_BINARIES
,
CONSIDER_EXTERNAL_JARS
, or their bitwise OR, or 0
multipleSelection
- true
if multiple selection is allowedfilter
- the initial pattern to filter the set of types containing a main method. For
example "App" shows all types starting with "app". 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 createMainTypeDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, int style, boolean multipleSelection)
main
method.
The caller is responsible for opening the dialog with 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
IJavaElementSearchConstants.CONSIDER_BINARIES
,
CONSIDER_EXTERNAL_JARS
, or their bitwise OR, or 0
multipleSelection
- true
if multiple selection is allowedpublic static IEditorPart openInEditor(IJavaElement element) throws JavaModelException, 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 Java editor for the given element, it is returned.element
- the input element; either a compilation unit
(ICompilationUnit
) 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 activeJavaModelException
- if this element does not exist or if an exception occurs while accessing its underlying resourcepublic static IEditorPart openInEditor(IJavaElement element, boolean activate, boolean reveal) throws JavaModelException, 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 Java editor for the given element, it is returned.element
- the input element; either a compilation unit
(ICompilationUnit
) 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 activeJavaModelException
- if this element does not exist or if an exception occurs while accessing its underlying resource@Deprecated public static void revealInEditor(IEditorPart part, ISourceReference element)
revealInEditor(IEditorPart, IJavaElement)
insteadpart
- the editor displaying the compilation unit or class fileelement
- the source reference element defining the source range to be revealedpublic static void revealInEditor(IEditorPart part, IJavaElement 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 IJavaElement getEditorInputJavaElement(IEditorInput editorInput)
editorInput
- the editor inputeditorInput
or null
if nonepublic static ITypeRoot getEditorInputTypeRoot(IEditorInput editorInput)
ITypeRoot
wrapped by the given editor input.editorInput
- the editor inputITypeRoot
wrapped by editorInput
or null
if the editor input
does not stand for a ITypeRoot@Deprecated public static IWorkingCopy[] getSharedWorkingCopies()
JavaCore.getWorkingCopies(org.eclipse.jdt.core.WorkingCopyOwner)
instead with null
as
argument for owner.JavaCore.getSharedWorkingCopies(org.eclipse.jdt.core.IBufferFactory)
@Deprecated public static IWorkingCopy[] getSharedWorkingCopiesOnClasspath()
JavaCore.getWorkingCopies(org.eclipse.jdt.core.WorkingCopyOwner)
instead and filter the list
with IJavaProject.isOnClasspath(IJavaElement)
.getSharedWorkingCopies()
@Deprecated public static IBufferFactory getBufferFactory()
IBufferFactory
has been replaced by WorkingCopyOwner
.
The Java UI plug-in uses the primary working copy owner that can be accessed with null
in
API's that require an ownerIBufferFactory
public static IDocumentProvider getDocumentProvider()
IDocumentProvider
@Deprecated public static void setLibraryJavadocLocation(IPath archivePath, URL url)
archivePath
- the path of the library; this can be an workspace path
or an external path in case of an external library.url
- the Javadoc location to set. This location should contain index.html and
a file 'package-list'. null
clears the current documentation
location.@Deprecated public static void setLibraryJavadocLocations(IPath[] archivePaths, URL[] urls)
archivePaths
- the paths of the libraries. can be workspace paths
or external paths in case of an external library.urls
- the Javadoc locations to set. Each location corresponds to the archive path of the same index. A location should contain index.html and
a file 'package-list'. null
is a valid location entry and clears the current documentation
location. The length of the location array must be equals to the number of archive paths passed.@Deprecated public static URL getLibraryJavadocLocation(IPath archivePath)
getJavadocBaseLocation(IJavaElement)
with the archive's IPackageFragmentRoot
or use getLibraryJavadocLocation(IClasspathEntry)
with the archive's IClasspathEntry
.null
if no
location is available.archivePath
- the path of the library. This can be an workspace path
or an external path in case of an external library.null
.public static URL getLibraryJavadocLocation(IClasspathEntry entry)
null
if no
location is available. Note that only classpath entries of kind IClasspathEntry.CPE_LIBRARY
and
IClasspathEntry.CPE_VARIABLE
support Javadoc locations.entry
- the classpath entry to get the Javadoc location fornull
if no Javadoc location is availableIllegalArgumentException
- Thrown when the entry is null
or not of kind
IClasspathEntry.CPE_LIBRARY
or IClasspathEntry.CPE_VARIABLE
.public static void setProjectJavadocLocation(IJavaProject project, 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 URL getProjectJavadocLocation(IJavaProject project)
null
if no
location is available. This location is used for all types located in the project's
source folders.project
- the projectnull
public static URL getJavadocBaseLocation(IJavaElement element) throws JavaModelException
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.JavaModelException
- thrown when the element can not be accessedpublic static URL getJavadocLocation(IJavaElement element, boolean includeAnchor) throws JavaModelException
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.JavaModelException
- thrown when the element can not be accessedpublic static Transfer getJavaElementClipboardTransfer()
IJavaElement[]
. So to access data from the
clipboard clients should use the following code snippet:
IJavaElement[] elements= (IJavaElement[])clipboard.getContents(JavaUI.getJavaElementClipboardTransfer());To put elements into the clipboard use the following snippet:
IJavaElement[] javaElements= ...; clipboard.setContents( new Object[] { javaElements }, new Transfer[] { JavaUI.getJavaElementClipboardTransfer() } );
public static IColorManager getColorManager()
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.