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.core
Interface ITypeRoot

All Superinterfaces:
IAdaptable, ICodeAssist, IJavaElement, IOpenable, IParent, ISourceReference
All Known Subinterfaces:
IClassFile, ICompilationUnit

public interface ITypeRoot
extends IJavaElement, IParent, IOpenable, ISourceReference, ICodeAssist

Represents an entire Java type root (either an ICompilationUnit or an IClassFile).

Since:
3.3
See Also:
Note that methods {@link #findPrimaryType()} and {@link #getElementAt(int)} were already implemented in this interface respectively since version 3.0 and version 1.0., Note that method {@link #getWorkingCopy(WorkingCopyOwner, IProgressMonitor)} was already implemented in this interface since version 3.0.
Restriction:
This interface is not intended to be implemented by clients.

Field Summary
 
Fields inherited from interface org.eclipse.jdt.core. IJavaElement
ANNOTATION, CLASS_FILE, COMPILATION_UNIT, FIELD, IMPORT_CONTAINER, IMPORT_DECLARATION, INITIALIZER, JAVA_MODEL, JAVA_PROJECT, LOCAL_VARIABLE, METHOD, PACKAGE_DECLARATION, PACKAGE_FRAGMENT, PACKAGE_FRAGMENT_ROOT, TYPE, TYPE_PARAMETER
 
Method Summary
  IType findPrimaryType ()
          Finds the primary type of this Java type root (that is, the type with the same name as the compilation unit, or the type of a class file), or null if no such a type exists.
  IJavaElement getElementAt (int position)
          Returns the smallest element within this Java type root that includes the given source position (that is, a method, field, etc.), or null if there is no element other than the Java type root itself at the given position, or if the given position is not within the source range of the source of this Java type root.
  ICompilationUnit getWorkingCopy ( WorkingCopyOwner owner, IProgressMonitor monitor)
          Returns a shared working copy on this compilation unit or class file using the given working copy owner to create the buffer.
 
Methods inherited from interface org.eclipse.jdt.core. IJavaElement
exists, getAncestor, getAttachedJavadoc, getCorrespondingResource, getElementName, getElementType, getHandleIdentifier, getJavaModel, getJavaProject, getOpenable, getParent, getPath, getPrimaryElement, getResource, getSchedulingRule, getUnderlyingResource, isReadOnly, isStructureKnown
 
Methods inherited from interface org.eclipse.core.runtime. IAdaptable
getAdapter
 
Methods inherited from interface org.eclipse.jdt.core. IParent
getChildren, hasChildren
 
Methods inherited from interface org.eclipse.jdt.core. IOpenable
close, findRecommendedLineSeparator, getBuffer, hasUnsavedChanges, isConsistent, isOpen, makeConsistent, open, save
 
Methods inherited from interface org.eclipse.jdt.core. ISourceReference
exists, getSource, getSourceRange
 
Methods inherited from interface org.eclipse.jdt.core. ICodeAssist
codeComplete, codeComplete, codeComplete, codeComplete, codeComplete, codeComplete, codeComplete, codeSelect, codeSelect
 

Method Detail

findPrimaryType

IType findPrimaryType()
Finds the primary type of this Java type root (that is, the type with the same name as the compilation unit, or the type of a class file), or null if no such a type exists.

Returns:
the found primary type of this Java type root, or null if no such a type exists

getElementAt

IJavaElement getElementAt(int position)
                          throws 
JavaModelException
Returns the smallest element within this Java type root that includes the given source position (that is, a method, field, etc.), or null if there is no element other than the Java type root itself at the given position, or if the given position is not within the source range of the source of this Java type root.

Parameters:
position - a source position inside the Java type root
Returns:
the innermost Java element enclosing a given source position or null if none (excluding the Java type root).
Throws:
JavaModelException - if the Java type root does not exist or if an exception occurs while accessing its corresponding resource

getWorkingCopy

ICompilationUnit getWorkingCopy(
WorkingCopyOwner owner,
                                
IProgressMonitor monitor)
                                throws 
JavaModelException
Returns a shared working copy on this compilation unit or class file using the given working copy owner to create the buffer. If this is already a working copy of the given owner, the element itself is returned. This API can only answer an already existing working copy if it is based on the same original Java type root AND was using the same working copy owner (that is, as defined by Object.equals(java.lang.Object) ).

The life time of a shared working copy is as follows:

So users of this method must discard exactly once the working copy.

Note that the working copy owner will be used for the life time of the shared working copy, that is if the working copy is closed then reopened, this owner will be used. The buffer will be automatically initialized with the original's Java type root content upon creation.

When the shared working copy instance is created, an ADDED IJavaElementDelta is reported on this working copy.

A working copy can be created on a not-yet existing compilation unit. In particular, such a working copy can then be committed in order to create the corresponding compilation unit.

Note that possible problems of this working copy are reported using this method only if the given working copy owner returns a problem requestor for this working copy (see WorkingCopyOwner.getProblemRequestor(ICompilationUnit)).

Parameters:
owner - the working copy owner that creates a buffer that is used to get the content of the working copy
monitor - a progress monitor used to report progress while opening this compilation unit or null if no progress should be reported
Returns:
a new working copy of this Java type root using the given owner to create the buffer, or this Java type root if it is already a working copy
Throws:
JavaModelException - if the contents of this element can not be determined.

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