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
Answertopia.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 ISourceReference

All Known Subinterfaces:
IAnnotation, IClassFile, ICompilationUnit, IField, IImportContainer, IImportDeclaration, IInitializer, ILocalVariable, IMember, IMethod, IPackageDeclaration, IType, ITypeParameter, ITypeRoot

public interface ISourceReference

Common protocol for Java elements that have associated source code. This set consists of IClassFile, ICompilationUnit, IPackageDeclaration, IImportDeclaration, IImportContainer, IType, IField, IMethod, IInitializer, ITypeParameter, ILocalVariable, and IAnnotation.

Note: For IClassFile, IType and other members derived from a binary type, the implementation returns source iff the element has attached source code.

Source reference elements may be working copies if they were created from a compilation unit that is a working copy.

See Also:
IPackageFragmentRoot.attachSource(org.eclipse.core.runtime.IPath, org.eclipse.core.runtime.IPath, org.eclipse.core.runtime.IProgressMonitor)
Restriction:
This interface is not intended to be implemented by clients.

Method Summary
 boolean exists ()
          Returns whether this element exists in the model.
  String getSource ()
          Returns the source code associated with this element.
  ISourceRange getSourceRange ()
          Returns the source range associated with this element.
 

Method Detail

exists

boolean exists()
Returns whether this element exists in the model.

Returns:
true if this element exists in the Java model
Since:
2.0

getSource


String getSource()
                 throws 
JavaModelException
Returns the source code associated with this element. This extracts the substring from the source buffer containing this source element. This corresponds to the source range that would be returned by getSourceRange.

For class files, this returns the source of the entire compilation unit associated with the class file (if there is one).

Returns:
the source code, or null if this element has no associated source code
Throws:
JavaModelException - if an exception occurs while accessing its corresponding resource

getSourceRange


ISourceRange getSourceRange()
                            throws 
JavaModelException
Returns the source range associated with this element.

For class files, this returns the range of the entire compilation unit associated with the class file (if there is one).

If this element has no associated source code null is either returned, or a source range with a -1 offset and a 0 length.

Returns:
the source range, or either null or [-1, 0] if this element has no associated source code
Throws:
JavaModelException - if an exception occurs while accessing its corresponding resource

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