当前位置: 首页>>代码示例>>Java>>正文


Java PresentationData类代码示例

本文整理汇总了Java中com.intellij.ide.projectView.PresentationData的典型用法代码示例。如果您正苦于以下问题:Java PresentationData类的具体用法?Java PresentationData怎么用?Java PresentationData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PresentationData类属于com.intellij.ide.projectView包,在下文中一共展示了PresentationData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateImpl

import com.intellij.ide.projectView.PresentationData; //导入依赖的package包/类
@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));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:PsiFileNode.java

示例2: updateImpl

import com.intellij.ide.projectView.PresentationData; //导入依赖的package包/类
@Override
public void updateImpl(PresentationData data) {
  String name = PsiFormatUtil.formatMethod(
    (PsiMethod)getPsiElement(),
      PsiSubstitutor.EMPTY, PsiFormatUtilBase.SHOW_NAME |
                            PsiFormatUtilBase.SHOW_TYPE |
                            PsiFormatUtilBase.TYPE_AFTER |
                            PsiFormatUtilBase.SHOW_PARAMETERS,
      PsiFormatUtilBase.SHOW_TYPE
  );
  int c = name.indexOf('\n');
  if (c > -1) {
    name = name.substring(0, c - 1);
  }
  data.setPresentableText(name);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MethodSmartPointerNode.java

示例3: updateImpl

import com.intellij.ide.projectView.PresentationData; //导入依赖的package包/类
@Override
public void updateImpl(PresentationData data) {
  String name = PsiFormatUtil.formatMethod(
    getValue(),
      PsiSubstitutor.EMPTY, PsiFormatUtilBase.SHOW_NAME |
                            PsiFormatUtilBase.SHOW_TYPE |
                            PsiFormatUtilBase.TYPE_AFTER |
                            PsiFormatUtilBase.SHOW_PARAMETERS,
      PsiFormatUtilBase.SHOW_TYPE
  );
  int c = name.indexOf('\n');
  if (c > -1) {
    name = name.substring(0, c - 1);
  }
  data.setPresentableText(name);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PsiMethodNode.java

示例4: updateImpl

import com.intellij.ide.projectView.PresentationData; //导入依赖的package包/类
@Override
protected void updateImpl(PresentationData data) {
  super.updateImpl(data);
  WorkspaceRoot workspaceRoot = WorkspaceRoot.fromProject(getProject());
  PsiDirectory psiDirectory = getValue();
  assert psiDirectory != null;
  WorkspacePath workspacePath = workspaceRoot.workspacePathFor(psiDirectory.getVirtualFile());
  String text = workspacePath.relativePath();

  for (BlazePsiDirectoryRootNodeNameModifier modifier :
      BlazePsiDirectoryRootNodeNameModifier.EP_NAME.getExtensions()) {
    text = modifier.modifyRootNodeName(text);
  }

  data.setPresentableText(text);
  data.clearText();
  data.addText(text, SimpleTextAttributes.REGULAR_ATTRIBUTES);
  data.setLocationString("");
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:20,代码来源:BlazePsiDirectoryRootNode.java

示例5: update

import com.intellij.ide.projectView.PresentationData; //导入依赖的package包/类
@Override
protected void update(PresentationData presentation) {
  final Collection<ArtifactProblemDescription> problems = ((ArtifactEditorImpl)myContext.getThisArtifactEditor()).getValidationManager().getProblems(this);
  if (problems == null || problems.isEmpty()) {
    super.update(presentation);
    return;
  }
  StringBuilder buffer = StringBuilderSpinAllocator.alloc();
  final String tooltip;
  boolean isError = false;
  try {
    for (ArtifactProblemDescription problem : problems) {
      isError |= problem.getSeverity() == ProjectStructureProblemType.Severity.ERROR;
      buffer.append(problem.getMessage(false)).append("<br>");
    }
    tooltip = XmlStringUtil.wrapInHtml(buffer);
  }
  finally {
    StringBuilderSpinAllocator.dispose(buffer);
  }

  getElementPresentation().render(presentation, addErrorHighlighting(isError, SimpleTextAttributes.REGULAR_ATTRIBUTES),
                                  addErrorHighlighting(isError, SimpleTextAttributes.GRAY_ATTRIBUTES));
  presentation.setTooltip(tooltip);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PackagingElementNode.java

示例6: render

import com.intellij.ide.projectView.PresentationData; //导入依赖的package包/类
@Override
public void render(@NotNull PresentationData presentationData, SimpleTextAttributes mainAttributes,
                   SimpleTextAttributes commentAttributes) {
  final String name = myLibrary.getName();
  if (name != null) {
    presentationData.setIcon(PlatformIcons.LIBRARY_ICON);
    presentationData.addText(name, mainAttributes);
    presentationData.addText(LibraryElementPresentation.getLibraryTableComment(myLibrary), commentAttributes);
  }
  else {
    if (((LibraryEx)myLibrary).isDisposed()) {
      //todo[nik] disposed library should not be shown in the tree
      presentationData.addText("Invalid Library", SimpleTextAttributes.ERROR_ATTRIBUTES);
      return;
    }
    final VirtualFile[] files = myLibrary.getFiles(OrderRootType.CLASSES);
    if (files.length > 0) {
      final VirtualFile file = files[0];
      presentationData.setIcon(VirtualFilePresentation.getIcon(file));
      presentationData.addText(file.getName(), mainAttributes);
    }
    else {
      presentationData.addText("Empty Library", SimpleTextAttributes.ERROR_ATTRIBUTES);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:LibrarySourceItem.java

示例7: createPresentation

import com.intellij.ide.projectView.PresentationData; //导入依赖的package包/类
public PackagingElementPresentation createPresentation(@NotNull ArtifactEditorContext context) {
  return new PackagingElementPresentation() {
    @Override
    public String getPresentableName() {
      return CompilerBundle.message("packaging.element.text.output.root");
    }

    @Override
    public void render(@NotNull PresentationData presentationData, SimpleTextAttributes mainAttributes,
                       SimpleTextAttributes commentAttributes) {
      presentationData.setIcon(AllIcons.Nodes.Artifact);
      presentationData.addText(getPresentableName(), mainAttributes);
    }

    @Override
    public int getWeight() {
      return 0;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ArtifactRootElementImpl.java

示例8: decorate

import com.intellij.ide.projectView.PresentationData; //导入依赖的package包/类
@Override
public void decorate(@SuppressWarnings("rawtypes") ProjectViewNode node, PresentationData data) {
  CoverageDataManager manager = getCoverageDataManager();
  CoverageSuitesBundle currentSuite = manager.getCurrentSuitesBundle();

  Project project = node.getProject();
  BlazeCoverageAnnotator annotator = getAnnotator(project, currentSuite);
  if (annotator == null) {
    return;
  }
  PsiFile file = getPsiFileForJavaClass(getPsiElement(node));
  if (file == null) {
    return;
  }
  String string = annotator.getFileCoverageInformationString(file, currentSuite, manager);
  if (string != null) {
    data.setLocationString(string);
  }
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:20,代码来源:BlazeCoverageProjectViewClassDecorator.java

示例9: update

import com.intellij.ide.projectView.PresentationData; //导入依赖的package包/类
@Override
protected void update(PresentationData presentation) {
  super.update(presentation);
  presentation.setIcon(ProgramRunnerUtil.getConfigurationIcon(mySettings, false));

  final ExternalSystemRunConfiguration runConfiguration = (ExternalSystemRunConfiguration)mySettings.getConfiguration();
  final ExternalSystemTaskExecutionSettings taskExecutionSettings = runConfiguration.getSettings();
  final String shortcutHint = StringUtil.nullize(getShortcutsManager().getDescription(
    taskExecutionSettings.getExternalProjectPath(), mySettings.getName()));
  final String activatorHint = StringUtil.nullize(getTaskActivator().getDescription(
    taskExecutionSettings.getExternalSystemId(), taskExecutionSettings.getExternalProjectPath(),
    getRunConfigurationActivationTaskName(mySettings)));

  String hint;
  if (shortcutHint == null) {
    hint = activatorHint;
  }
  else if (activatorHint == null) {
    hint = shortcutHint;
  }
  else {
    hint = shortcutHint + ", " + activatorHint;
  }

  setNameAndTooltip(getName(), StringUtil.join(taskExecutionSettings.getTaskNames(), " "), hint);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:RunConfigurationNode.java

示例10: update

import com.intellij.ide.projectView.PresentationData; //导入依赖的package包/类
@Override
protected void update(PresentationData presentation) {
  super.update(presentation);
  presentation.setIcon(getUiAware().getTaskIcon());

  final String shortcutHint = StringUtil.nullize(getShortcutsManager().getDescription(myTaskData.getLinkedExternalProjectPath(), myTaskData.getName()));
  final String activatorHint = StringUtil.nullize(getTaskActivator().getDescription(
    myTaskData.getOwner(), myTaskData.getLinkedExternalProjectPath(), myTaskData.getName()));

  String hint;
  if (shortcutHint == null) {
    hint = activatorHint;
  }
  else if (activatorHint == null) {
    hint = shortcutHint;
  }
  else {
    hint = shortcutHint + ", " + activatorHint;
  }

  setNameAndTooltip(getName(), myTaskData.getDescription(), hint);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:TaskNode.java

示例11: update

import com.intellij.ide.projectView.PresentationData; //导入依赖的package包/类
@Override
protected void update(final PresentationData presentation) {
  ApplicationManager.getApplication().runReadAction(new Runnable() {
    public void run() {
      final Object value = getValue();
      if (value instanceof PsiNamedElement) {

        if (value instanceof PsiQualifiedNamedElement &&
            (myStateBean.myFlattenPackages && ((PsiNamedElement)value).getContainingFile() == null ||
             getParent() instanceof CoverageListRootNode)) {
          presentation.setPresentableText(((PsiQualifiedNamedElement)value).getQualifiedName());
        }
        else {
          presentation.setPresentableText(((PsiNamedElement)value).getName());
        }
        presentation.setIcon(((PsiElement)value).getIcon(0));
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:CoverageListNode.java

示例12: setStudyAttributes

import com.intellij.ide.projectView.PresentationData; //导入依赖的package包/类
protected void setStudyAttributes(Task task, PresentationData data, String additionalName) {
  StudyStatus taskStatus = StudyTaskManager.getInstance(myProject).getStatus(task);
  switch (taskStatus) {
    case Unchecked: {
      updatePresentation(data, additionalName, JBColor.BLACK, EducationalIcons.Task);
      break;
    }
    case Solved: {
      updatePresentation(data, additionalName, new JBColor(new Color(0, 134, 0), new Color(98, 150, 85)),
                         InteractiveLearningIcons.TaskCompl);
      break;
    }
    case Failed: {
      updatePresentation(data, additionalName, JBColor.RED, InteractiveLearningIcons.TaskProbl);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:StudyDirectoryNode.java

示例13: update

import com.intellij.ide.projectView.PresentationData; //导入依赖的package包/类
@Override
public void update(PresentationData data) {
  super.update(data);

  PsiFile psiFile = getValue();
  if (psiFile == null || !psiFile.isValid()) {
    return;
  }

  String fileName = psiFile.getName();
  data.addText(fileName, SimpleTextAttributes.REGULAR_ATTRIBUTES);
  data.setPresentableText(fileName);
  if (myQualifier != null) {
    data.addText(" (" + myQualifier + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AndroidBuildScriptNode.java

示例14: update

import com.intellij.ide.projectView.PresentationData; //导入依赖的package包/类
@Override
protected void update(PresentationData presentation) {
  if (getValue() != null) {
    final Object object = getValue().getObject();
    final String classString = object.getClass().toString();
    final String objectString = object.toString();

    presentation.setPresentableText(objectString);

    if (getValue().getOwnModification() < myTree.myModificationToFilter) {
      presentation.setForcedTextForeground(JBColor.GRAY);
    }

    if (objectString != null) {
      final int dogIndex = objectString.lastIndexOf("@");
      if (dogIndex >= 0) {
        final String fqNameObject = objectString.substring(0, dogIndex);
        final String fqNameClass = classString.substring("class ".length());
        if (fqNameObject.equals(fqNameClass)) return;
      }
    }

    presentation.setLocationString(classString);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:DisposerDebugger.java

示例15: update

import com.intellij.ide.projectView.PresentationData; //导入依赖的package包/类
@Override
protected void update(PresentationData presentation) {
  String name = myBlock.getClass().getSimpleName();
  if (myBlock instanceof DataLanguageBlockWrapper) {
    name += " (" + ((DataLanguageBlockWrapper)myBlock).getOriginal().getClass().getSimpleName() + ")";
  }
  presentation.addText(name, SimpleTextAttributes.REGULAR_ATTRIBUTES);

  if (myBlock.getIndent() != null) {
    presentation.addText(" " + String.valueOf(myBlock.getIndent()).replaceAll("[<>]", " "), SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
  else {
    presentation.addText(" Indent: null", SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
  if (myBlock.getAlignment() != null) {
    presentation
      .addText(" " + String.valueOf(myBlock.getAlignment()), new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, JBColor.darkGray));
  }
  if (myBlock.getWrap() != null) {
    presentation
      .addText(" " + String.valueOf(myBlock.getWrap()), new SimpleTextAttributes(SimpleTextAttributes.STYLE_ITALIC, PlatformColors.BLUE));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:BlockTreeNode.java


注:本文中的com.intellij.ide.projectView.PresentationData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。