com.intellij.openapi.roots.ui.util.CompositeAppearance Java Examples

The following examples show how to use com.intellij.openapi.roots.ui.util.CompositeAppearance. 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: AbstractSlingServerNodeDescriptor.java    From aem-ide-tooling-4-intellij with Apache License 2.0 5 votes vote down vote up
public static boolean addShortcutText(String actionId, CompositeAppearance appearance) {
    Keymap activeKeymap = KeymapManager.getInstance().getActiveKeymap();
    Shortcut[] shortcuts = activeKeymap.getShortcuts(actionId);
    if (shortcuts != null && shortcuts.length > 0) {
        appearance.getEnding().addText(" (" + KeymapUtil.getShortcutText(shortcuts[0]) + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
        return true;
    } else return false;
}
 
Example #2
Source File: OrderEntryAppearanceServiceImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public CellAppearanceEx forSdk(@Nullable final Sdk jdk, final boolean isInComboBox, final boolean selected, final boolean showVersion) {
  if (jdk == null) {
    return SimpleTextCellAppearance.invalid(ProjectBundle.message("unknown.sdk"), AllIcons.Toolbar.Unknown);
  }

  String name = jdk.getName();
  CompositeAppearance appearance = new CompositeAppearance();
  SdkType sdkType = (SdkType)jdk.getSdkType();
  appearance.setIcon(SdkUtil.getIcon(jdk));
  SimpleTextAttributes attributes = getTextAttributes(sdkType.sdkHasValidPath(jdk), selected);
  CompositeAppearance.DequeEnd ending = appearance.getEnding();
  ending.addText(name, attributes);

  if (showVersion) {
    String versionString = jdk.getVersionString();
    if (versionString != null && !versionString.equals(name)) {
      SimpleTextAttributes textAttributes = isInComboBox && !selected ? SimpleTextAttributes.SYNTHETIC_ATTRIBUTES :
                                            SystemInfo.isMac && selected ? new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, 
                                                                                                    Color.WHITE): SimpleTextAttributes.GRAY_ATTRIBUTES;
      ending.addComment(versionString, textAttributes);
    }
  }

  return ending.getAppearance();
}
 
Example #3
Source File: AbstractSlingServerNodeDescriptor.java    From aem-ide-tooling-4-intellij with Apache License 2.0 4 votes vote down vote up
public AbstractSlingServerNodeDescriptor(final Project project, final NodeDescriptor parentDescriptor, final T target) {
    super(project, parentDescriptor);
    myTarget = target;
    myHighlightedText = new CompositeAppearance();
}
 
Example #4
Source File: HierarchyNodeDescriptor.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected HierarchyNodeDescriptor(@Nonnull Project project, final NodeDescriptor parentDescriptor, @Nonnull PsiElement element, final boolean isBase) {
  super(project, parentDescriptor, element);
  myHighlightedText = new CompositeAppearance();
  myName = "";
  myIsBase = isBase;
}
 
Example #5
Source File: HierarchyNodeDescriptor.java    From consulo with Apache License 2.0 4 votes vote down vote up
public final CompositeAppearance getHighlightedText() {
  return myHighlightedText;
}