예제 #1
0
    @Override
    public StyledString getStyledText(Object element) {
      if (element instanceof IStructuredSelection)
        element = ((IStructuredSelection) element).getFirstElement();

      if (element instanceof Repository) {
        Repository repositoryNode = (Repository) element;
        StyledString styledString = new StyledString(repositoryNode.getName());

        if (repositoryNode.getResources() != null) {
          styledString.append(
              " (" + repositoryNode.getResources().size() + ") ", StyledString.QUALIFIER_STYLER);
        }
        return styledString;
      }

      if (element instanceof Resource) {
        StyledString styledString = new StyledString(((Resource) element).getName());

        if (((Resource) element).getDescriptor() == null) {
          styledString.append(
              " describes (" + ((Resource) element).getDescribes().size() + ") resources",
              StyledString.COUNTER_STYLER);
        }

        return styledString;
      }

      return null;
    }
예제 #2
0
    @Override
    public StyledString getStyledText(Object element) {
      if (element instanceof IStructuredSelection)
        element = ((IStructuredSelection) element).getFirstElement();

      if (element instanceof Repository) {
        Repository repositoryNode = (Repository) element;
        StyledString styledString = new StyledString(repositoryNode.getName());
        return styledString;
      }

      if (element instanceof Resource) {
        Resource resourceObject = (Resource) element;
        StyledString styledString = new StyledString((String) resourceObject.getUri());

        return styledString;
      }

      return null;
    }