com.intellij.util.PlatformIcons Java Examples

The following examples show how to use com.intellij.util.PlatformIcons. 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: TableModelEditor.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public JComponent createComponent() {
  return toolbarDecorator.addExtraAction(
    new ToolbarDecorator.ElementActionButton(IdeBundle.message("button.copy"), PlatformIcons.COPY_ICON) {
      @Override
      public void actionPerformed(@Nonnull AnActionEvent e) {
        TableUtil.stopEditing(table);

        List<T> selectedItems = table.getSelectedObjects();
        if (selectedItems.isEmpty()) {
          return;
        }

        for (T item : selectedItems) {
          model.addRow(itemEditor.clone(item, false));
        }

        IdeFocusManager.getGlobalInstance().doForceFocusWhenFocusSettlesDown(table);
        TableUtil.updateScroller(table);
      }
    }
  ).createPanel();
}
 
Example #2
Source File: CreateRTAction.java    From react-templates-plugin with MIT License 6 votes vote down vote up
public MyDialog(final Project project, final MyInputValidator validator) {
            super(project, true);
            myProject = project;
            myValidator = validator;
            myBaseLayoutManagerCombo.registerUpDownHint(myFormNameTextField);
            myUpDownHintForm.setIcon(PlatformIcons.UP_DOWN_ARROWS);
            myBaseLayoutManagerCombo.addItem("None", RTIcons.RT, "none");
            myBaseLayoutManagerCombo.addItem("AMD", RTIcons.RT, "amd");
            myBaseLayoutManagerCombo.addItem("CommonJS", RTIcons.RT, "commonjs");
            myBaseLayoutManagerCombo.addItem("ES6", RTIcons.RT, "es6");
            myBaseLayoutManagerCombo.addItem("Typescript", RTIcons.RT, "typescript");
            init();
            setTitle(RTBundle.message("title.new.gui.form"));
            setOKActionEnabled(false);

            myFormNameTextField.getDocument().addDocumentListener(new DocumentAdapter() {
                protected void textChanged(DocumentEvent e) {
                    setOKActionEnabled(!myFormNameTextField.getText().isEmpty());
                }
            });

            myBaseLayoutManagerCombo.setSelectedName(Settings.getInstance(project).modules);
            myBaseLayoutManagerCombo.setEnabled(false);
//            myBaseLayoutManagerCombo.setSelectedName(GuiDesignerConfiguration.getInstance(project).DEFAULT_LAYOUT_MANAGER);
        }
 
Example #3
Source File: AssetCompletionProvider.java    From idea-php-symfony2-plugin with MIT License 6 votes vote down vote up
public void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull final CompletionResultSet resultSet) {
    Project project = parameters.getPosition().getProject();

    if(!Symfony2ProjectComponent.isEnabled(parameters.getPosition())) {
        return;
    }

    for (AssetFile assetFile : assetParser.getAssetFiles(project)) {
        resultSet.addElement(new AssetLookupElement(assetFile, project));
    }

    if(includeCustom) {
        TwigNamedAssetsServiceParser twigPathServiceParser = ServiceXmlParserFactory.getInstance(project, TwigNamedAssetsServiceParser.class);
        for (String s : twigPathServiceParser.getNamedAssets().keySet()) {
            resultSet.addElement(LookupElementBuilder.create("@" + s).withIcon(PlatformIcons.FOLDER_ICON).withTypeText("Custom Assets", true));
        }
    }
}
 
Example #4
Source File: CreateRTAction.java    From react-templates-plugin with MIT License 6 votes vote down vote up
public MyDialog(final Project project, final MyInputValidator validator) {
            super(project, true);
            myProject = project;
            myValidator = validator;
            myBaseLayoutManagerCombo.registerUpDownHint(myFormNameTextField);
            myUpDownHintForm.setIcon(PlatformIcons.UP_DOWN_ARROWS);
            myBaseLayoutManagerCombo.addItem("None", RTIcons.RT, "none");
            myBaseLayoutManagerCombo.addItem("AMD", RTIcons.RT, "amd");
            myBaseLayoutManagerCombo.addItem("CommonJS", RTIcons.RT, "commonjs");
            myBaseLayoutManagerCombo.addItem("ES6", RTIcons.RT, "es6");
            myBaseLayoutManagerCombo.addItem("Typescript", RTIcons.RT, "typescript");
            init();
            setTitle(RTBundle.message("title.new.gui.form"));
            setOKActionEnabled(false);

            myFormNameTextField.getDocument().addDocumentListener(new DocumentAdapter() {
                protected void textChanged(DocumentEvent e) {
                    setOKActionEnabled(!myFormNameTextField.getText().isEmpty());
                }
            });

            myBaseLayoutManagerCombo.setSelectedName(Settings.getInstance(project).modules);
            myBaseLayoutManagerCombo.setEnabled(false);
//            myBaseLayoutManagerCombo.setSelectedName(GuiDesignerConfiguration.getInstance(project).DEFAULT_LAYOUT_MANAGER);
        }
 
Example #5
Source File: TfsTreeNode.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
@Override
protected void update(final PresentationData presentation) {
    if (isRoot()) {
        //noinspection ConstantConditions
        presentation.addText(treeContext.serverContext.getUri().getPath(), getPlainAttributes());
        presentation.setIcon(Icons.VSLogoSmall);
    } else {
        if (isDirectory()) {
            presentation.setIcon(PlatformIcons.DIRECTORY_CLOSED_ICON);
        } else {
            presentation.setIcon(FileTypeManager.getInstance().getFileTypeByFileName(getFileName()).getIcon());
        }
        SimpleTextAttributes attrs;
        if (isVirtual) {
            attrs = VIRTUAL_ATTRS;
        } else if (treeContext.isAccepted(path)) {
            attrs = getPlainAttributes();
        } else {
            attrs = SimpleTextAttributes.GRAYED_ATTRIBUTES;
        }
        presentation.addText(getFileName(), attrs);
    }
}
 
Example #6
Source File: FileLookupData.java    From intellij with Apache License 2.0 6 votes vote down vote up
public FilePathLookupElement lookupElementForFile(
    Project project, VirtualFile file, @Nullable WorkspacePath workspacePath) {
  NullableLazyValue<Icon> icon =
      new NullableLazyValue<Icon>() {
        @Override
        protected Icon compute() {
          if (file.findChild("BUILD") != null) {
            return BlazeIcons.BuildFile;
          }
          if (file.isDirectory()) {
            return PlatformIcons.FOLDER_ICON;
          }
          PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
          return psiFile != null ? psiFile.getIcon(0) : AllIcons.FileTypes.Any_type;
        }
      };
  String fullLabel =
      workspacePath != null ? getFullLabel(workspacePath.relativePath()) : file.getPath();
  String itemText = workspacePath != null ? getItemText(workspacePath.relativePath()) : fullLabel;
  return new FilePathLookupElement(fullLabel, itemText, quoteType, icon);
}
 
Example #7
Source File: ThriftStructureViewModel.java    From intellij-thrift with Apache License 2.0 5 votes vote down vote up
@NotNull
public ActionPresentation getPresentation() {
  return new ActionPresentationData(
    IdeBundle.message("action.structureview.show.fields"),
    null,
    PlatformIcons.FIELD_ICON
  );
}
 
Example #8
Source File: HaxeStructureViewModel.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
@NotNull
public ActionPresentation getPresentation() {
  return new ActionPresentationData(
    IdeBundle.message("action.structureview.show.fields"),
    null,
    PlatformIcons.FIELD_ICON
  );
}
 
Example #9
Source File: IgnoreDirectoryMarkerProvider.java    From idea-gitignore with MIT License 5 votes vote down vote up
/**
 * Returns {@link LineMarkerInfo} with set {@link PlatformIcons#FOLDER_ICON} if entry points to the directory.
 *
 * @param element current element
 * @return <code>null</code> if entry is not a directory
 */
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) {
    if (!(element instanceof IgnoreEntryFile)) {
        return null;
    }

    boolean isDirectory = element instanceof IgnoreEntryDirectory;

    if (!isDirectory) {
        final String key = element.getText();
        if (cache.containsKey(key)) {
            isDirectory = cache.get(key);
        } else {
            final IgnoreEntryFile entry = (IgnoreEntryFile) element;
            final VirtualFile parent = element.getContainingFile().getVirtualFile().getParent();
            if (parent == null) {
                return null;
            }

            final Project project = element.getProject();
            final Module module = Utils.getModuleForFile(parent, project);
            if (module == null) {
                return null;
            }

            final MatcherUtil matcher = IgnoreManager.getInstance(project).getMatcher();
            final VirtualFile file = Glob.findOne(parent, entry, matcher);
            cache.put(key, isDirectory = file != null && file.isDirectory());
        }
    }

    if (isDirectory) {
        return new LineMarkerInfo<>(element.getFirstChild(), element.getTextRange(),
                PlatformIcons.FOLDER_ICON, null, null, GutterIconRenderer.Alignment.CENTER);
    }
    return null;
}
 
Example #10
Source File: FastpassManagerDialog.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
private void showCurrentTargetsFetchError() {
  mainPanel.removeAll();
  mainPanel.add(new JLabel(
    PantsBundle.message("pants.bsp.error.failed.to.fetch.targets"),
    PlatformIcons.ERROR_INTRODUCTION_ICON,
    SwingConstants.CENTER
  ));
  mainPanel.updateUI();
}
 
Example #11
Source File: FastpassStatus.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
public void setError(String msg) {
  this.removeAll();
  this.add(myLabel);
  myLabel.setIcon(PlatformIcons.ERROR_INTRODUCTION_ICON);
  myLabel.setText(msg);
  this.updateUI();
}
 
Example #12
Source File: FastpassStatus.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
public void setWarning(String msg) {
  this.removeAll();
  this.add(myLabel);
  myLabel.setIcon(PlatformIcons.WARNING_INTRODUCTION_ICON);
  myLabel.setText(msg);
  this.updateUI();
}
 
Example #13
Source File: FastpassStatus.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
public void setOk(){
  this.removeAll();
  this.add(myLabel);
  myLabel.setIcon(PlatformIcons.CHECK_ICON);
  myLabel.setText("");
  this.updateUI();
}
 
Example #14
Source File: BashLineMarkerProvider.java    From BashSupport with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) {
    if (element.getNode().getElementType() == BashTokenTypes.WORD && element.getParent() instanceof BashFunctionDefName && element.getParent().getParent() instanceof BashFunctionDef) {
        return new LineMarkerInfo<>(element, element.getTextRange(), PlatformIcons.METHOD_ICON, Pass.UPDATE_ALL, null, null, GutterIconRenderer.Alignment.LEFT);
    }

    return null;
}
 
Example #15
Source File: AnnotationIconProvider.java    From idea-php-annotation-plugin with MIT License 5 votes vote down vote up
public Icon getIcon(@NotNull PsiElement element, @Iconable.IconFlags int flags) {
    if (element instanceof PhpFile && PhpPsiUtil.findClasses((PhpFile)element, AnnotationUtil::isAnnotationClass).size() == 1) {
        return PlatformIcons.ANNOTATION_TYPE_ICON;
    }

    return null;
}
 
Example #16
Source File: NewBlazePackageAction.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
protected void updateForBlazeProject(Project project, AnActionEvent event) {
  Presentation presentation = event.getPresentation();
  String buildSystem = Blaze.buildSystemName(project);
  presentation.setEnabledAndVisible(isEnabled(event));
  presentation.setText(String.format("%s Package", buildSystem));
  presentation.setDescription(String.format("Create a new %s package", buildSystem));
  presentation.setIcon(PlatformIcons.PACKAGE_ICON);
}
 
Example #17
Source File: LanguageServerWrapper.java    From lsp4intellij with Apache License 2.0 5 votes vote down vote up
public void crashed(Exception e) {
    crashCount += 1;
    if (crashCount <= 3) {
        reconnect();
    } else {
        invokeLater(() -> {
            if (alreadyShownCrash) {
                reconnect();
            } else {
                int response = Messages.showYesNoDialog(String.format(
                        "LanguageServer for definition %s, project %s keeps crashing due to \n%s\n"
                        , serverDefinition.toString(), project.getName(), e.getMessage()),
                        "Language Server Client Warning", "Keep Connected", "Disconnect", PlatformIcons.CHECK_ICON);
                if (response == Messages.NO) {
                    int confirm = Messages.showYesNoDialog("All the language server based plugin features will be disabled.\n" +
                            "Do you wish to continue?", "", PlatformIcons.WARNING_INTRODUCTION_ICON);
                    if (confirm == Messages.YES) {
                        // Disconnects from the language server.
                        stop(true);
                    } else {
                        reconnect();
                    }
                } else {
                    reconnect();
                }
            }
            alreadyShownCrash = true;
            crashCount = 0;
        });
    }
}
 
Example #18
Source File: MapOfObjectFieldDefinitionValue.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public void computeChildren(@NotNull XCompositeNode node) {
    final XValueChildrenList list = new XValueChildrenList();
    for (Map.Entry<String, ObjectFieldDefinition> entry : values.entrySet()) {
        list.add(entry.getKey(), new ObjectFieldDefinitionValue(session, entry.getValue(), PlatformIcons.PROPERTY_ICON));
    }
    node.addChildren(list, false);
    super.computeChildren(node);
}
 
Example #19
Source File: WeaveIntegrationStackFrame.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public void computeChildren(@NotNull XCompositeNode node)
{
    final XValueChildrenList children = new XValueChildrenList();
    for (ObjectFieldDefinition objectFieldDefinition : frame)
    {
        children.add(objectFieldDefinition.getName(), new ObjectFieldDefinitionValue(session, objectFieldDefinition, PlatformIcons.PROPERTY_ICON));
    }
    node.addChildren(children, true);
}
 
Example #20
Source File: LoadStatementsFilter.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public ActionPresentation getPresentation() {
  return new ActionPresentationData(
      /*text=*/ "Show Load Statements",
      /*description=*/ null,
      /*icon=*/ PlatformIcons.IMPORT_ICON);
}
 
Example #21
Source File: KubernetesYamlCompletionContributor.java    From intellij-kubernetes with Apache License 2.0 5 votes vote down vote up
/**
 * Create a {@link LookupElementBuilder} when completing the text of a key identified by the given name and definition.
 *
 * @param propertyName the name of the property.
 * @param propertySpec the schema definition of the property.
 * @return the created {@code LookupElementBuilder}.
 */
@NotNull
private static LookupElementBuilder createKeyLookupElement(@NotNull final String propertyName, @NotNull final Property propertySpec) {
    final String typeText = ModelUtil.typeStringFor(propertySpec);
    Icon icon = PlatformIcons.PROPERTY_ICON;
    boolean addLayerOfNesting = false;
    if (propertySpec.getType() == FieldType.ARRAY) {
        icon = Json.Array;
        addLayerOfNesting = true;
    } else if (propertySpec.getRef() != null || propertySpec.getType() == FieldType.OBJECT) {
        icon = Json.Object;
        addLayerOfNesting = true;
    }
    return createKeyLookupElement(new PropertyCompletionItem(propertyName, propertySpec), addLayerOfNesting).withTypeText(typeText, true).withIcon(icon);
}
 
Example #22
Source File: NewArrayValueLookupElement.java    From yiistorm with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(insertString);
    presentation.setIcon(PlatformIcons.ADD_ICON);
    presentation.setTypeText(createTitle);
    presentation.setTailText(".php");
    presentation.setTypeGrayed(false);
}
 
Example #23
Source File: NewFileLookupElement.java    From yiistorm with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(this.lookupString);
    presentation.setIcon(PlatformIcons.ADD_ICON);
    presentation.setTypeText(createTitle);
    presentation.setTailText(".php");
    presentation.setTypeGrayed(false);
}
 
Example #24
Source File: SimpleWeaveValue.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public void computePresentation(@NotNull XValueNode xValueNode, @NotNull XValuePlace xValuePlace)
{
    //Lets make sure if it is null to be a string
    final String presentationValue = String.valueOf(debuggerValue.value());
    xValueNode.setPresentation(PlatformIcons.VARIABLE_ICON, debuggerValue.typeName(), presentationValue, false);
}
 
Example #25
Source File: StructureFilterPopupComponent.java    From consulo with Apache License 2.0 4 votes vote down vote up
public CheckboxColorIcon(int size, @Nonnull Color color) {
  super(size, color);
  mySize = size;
  mySizedIcon = new SizedIcon(PlatformIcons.CHECK_ICON_SMALL, mySize, mySize);
}
 
Example #26
Source File: TodoPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
public MyShowPackagesAction() {
  super(IdeBundle.message("action.group.by.packages"), null, PlatformIcons.GROUP_BY_PACKAGES);
}
 
Example #27
Source File: LookupUi.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void update(@Nonnull AnActionEvent e) {
  e.getPresentation().setIcon(sortByName ? PlatformIcons.CHECK_ICON : null);
}
 
Example #28
Source File: UpdateInfoTree.java    From consulo with Apache License 2.0 4 votes vote down vote up
public MyGroupByPackagesAction() {
  super(VcsBundle.message("action.name.group.by.packages"), null, PlatformIcons.GROUP_BY_PACKAGES);
}
 
Example #29
Source File: StructureFilterPopupComponent.java    From consulo with Apache License 2.0 4 votes vote down vote up
private SelectFromHistoryAction(@Nonnull VcsLogStructureFilter filter) {
  super(getStructureActionText(filter), getTooltipTextForFilePaths(filter.getFiles(), false).replace("\n", " "), null);
  myFilter = filter;
  myIcon = new SizedIcon(PlatformIcons.CHECK_ICON_SMALL, CHECKBOX_ICON_SIZE, CHECKBOX_ICON_SIZE);
  myEmptyIcon = EmptyIcon.create(CHECKBOX_ICON_SIZE);
}
 
Example #30
Source File: XQueryEvaluator.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
@Override
public void computePresentation(@NotNull XValueNode xValueNode, @NotNull XValuePlace xValuePlace) {
    Icon icon = PlatformIcons.PROPERTY_ICON;
    xValueNode.setPresentation(icon, propertyValue.getType(), propertyValue.getValue(), false);
}