public void appendElementLabel(IJavaElement element,long flags){
  int type=element.getElementType();
  IPackageFragmentRoot root=null;
  if (type != IJavaElement.JAVA_MODEL && type != IJavaElement.JAVA_PROJECT && type != IJavaElement.PACKAGE_FRAGMENT_ROOT)   root=JavaModelUtil.getPackageFragmentRoot(element);
  if (root != null && getFlag(flags,JavaElementLabels.PREPEND_ROOT_PATH)) {
    appendPackageFragmentRootLabel(root,JavaElementLabels.ROOT_QUALIFIED);
    fBuffer.append(JavaElementLabels.CONCAT_STRING);
  }
switch (type) {
case IJavaElement.METHOD:
    appendMethodLabel((IMethod)element,flags);
  break;
case IJavaElement.FIELD:
appendFieldLabel((IField)element,flags);
break;
case IJavaElement.LOCAL_VARIABLE:
appendLocalVariableLabel((ILocalVariable)element,flags);
break;
case IJavaElement.TYPE_PARAMETER:
appendTypeParameterLabel((ITypeParameter)element,flags);
break;
case IJavaElement.INITIALIZER:
appendInitializerLabel((IInitializer)element,flags);
break;
case IJavaElement.TYPE:
appendTypeLabel((IType)element,flags);
break;
case IJavaElement.CLASS_FILE:
appendClassFileLabel((IClassFile)element,flags);
break;
case IJavaElement.COMPILATION_UNIT:
appendCompilationUnitLabel((ICompilationUnit)element,flags);
break;
case IJavaElement.PACKAGE_FRAGMENT:
appendPackageFragmentLabel((IPackageFragment)element,flags);
break;
case IJavaElement.PACKAGE_FRAGMENT_ROOT:
appendPackageFragmentRootLabel((IPackageFragmentRoot)element,flags);
break;
case IJavaElement.IMPORT_CONTAINER:
case IJavaElement.IMPORT_DECLARATION:
case IJavaElement.PACKAGE_DECLARATION:
appendDeclarationLabel(element,flags);
break;
case IJavaElement.JAVA_PROJECT:
case IJavaElement.JAVA_MODEL:
fBuffer.append(element.getElementName());
break;
default :
fBuffer.append(element.getElementName());
}
if (root != null && getFlag(flags,JavaElementLabels.APPEND_ROOT_PATH)) {
int offset=fBuffer.length();
fBuffer.append(JavaElementLabels.CONCAT_STRING);
appendPackageFragmentRootLabel(root,JavaElementLabels.ROOT_QUALIFIED);
}
}

public void appendElementLabel ( IJavaElement element , long flags ) { int type = element . getElementType ( ) ; IPackageFragmentRoot root = null ; if ( type != IJavaElement . JAVA_MODEL && type != IJavaElement . JAVA_PROJECT && type != IJavaElement . PACKAGE_FRAGMENT_ROOT ) root = JavaModelUtil . getPackageFragmentRoot ( element ) ; if ( root != null && getFlag ( flags , JavaElementLabels . PREPEND_ROOT_PATH ) ) { appendPackageFragmentRootLabel ( root , JavaElementLabels . ROOT_QUALIFIED ) ; fBuffer . append ( JavaElementLabels . CONCAT_STRING ) ; } switch ( type ) { case IJavaElement . METHOD : appendMethodLabel ( ( IMethod ) element , flags ) ; break ; case IJavaElement . FIELD : appendFieldLabel ( ( IField ) element , flags ) ; break ; case IJavaElement . LOCAL_VARIABLE : appendLocalVariableLabel ( ( ILocalVariable ) element , flags ) ; break ; case IJavaElement . TYPE_PARAMETER : appendTypeParameterLabel ( ( ITypeParameter ) element , flags ) ; break ; case IJavaElement . INITIALIZER : appendInitializerLabel ( ( IInitializer ) element , flags ) ; break ; case IJavaElement . TYPE : appendTypeLabel ( ( IType ) element , flags ) ; break ; case IJavaElement . CLASS_FILE : appendClassFileLabel ( ( IClassFile ) element , flags ) ; break ; case IJavaElement . COMPILATION_UNIT : appendCompilationUnitLabel ( ( ICompilationUnit ) element , flags ) ; break ; case IJavaElement . PACKAGE_FRAGMENT : appendPackageFragmentLabel ( ( IPackageFragment ) element , flags ) ; break ; case IJavaElement . PACKAGE_FRAGMENT_ROOT : appendPackageFragmentRootLabel ( ( IPackageFragmentRoot ) element , flags ) ; break ; case IJavaElement . IMPORT_CONTAINER : case IJavaElement . IMPORT_DECLARATION : case IJavaElement . PACKAGE_DECLARATION : appendDeclarationLabel ( element , flags ) ; break ; case IJavaElement . JAVA_PROJECT : case IJavaElement . JAVA_MODEL : fBuffer . append ( element . getElementName ( ) ) ; break ; default : fBuffer . append ( element . getElementName ( ) ) ; } if ( root != null && getFlag ( flags , JavaElementLabels . APPEND_ROOT_PATH ) ) { int offset = fBuffer . length ( ) ; fBuffer . append ( JavaElementLabels . CONCAT_STRING ) ; appendPackageFragmentRootLabel ( root , JavaElementLabels . ROOT_QUALIFIED ) ; } }
appends the label for a java element with the flags as defined by this class .
