Java Code Examples for consulo.ide.IconDescriptorUpdaters#getIcon()

The following examples show how to use consulo.ide.IconDescriptorUpdaters#getIcon() . 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: PsiFileImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public ItemPresentation getPresentation() {
  return new ItemPresentation() {
    @Override
    public String getPresentableText() {
      return getName();
    }

    @Override
    public String getLocationString() {
      final PsiDirectory psiDirectory = getParent();
      if (psiDirectory != null) {
        return psiDirectory.getVirtualFile().getPresentableUrl();
      }
      return null;
    }

    @Override
    public Image getIcon() {
      return IconDescriptorUpdaters.getIcon(PsiFileImpl.this, 0);
    }
  };
}
 
Example 2
Source File: CSharpBaseGroupingRule.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public Image getIcon()
{
	T element = myPointer.getElement();
	if(element == null)
	{
		return null;
	}
	return IconDescriptorUpdaters.getIcon(element, Iconable.ICON_FLAG_VISIBILITY | Iconable.ICON_FLAG_READ_STATUS);
}
 
Example 3
Source File: UsageInfo2UsageAdapter.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Image getIcon() {
  Image icon = myIcon;
  if (icon == null) {
    PsiElement psiElement = getElement();
    myIcon = icon = psiElement != null && psiElement.isValid() ? IconDescriptorUpdaters.getIcon(psiElement, 0) : null;
  }
  return icon;
}
 
Example 4
Source File: PomTargetPsiElementImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Image getIcon() {
  Image icon = TypePresentationService.getInstance().getIcon(myTarget);
  if (icon != null) return icon;

  if (myTarget instanceof PsiTarget) {
    return IconDescriptorUpdaters.getIcon(((PsiTarget)myTarget).getNavigationElement(), 0);
  }
  return null;
}
 
Example 5
Source File: PsiTreeElementBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Image getIcon() {
  final PsiElement element = getElement();
  if (element != null) {
    int flags = Iconable.ICON_FLAG_READ_STATUS;
    if (!(element instanceof PsiFile) || !element.isWritable()) flags |= Iconable.ICON_FLAG_VISIBILITY;
    return IconDescriptorUpdaters.getIcon(element, flags);
  }
  else {
    return null;
  }
}
 
Example 6
Source File: SmartElementDescriptor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public boolean update() {
  PsiElement element = mySmartPointer.getElement();
  if (element == null) return true;
  int flags = Iconable.ICON_FLAG_VISIBILITY;
  if (isMarkReadOnly()){
    flags |= Iconable.ICON_FLAG_READ_STATUS;
  }
  consulo.ui.image.Image icon = null;
  try {
    icon = IconDescriptorUpdaters.getIcon(element, flags);
  }
  catch (IndexNotReadyException ignored) {
  }
  Color color = null;

  if (isMarkModified() ){
    VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element);
    if (virtualFile != null) {
      color = FileStatusManager.getInstance(myProject).getStatus(virtualFile).getColor();
    }
  }
  if (CopyPasteManager.getInstance().isCutElement(element)) {
    color = CopyPasteManager.CUT_COLOR;
  }

  boolean changes = !Comparing.equal(icon, getIcon()) || !Comparing.equal(color, myColor);
  setIcon(icon);
  myColor = color;
  return changes;
}
 
Example 7
Source File: IconUtilEx.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static Image getIcon(Object object, @Iconable.IconFlags int flags, Project project) {
  if (object instanceof PsiElement) {
    return IconDescriptorUpdaters.getIcon(((PsiElement)object), flags);
  }
  if (object instanceof Module) {
    return AllIcons.Nodes.Module;
  }
  if (object instanceof VirtualFile) {
    VirtualFile file = (VirtualFile)object;
    return VfsIconUtil.getIcon(file, flags, project);
  }
  return null;
}
 
Example 8
Source File: CSharpQualifiedElementPresentationProvider.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public Image getIcon()
{
	return IconDescriptorUpdaters.getIcon(myDeclaration, Iconable.ICON_FLAG_VISIBILITY);
}
 
Example 9
Source File: PsiElementUsageGroupBase.java    From consulo with Apache License 2.0 4 votes vote down vote up
public PsiElementUsageGroupBase(@Nonnull T element) {
  this(element, IconDescriptorUpdaters.getIcon(element, 0));
}
 
Example 10
Source File: XLineBreakpointType.java    From consulo with Apache License 2.0 4 votes vote down vote up
@RequiredReadAction
@Override
public Image getIcon() {
  return IconDescriptorUpdaters.getIcon(myElement, 0);
}
 
Example 11
Source File: PsiElementListCellRenderer.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected Image getIcon(PsiElement element) {
  return IconDescriptorUpdaters.getIcon(element, getIconFlags());
}