/** * Returns a label for a resource name. * * @param resourceName the resource name * @return the label of the resource name. */ public static String getResourceName(String resourceName) { return Strings.markLTR(resourceName); }
/** * Returns a label for a version name. Example is '1.4.1' * * @param name the version string * @return the version label */ public static String getVersionName(String name) { return Strings.markLTR(name); }
/** * Returns the label for a file pattern like '*.java' * * @param name the pattern * @return the label of the pattern. */ public static String getFilePattern(String name) { return Strings.markLTR(name, FILE_PATTERN_DELIMITERS); }
/** * Returns a label for Java code snippet used in a label. Example is 'Test test= new Test<? extends List>() { ...}'. * * @param string the Java code snippet * @return the label for the Java code snippet */ public static String getJavaCodeString(String string) { return Strings.markLTR(string, CODE_DELIMITERS); }
/** * Returns the label for a URL, URI or URL part. Example is 'http://www.x.xom/s.html#1' * * @param name the URL string * @return the label of the URL. */ public static String getURLPart(String name) { return Strings.markLTR(name, URL_DELIMITERS); }
/** * Returns the label of the path of a file. * * @param file the file * @return the label of the file path to be used in the UI. */ public static String getPathLabel(File file) { return Strings.markLTR(file.getAbsolutePath()); }
/** * Returns a label for a type root name which is a file name. * * @param typeRoot the typeRoot * @return the label of the resource name. */ public static String getFileName(ITypeRoot typeRoot) { return Strings.markLTR(typeRoot.getElementName()); }
/** * Returns a label for a working set * * @param set the working set * @return the label of the working set */ public static String getWorkingSetLabel(IWorkingSet set) { return Strings.markLTR(set.getLabel()); }
/** * Returns a label for a resource name. * * @param resource the resource * @return the label of the resource name. */ public static String getResourceName(IResource resource) { return Strings.markLTR(resource.getName()); }
/** * Returns the styled string for the given resource. * The returned label is BiDi-processed with {@link TextProcessor#process(String, String)}. * * @param resource the resource * @return the styled string * @since 3.4 */ private static StyledString getStyledResourceLabel(IResource resource) { StyledString result= new StyledString(resource.getName()); return Strings.markLTR(result); }
/** * Returns the styled string for the given resource. * The returned label is BiDi-processed with {@link TextProcessor#process(String, String)}. * * @param resource the resource * @return the styled string * @since 3.4 */ private static StyledString getStyledResourceLabel(IResource resource) { StyledString result= new StyledString(resource.getName()); return Strings.markLTR(result); }
/** * Returns the styled string for the given storage. * The returned label is BiDi-processed with {@link TextProcessor#process(String, String)}. * * @param storage the storage * @return the styled string * @since 3.4 */ private static StyledString getStyledStorageLabel(IStorage storage) { StyledString result= new StyledString(storage.getName()); return Strings.markLTR(result); }
/** * Returns the styled string for the given storage. * The returned label is BiDi-processed with {@link TextProcessor#process(String, String)}. * * @param storage the storage * @return the styled string * @since 3.4 */ private static StyledString getStyledStorageLabel(IStorage storage) { StyledString result= new StyledString(storage.getName()); return Strings.markLTR(result); }
/** * Returns the label of a path. * * @param path the path * @param isOSPath if <code>true</code>, the path represents an OS path, if <code>false</code> it is a workspace path. * @return the label of the path to be used in the UI. */ public static String getPathLabel(IPath path, boolean isOSPath) { String label; if (isOSPath) { label= path.toOSString(); } else { label= path.makeRelative().toString(); } return Strings.markLTR(label); }
/** * Returns the label for a Java element with the flags as defined by {@link JavaElementLabels}. * @param binding The binding to render. * @param flags The text flags as defined in {@link JavaElementLabels} * @return the label of the binding */ public static String getBindingLabel(IBinding binding, long flags) { StringBuffer buffer= new StringBuffer(60); if (binding instanceof ITypeBinding) { getTypeLabel(((ITypeBinding) binding), flags, buffer); } else if (binding instanceof IMethodBinding) { getMethodLabel(((IMethodBinding) binding), flags, buffer); } else if (binding instanceof IVariableBinding) { final IVariableBinding variable= (IVariableBinding) binding; if (variable.isField()) getFieldLabel(variable, flags, buffer); else getLocalVariableLabel(variable, flags, buffer); } return Strings.markLTR(buffer.toString()); }
/** * 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); }
return Strings.markLTR(str);
/** * Returns the styled label of the given object. The object must be of type {@link IJavaElement} or adapt to {@link IWorkbenchAdapter}. * If the element type is not known, the empty string is returned. * The returned label is BiDi-processed with {@link TextProcessor#process(String, String)}. * * @param obj object to get the label for * @param flags the rendering flags * @return the label or the empty string if the object type is not supported * * @since 3.4 */ public static StyledString getStyledTextLabel(Object obj, long flags) { if (obj instanceof IJavaElement) { return getStyledElementLabel((IJavaElement) obj, flags); } else if (obj instanceof IResource) { return getStyledResourceLabel((IResource) obj); } else if (obj instanceof ClassPathContainer) { ClassPathContainer container= (ClassPathContainer) obj; return getStyledContainerEntryLabel(container.getClasspathEntry().getPath(), container.getJavaProject()); } else if (obj instanceof IStorage) { return getStyledStorageLabel((IStorage) obj); } else if (obj instanceof IAdaptable) { IWorkbenchAdapter wbadapter= ((IAdaptable)obj).getAdapter(IWorkbenchAdapter.class); if (wbadapter != null) { return Strings.markLTR(new StyledString(wbadapter.getLabel(obj))); } } return new StyledString(); }
/** * Returns the styled label of the given object. The object must be of type {@link IJavaElement} or adapt to {@link IWorkbenchAdapter}. * If the element type is not known, the empty string is returned. * The returned label is BiDi-processed with {@link TextProcessor#process(String, String)}. * * @param obj object to get the label for * @param flags the rendering flags * @return the label or the empty string if the object type is not supported * * @since 3.4 */ public static StyledString getStyledTextLabel(Object obj, long flags) { if (obj instanceof IJavaElement) { return getStyledElementLabel((IJavaElement) obj, flags); } else if (obj instanceof IResource) { return getStyledResourceLabel((IResource) obj); } else if (obj instanceof ClassPathContainer) { ClassPathContainer container= (ClassPathContainer) obj; return getStyledContainerEntryLabel(container.getClasspathEntry().getPath(), container.getJavaProject()); } else if (obj instanceof IStorage) { return getStyledStorageLabel((IStorage) obj); } else if (obj instanceof IAdaptable) { IWorkbenchAdapter wbadapter= ((IAdaptable)obj).getAdapter(IWorkbenchAdapter.class); if (wbadapter != null) { return Strings.markLTR(new StyledString(wbadapter.getLabel(obj))); } } return new StyledString(); }
IWorkbenchAdapter wbadapter= ((IAdaptable)obj).getAdapter(IWorkbenchAdapter.class); if (wbadapter != null) { return Strings.markLTR(wbadapter.getLabel(obj));