Пример #1
0
 @Override
 protected void update(PresentationData presentation) {
   if (presentation != null) {
     presentation.setChanged(presentation.isChanged() || changed);
     changed = false;
   }
 }
    private void renderFile(
        final VirtualFile file,
        final SimpleTextAttributes textAttributes,
        @Nullable final String toolTip) {
      final PresentationData presentation = getPresentation();
      presentation.setTooltip(toolTip);
      presentation.addText(myFilePointer.getFileName(), textAttributes);

      if (file != null) {
        presentation.setLocationString(file.getPath());
      }
    }
 protected LibraryEditorDescriptor(
     final Project project,
     final NodeDescriptor parentDescriptor,
     final Library element,
     String libraryName,
     StructureConfigurableContext context) {
   super(project, parentDescriptor, element);
   final PresentationData templatePresentation = getTemplatePresentation();
   Icon icon = LibraryPresentationManager.getInstance().getNamedLibraryIcon(element, context);
   templatePresentation.setIcons(icon);
   templatePresentation.addText(libraryName, SimpleTextAttributes.REGULAR_ATTRIBUTES);
 }
  private PresentationData getUpdatedPresentation() {
    PresentationData presentation =
        myUpdatedPresentation != null ? myUpdatedPresentation : createPresentation();
    myUpdatedPresentation = presentation;
    presentation.clear();
    update(presentation);

    if (shouldPostprocess()) {
      postprocess(presentation);
    }

    return presentation;
  }
    FileSetNode(final OfbizFileSet fileSet) {
      mySet = fileSet;

      final PresentationData presentationData = getPresentation();
      final String name = mySet.getName();

      if (fileSet.getFiles().isEmpty()) {
        presentationData.addText(name, getErrorAttributes());
        presentationData.setTooltip("No files attached");
      } else {
        presentationData.addText(name, getPlainAttributes());
        presentationData.setLocationString("" + fileSet.getFiles().size());
      }
    }
 @Override
 public void updateImpl(PresentationData data) {
   final PsiClass aClass = getPsiClass();
   if (aClass != null) {
     data.setPresentableText(aClass.getName());
   }
 }
 @Override
 protected void update(PresentationData presentation) {
   CertificateWrapper wrapper = getElement();
   SimpleTextAttributes attr =
       wrapper.isValid() ? SimpleTextAttributes.REGULAR_ATTRIBUTES : STRIKEOUT_ATTRIBUTES;
   presentation.addText(wrapper.getSubjectField(COMMON_NAME), attr);
 }
Пример #8
0
 @Override
 protected void applyDecorationUnderSvn(ProjectViewNode node, PresentationData data) {
   ProjectViewStatus status = getBranchStatusAndCache(node);
   if (shouldApplyDecoration(status)) {
     addSmartText(data, getName(node), SimpleTextAttributes.REGULAR_ATTRIBUTES);
     data.addText(formatBranchName(status));
   }
 }
Пример #9
0
  @Override
  protected void updateImpl(PresentationData data) {
    PsiFile value = getValue();
    data.setPresentableText(value.getName());
    data.setIcon(value.getIcon(Iconable.ICON_FLAG_READ_STATUS));

    VirtualFile file = getVirtualFile();
    if (file != null && file.is(VFileProperty.SYMLINK)) {
      String target = file.getCanonicalPath();
      if (target == null) {
        data.setAttributesKey(CodeInsightColors.WRONG_REFERENCES_ATTRIBUTES);
        data.setTooltip(CommonBundle.message("vfs.broken.link"));
      } else {
        data.setTooltip(FileUtil.toSystemDependentName(target));
      }
    }
  }
    @Override
    protected void update(PresentationData presentation) {
      super.update(presentation);
      presentation.setIcon(AllIcons.Nodes.PpLib);

      final LibraryDependencyData data = getData();
      if (data != null) {
        setNameAndTooltip(getName(), null, data.getScope().getDisplayName());
      }
    }
    @Override
    protected void update(PresentationData presentation) {
      super.update(presentation);
      presentation.setIcon(getUiAware().getProjectIcon());

      final ModuleDependencyData data = getData();
      if (data != null) {
        setNameAndTooltip(getName(), null, data.getScope().getDisplayName());
      }
    }
Пример #12
0
  @Override
  protected void postprocess(PresentationData presentation) {
    if (hasProblemFileBeneath()) {
      presentation.setAttributesKey(CodeInsightColors.ERRORS_ATTRIBUTES);
    }

    Color fgColor = getFileStatus().getColor();

    if (valueIsCut()) {
      fgColor = CopyPasteManager.CUT_COLOR;
    }

    if (presentation.getForcedTextForeground() == null) {
      presentation.setForcedTextForeground(fgColor);
    }

    if (hasProblemFileBeneath()) {
      presentation.setAttributesKey(CodeInsightColors.ERRORS_ATTRIBUTES);
    }
  }
  @Override
  protected void updateImpl(PresentationData data) {
    // TODO:change presentable name for files with suffix _answer

    String valueName = myValue.getName();
    final Course course = CCProjectService.getInstance(myProject).getCourse();
    if (course == null) return;
    if (myProject.getBaseDir().equals(myValue.getVirtualFile())) {
      data.clearText();
      data.addText(valueName, SimpleTextAttributes.REGULAR_ATTRIBUTES);
      data.addText(" (" + course.getName() + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
      return;
    }
    final Lesson lesson = course.getLesson(valueName);
    if (lesson != null) {
      data.clearText();
      data.addText(valueName, SimpleTextAttributes.REGULAR_ATTRIBUTES);
      data.addText(" (" + lesson.getName() + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
      return;
    } else {
      final PsiDirectory parentDir = myValue.getParentDirectory();
      if (parentDir != null) {
        final Lesson parentLesson = course.getLesson(parentDir.getName());
        if (parentLesson != null) {
          final Task task = parentLesson.getTask(valueName);
          if (task != null) {
            data.clearText();
            data.addText(valueName, SimpleTextAttributes.REGULAR_ATTRIBUTES);
            data.addText(" (" + task.name + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
            return;
          }
        }
      }
    }
    data.setPresentableText(valueName);
  }
  protected final boolean apply(PresentationData presentation, @Nullable PresentationData before) {
    myOpenIcon = presentation.getIcon(true);
    myClosedIcon = presentation.getIcon(false);
    myName = presentation.getPresentableText();
    myColor = presentation.getForcedTextForeground();
    boolean updated = before != null ? !presentation.equals(before) : true;

    if (myUpdatedPresentation == null) {
      myUpdatedPresentation = createPresentation();
    }

    myUpdatedPresentation.copyFrom(presentation);

    if (myTemplatePresentation != null) {
      myUpdatedPresentation.applyFrom(myTemplatePresentation);
    }

    updated |= myUpdatedPresentation.isChanged();
    myUpdatedPresentation.setChanged(false);

    return updated;
  }
 @Override
 protected void update(PresentationData presentation) {
   presentation.addText("<root>", SimpleTextAttributes.REGULAR_ATTRIBUTES);
 }
 @Override
 protected void update(@NotNull PresentationData presentation) {
   presentation.setAttributesKey(myAttributes);
   presentation.setPresentableText(myName);
   presentation.setIcon(getIcon());
 }
Пример #17
0
 @Override
 public void update(PresentationData presentation) {
   presentation.setPresentableText(IdeBundle.message("node.projectview.libraries"));
   presentation.setIcon(PlatformIcons.LIBRARY_ICON);
 }
 @Override
 protected void update(PresentationData presentation) {
   super.update(presentation);
   presentation.setIcon(AllIcons.Nodes.PpLibFolder);
 }
 @Override
 protected void update(PresentationData presentation) {
   presentation.addText(getElement(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
 }