Java 类com.intellij.ui.HighlightedRegion 实例源码

项目:intellij-ce-playground    文件:ModuleToDoNode.java   
@Override
public void update(PresentationData presentation) {
  String newName = getValue().getName();
  int nameEndOffset = newName.length();
  int todoItemCount = getTodoItemCount(getValue());
  int fileCount = getFileCount(getValue());
  newName = IdeBundle.message("node.todo.group", newName, todoItemCount, fileCount);
  myHighlightedRegions.clear();

  TextAttributes textAttributes = new TextAttributes();

  if (CopyPasteManager.getInstance().isCutElement(getValue())) {
    textAttributes.setForegroundColor(CopyPasteManager.CUT_COLOR);
  }
  myHighlightedRegions.add(new HighlightedRegion(0, nameEndOffset, textAttributes));

  EditorColorsScheme colorsScheme = UsageTreeColorsScheme.getInstance().getScheme();
  myHighlightedRegions.add(
    new HighlightedRegion(nameEndOffset, newName.length(), colorsScheme.getAttributes(UsageTreeColors.NUMBER_OF_USAGES)));
  presentation.setIcon(ModuleType.get(getValue()).getIcon());
  presentation.setPresentableText(newName);
}
项目:tools-idea    文件:ModuleToDoNode.java   
@Override
public void update(PresentationData presentation) {
  String newName = getValue().getName();
  int nameEndOffset = newName.length();
  int todoItemCount = getTodoItemCount(getValue());
  int fileCount = getFileCount(getValue());
  newName = IdeBundle.message("node.todo.group", newName, todoItemCount, fileCount);
  myHighlightedRegions.clear();

  TextAttributes textAttributes = new TextAttributes();

  if (CopyPasteManager.getInstance().isCutElement(getValue())) {
    textAttributes.setForegroundColor(CopyPasteManager.CUT_COLOR);
  }
  myHighlightedRegions.add(new HighlightedRegion(0, nameEndOffset, textAttributes));

  EditorColorsScheme colorsScheme = UsageTreeColorsScheme.getInstance().getScheme();
  myHighlightedRegions.add(
    new HighlightedRegion(nameEndOffset, newName.length(), colorsScheme.getAttributes(UsageTreeColors.NUMBER_OF_USAGES)));
  presentation.setIcon(ModuleType.get(getValue()).getIcon());
  presentation.setPresentableText(newName);
}
项目:consulo    文件:ModuleToDoNode.java   
@Override
public void update(PresentationData presentation) {
  String newName = getValue().getName();
  int nameEndOffset = newName.length();
  int todoItemCount = getTodoItemCount(getValue());
  int fileCount = getFileCount(getValue());
  newName = IdeBundle.message("node.todo.group", newName, todoItemCount, fileCount);
  myHighlightedRegions.clear();

  TextAttributes textAttributes = new TextAttributes();

  if (CopyPasteManager.getInstance().isCutElement(getValue())) {
    textAttributes.setForegroundColor(CopyPasteManager.CUT_COLOR);
  }
  myHighlightedRegions.add(new HighlightedRegion(0, nameEndOffset, textAttributes));

  EditorColorsScheme colorsScheme = UsageTreeColorsScheme.getInstance().getScheme();
  myHighlightedRegions.add(
    new HighlightedRegion(nameEndOffset, newName.length(), colorsScheme.getAttributes(UsageTreeColors.NUMBER_OF_USAGES)));
  presentation.setIcon(AllIcons.Nodes.Module);
  presentation.setPresentableText(newName);
}
项目:intellij-ce-playground    文件:TodoPackageNode.java   
public TodoPackageNode(@NotNull Project project,
                       PackageElement element,
                       TodoTreeBuilder builder,
                       @Nullable String name) {
  super(project, element, ViewSettings.DEFAULT);
  myBuilder = builder;
  myHighlightedRegions = new ArrayList<HighlightedRegion>(2);
  if (element != null && name == null){
    final PsiPackage aPackage = element.getPackage();
    myPresentationName = aPackage.getName();
  }
  else {
    myPresentationName = name;
  }
}
项目:intellij-ce-playground    文件:TodoCompositeRenderer.java   
@Override
public Component getTreeCellRendererComponent(JTree tree, Object obj, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  Component result;

  Object userObject = ((DefaultMutableTreeNode)obj).getUserObject();
  if (userObject instanceof SummaryNode) {
    myNodeRenderer.getTreeCellRendererComponent(tree, userObject.toString(), selected, expanded, leaf, row, hasFocus);
    myNodeRenderer.setFont(UIUtil.getTreeFont().deriveFont(Font.BOLD));
    myNodeRenderer.setIcon(null);
    result = myNodeRenderer;
  }
  else if (userObject instanceof NodeDescriptor && userObject instanceof HighlightedRegionProvider) {
    NodeDescriptor descriptor = (NodeDescriptor)userObject;
    HighlightedRegionProvider regionProvider = (HighlightedRegionProvider)userObject;
    myColorTreeCellRenderer.getTreeCellRendererComponent(tree, obj, selected, expanded, leaf, row, hasFocus);
    for (HighlightedRegion region : regionProvider.getHighlightedRegions()) {
      myColorTreeCellRenderer.addHighlighter(region.startOffset, region.endOffset, region.textAttributes);
    }
    myColorTreeCellRenderer.setIcon(descriptor.getIcon());
    result = myColorTreeCellRenderer;
  }
  else {
    result = myNodeRenderer.getTreeCellRendererComponent(tree, null, selected, expanded, leaf, row, hasFocus);
  }

  if (result instanceof JComponent) {
    ((JComponent)result).setOpaque(!selected);
  }

  return result;
}
项目:intellij-ce-playground    文件:TodoDirNode.java   
public TodoDirNode(Project project,
                   PsiDirectory directory,
                   TodoTreeBuilder builder) {
  super(project, directory, ViewSettings.DEFAULT);
  myBuilder = builder;
  myHighlightedRegions = new ArrayList<HighlightedRegion>(2);
}
项目:intellij-ce-playground    文件:TodoDirNode.java   
@Override
protected void updateImpl(PresentationData data) {
  super.updateImpl(data);
  int fileCount = getFileCount(getValue());
  if (getValue() == null || !getValue().isValid() || fileCount == 0) {
    setValue(null);
    return;
  }

  VirtualFile directory = getValue().getVirtualFile();
  boolean isProjectRoot = !ProjectRootManager.getInstance(getProject()).getFileIndex().isInContent(directory);
  String newName = isProjectRoot || getStructure().getIsFlattenPackages() ? getValue().getVirtualFile().getPresentableUrl() : getValue().getName();

  int nameEndOffset = newName.length();
  int todoItemCount = getTodoItemCount(getValue());
  newName = IdeBundle.message("node.todo.group", newName, todoItemCount, fileCount);

  myHighlightedRegions.clear();

  TextAttributes textAttributes = new TextAttributes();
  Color newColor = FileStatusManager.getInstance(getProject()).getStatus(getValue().getVirtualFile()).getColor();

  if (CopyPasteManager.getInstance().isCutElement(getValue())) {
    newColor = CopyPasteManager.CUT_COLOR;
  }
  textAttributes.setForegroundColor(newColor);
  myHighlightedRegions.add(new HighlightedRegion(0, nameEndOffset, textAttributes));

  EditorColorsScheme colorsScheme = UsageTreeColorsScheme.getInstance().getScheme();
  myHighlightedRegions.add(
    new HighlightedRegion(nameEndOffset, newName.length(), colorsScheme.getAttributes(UsageTreeColors.NUMBER_OF_USAGES)));

  data.setPresentableText(newName);
}
项目:intellij-ce-playground    文件:TodoFileNode.java   
public TodoFileNode(Project project,
                    PsiFile file,
                    TodoTreeBuilder treeBuilder,
                    boolean singleFileMode){
  super(project,file,ViewSettings.DEFAULT);
  myBuilder=treeBuilder;
  myHighlightedRegions=new ArrayList<HighlightedRegion>(2);
  mySingleFileMode=singleFileMode;
}
项目:intellij-ce-playground    文件:TodoFileNode.java   
@Override
protected void updateImpl(PresentationData data) {
  super.updateImpl(data);
  String newName;
  if(myBuilder.getTodoTreeStructure().isPackagesShown()){
    newName=getValue().getName();
  }else{
    newName=mySingleFileMode ? getValue().getName() : getValue().getVirtualFile().getPresentableUrl();
  }

  int nameEndOffset=newName.length();
  int todoItemCount;
  try {
    todoItemCount = myBuilder.getTodoTreeStructure().getTodoItemCount(getValue());
  }
  catch (IndexNotReadyException e) {
    return;
  }
  if(mySingleFileMode){
    if(todoItemCount==0){
      newName = IdeBundle.message("node.todo.no.items.found", newName);
    } else {
      newName = IdeBundle.message("node.todo.found.items", newName, todoItemCount);
    }
  }else{
    newName = IdeBundle.message("node.todo.items", newName, todoItemCount);
  }

  myHighlightedRegions.clear();

  TextAttributes textAttributes=new TextAttributes();
  textAttributes.setForegroundColor(myColor);
  myHighlightedRegions.add(new HighlightedRegion(0,nameEndOffset,textAttributes));

  EditorColorsScheme colorsScheme=UsageTreeColorsScheme.getInstance().getScheme();
  myHighlightedRegions.add(
    new HighlightedRegion(nameEndOffset,newName.length(),colorsScheme.getAttributes(UsageTreeColors.NUMBER_OF_USAGES))
  );

}
项目:intellij-ce-playground    文件:TodoItemNode.java   
public TodoItemNode(Project project,
                    SmartTodoItemPointer value,
                    TodoTreeBuilder builder) {
  super(project, value, builder);
  RangeMarker rangeMarker = getValue().getRangeMarker();
  LOG.assertTrue(rangeMarker.isValid());

  myHighlightedRegions=new ArrayList<HighlightedRegion>();

}
项目:tools-idea    文件:TodoPackageNode.java   
public TodoPackageNode(@NotNull Project project,
                       PackageElement element,
                       TodoTreeBuilder builder,
                       @Nullable String name) {
  super(project, element, ViewSettings.DEFAULT);
  myBuilder = builder;
  myHighlightedRegions = new ArrayList<HighlightedRegion>(2);
  if (element != null && name == null){
    final PsiPackage aPackage = element.getPackage();
    myPresentationName = aPackage.getName();
  }
  else {
    myPresentationName = name;
  }
}
项目:tools-idea    文件:TodoCompositeRenderer.java   
@Override
public Component getTreeCellRendererComponent(JTree tree, Object obj, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  Component result;

  Object userObject = ((DefaultMutableTreeNode)obj).getUserObject();
  if (userObject instanceof SummaryNode) {
    myNodeRenderer.getTreeCellRendererComponent(tree, userObject.toString(), selected, expanded, leaf, row, hasFocus);
    myNodeRenderer.setFont(UIUtil.getTreeFont().deriveFont(Font.BOLD));
    myNodeRenderer.setIcon(null);
    result = myNodeRenderer;
  }
  else if (userObject instanceof NodeDescriptor && userObject instanceof HighlightedRegionProvider) {
    NodeDescriptor descriptor = (NodeDescriptor)userObject;
    HighlightedRegionProvider regionProvider = (HighlightedRegionProvider)userObject;
    myColorTreeCellRenderer.getTreeCellRendererComponent(tree, obj, selected, expanded, leaf, row, hasFocus);
    for (HighlightedRegion region : regionProvider.getHighlightedRegions()) {
      myColorTreeCellRenderer.addHighlighter(region.startOffset, region.endOffset, region.textAttributes);
    }
    myColorTreeCellRenderer.setIcon(descriptor.getIcon());
    result = myColorTreeCellRenderer;
  }
  else {
    result = myNodeRenderer.getTreeCellRendererComponent(tree, null, selected, expanded, leaf, row, hasFocus);
  }

  if (result instanceof JComponent) {
    ((JComponent)result).setOpaque(!selected);
  }

  return result;
}
项目:tools-idea    文件:TodoDirNode.java   
public TodoDirNode(Project project,
                   PsiDirectory directory,
                   TodoTreeBuilder builder) {
  super(project, directory, ViewSettings.DEFAULT);
  myBuilder = builder;
  myHighlightedRegions = new ArrayList<HighlightedRegion>(2);
}
项目:tools-idea    文件:TodoDirNode.java   
@Override
protected void updateImpl(PresentationData data) {
  super.updateImpl(data);
  int fileCount = getFileCount(getValue());
  if (getValue() == null || !getValue().isValid() || fileCount == 0) {
    setValue(null);
    return;
  }

  VirtualFile directory = getValue().getVirtualFile();
  boolean isProjectRoot = !ProjectRootManager.getInstance(getProject()).getFileIndex().isInContent(directory);
  String newName = isProjectRoot || getStructure().getIsFlattenPackages() ? getValue().getVirtualFile().getPresentableUrl() : getValue().getName();

  int nameEndOffset = newName.length();
  int todoItemCount = getTodoItemCount(getValue());
  newName = IdeBundle.message("node.todo.group", newName, todoItemCount, fileCount);

  myHighlightedRegions.clear();

  TextAttributes textAttributes = new TextAttributes();
  Color newColor = FileStatusManager.getInstance(getProject()).getStatus(getValue().getVirtualFile()).getColor();

  if (CopyPasteManager.getInstance().isCutElement(getValue())) {
    newColor = CopyPasteManager.CUT_COLOR;
  }
  textAttributes.setForegroundColor(newColor);
  myHighlightedRegions.add(new HighlightedRegion(0, nameEndOffset, textAttributes));

  EditorColorsScheme colorsScheme = UsageTreeColorsScheme.getInstance().getScheme();
  myHighlightedRegions.add(
    new HighlightedRegion(nameEndOffset, newName.length(), colorsScheme.getAttributes(UsageTreeColors.NUMBER_OF_USAGES)));

  data.setPresentableText(newName);
}
项目:tools-idea    文件:TodoFileNode.java   
public TodoFileNode(Project project,
                    PsiFile file,
                    TodoTreeBuilder treeBuilder,
                    boolean singleFileMode){
  super(project,file,ViewSettings.DEFAULT);
  myBuilder=treeBuilder;
  myHighlightedRegions=new ArrayList<HighlightedRegion>(2);
  mySingleFileMode=singleFileMode;
}
项目:tools-idea    文件:TodoFileNode.java   
@Override
protected void updateImpl(PresentationData data) {
  super.updateImpl(data);
  String newName;
  if(myBuilder.getTodoTreeStructure().isPackagesShown()){
    newName=getValue().getName();
  }else{
    newName=mySingleFileMode ? getValue().getName() : getValue().getVirtualFile().getPresentableUrl();
  }

  int nameEndOffset=newName.length();
  int todoItemCount;
  try {
    todoItemCount = myBuilder.getTodoTreeStructure().getTodoItemCount(getValue());
  }
  catch (IndexNotReadyException e) {
    return;
  }
  if(mySingleFileMode){
    if(todoItemCount==0){
      newName = IdeBundle.message("node.todo.no.items.found", newName);
    } else {
      newName = IdeBundle.message("node.todo.found.items", newName, todoItemCount);
    }
  }else{
    newName = IdeBundle.message("node.todo.items", newName, todoItemCount);
  }

  myHighlightedRegions.clear();

  TextAttributes textAttributes=new TextAttributes();
  textAttributes.setForegroundColor(myColor);
  myHighlightedRegions.add(new HighlightedRegion(0,nameEndOffset,textAttributes));

  EditorColorsScheme colorsScheme=UsageTreeColorsScheme.getInstance().getScheme();
  myHighlightedRegions.add(
    new HighlightedRegion(nameEndOffset,newName.length(),colorsScheme.getAttributes(UsageTreeColors.NUMBER_OF_USAGES))
  );

}
项目:tools-idea    文件:TodoItemNode.java   
public TodoItemNode(Project project,
                    SmartTodoItemPointer value,
                    TodoTreeBuilder builder) {
  super(project, value, builder);
  RangeMarker rangeMarker = getValue().getRangeMarker();
  LOG.assertTrue(rangeMarker.isValid());

  myHighlightedRegions=new ArrayList<HighlightedRegion>();

}
项目:consulo    文件:TodoCompositeRenderer.java   
@Override
public Component getTreeCellRendererComponent(JTree tree, Object obj, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  Component result;

  Object userObject = ((DefaultMutableTreeNode)obj).getUserObject();
  if (userObject instanceof SummaryNode) {
    myNodeRenderer.getTreeCellRendererComponent(tree, userObject.toString(), selected, expanded, leaf, row, hasFocus);
    myNodeRenderer.setFont(UIUtil.getTreeFont().deriveFont(Font.BOLD));
    myNodeRenderer.setIcon(null);
    result = myNodeRenderer;
  }
  else if (userObject instanceof NodeDescriptor && userObject instanceof HighlightedRegionProvider) {
    NodeDescriptor descriptor = (NodeDescriptor)userObject;
    HighlightedRegionProvider regionProvider = (HighlightedRegionProvider)userObject;
    myColorTreeCellRenderer.getTreeCellRendererComponent(tree, obj, selected, expanded, leaf, row, hasFocus);
    for (HighlightedRegion region : regionProvider.getHighlightedRegions()) {
      myColorTreeCellRenderer.addHighlighter(region.startOffset, region.endOffset, region.textAttributes);
    }
    myColorTreeCellRenderer.setIcon(descriptor.getIcon());
    result = myColorTreeCellRenderer;
  }
  else {
    result = myNodeRenderer.getTreeCellRendererComponent(tree, null, selected, expanded, leaf, row, hasFocus);
  }

  if (result instanceof JComponent) {
    ((JComponent)result).setOpaque(!selected);
  }

  return result;
}
项目:consulo    文件:TodoPackageNode.java   
public TodoPackageNode(@Nonnull Project project,
                       PackageElement element,
                       TodoTreeBuilder builder,
                       @Nullable String name) {
  super(project, element, ViewSettings.DEFAULT);
  myBuilder = builder;
  myHighlightedRegions = new ArrayList<HighlightedRegion>(2);
  if (element != null && name == null){
    final PsiPackage aPackage = element.getPackage();
    myPresentationName = aPackage.getName();
  }
  else {
    myPresentationName = name;
  }
}
项目:consulo    文件:TodoDirNode.java   
public TodoDirNode(Project project,
                   PsiDirectory directory,
                   TodoTreeBuilder builder) {
  super(project, directory, ViewSettings.DEFAULT);
  myBuilder = builder;
  myHighlightedRegions = new ArrayList<HighlightedRegion>(2);
}
项目:consulo    文件:TodoDirNode.java   
@Override
protected void updateImpl(PresentationData data) {
  super.updateImpl(data);
  int fileCount = getFileCount(getValue());
  if (getValue() == null || !getValue().isValid() || fileCount == 0) {
    setValue(null);
    return;
  }

  VirtualFile directory = getValue().getVirtualFile();
  boolean isProjectRoot = !ProjectRootManager.getInstance(getProject()).getFileIndex().isInContent(directory);
  String newName = isProjectRoot || getStructure().getIsFlattenPackages() ? getValue().getVirtualFile().getPresentableUrl() : getValue().getName();

  int nameEndOffset = newName.length();
  int todoItemCount = getTodoItemCount(getValue());
  newName = IdeBundle.message("node.todo.group", newName, todoItemCount, fileCount);

  myHighlightedRegions.clear();

  TextAttributes textAttributes = new TextAttributes();
  Color newColor = FileStatusManager.getInstance(getProject()).getStatus(getValue().getVirtualFile()).getColor();

  if (CopyPasteManager.getInstance().isCutElement(getValue())) {
    newColor = CopyPasteManager.CUT_COLOR;
  }
  textAttributes.setForegroundColor(newColor);
  myHighlightedRegions.add(new HighlightedRegion(0, nameEndOffset, textAttributes));

  EditorColorsScheme colorsScheme = UsageTreeColorsScheme.getInstance().getScheme();
  myHighlightedRegions.add(
    new HighlightedRegion(nameEndOffset, newName.length(), colorsScheme.getAttributes(UsageTreeColors.NUMBER_OF_USAGES)));

  data.setPresentableText(newName);
}
项目:consulo    文件:TodoFileNode.java   
public TodoFileNode(Project project,
                    PsiFile file,
                    TodoTreeBuilder treeBuilder,
                    boolean singleFileMode){
  super(project,file,ViewSettings.DEFAULT);
  myBuilder=treeBuilder;
  myHighlightedRegions=new ArrayList<HighlightedRegion>(2);
  mySingleFileMode=singleFileMode;
}
项目:consulo    文件:TodoFileNode.java   
@Override
protected void updateImpl(PresentationData data) {
  super.updateImpl(data);
  String newName;
  if(myBuilder.getTodoTreeStructure().isPackagesShown()){
    newName=getValue().getName();
  }else{
    newName=mySingleFileMode ? getValue().getName() : getValue().getVirtualFile().getPresentableUrl();
  }

  int nameEndOffset=newName.length();
  int todoItemCount;
  try {
    todoItemCount = myBuilder.getTodoTreeStructure().getTodoItemCount(getValue());
  }
  catch (IndexNotReadyException e) {
    return;
  }
  if(mySingleFileMode){
    if(todoItemCount==0){
      newName = IdeBundle.message("node.todo.no.items.found", newName);
    } else {
      newName = IdeBundle.message("node.todo.found.items", newName, todoItemCount);
    }
  }else{
    newName = IdeBundle.message("node.todo.items", newName, todoItemCount);
  }

  myHighlightedRegions.clear();

  TextAttributes textAttributes=new TextAttributes();
  textAttributes.setForegroundColor(myColor);
  myHighlightedRegions.add(new HighlightedRegion(0,nameEndOffset,textAttributes));

  EditorColorsScheme colorsScheme=UsageTreeColorsScheme.getInstance().getScheme();
  myHighlightedRegions.add(
    new HighlightedRegion(nameEndOffset,newName.length(),colorsScheme.getAttributes(UsageTreeColors.NUMBER_OF_USAGES))
  );

}
项目:consulo    文件:TodoItemNode.java   
public TodoItemNode(Project project,
                    SmartTodoItemPointer value,
                    TodoTreeBuilder builder) {
  super(project, value, builder);
  RangeMarker rangeMarker = getValue().getRangeMarker();
  LOG.assertTrue(rangeMarker.isValid());

  myHighlightedRegions=new ArrayList<HighlightedRegion>();

}
项目:intellij-ce-playground    文件:TodoPackageNode.java   
@Override
public ArrayList<HighlightedRegion> getHighlightedRegions() {
  return myHighlightedRegions;
}
项目:intellij-ce-playground    文件:TodoPackageNode.java   
@Override
protected void update(PresentationData data) {
  super.update(data);
  final PackageElement packageElement = getValue();

  try {
    if (packageElement == null || !packageElement.getPackage().isValid()) {
      setValue(null);
      return;
    }

    int fileCount = getFileCount(packageElement);
    if (fileCount == 0){
      setValue(null);
      return;
    }

    PsiPackage aPackage = packageElement.getPackage();
    String newName;
    if (getStructure().areFlattenPackages()) {
      newName = aPackage.getQualifiedName();
    }
    else {
      newName = myPresentationName != null ? myPresentationName : "";
    }

    int nameEndOffset = newName.length();
    int todoItemCount = getTodoItemCount(packageElement);
    newName = IdeBundle.message("node.todo.group", newName, todoItemCount, fileCount);

    myHighlightedRegions.clear();

    TextAttributes textAttributes = new TextAttributes();
    Color newColor = null;

    if (CopyPasteManager.getInstance().isCutElement(packageElement)) {
      newColor = CopyPasteManager.CUT_COLOR;
    }
    textAttributes.setForegroundColor(newColor);
    myHighlightedRegions.add(new HighlightedRegion(0, nameEndOffset, textAttributes));

    EditorColorsScheme colorsScheme = UsageTreeColorsScheme.getInstance().getScheme();
    myHighlightedRegions.add(
      new HighlightedRegion(nameEndOffset, newName.length(), colorsScheme.getAttributes(UsageTreeColors.NUMBER_OF_USAGES)));

    data.setPresentableText(newName);
  }
  catch (IndexNotReadyException e) {
    LOG.info(e);
    data.setPresentableText("N/A");
  }
}
项目:intellij-ce-playground    文件:ModuleToDoNode.java   
public ModuleToDoNode(Project project, Module value, TodoTreeBuilder builder) {
  super(project, value, builder);
  myHighlightedRegions = new ArrayList<HighlightedRegion>(2);
}
项目:intellij-ce-playground    文件:ModuleToDoNode.java   
@Override
public ArrayList<HighlightedRegion> getHighlightedRegions() {
  return myHighlightedRegions;
}
项目:intellij-ce-playground    文件:TodoDirNode.java   
@Override
public ArrayList<HighlightedRegion> getHighlightedRegions() {
  return myHighlightedRegions;
}
项目:intellij-ce-playground    文件:TodoFileNode.java   
@Override
public ArrayList<HighlightedRegion> getHighlightedRegions(){
  return myHighlightedRegions;
}
项目:intellij-ce-playground    文件:TodoItemNode.java   
@Override
public ArrayList<HighlightedRegion> getHighlightedRegions(){
  return myHighlightedRegions;
}
项目:tools-idea    文件:TodoPackageNode.java   
@Override
public ArrayList<HighlightedRegion> getHighlightedRegions() {
  return myHighlightedRegions;
}
项目:tools-idea    文件:TodoPackageNode.java   
@Override
protected void update(PresentationData data) {
  super.update(data);
  final PackageElement packageElement = getValue();

  try {
    if (packageElement == null || !packageElement.getPackage().isValid()) {
      setValue(null);
      return;
    }

    int fileCount = getFileCount(packageElement);
    if (fileCount == 0){
      setValue(null);
      return;
    }

    PsiPackage aPackage = packageElement.getPackage();
    String newName;
    if (getStructure().areFlattenPackages()) {
      newName = aPackage.getQualifiedName();
    }
    else {
      newName = myPresentationName != null ? myPresentationName : "";
    }

    int nameEndOffset = newName.length();
    int todoItemCount = getTodoItemCount(packageElement);
    newName = IdeBundle.message("node.todo.group", newName, todoItemCount, fileCount);

    myHighlightedRegions.clear();

    TextAttributes textAttributes = new TextAttributes();
    Color newColor = null;

    if (CopyPasteManager.getInstance().isCutElement(packageElement)) {
      newColor = CopyPasteManager.CUT_COLOR;
    }
    textAttributes.setForegroundColor(newColor);
    myHighlightedRegions.add(new HighlightedRegion(0, nameEndOffset, textAttributes));

    EditorColorsScheme colorsScheme = UsageTreeColorsScheme.getInstance().getScheme();
    myHighlightedRegions.add(
      new HighlightedRegion(nameEndOffset, newName.length(), colorsScheme.getAttributes(UsageTreeColors.NUMBER_OF_USAGES)));

    data.setPresentableText(newName);
  }
  catch (IndexNotReadyException e) {
    LOG.info(e);
    data.setPresentableText("N/A");
  }
}
项目:tools-idea    文件:ModuleToDoNode.java   
public ModuleToDoNode(Project project, Module value, TodoTreeBuilder builder) {
  super(project, value, builder);
  myHighlightedRegions = new ArrayList<HighlightedRegion>(2);
}
项目:tools-idea    文件:ModuleToDoNode.java   
@Override
public ArrayList<HighlightedRegion> getHighlightedRegions() {
  return myHighlightedRegions;
}
项目:tools-idea    文件:TodoDirNode.java   
@Override
public ArrayList<HighlightedRegion> getHighlightedRegions() {
  return myHighlightedRegions;
}
项目:tools-idea    文件:TodoFileNode.java   
@Override
public ArrayList<HighlightedRegion> getHighlightedRegions(){
  return myHighlightedRegions;
}
项目:tools-idea    文件:TodoItemNode.java   
@Override
public ArrayList<HighlightedRegion> getHighlightedRegions(){
  return myHighlightedRegions;
}
项目:consulo    文件:TodoPackageNode.java   
@Override
public ArrayList<HighlightedRegion> getHighlightedRegions() {
  return myHighlightedRegions;
}
项目:consulo    文件:TodoPackageNode.java   
@Override
protected void update(PresentationData data) {
  super.update(data);
  final PackageElement packageElement = getValue();

  try {
    if (packageElement == null || !packageElement.getPackage().isValid()) {
      setValue(null);
      return;
    }

    int fileCount = getFileCount(packageElement);
    if (fileCount == 0){
      setValue(null);
      return;
    }

    PsiPackage aPackage = packageElement.getPackage();
    String newName;
    if (getStructure().areFlattenPackages()) {
      newName = aPackage.getQualifiedName();
    }
    else {
      newName = myPresentationName != null ? myPresentationName : "";
    }

    int nameEndOffset = newName.length();
    int todoItemCount = getTodoItemCount(packageElement);
    newName = IdeBundle.message("node.todo.group", newName, todoItemCount, fileCount);

    myHighlightedRegions.clear();

    TextAttributes textAttributes = new TextAttributes();
    Color newColor = null;

    if (CopyPasteManager.getInstance().isCutElement(packageElement)) {
      newColor = CopyPasteManager.CUT_COLOR;
    }
    textAttributes.setForegroundColor(newColor);
    myHighlightedRegions.add(new HighlightedRegion(0, nameEndOffset, textAttributes));

    EditorColorsScheme colorsScheme = UsageTreeColorsScheme.getInstance().getScheme();
    myHighlightedRegions.add(
      new HighlightedRegion(nameEndOffset, newName.length(), colorsScheme.getAttributes(UsageTreeColors.NUMBER_OF_USAGES)));

    data.setPresentableText(newName);
  }
  catch (IndexNotReadyException e) {
    ProjectViewNode.LOG.info(e);
    data.setPresentableText("N/A");
  }
}