Пример #1
0
 @Override
 public StyledString getStyledText(Object element) {
   if (element instanceof INode) {
     return this.cmlLabelProvider.getStyledText(element);
   }
   return workbenchLabelProvider.getStyledText(element);
 }
  @Override
  public StyledString getStyledText(Object element) {
    if (element instanceof IResource) {
      IResource resource = (IResource) element;

      // Un-analyzed resources are grey.
      if (!DartCore.isAnalyzed(resource)) {
        return new StyledString(resource.getName(), StyledString.QUALIFIER_STYLER);
      }

      StyledString string = new StyledString(resource.getName());

      DartElement dartElement = DartCore.create(resource);

      // Append the library name to library units.
      if (dartElement instanceof CompilationUnit) {
        if (((CompilationUnit) dartElement).definesLibrary()) {
          DartLibrary library = ((CompilationUnit) dartElement).getLibrary();

          string.append(" [" + library.getDisplayName() + "]", StyledString.QUALIFIER_STYLER);
        }
      }

      return string;
    }

    return workbenchLabelProvider.getStyledText(element);
  }