|
Eclipse JDT Release 3.8 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jdt.ui.StandardJavaElementContentProvider
public class StandardJavaElementContentProvider
A base content provider for Java elements. It provides access to the Java element hierarchy without listening to changes in the Java model. If updating the presentation on Java model change is required than clients have to subclass, listen to Java model changes and have to update the UI using corresponding methods provided by the JFace viewers or their own UI presentation.
The following Java element hierarchy is surfaced by this content provider:
Java model (IJavaModel
) Java project (IJavaProject
) package fragment root (IPackageFragmentRoot
) package fragment (IPackageFragment
) compilation unit (ICompilationUnit
) binary class file (IClassFile
)
Note that when the entire Java project is declared to be package fragment root, the corresponding package fragment root element that normally appears between the Java project and the package fragments is automatically filtered out.
Field Summary | |
---|---|
protected boolean |
fProvideMembers
|
protected boolean |
fProvideWorkingCopy
|
protected static Object[] |
NO_CHILDREN
|
Constructor Summary | |
---|---|
StandardJavaElementContentProvider()
Creates a new content provider. |
|
StandardJavaElementContentProvider(boolean provideMembers)
Creates a new StandardJavaElementContentProvider . |
|
StandardJavaElementContentProvider(boolean provideMembers,
boolean provideWorkingCopy)
Deprecated. Use StandardJavaElementContentProvider(boolean) instead.
Since 3.0 compilation unit children are always provided as working copies. The Java Model
does not support the 'original' mode anymore. |
Method Summary | |
---|---|
protected static Object[] |
concatenate(Object[] a1,
Object[] a2)
Utility method to concatenate two arrays. |
void |
dispose()
|
protected boolean |
exists(Object element)
Note: This method is for internal use only. |
Object[] |
getChildren(Object element)
|
Object[] |
getElements(Object parent)
|
protected Object[] |
getFolderContent(IFolder folder)
Evaluates all children of a given IFolder . |
protected Object[] |
getJavaProjects(IJavaModel jm)
Evaluates all Java projects of a given IJavaModel . |
protected Object[] |
getPackageContent(IPackageFragment fragment)
Evaluates all children of a given IPackageFragment . |
protected Object[] |
getPackageFragmentRootContent(IPackageFragmentRoot root)
Evaluates all children of a given IPackageFragmentRoot . |
protected Object[] |
getPackageFragmentRoots(IJavaProject project)
Evaluates all children of a given IJavaProject . |
Object |
getParent(Object element)
|
boolean |
getProvideMembers()
Returns whether members are provided when asking for a compilation units or class file for its children. |
boolean |
getProvideWorkingCopy()
Deprecated. Since 3.0 compilation unit children are always provided as working copies. The Java model does not support the 'original' mode anymore. |
boolean |
hasChildren(Object element)
|
void |
inputChanged(Viewer viewer,
Object oldInput,
Object newInput)
|
protected Object |
internalGetParent(Object element)
Note: This method is for internal use only. |
protected boolean |
isClassPathChange(IJavaElementDelta delta)
Tests if the a Java element delta contains a class path change |
protected boolean |
isPackageFragmentEmpty(IJavaElement element)
Tests if the given element is a empty package fragment. |
protected boolean |
isProjectPackageFragmentRoot(IPackageFragmentRoot root)
Tests if the package fragment root is located on the project. |
boolean |
providesWorkingCopies()
Returns true if the content provider returns working
copy elements; otherwise false is returned. |
void |
setProvideMembers(boolean b)
Sets whether the content provider is supposed to return members when asking a compilation unit or class file for its children. |
void |
setProvideWorkingCopy(boolean b)
Deprecated. Since 3.0 compilation unit children are always provided from the working copy. The Java model offers a unified world and does not support the 'original' mode anymore. |
protected Object |
skipProjectPackageFragmentRoot(IPackageFragmentRoot root)
Note: This method is for internal use only. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Object[] NO_CHILDREN
protected boolean fProvideMembers
protected boolean fProvideWorkingCopy
Constructor Detail |
---|
public StandardJavaElementContentProvider()
public StandardJavaElementContentProvider(boolean provideMembers, boolean provideWorkingCopy)
StandardJavaElementContentProvider(boolean)
instead.
Since 3.0 compilation unit children are always provided as working copies. The Java Model
does not support the 'original' mode anymore.
provideMembers
- if true
members below compilation unitsprovideWorkingCopy
- if true
working copies are providedpublic StandardJavaElementContentProvider(boolean provideMembers)
StandardJavaElementContentProvider
.
provideMembers
- if true
members below compilation units
and class files are provided.Method Detail |
---|
public boolean getProvideMembers()
true
if the content provider provides members;
otherwise false
is returnedpublic void setProvideMembers(boolean b)
b
- if true
then members are provided.
If false
compilation units and class files are the
leaves provided by this content provider.public boolean getProvideWorkingCopy()
true
if working copies are providedpublic void setProvideWorkingCopy(boolean b)
b
- specifies if working copies should be providedpublic boolean providesWorkingCopies()
IWorkingCopyProvider
true
if the content provider returns working
copy elements; otherwise false
is returned.
providesWorkingCopies
in interface IWorkingCopyProvider
public Object[] getElements(Object parent)
getElements
in interface IStructuredContentProvider
getElements
in interface ITreeContentProvider
public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
inputChanged
in interface IContentProvider
public void dispose()
dispose
in interface IContentProvider
public Object[] getChildren(Object element)
getChildren
in interface ITreeContentProvider
public boolean hasChildren(Object element)
hasChildren
in interface ITreeContentProvider
public Object getParent(Object element)
getParent
in interface ITreeContentProvider
protected Object[] getPackageFragmentRootContent(IPackageFragmentRoot root) throws JavaModelException
IPackageFragmentRoot
. Clients can override this method.
root
- The root to evaluate the children for.
JavaModelException
- if the package fragment root does not exist or if an
exception occurs while accessing its corresponding resourceprotected Object[] getPackageFragmentRoots(IJavaProject project) throws JavaModelException
IJavaProject
. Clients can override this method.
project
- The Java project to evaluate the children for.
JavaModelException
- if the Java project does not exist or if an
exception occurs while accessing its corresponding resourceprotected Object[] getJavaProjects(IJavaModel jm) throws JavaModelException
IJavaModel
. Clients can override this method.
jm
- the Java model
JavaModelException
- thrown if accessing the model failedprotected Object[] getPackageContent(IPackageFragment fragment) throws JavaModelException
IPackageFragment
. Clients can override this method.
fragment
- The fragment to evaluate the children for.
JavaModelException
- if the package fragment does not exist or if an
exception occurs while accessing its corresponding resourceprotected Object[] getFolderContent(IFolder folder) throws CoreException
IFolder
. Clients can override this method.
folder
- The folder to evaluate the children for.
CoreException
- if the folder does not exist.protected boolean isClassPathChange(IJavaElementDelta delta)
delta
- the Java element delta
true
if the delta contains a class path changeprotected Object skipProjectPackageFragmentRoot(IPackageFragmentRoot root)
root
- the package fragment root
protected boolean isPackageFragmentEmpty(IJavaElement element) throws JavaModelException
element
- the element to test
true
if the package fragment is empty
JavaModelException
- thrown if accessing the element failedprotected boolean isProjectPackageFragmentRoot(IPackageFragmentRoot root)
root
- the package fragment root
true
if the package fragment root is the located on the projectprotected boolean exists(Object element)
element
- the element to test
true
if the element existsprotected Object internalGetParent(Object element)
element
- the element
protected static Object[] concatenate(Object[] a1, Object[] a2)
a1
- the first arraya2
- the second array
|
Eclipse JDT Release 3.8 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) 2000, 2013 IBM Corporation and others. All rights reserved.