consulo.ui.image.Image Java Examples

The following examples show how to use consulo.ui.image.Image. 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: ShaderReference.java    From consulo-unity3d with Apache License 2.0 6 votes vote down vote up
@RequiredReadAction
public static void consumeProperties(@Nonnull ShaderLabFile file, @Nonnull Consumer<LookupElement> consumer)
{
	for(ShaderProperty shaderProperty : file.getProperties())
	{
		String name = shaderProperty.getName();
		if(name == null)
		{
			continue;
		}
		LookupElementBuilder builder = LookupElementBuilder.create(name);
		builder = builder.withIcon((Image) AllIcons.Nodes.Property);
		ShaderPropertyType type = shaderProperty.getType();
		if(type != null)
		{
			builder = builder.withTypeText(type.getTargetText(), true);
		}
		consumer.consume(builder);
	}
}
 
Example #2
Source File: DesktopDeferredIconImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public Image evaluateImage() {
  consulo.ui.image.Image result;
  try {
    result = nonNull(myEvaluator.fun(myParam));
  }
  catch (IndexNotReadyException e) {
    result = EMPTY_ICON;
  }

  if (Holder.CHECK_CONSISTENCY) {
    checkDoesntReferenceThis(result);
  }

  Icon icon = TargetAWT.to(result);

  if (getScale() != 1f && icon instanceof ScalableIcon) {
    icon = ((ScalableIcon)result).scale(getScale());
  }
  return TargetAWT.from(icon);
}
 
Example #3
Source File: NotificationsUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static Image getIcon(@Nonnull final Notification notification) {
  Image icon = notification.getIcon();
  if (icon != null) {
    return icon;
  }

  switch (notification.getType()) {
    case WARNING:
      return AllIcons.General.BalloonWarning;
    case ERROR:
      return AllIcons.Ide.FatalError;
    case INFORMATION:
    default:
      return AllIcons.General.BalloonInformation;
  }
}
 
Example #4
Source File: UserFileType.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public Image getIcon() {
  Image icon = myIcon;
  if (icon == null) {
    if (myIconPath != null) {
      icon = IconLoader.getIcon(myIconPath);
      myIcon = icon;
    }

    if (icon == null) {
      // to not load PlatformIcons on UserFileType instantiation
      icon = AllIcons.FileTypes.Custom;
    }
  }
  return icon;
}
 
Example #5
Source File: ActionManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void setIconFromClass(@Nonnull Class<?> actionClass,
                                     @Nonnull final ClassLoader classLoader,
                                     @Nonnull final String iconPath,
                                     @Nonnull Presentation presentation,
                                     final PluginId pluginId) {
  Image lazyIcon = consulo.ui.image.Image.lazy(() -> {
    //try to find icon in idea class path
    consulo.ui.image.Image icon = IconLoader.findIcon(iconPath, actionClass, true);
    if (icon == null) {
      icon = IconLoader.findIcon(iconPath, classLoader);
    }

    if (icon == null) {
      reportActionError(pluginId, "Icon cannot be found in '" + iconPath + "', action class='" + actionClass + "'");
      icon = AllIcons.Toolbar.Unknown;
    }

    return icon;
  });

  presentation.setIcon(lazyIcon);
}
 
Example #6
Source File: Notification.java    From consulo with Apache License 2.0 6 votes vote down vote up
/**
 * @param groupDisplayId this should be a human-readable, capitalized string like "Facet Detector".
 *                       It will appear in "Notifications" configurable.
 * @param icon           notification icon, if <b>null</b> used icon from type
 * @param title          notification title
 * @param subtitle       notification subtitle
 * @param content        notification content
 * @param type           notification type
 * @param listener       notification lifecycle listener
 */
public Notification(@Nonnull String groupDisplayId,
                    @Nullable Image icon,
                    @Nullable String title,
                    @Nullable String subtitle,
                    @Nullable String content,
                    @Nonnull NotificationType type,
                    @Nullable NotificationListener listener) {
  myGroupId = groupDisplayId;
  myTitle = StringUtil.notNullize(title);
  myContent = StringUtil.notNullize(content);
  myType = type;
  myListener = listener;
  myTimestamp = System.currentTimeMillis();

  myIcon = icon;
  mySubtitle = subtitle;

  assertHasTitleOrContent();
  id = calculateId(this);
}
 
Example #7
Source File: IconDescriptorUpdaters.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static Image computeBaseIcon(@Nonnull PsiElement element) {
  PsiFile containingFile = element.getContainingFile();
  if (containingFile != null) {
    VirtualFile virtualFile = containingFile.getVirtualFile();
    if (virtualFile != null) {
      Image icon = virtualFile.getFileType().getIcon();
      if (icon != null) {
        return icon;
      }
    }
  }
  return AllIcons.Nodes.NodePlaceholder;
}
 
Example #8
Source File: ReopenProjectAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public Image getExtensionIcon() {
  List<String> extensions = getExtensions();
  Image moduleMainIcon = Image.empty(16);
  if (!extensions.isEmpty()) {
    for (String extensionId : extensions) {
      ModuleExtensionProviderEP provider = ModuleExtensionProviders.findProvider(extensionId);
      if (provider != null) {
        moduleMainIcon = provider.getIcon();
        break;
      }
    }
  }
  return moduleMainIcon;
}
 
Example #9
Source File: NamedLibraryElementNode.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static Image getIconForLibrary(OrderEntry orderEntry) {
  if (orderEntry instanceof LibraryOrderEntry) {
    Library library = ((LibraryOrderEntry)orderEntry).getLibrary();
    if (library != null) {
      return LibraryPresentationManager.getInstance().getNamedLibraryIcon(library, null);
    }
  }
  return AllIcons.Nodes.PpLib;
}
 
Example #10
Source File: PsiElementUsageGroupBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
public PsiElementUsageGroupBase(@Nonnull T element, Image icon) {
  String myName = element.getName();
  if (myName == null) myName = "<anonymous>";
  this.myName = myName;
  myElementPointer = SmartPointerManager.getInstance(element.getProject()).createSmartPsiElementPointer(element);

  myIcon = icon;
}
 
Example #11
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 #12
Source File: LambdaLineMarkerCollector.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
public MarkerInfo(@Nonnull PsiElement element,
		@Nonnull TextRange textRange,
		Image icon,
		int updatePass,
		@Nullable Function<? super PsiElement, String> tooltipProvider,
		@Nullable GutterIconNavigationHandler<PsiElement> navHandler,
		@Nonnull GutterIconRenderer.Alignment alignment)
{
	super(element, textRange, icon, updatePass, tooltipProvider, navHandler, alignment);
}
 
Example #13
Source File: MergeableLineMarkerInfo.java    From consulo with Apache License 2.0 5 votes vote down vote up
public MergeableLineMarkerInfo(@Nonnull T element,
                               @Nonnull TextRange textRange,
                               Image icon,
                               int updatePass,
                               @Nullable Function<? super T, String> tooltipProvider,
                               @Nullable GutterIconNavigationHandler<T> navHandler,
                               @Nonnull GutterIconRenderer.Alignment alignment) {
  super(element, textRange, icon, updatePass, tooltipProvider, navHandler, alignment);
}
 
Example #14
Source File: TemplateLanguageStructureViewBuilder.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@Nonnull
public StructureViewModel createStructureViewModel(@Nullable Editor editor) {
  List<StructureViewComposite.StructureViewDescriptor> viewDescriptors = new ArrayList<>();
  PsiFile psiFile = ObjectUtils.notNull(PsiManager.getInstance(myProject).findFile(myVirtualFile));
  for (Language language : getLanguages(psiFile)) {
    StructureViewBuilder builder = getBuilder(psiFile, language);
    if (!(builder instanceof TreeBasedStructureViewBuilder)) continue;
    StructureViewModel model = ((TreeBasedStructureViewBuilder)builder).createStructureViewModel(editor);
    String title = language.getDisplayName();
    Image icon = ObjectUtils.notNull(LanguageUtil.getLanguageFileType(language), UnknownFileType.INSTANCE).getIcon();
    viewDescriptors.add(new StructureViewComposite.StructureViewDescriptor(title, model, icon));
  }
  return new StructureViewCompositeModel(psiFile, editor, viewDescriptors);
}
 
Example #15
Source File: ModuleExtensionProviderEP.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
protected Image compute() {
  if (StringUtil.isEmpty(icon)) {
    return AllIcons.Toolbar.Unknown;
  }
  Image temp = IconLoader.findIcon(icon, getLoaderForClass());
  return temp == null ? AllIcons.Toolbar.Unknown : temp;
}
 
Example #16
Source File: TextConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
public TextConfigurable(final T object,
                        final String displayName,
                        final String bannerSlogan,
                        final String descriptionText,
                        final Image closedIcon) {
  myDisplayName = displayName;
  myBannerSlogan = bannerSlogan;
  myDescriptionText = descriptionText;
  myClosedIcon = closedIcon;
  myObject = object;
}
 
Example #17
Source File: XLineBreakpointImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void updateIcon() {
  Image icon = calculateSpecialIcon();
  if (icon == null) {
    icon = isTemporary() ? myType.getTemporaryIcon() : myType.getEnabledIcon();
  }
  setIcon(icon);
}
 
Example #18
Source File: ActionGroup.java    From consulo with Apache License 2.0 4 votes vote down vote up
public ActionGroup(@Nls(capitalization = Nls.Capitalization.Title) String text, @Nls(capitalization = Nls.Capitalization.Sentence) String description, Image icon) {
  super(text, description, icon);
}
 
Example #19
Source File: XLineBreakpointType.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
@RequiredReadAction
public abstract Image getIcon();
 
Example #20
Source File: Content.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
Image getIcon();
 
Example #21
Source File: WebMenuItemImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void setIcon(@Nullable Image icon) {
  Vaadin vaadinComponent = getVaadinComponent();
  vaadinComponent.getState().myImageState = icon == null ? null : WebImageUrlCache.map(icon).getState();
  vaadinComponent.markAsDirty();
}
 
Example #22
Source File: ProjectOpenProcessor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
public abstract Image getIcon(@Nonnull VirtualFile file);
 
Example #23
Source File: SandExecutor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Image getDisabledIcon() {
  return AllIcons.Ide.HectorOff;
}
 
Example #24
Source File: ConfigurationFactory.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
public Image getIcon() {
  return myType.getIcon();
}
 
Example #25
Source File: Presentation.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void setIcon(@Nullable Image image) {
  setIcon(TargetAWT.to(image));
}
 
Example #26
Source File: TargetAWTFacadeStub.java    From consulo with Apache License 2.0 4 votes vote down vote up
private IconWrapper(Image image) {
  myImage = image;
}
 
Example #27
Source File: XBreakpointCustomGroup.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
@Nullable
public Image getIcon(final boolean isOpen) {
  return AllIcons.Nodes.NewFolder;
}
 
Example #28
Source File: UsageGroup.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
Image getIcon();
 
Example #29
Source File: ModuleConfigurable.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Image getIcon(final boolean open) {
  return AllIcons.Nodes.Module;
}
 
Example #30
Source File: RemoteServerListConfigurable.java    From consulo with Apache License 2.0 4 votes vote down vote up
private AddRemoteServerAction(ServerType<?> serverType, final Image icon) {
  super(serverType.getPresentableName(), null, TargetAWT.to(icon));
  myServerType = serverType;
}