本文整理汇总了Java中org.eclipse.jdt.ui.JavaElementLabels.getElementLabel方法的典型用法代码示例。如果您正苦于以下问题:Java JavaElementLabels.getElementLabel方法的具体用法?Java JavaElementLabels.getElementLabel怎么用?Java JavaElementLabels.getElementLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.ui.JavaElementLabels
的用法示例。
在下文中一共展示了JavaElementLabels.getElementLabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkNewElementName
import org.eclipse.jdt.ui.JavaElementLabels; //导入方法依赖的package包/类
public RefactoringStatus checkNewElementName(String newName) throws JavaModelException {
RefactoringStatus result = Checks.checkFieldName(newName, fCu);
if (!Checks.startsWithLowerCase(newName))
if (fIsComposite) {
final String nameOfParent =
JavaElementLabels.getElementLabel(
fLocalVariable.getParent(), JavaElementLabels.ALL_DEFAULT);
final String nameOfType =
JavaElementLabels.getElementLabel(
fLocalVariable.getAncestor(IJavaElement.TYPE), JavaElementLabels.ALL_DEFAULT);
result.addWarning(
Messages.format(
RefactoringCoreMessages.RenameTempRefactoring_lowercase2,
new String[] {
BasicElementLabels.getJavaElementName(newName), nameOfParent, nameOfType
}));
} else {
result.addWarning(RefactoringCoreMessages.RenameTempRefactoring_lowercase);
}
return result;
}
示例2: getDecription
import org.eclipse.jdt.ui.JavaElementLabels; //导入方法依赖的package包/类
public String getDecription(Object obj, long flags) {
if (obj instanceof TreeElement<?, ?>) {
TreeElement<?, ?> element = (TreeElement<?, ?>) obj;
Object data = element.getData();
if (data instanceof IJavaElement) {
return JavaElementLabels.getElementLabel((IJavaElement) data, flags);
}
if (data instanceof IResource) {
IJavaElement javaElt = JavaCore.create((IResource) data);
if (javaElt != null) {
return JavaElementLabels.getElementLabel(javaElt, flags);
}
}
}
return getText(obj);
}
示例3: checkInitialConditions
import org.eclipse.jdt.ui.JavaElementLabels; //导入方法依赖的package包/类
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
IType primary = (IType) fType.getPrimaryElement();
if (primary == null || !primary.exists()) {
String qualifiedTypeName =
JavaElementLabels.getElementLabel(fType, JavaElementLabels.F_FULLY_QUALIFIED);
String message =
Messages.format(
RefactoringCoreMessages.RenameTypeRefactoring_does_not_exist,
new String[] {
BasicElementLabels.getJavaElementName(qualifiedTypeName),
BasicElementLabels.getFileName(fType.getCompilationUnit())
});
return RefactoringStatus.createFatalErrorStatus(message);
}
fType = primary;
return Checks.checkIfCuBroken(fType);
}
示例4: checkPackageName
import org.eclipse.jdt.ui.JavaElementLabels; //导入方法依赖的package包/类
private RefactoringStatus checkPackageName(String newName) throws CoreException {
RefactoringStatus status = new RefactoringStatus();
IPackageFragmentRoot[] roots = fPackage.getJavaProject().getPackageFragmentRoots();
Set<String> topLevelTypeNames = getTopLevelTypeNames();
for (int i = 0; i < roots.length; i++) {
IPackageFragmentRoot root = roots[i];
if (!isPackageNameOkInRoot(newName, root)) {
String rootLabel = JavaElementLabels.getElementLabel(root, JavaElementLabels.ALL_DEFAULT);
String newPackageName = BasicElementLabels.getJavaElementName(getNewElementName());
String message =
Messages.format(
RefactoringCoreMessages.RenamePackageRefactoring_aleady_exists,
new Object[] {newPackageName, rootLabel});
status.merge(RefactoringStatus.createWarningStatus(message));
status.merge(checkTypeNameConflicts(root, newName, topLevelTypeNames));
}
}
return status;
}
示例5: resolve
import org.eclipse.jdt.ui.JavaElementLabels; //导入方法依赖的package包/类
@Override
protected String resolve(TemplateContext context) {
IJavaElement element = ((CompilationUnitContext) context).findEnclosingElement(fElementType);
if (element instanceof IType)
return JavaElementLabels.getElementLabel(element, JavaElementLabels.T_CONTAINER_QUALIFIED);
return (element == null) ? null : element.getElementName();
}
示例6: createWarningAboutCall
import org.eclipse.jdt.ui.JavaElementLabels; //导入方法依赖的package包/类
private RefactoringStatus createWarningAboutCall(
IMember enclosing, ASTNode concreteNode, String message) {
String name = JavaElementLabels.getElementLabel(enclosing, JavaElementLabels.ALL_DEFAULT);
String container =
JavaElementLabels.getElementLabel(
enclosing.getDeclaringType(), JavaElementLabels.ALL_FULLY_QUALIFIED);
return RefactoringStatus.createWarningStatus(
Messages.format(message, new String[] {name, container}),
JavaStatusContext.create(enclosing.getCompilationUnit(), concreteNode));
}
示例7: getName
import org.eclipse.jdt.ui.JavaElementLabels; //导入方法依赖的package包/类
@Override
public String getName() {
String rootName = JavaElementLabels.getElementLabel(getRoot(), JavaElementLabels.ALL_DEFAULT);
String destinationName = BasicElementLabels.getResourceName(getDestination());
return Messages.format(
RefactoringCoreMessages.MovePackageFragmentRootChange_move,
new String[] {rootName, destinationName});
}
示例8: getName
import org.eclipse.jdt.ui.JavaElementLabels; //导入方法依赖的package包/类
@Override
public String getName() {
String packageName =
JavaElementLabels.getElementLabel(getPackage(), JavaElementLabels.ALL_DEFAULT);
String destinationName =
JavaElementLabels.getElementLabel(getDestination(), JavaElementLabels.ALL_DEFAULT);
return Messages.format(
RefactoringCoreMessages.CopyPackageChange_copy,
new String[] {packageName, destinationName});
}
示例9: getName
import org.eclipse.jdt.ui.JavaElementLabels; //导入方法依赖的package包/类
@Override
public String getName() {
String rootName = JavaElementLabels.getElementLabel(getRoot(), JavaElementLabels.ALL_DEFAULT);
String destinationName = BasicElementLabels.getResourceName(getDestination());
return Messages.format(
RefactoringCoreMessages.CopyPackageFragmentRootChange_copy,
new String[] {rootName, destinationName});
}
示例10: getName
import org.eclipse.jdt.ui.JavaElementLabels; //导入方法依赖的package包/类
@Override
public String getName() {
String packageName =
JavaElementLabels.getElementLabel(getPackage(), JavaElementLabels.ALL_DEFAULT);
String destinationName =
JavaElementLabels.getElementLabel(getDestination(), JavaElementLabels.ALL_DEFAULT);
return Messages.format(
RefactoringCoreMessages.MovePackageChange_move,
new String[] {packageName, destinationName});
}
示例11: getSearchPatternDescription
import org.eclipse.jdt.ui.JavaElementLabels; //导入方法依赖的package包/类
private String getSearchPatternDescription() {
if (fPatternData instanceof ElementQuerySpecification) {
IJavaElement element = ((ElementQuerySpecification) fPatternData).getElement();
return JavaElementLabels.getElementLabel(
element,
JavaElementLabels.ALL_DEFAULT
| JavaElementLabels.ALL_FULLY_QUALIFIED
| JavaElementLabels.USE_RESOLVED
| JavaElementLabels.P_COMPRESSED);
}
return BasicElementLabels.getFilePattern(
((PatternQuerySpecification) fPatternData).getPattern());
}
示例12: getText
import org.eclipse.jdt.ui.JavaElementLabels; //导入方法依赖的package包/类
@Override
public String getText() {
return JavaElementLabels.getElementLabel(fJavaElement, JavaElementLabels.ALL_DEFAULT);
}
示例13: getDeclaringTypeLabel
import org.eclipse.jdt.ui.JavaElementLabels; //导入方法依赖的package包/类
private String getDeclaringTypeLabel() {
return JavaElementLabels.getElementLabel(
fMethod.getDeclaringType(), JavaElementLabels.ALL_DEFAULT);
}
示例14: getElementLabel
import org.eclipse.jdt.ui.JavaElementLabels; //导入方法依赖的package包/类
private static String getElementLabel(IJavaElement javaElement) {
return JavaElementLabels.getElementLabel(javaElement, JavaElementLabels.ALL_DEFAULT);
}
示例15: getJavaElementName
import org.eclipse.jdt.ui.JavaElementLabels; //导入方法依赖的package包/类
private static String getJavaElementName(IJavaElement element) {
return JavaElementLabels.getElementLabel(element, JavaElementLabels.ALL_DEFAULT);
}