本文整理汇总了Java中org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels.getPathLabel方法的典型用法代码示例。如果您正苦于以下问题:Java BasicElementLabels.getPathLabel方法的具体用法?Java BasicElementLabels.getPathLabel怎么用?Java BasicElementLabels.getPathLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels
的用法示例。
在下文中一共展示了BasicElementLabels.getPathLabel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getContainerEntryLabel
import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels; //导入方法依赖的package包/类
/**
* Returns the label of a classpath container. The returned label is BiDi-processed with {@link
* TextProcessor#process(String, String)}.
*
* @param containerPath the path of the container
* @param project the project the container is resolved in
* @return the label of the classpath container
* @throws JavaModelException when resolving of the container failed
*/
public static String getContainerEntryLabel(IPath containerPath, IJavaProject project)
throws JavaModelException {
IClasspathContainer container = JavaCore.getClasspathContainer(containerPath, project);
if (container != null) {
return Strings.markLTR(container.getDescription());
}
ClasspathContainerInitializer initializer =
JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
if (initializer != null) {
return Strings.markLTR(initializer.getDescription(containerPath, project));
}
return BasicElementLabels.getPathLabel(containerPath, false);
}
示例2: getStyledContainerEntryLabel
import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels; //导入方法依赖的package包/类
/**
* Returns the styled label of a classpath container. The returned label is BiDi-processed with
* {@link TextProcessor#process(String, String)}.
*
* @param containerPath the path of the container
* @param project the project the container is resolved in
* @return the label of the classpath container
* @since 3.4
*/
public static StyledString getStyledContainerEntryLabel(
IPath containerPath, IJavaProject project) {
try {
IClasspathContainer container = JavaCore.getClasspathContainer(containerPath, project);
String description = null;
if (container != null) {
description = container.getDescription();
}
if (description == null) {
ClasspathContainerInitializer initializer =
JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
if (initializer != null) {
description = initializer.getDescription(containerPath, project);
}
}
if (description != null) {
StyledString str = new StyledString(description);
// if (containerPath.segmentCount() > 0 &&
// JavaRuntime.JRE_CONTAINER.equals(containerPath.segment(0))) {
// int index= description.indexOf('[');
// if (index != -1) {
// str.setStyle(index, description.length() - index, DECORATIONS_STYLE);
// }
// }
return Strings.markLTR(str);
}
} catch (JavaModelException e) {
// ignore
}
return new StyledString(BasicElementLabels.getPathLabel(containerPath, false));
}
示例3: getName
import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels; //导入方法依赖的package包/类
@Override
public String getName() {
String cuName = BasicElementLabels.getResourceName(fOldCu.getElementName());
String cuContainerName = BasicElementLabels.getPathLabel(fOldCu.getParent().getPath(), false);
return Messages.format(
RefactoringCoreMessages.CreateCopyOfCompilationUnitChange_create_copy,
new String[] {cuName, cuContainerName});
}
示例4: getName
import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels; //导入方法依赖的package包/类
@Override
public String getName() {
String cuName = BasicElementLabels.getFileName(fUnit);
String cuContainerName = BasicElementLabels.getPathLabel(fUnit.getParent().getPath(), false);
return Messages.format(
RefactoringCoreMessages.CompilationUnitChange_label,
new String[] {cuName, cuContainerName});
}