Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse JDT
Release 3.5

org.eclipse.jdt.ui
Class StandardJavaElementContentProvider

java.lang.Object
  extended by 
org.eclipse.jdt.ui.StandardJavaElementContentProvider
All Implemented Interfaces:
IWorkingCopyProvider, IContentProvider, IStructuredContentProvider, ITreeContentProvider
Direct Known Subclasses:
JavaElementContentProvider

public class StandardJavaElementContentProvider
extends Object
implements ITreeContentProvider, IWorkingCopyProvider

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.

Since:
2.0

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

NO_CHILDREN

protected static final 
Object[] NO_CHILDREN

fProvideMembers

protected boolean fProvideMembers

fProvideWorkingCopy

protected boolean fProvideWorkingCopy
Constructor Detail

StandardJavaElementContentProvider

public StandardJavaElementContentProvider()
Creates a new content provider. The content provider does not provide members of compilation units or class files.


StandardJavaElementContentProvider

public 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.

Parameters:
provideMembers - if true members below compilation units
provideWorkingCopy - if true working copies are provided

StandardJavaElementContentProvider

public StandardJavaElementContentProvider(boolean provideMembers)
Creates a new StandardJavaElementContentProvider.

Parameters:
provideMembers - if true members below compilation units and class files are provided.
Method Detail

getProvideMembers

public boolean getProvideMembers()
Returns whether members are provided when asking for a compilation units or class file for its children.

Returns:
true if the content provider provides members; otherwise false is returned

setProvideMembers

public 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.

Parameters:
b - if true then members are provided. If false compilation units and class files are the leaves provided by this content provider.

getProvideWorkingCopy

public 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.

Returns:
returns true if working copies are provided

setProvideWorkingCopy

public 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.

Parameters:
b - specifies if working copies should be provided

providesWorkingCopies

public boolean providesWorkingCopies()
Description copied from interface: IWorkingCopyProvider
Returns true if the content provider returns working copy elements; otherwise false is returned.

Specified by:
providesWorkingCopies in interface IWorkingCopyProvider
Returns:
whether working copy elements are provided.

getElements

public 
Object[] getElements(
Object parent)
Specified by:
getElements in interface IStructuredContentProvider

inputChanged

public void inputChanged(
Viewer viewer,
                         
Object oldInput,
                         
Object newInput)
Specified by:
inputChanged in interface IContentProvider

dispose

public void dispose()
Specified by:
dispose in interface IContentProvider

getChildren

public 
Object[] getChildren(
Object element)
Specified by:
getChildren in interface ITreeContentProvider

hasChildren

public boolean hasChildren(
Object element)
Specified by:
hasChildren in interface ITreeContentProvider

getParent

public 
Object getParent(
Object element)
Specified by:
getParent in interface ITreeContentProvider

getPackageFragmentRootContent

protected 
Object[] getPackageFragmentRootContent(
IPackageFragmentRoot root)
                                          throws 
JavaModelException
Evaluates all children of a given IPackageFragmentRoot. Clients can override this method.

Parameters:
root - The root to evaluate the children for.
Returns:
The children of the root
Throws:
JavaModelException - if the package fragment root does not exist or if an exception occurs while accessing its corresponding resource
Since:
3.3

getPackageFragmentRoots

protected 
Object[] getPackageFragmentRoots(
IJavaProject project)
                                    throws 
JavaModelException
Evaluates all children of a given IJavaProject. Clients can override this method.

Parameters:
project - The Java project to evaluate the children for.
Returns:
The children of the project. Typically these are package fragment roots but can also be other elements.
Throws:
JavaModelException - if the Java project does not exist or if an exception occurs while accessing its corresponding resource

getJavaProjects

protected 
Object[] getJavaProjects(
IJavaModel jm)
                            throws 
JavaModelException
Evaluates all Java projects of a given IJavaModel. Clients can override this method.

Parameters:
jm - the Java model
Returns:
the projects
Throws:
JavaModelException - thrown if accessing the model failed

getPackageContent

protected 
Object[] getPackageContent(
IPackageFragment fragment)
                              throws 
JavaModelException
Evaluates all children of a given IPackageFragment. Clients can override this method.

Parameters:
fragment - The fragment to evaluate the children for.
Returns:
The children of the given package fragment.
Throws:
JavaModelException - if the package fragment does not exist or if an exception occurs while accessing its corresponding resource
Since:
3.3

getFolderContent

protected 
Object[] getFolderContent(
IFolder folder)
                             throws 
CoreException
Evaluates all children of a given IFolder. Clients can override this method.

Parameters:
folder - The folder to evaluate the children for.
Returns:
The children of the given folder.
Throws:
CoreException - if the folder does not exist.
Since:
3.3

isClassPathChange

protected boolean isClassPathChange(
IJavaElementDelta delta)
Tests if the a Java element delta contains a class path change

Parameters:
delta - the Java element delta
Returns:
returns true if the delta contains a class path change

skipProjectPackageFragmentRoot

protected 
Object skipProjectPackageFragmentRoot(
IPackageFragmentRoot root)
Note: This method is for internal use only. Clients should not call this method.

Parameters:
root - the package fragment root
Returns:
returns the element representing the root.
Restriction:
This method is not intended to be referenced by clients.

isPackageFragmentEmpty

protected boolean isPackageFragmentEmpty(
IJavaElement element)
                                  throws 
JavaModelException
Tests if the given element is a empty package fragment.

Parameters:
element - the element to test
Returns:
returns true if the package fragment is empty
Throws:
JavaModelException - thrown if accessing the element failed

isProjectPackageFragmentRoot

protected boolean isProjectPackageFragmentRoot(
IPackageFragmentRoot root)
Tests if the package fragment root is located on the project.

Parameters:
root - the package fragment root
Returns:
returns true if the package fragment root is the located on the project

exists

protected boolean exists(
Object element)
Note: This method is for internal use only. Clients should not call this method.

Parameters:
element - the element to test
Returns:
returns true if the element exists
Restriction:
This method is not intended to be referenced by clients.

internalGetParent

protected 
Object internalGetParent(
Object element)
Note: This method is for internal use only. Clients should not call this method.

Parameters:
element - the element
Returns:
the parent of the element
Restriction:
This method is not intended to be referenced by clients.

concatenate

protected static 
Object[] concatenate(
Object[] a1,
                                      
Object[] a2)
Utility method to concatenate two arrays.

Parameters:
a1 - the first array
a2 - the second array
Returns:
the concatenated array

Eclipse JDT
Release 3.5

Copyright (c) IBM Corp. and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire