|
Eclipse JDT Release 3.7 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jdt.ui.JavaElementLabels
public class JavaElementLabels
JavaElementLabels
provides helper methods to render names of Java elements.
Field Summary | |
---|---|
static long |
ALL_CATEGORY
Show category for all elements. |
static long |
ALL_DEFAULT
Default options (M_PARAMETER_TYPES, M_APP_TYPE_PARAMETERS & T_TYPE_PARAMETERS enabled) |
static long |
ALL_FULLY_QUALIFIED
Qualify all elements |
static long |
ALL_POST_QUALIFIED
Post qualify all elements |
static long |
APPEND_ROOT_PATH
Add root path to all elements except Package Fragment Roots and Java projects. |
static String |
CATEGORY_SEPARATOR_STRING
User-readable string for concatenating categories (e.g. " "). |
static long |
CF_POST_QUALIFIED
Class file names are post qualified. |
static long |
CF_QUALIFIED
Class file names are fully qualified. |
static long |
COLORIZE
Specifies to apply color styles to labels. |
static String |
COMMA_STRING
User-readable string for separating list items (e.g. ", "). |
static String |
CONCAT_STRING
User-readable string for separating post qualified names (e.g. " - "). |
static long |
CU_POST_QUALIFIED
Compilation unit names are post qualified. |
static long |
CU_QUALIFIED
Compilation unit names are fully qualified. |
static long |
D_POST_QUALIFIED
Declarations (import container / declaration, package declaration) are post qualified. |
static long |
D_QUALIFIED
Declarations (import container / declaration, package declaration) are qualified. |
static String |
DECL_STRING
User-readable string for separating the return type (e.g. " : "). |
static String |
DEFAULT_PACKAGE
User-readable string for the default package name (e.g. |
static long |
DEFAULT_POST_QUALIFIED
Default post qualify options (All except Root and Package) |
static long |
DEFAULT_QUALIFIED
Default qualify options (All except Root and Package) |
static String |
ELLIPSIS_STRING
User-readable string for ellipsis ("..."). |
static long |
F_APP_TYPE_SIGNATURE
Field names contain the declared type (appended) e.g. |
static long |
F_CATEGORY
Prepend first category (if any) to field. |
static long |
F_FULLY_QUALIFIED
Fields names are fully qualified. |
static long |
F_POST_QUALIFIED
Fields names are post qualified. |
static long |
F_PRE_TYPE_SIGNATURE
Field names contain the declared type (prepended) e.g. |
static long |
I_FULLY_QUALIFIED
Initializer names are fully qualified. |
static long |
I_POST_QUALIFIED
Type names are post qualified. |
static long |
M_APP_RETURNTYPE
Method names contain return type (appended) e.g. |
static long |
M_APP_TYPE_PARAMETERS
Method names contain type parameters appended. |
static long |
M_CATEGORY
Prepend first category (if any) to method. |
static long |
M_EXCEPTIONS
Method names contain thrown exceptions. |
static long |
M_FULLY_QUALIFIED
Method names are fully qualified. |
static long |
M_PARAMETER_NAMES
Method names contain parameter names. |
static long |
M_PARAMETER_TYPES
Method names contain parameter types. |
static long |
M_POST_QUALIFIED
Method names are post qualified. |
static long |
M_PRE_RETURNTYPE
Method names contain return type (appended) e.g. |
static long |
M_PRE_TYPE_PARAMETERS
Method names contain type parameters prepended. |
static long |
P_COMPRESSED
Package names are abbreviated if PreferenceConstants.APPEARANCE_ABBREVIATE_PACKAGE_NAMES is true and/or
compressed if PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES is
true . |
static long |
P_POST_QUALIFIED
Package names are post qualified. |
static long |
P_QUALIFIED
Package names are qualified. |
static long |
PREPEND_ROOT_PATH
Add root path to all elements except Package Fragment Roots and Java projects. |
static long |
REFERENCED_ROOT_POST_QUALIFIED
Post qualify referenced package fragment roots. |
static long |
ROOT_POST_QUALIFIED
Package Fragment Roots contain the project name if not an archive (appended). |
static long |
ROOT_QUALIFIED
Package Fragment Roots contain the project name if not an archive (prepended). |
static long |
ROOT_VARIABLE
Package Fragment Roots contain variable name if from a variable. |
static long |
T_CATEGORY
Prepend first category (if any) to type. |
static long |
T_CONTAINER_QUALIFIED
Type names are type container qualified. |
static long |
T_FULLY_QUALIFIED
Type names are fully qualified. |
static long |
T_POST_QUALIFIED
Type names are post qualified. |
static long |
T_TYPE_PARAMETERS
Type names contain type parameters. |
static long |
TP_POST_QUALIFIED
Type parameters are post qualified. |
static long |
USE_RESOLVED
Specifies to use the resolved information of a IType, IMethod or IField. |
Method Summary | |
---|---|
static void |
getClassFileLabel(IClassFile classFile,
long flags,
StringBuffer buf)
Appends the label for a class file to a StringBuffer . |
static void |
getClassFileLabel(IClassFile classFile,
long flags,
StyledString result)
Appends the label for a class file to a StyledString . |
static void |
getCompilationUnitLabel(ICompilationUnit cu,
long flags,
StringBuffer buf)
Appends the label for a compilation unit to a StringBuffer . |
static void |
getCompilationUnitLabel(ICompilationUnit cu,
long flags,
StyledString result)
Appends the label for a compilation unit to a StyledString . |
static String |
getContainerEntryLabel(IPath containerPath,
IJavaProject project)
Returns the label of a classpath container. |
static void |
getDeclarationLabel(IJavaElement declaration,
long flags,
StringBuffer buf)
Appends the label for a import container, import or package declaration to a StringBuffer . |
static void |
getDeclarationLabel(IJavaElement declaration,
long flags,
StyledString result)
Appends the label for a import container, import or package declaration to a StyledString . |
static String |
getElementLabel(IJavaElement element,
long flags)
Returns the label for a Java element with the flags as defined by this class. |
static void |
getElementLabel(IJavaElement element,
long flags,
StringBuffer buf)
Returns the label for a Java element with the flags as defined by this class. |
static void |
getElementLabel(IJavaElement element,
long flags,
StyledString result)
Returns the styled label for a Java element with the flags as defined by this class. |
static void |
getFieldLabel(IField field,
long flags,
StringBuffer buf)
Appends the label for a field to a StringBuffer . |
static void |
getFieldLabel(IField field,
long flags,
StyledString result)
Appends the style label for a field to a StyledString . |
static void |
getInitializerLabel(IInitializer initializer,
long flags,
StringBuffer buf)
Appends the label for a initializer to a StringBuffer . |
static void |
getInitializerLabel(IInitializer initializer,
long flags,
StyledString result)
Appends the label for a initializer to a StyledString . |
static void |
getLocalVariableLabel(ILocalVariable localVariable,
long flags,
StringBuffer buf)
Appends the label for a local variable to a StringBuffer . |
static void |
getLocalVariableLabel(ILocalVariable localVariable,
long flags,
StyledString result)
Appends the styled label for a local variable to a StyledString . |
static void |
getMethodLabel(IMethod method,
long flags,
StringBuffer buf)
Appends the label for a method to a StringBuffer . |
static void |
getMethodLabel(IMethod method,
long flags,
StyledString result)
Appends the label for a method to a StyledString . |
static void |
getPackageFragmentLabel(IPackageFragment pack,
long flags,
StringBuffer buf)
Appends the label for a package fragment to a StringBuffer . |
static void |
getPackageFragmentLabel(IPackageFragment pack,
long flags,
StyledString result)
Appends the label for a package fragment to a StyledString . |
static void |
getPackageFragmentRootLabel(IPackageFragmentRoot root,
long flags,
StringBuffer buf)
Appends the label for a package fragment root to a StringBuffer . |
static void |
getPackageFragmentRootLabel(IPackageFragmentRoot root,
long flags,
StyledString result)
Appends the label for a package fragment root to a StyledString . |
static StyledString |
getStyledContainerEntryLabel(IPath containerPath,
IJavaProject project)
Returns the styled label of a classpath container. |
static StyledString |
getStyledElementLabel(IJavaElement element,
long flags)
Returns the styled label for a Java element with the flags as defined by this class. |
static StyledString |
getStyledTextLabel(Object obj,
long flags)
Returns the styled label of the given object. |
static String |
getTextLabel(Object obj,
long flags)
Returns the label of the given object. |
static void |
getTypeLabel(IType type,
long flags,
StringBuffer buf)
Appends the label for a type to a StringBuffer . |
static void |
getTypeLabel(IType type,
long flags,
StyledString result)
Appends the label for a type to a StyledString . |
static void |
getTypeParameterLabel(ITypeParameter typeParameter,
long flags,
StringBuffer buf)
Appends the label for a type parameter to a StringBuffer . |
static void |
getTypeParameterLabel(ITypeParameter typeParameter,
long flags,
StyledString result)
Appends the label for a type parameter to a StyledString . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long M_PARAMETER_TYPES
foo(int)
public static final long M_PARAMETER_NAMES
foo(index)
public static final long M_PRE_TYPE_PARAMETERS
<A> foo(A index)
public static final long M_APP_TYPE_PARAMETERS
foo(A index) <A>
public static final long M_EXCEPTIONS
foo throws IOException
public static final long M_APP_RETURNTYPE
foo : int
public static final long M_PRE_RETURNTYPE
int foo
public static final long M_FULLY_QUALIFIED
java.util.Vector.size
public static final long M_POST_QUALIFIED
size - java.util.Vector
public static final long I_FULLY_QUALIFIED
java.util.Vector.{ ... }
public static final long I_POST_QUALIFIED
{ ... } - java.util.Map
public static final long F_APP_TYPE_SIGNATURE
fHello : int
public static final long F_PRE_TYPE_SIGNATURE
int fHello
public static final long F_FULLY_QUALIFIED
java.lang.System.out
public static final long F_POST_QUALIFIED
out - java.lang.System
public static final long T_FULLY_QUALIFIED
java.util.Map.Entry
public static final long T_CONTAINER_QUALIFIED
Map.Entry
public static final long T_POST_QUALIFIED
Entry - java.util.Map
public static final long T_TYPE_PARAMETERS
Map<S, T>
public static final long TP_POST_QUALIFIED
K - java.util.Map.Entry
public static final long D_QUALIFIED
java.util.Vector.class/import container
public static final long D_POST_QUALIFIED
import container - java.util.Vector.class
public static final long CF_QUALIFIED
java.util.Vector.class
public static final long CF_POST_QUALIFIED
Vector.class - java.util
public static final long CU_QUALIFIED
java.util.Vector.java
public static final long CU_POST_QUALIFIED
Vector.java - java.util
public static final long P_QUALIFIED
MyProject/src/java.util
public static final long P_POST_QUALIFIED
java.util - MyProject/src
public static final long P_COMPRESSED
PreferenceConstants.APPEARANCE_ABBREVIATE_PACKAGE_NAMES
is true
and/or
compressed if PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES
is
true
.
public static final long ROOT_VARIABLE
JRE_LIB - c:\java\lib\rt.jar
public static final long ROOT_QUALIFIED
MyProject/src
public static final long ROOT_POST_QUALIFIED
src - MyProject
public static final long APPEND_ROOT_PATH
java.lang.Vector - C:\java\lib\rt.jar
Option only applies to getElementLabel
public static final long PREPEND_ROOT_PATH
C:\java\lib\rt.jar - java.lang.Vector
Option only applies to getElementLabel
public static final long REFERENCED_ROOT_POST_QUALIFIED
jdt.jar - org.eclipse.jdt.ui
if the jar is referenced
from another project.
public static final long USE_RESOLVED
IType.isResolved()
.
If resolved information is available, types will be rendered with type parameters of the instantiated type.
Resolved methods render with the parameter types of the method instance.
Vector<String>.get(String)
public static final long COLORIZE
StyledString
.
public static final long F_CATEGORY
public static final long M_CATEGORY
public static final long T_CATEGORY
public static final long ALL_CATEGORY
public static final long ALL_FULLY_QUALIFIED
public static final long ALL_POST_QUALIFIED
public static final long ALL_DEFAULT
public static final long DEFAULT_QUALIFIED
public static final long DEFAULT_POST_QUALIFIED
public static final String CONCAT_STRING
public static final String COMMA_STRING
public static final String DECL_STRING
public static final String CATEGORY_SEPARATOR_STRING
public static final String ELLIPSIS_STRING
public static final String DEFAULT_PACKAGE
Method Detail |
---|
public static String getTextLabel(Object obj, long flags)
IJavaElement
or adapt to IWorkbenchAdapter
.
If the element type is not known, the empty string is returned.
The returned label is BiDi-processed with TextProcessor.process(String, String)
.
obj
- object to get the label forflags
- the rendering flags
public static StyledString getStyledTextLabel(Object obj, long flags)
IJavaElement
or adapt to IWorkbenchAdapter
.
If the element type is not known, the empty string is returned.
The returned label is BiDi-processed with TextProcessor.process(String, String)
.
obj
- object to get the label forflags
- the rendering flags
public static String getElementLabel(IJavaElement element, long flags)
element
- the element to renderflags
- the rendering flags
public static StyledString getStyledElementLabel(IJavaElement element, long flags)
element
- the element to renderflags
- the rendering flags
public static void getElementLabel(IJavaElement element, long flags, StringBuffer buf)
element
- the element to renderflags
- the rendering flagsbuf
- the buffer to append the resulting label topublic static void getElementLabel(IJavaElement element, long flags, StyledString result)
element
- the element to renderflags
- the rendering flagsresult
- the buffer to append the resulting label topublic static void getMethodLabel(IMethod method, long flags, StringBuffer buf)
StringBuffer
. Considers the M_* flags.
method
- the element to renderflags
- the rendering flags. Flags with names starting with 'M_' are considered.buf
- the buffer to append the resulting label topublic static void getMethodLabel(IMethod method, long flags, StyledString result)
StyledString
. Considers the M_* flags.
method
- the element to renderflags
- the rendering flags. Flags with names starting with 'M_' are considered.result
- the buffer to append the resulting label topublic static void getFieldLabel(IField field, long flags, StringBuffer buf)
StringBuffer
. Considers the F_* flags.
field
- the element to renderflags
- the rendering flags. Flags with names starting with 'F_' are considered.buf
- the buffer to append the resulting label topublic static void getFieldLabel(IField field, long flags, StyledString result)
StyledString
. Considers the F_* flags.
field
- the element to renderflags
- the rendering flags. Flags with names starting with 'F_' are considered.result
- the buffer to append the resulting label topublic static void getLocalVariableLabel(ILocalVariable localVariable, long flags, StringBuffer buf)
StringBuffer
.
localVariable
- the element to renderflags
- the rendering flags. Flags with names starting with 'F_' are considered.buf
- the buffer to append the resulting label topublic static void getLocalVariableLabel(ILocalVariable localVariable, long flags, StyledString result)
StyledString
.
localVariable
- the element to renderflags
- the rendering flags. Flags with names starting with 'F_' are considered.result
- the buffer to append the resulting label topublic static void getInitializerLabel(IInitializer initializer, long flags, StringBuffer buf)
StringBuffer
. Considers the I_* flags.
initializer
- the element to renderflags
- the rendering flags. Flags with names starting with 'I_' are considered.buf
- the buffer to append the resulting label topublic static void getInitializerLabel(IInitializer initializer, long flags, StyledString result)
StyledString
. Considers the I_* flags.
initializer
- the element to renderflags
- the rendering flags. Flags with names starting with 'I_' are considered.result
- the buffer to append the resulting label topublic static void getTypeLabel(IType type, long flags, StringBuffer buf)
StringBuffer
. Considers the T_* flags.
type
- the element to renderflags
- the rendering flags. Flags with names starting with 'T_' are considered.buf
- the buffer to append the resulting label topublic static void getTypeLabel(IType type, long flags, StyledString result)
StyledString
. Considers the T_* flags.
type
- the element to renderflags
- the rendering flags. Flags with names starting with 'T_' are considered.result
- the buffer to append the resulting label topublic static void getTypeParameterLabel(ITypeParameter typeParameter, long flags, StringBuffer buf)
StringBuffer
. Considers the TP_* flags.
typeParameter
- the element to renderflags
- the rendering flags. Flags with names starting with 'TP_' are considered.buf
- the buffer to append the resulting label topublic static void getTypeParameterLabel(ITypeParameter typeParameter, long flags, StyledString result)
StyledString
. Considers the TP_* flags.
typeParameter
- the element to renderflags
- the rendering flags. Flags with names starting with 'TP_' are considered.result
- the buffer to append the resulting label topublic static void getDeclarationLabel(IJavaElement declaration, long flags, StringBuffer buf)
StringBuffer
. Considers the D_* flags.
declaration
- the element to renderflags
- the rendering flags. Flags with names starting with 'D_' are considered.buf
- the buffer to append the resulting label topublic static void getDeclarationLabel(IJavaElement declaration, long flags, StyledString result)
StyledString
. Considers the D_* flags.
declaration
- the element to renderflags
- the rendering flags. Flags with names starting with 'D_' are considered.result
- the buffer to append the resulting label topublic static void getClassFileLabel(IClassFile classFile, long flags, StringBuffer buf)
StringBuffer
. Considers the CF_* flags.
classFile
- the element to renderflags
- the rendering flags. Flags with names starting with 'CF_' are considered.buf
- the buffer to append the resulting label topublic static void getClassFileLabel(IClassFile classFile, long flags, StyledString result)
StyledString
. Considers the CF_* flags.
classFile
- the element to renderflags
- the rendering flags. Flags with names starting with 'CF_' are considered.result
- the buffer to append the resulting label topublic static void getCompilationUnitLabel(ICompilationUnit cu, long flags, StringBuffer buf)
StringBuffer
. Considers the CU_* flags.
cu
- the element to renderflags
- the rendering flags. Flags with names starting with 'CU_' are considered.buf
- the buffer to append the resulting label topublic static void getCompilationUnitLabel(ICompilationUnit cu, long flags, StyledString result)
StyledString
. Considers the CU_* flags.
cu
- the element to renderflags
- the rendering flags. Flags with names starting with 'CU_' are considered.result
- the buffer to append the resulting label topublic static void getPackageFragmentLabel(IPackageFragment pack, long flags, StringBuffer buf)
StringBuffer
. Considers the P_* flags.
pack
- the element to renderflags
- the rendering flags. Flags with names starting with P_' are considered.buf
- the buffer to append the resulting label topublic static void getPackageFragmentLabel(IPackageFragment pack, long flags, StyledString result)
StyledString
. Considers the P_* flags.
pack
- the element to renderflags
- the rendering flags. Flags with names starting with P_' are considered.result
- the buffer to append the resulting label topublic static void getPackageFragmentRootLabel(IPackageFragmentRoot root, long flags, StringBuffer buf)
StringBuffer
. Considers the ROOT_* flags.
root
- the element to renderflags
- the rendering flags. Flags with names starting with ROOT_' are considered.buf
- the buffer to append the resulting label topublic static void getPackageFragmentRootLabel(IPackageFragmentRoot root, long flags, StyledString result)
StyledString
. Considers the ROOT_* flags.
root
- the element to renderflags
- the rendering flags. Flags with names starting with ROOT_' are considered.result
- the buffer to append the resulting label topublic static String getContainerEntryLabel(IPath containerPath, IJavaProject project) throws JavaModelException
TextProcessor.process(String, String)
.
containerPath
- the path of the containerproject
- the project the container is resolved in
JavaModelException
- when resolving of the container failedpublic static StyledString getStyledContainerEntryLabel(IPath containerPath, IJavaProject project)
TextProcessor.process(String, String)
.
containerPath
- the path of the containerproject
- the project the container is resolved in
|
Eclipse JDT Release 3.7 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) 2000, 2011 IBM Corporation and others. All rights reserved.