Java Code Examples for com.intellij.ui.SimpleTextAttributes#ERROR_ATTRIBUTES

The following examples show how to use com.intellij.ui.SimpleTextAttributes#ERROR_ATTRIBUTES . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OrderEntryAppearanceServiceImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
private static CellAppearanceEx formatRelativePath(@Nonnull final ContentFolder folder, @Nonnull final Image icon) {
  LightFilePointer folderFile = new LightFilePointer(folder.getUrl());
  VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(folder.getContentEntry().getUrl());
  if (file == null) return FileAppearanceService.getInstance().forInvalidUrl(folderFile.getPresentableUrl());

  String contentPath = file.getPath();
  String relativePath;
  SimpleTextAttributes textAttributes;
  VirtualFile folderFileFile = folderFile.getFile();
  if (folderFileFile == null) {
    String absolutePath = folderFile.getPresentableUrl();
    relativePath = absolutePath.startsWith(contentPath) ? absolutePath.substring(contentPath.length()) : absolutePath;
    textAttributes = SimpleTextAttributes.ERROR_ATTRIBUTES;
  }
  else {
    relativePath = VfsUtilCore.getRelativePath(folderFileFile, file, File.separatorChar);
    textAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
  }

  relativePath = StringUtil.isEmpty(relativePath) ? "." + File.separatorChar : relativePath;
  return new SimpleTextCellAppearance(relativePath, icon, textAttributes);
}
 
Example 2
Source File: ExtractedDirectoryPresentation.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void render(@Nonnull PresentationData presentationData, SimpleTextAttributes mainAttributes, SimpleTextAttributes commentAttributes) {
  presentationData.setIcon(AllIcons.Nodes.ExtractedFolder);
  final String parentPath = PathUtil.getParentPath(myJarPath);
  if (myFile == null || !myFile.isDirectory()) {
    mainAttributes = SimpleTextAttributes.ERROR_ATTRIBUTES;
    final VirtualFile parentFile = LocalFileSystem.getInstance().findFileByPath(parentPath);
    if (parentFile == null) {
      commentAttributes = SimpleTextAttributes.ERROR_ATTRIBUTES;
    }
  }
  presentationData.addText("Extracted '" + PathUtil.getFileName(myJarPath) + myPathInJar + "'", mainAttributes);
  presentationData.addText(" (" + parentPath + ")", commentAttributes);
}
 
Example 3
Source File: DirectoryCopyPresentation.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void render(@Nonnull PresentationData presentationData, SimpleTextAttributes mainAttributes, SimpleTextAttributes commentAttributes) {
  presentationData.setIcon(AllIcons.Nodes.CopyOfFolder);
  if (myFile == null || !myFile.isDirectory()) {
    mainAttributes = SimpleTextAttributes.ERROR_ATTRIBUTES;
    final VirtualFile parentFile = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(mySourcePath));
    if (parentFile == null) {
      commentAttributes = SimpleTextAttributes.ERROR_ATTRIBUTES;
    }
  }
  presentationData.addText(CompilerBundle.message("node.text.0.directory.content", mySourceFileName), mainAttributes);
  presentationData.addText(" (" + mySourcePath + ")", commentAttributes);
}
 
Example 4
Source File: FileGroup.java    From consulo with Apache License 2.0 5 votes vote down vote up
public SimpleTextAttributes getInvalidAttributes() {
  if (myCanBeAbsent) {
    return new SimpleTextAttributes(Font.PLAIN, FileStatus.DELETED.getColor());
  }
  else {
    return SimpleTextAttributes.ERROR_ATTRIBUTES;
  }
}
 
Example 5
Source File: OrderEntryAppearanceServiceImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static SimpleTextAttributes getTextAttributes(final boolean valid, final boolean selected) {
  if (!valid) {
    return SimpleTextAttributes.ERROR_ATTRIBUTES;
  }
  else {
    return SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES;
  }
}
 
Example 6
Source File: SimpleTextCellAppearance.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static SimpleTextCellAppearance invalid(@Nonnull final String text, @Nullable final Image icon) {
  return new SimpleTextCellAppearance(text, icon, SimpleTextAttributes.ERROR_ATTRIBUTES);
}
 
Example 7
Source File: DirectoryTreeNode.java    From consulo with Apache License 2.0 4 votes vote down vote up
public DirectoryTreeNode(String path, Project project, String parentPath) {
  super(path, SimpleTextAttributes.ERROR_ATTRIBUTES, project, parentPath);
}
 
Example 8
Source File: UpdateRootNode.java    From consulo with Apache License 2.0 4 votes vote down vote up
public UpdateRootNode(UpdatedFiles updatedFiles, Project project, String rootName, ActionInfo actionInfo) {
  super(rootName, false, SimpleTextAttributes.ERROR_ATTRIBUTES, project, Collections.<String, String>emptyMap(), null);
  myProject = project;

  addGroupsToNode(updatedFiles.getTopLevelGroups(), this, actionInfo);
}
 
Example 9
Source File: ModuleExtensionWithSdkOrderEntryTypeEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public CellAppearanceEx getCellAppearance(@Nonnull ModuleExtensionWithSdkOrderEntryImpl orderEntry) {
  Sdk sdk = orderEntry.getSdk();
  return new SimpleTextCellAppearance(orderEntry.getPresentableName(), SdkUtil.getIcon(sdk), sdk == null ? SimpleTextAttributes.ERROR_ATTRIBUTES : SimpleTextAttributes.SYNTHETIC_ATTRIBUTES);
}