Java Code Examples for com.intellij.icons.AllIcons

The following examples show how to use com.intellij.icons.AllIcons. These examples are extracted from open source projects. 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
@Override
public void customizePresentation(@NotNull final ColoredTextContainer component) {
  final String unoptimizedPrefix = "[Unoptimized] ";

  String name = StringUtil.trimEnd(myVmFrame.getCode().getName(), "="); // trim setter postfix
  name = StringUtil.trimStart(name, unoptimizedPrefix);

  final boolean causal = myVmFrame.getKind() == FrameKind.AsyncCausal;
  component.append(name, causal ? SimpleTextAttributes.REGULAR_ITALIC_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES);

  if (mySourcePosition != null) {
    final String text = " (" + mySourcePosition.getFile().getName() + ":" + (mySourcePosition.getLine() + 1) + ")";
    component.append(text, SimpleTextAttributes.GRAY_ATTRIBUTES);
  }

  component.setIcon(AllIcons.Debugger.Frame);
}
 
Example 2
public static final ConsoleView showHelperProcessRunContent(String header, OSProcessHandler runHandler, Project project, Executor defaultExecutor) {
        ProcessTerminatedListener.attach(runHandler);

        ConsoleViewImpl consoleView = new ConsoleViewImpl(project, true);
        DefaultActionGroup toolbarActions = new DefaultActionGroup();

        JPanel panel = new JPanel((LayoutManager) new BorderLayout());
        panel.add((Component) consoleView.getComponent(), "Center");
        ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("unknown", (ActionGroup) toolbarActions, false);
        toolbar.setTargetComponent(consoleView.getComponent());
        panel.add((Component) toolbar.getComponent(), "West");

        RunContentDescriptor runDescriptor = new RunContentDescriptor((ExecutionConsole) consoleView,
                (ProcessHandler) runHandler, (JComponent) panel, header, AllIcons.RunConfigurations.Application);
        AnAction[]
                consoleActions = consoleView.createConsoleActions();
        toolbarActions.addAll((AnAction[]) Arrays.copyOf(consoleActions, consoleActions.length));
        toolbarActions.add((AnAction) new StopProcessAction("Stop process", "Stop process", (ProcessHandler) runHandler));
        toolbarActions.add((AnAction) new CloseAction(defaultExecutor, runDescriptor, project));

        consoleView.attachToProcess((ProcessHandler) runHandler);
//        ExecutionManager.getInstance(environment.getProject()).getContentManager().showRunContent(environment.getExecutor(), runDescriptor);
        showConsole(project, defaultExecutor, runDescriptor);
        return (ConsoleView) consoleView;
    }
 
Example 3
Source Project: PackageTemplates   Source File: ReportDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void addFailed(final BaseReport report) {
    //Icon
    JBLabel iconLabel = new JBLabel(PluginIcons.REPORT_FAIL);
    iconLabel.setToolTipText(Localizer.get("tooltip.ReportFailed"));

    //Label
    JBLabel label = new JBLabel(report.getAction().toString(), report.toIcon(), SwingConstants.LEFT);

    // Button details
    JButton btnDetails = new JButton(Localizer.get("action.ShowDetails"), AllIcons.General.InspectionsEye);
    btnDetails.repaint();
    btnDetails.addMouseListener(new ClickListener() {
        @Override
        public void mouseClicked(MouseEvent e) {
            Messages.showMessageDialog(
                    report.getMessage(),
                    Localizer.get("title.ErrorDetails"),
                    Messages.getInformationIcon()
            );
        }
    });

    panel.add(iconLabel, new CC().spanX().split(3));
    panel.add(label, new CC());
    panel.add(btnDetails, new CC().wrap().pad(0, 0, 0, 0));
}
 
Example 4
public FlutterGeneratorPeer(WizardContext context) {
  myContext = context;
  myInstallSdkAction = new InstallSdkAction(this);

  errorIcon.setText("");
  errorIcon.setIcon(AllIcons.Actions.Lightning);
  Messages.installHyperlinkSupport(errorText);

  // Hide pending real content.
  myVersionContent.setVisible(false);
  myProgressBar.setVisible(false);
  myProgressText.setVisible(false);
  myCancelProgressButton.setVisible(false);

  init();
}
 
Example 5
Source Project: reasonml-idea-plugin   Source File: CmtFileEditor.java    License: MIT License 6 votes vote down vote up
@NotNull
@Override
public JComponent getComponent() {
    m_rootTabbedPane = new JBTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);

    InsightManager insightManager = ServiceManager.getService(m_project, InsightManager.class);
    List<String> meta = insightManager.dumpMeta(m_file);
    String xmlSource = insightManager.dumpTree(m_file);
    List<String> types = insightManager.dumpInferredTypes(m_file);

    m_rootTabbedPane.addTab("Meta", AllIcons.Nodes.DataTables, new JBScrollPane(new Table(new MetaTableModel(meta))));
    m_rootTabbedPane.addTab("AST", AllIcons.FileTypes.Xml, new CmtXmlComponent(m_project, m_rootTabbedPane, xmlSource));
    m_rootTabbedPane.addTab("Inferred", AllIcons.Nodes.DataSchema, new JBScrollPane(new Table(new InferredTableModel(types))));

    return m_rootTabbedPane;
}
 
Example 6
@Override
public void customize(JList list, SearchActionType actionType, int index, boolean selected, boolean hasFocus) {
    if (actionType != null) {
        setText(Localizer.get(actionType.getNameLangKey()));
        switch (actionType) {
            case DIR_ABOVE:
            case DIR_BELOW:
            case DIR_PARENT:
                setIcon(AllIcons.Nodes.Package);
                break;
            case FILE:
                setIcon(AllIcons.FileTypes.Text);
                break;
        }
    }
}
 
Example 7
public DartVmServiceExecutionStack(@NotNull final DartVmServiceDebugProcess debugProcess,
                                   @NotNull final String isolateId,
                                   @NotNull final String isolateName,
                                   @Nullable final Frame topFrame,
                                   @Nullable final InstanceRef exception) {
  // topFrame is not null for (and only for) the active execution stack
  super(debugProcess.isIsolateSuspended(isolateId) ? beautify(isolateName)
                                                   : beautify(isolateName) + " (running)",
        topFrame != null ? AllIcons.Debugger.ThreadCurrent
                         : debugProcess.isIsolateSuspended(isolateId) ? AllIcons.Debugger.ThreadAtBreakpoint
                                                                      : AllIcons.Debugger.ThreadRunning);
  myDebugProcess = debugProcess;
  myIsolateId = isolateId;
  myException = exception;
  myTopFrame = topFrame == null ? null : new DartVmServiceStackFrame(debugProcess, isolateId, topFrame, null, exception);
}
 
Example 8
Source Project: CodeMaker   Source File: TemplateEditPane.java    License: Apache License 2.0 6 votes vote down vote up
protected void setUpShowTestInputButton() {
    showTestInput.setIcon(AllIcons.General.ArrowDown);
    showTestInput.setToolTipText("Show Test Input");
    showTestInput.addActionListener(e -> {
        if(!templateEditAndTest.getTestInputShown()) {
            templateEditAndTest.toggleTestInputPane();
            showTestInput.setIcon(AllIcons.General.ArrowUp);
            editorSplitPane.setEnabled(true);
            showTestInput.setToolTipText("Hide Test Input");
        } else {
            templateEditAndTest.toggleTestInputPane();
            showTestInput.setIcon(AllIcons.General.ArrowDown);
            showTestInput.setToolTipText("Show Test Input");
            editorSplitPane.setEnabled(false);
        }
    });
}
 
Example 9
@Override
public void customizePresentation(@NotNull final ColoredTextContainer component) {
  final String unoptimizedPrefix = "[Unoptimized] ";

  String name = StringUtil.trimEnd(myVmFrame.getCode().getName(), "="); // trim setter postfix
  name = StringUtil.trimStart(name, unoptimizedPrefix);

  final boolean causal = myVmFrame.getKind() == FrameKind.AsyncCausal;
  component.append(name, causal ? SimpleTextAttributes.REGULAR_ITALIC_ATTRIBUTES : SimpleTextAttributes.REGULAR_ATTRIBUTES);

  if (mySourcePosition != null) {
    final String text = " (" + mySourcePosition.getFile().getName() + ":" + (mySourcePosition.getLine() + 1) + ")";
    component.append(text, SimpleTextAttributes.GRAY_ATTRIBUTES);
  }

  component.setIcon(AllIcons.Debugger.Frame);
}
 
Example 10
Source Project: mule-intellij-plugins   Source File: WeaveExecutionStack.java    License: Apache License 2.0 6 votes vote down vote up
protected WeaveExecutionStack(DebuggerClient client, OnFrameEvent onFrameEvent, String displayName, XDebugSession session, VirtualFile file)
{
    super(displayName, AllIcons.Debugger.ThreadSuspended);
    final DebuggerFrame[] frames = onFrameEvent.frames();
    this.frames = new ArrayList<>();
    for (int i = 0; i < frames.length; i++)
    {
        final DebuggerFrame debuggerFrame = frames[i];
        if (i == 0)
        {
            this.frames.add(new WeaveStackFrame(client, onFrameEvent.startPosition(), debuggerFrame, file));
        }
        else
        {
            this.frames.add(new WeaveStackFrame(client, frames[i - 1].startPosition(), debuggerFrame, file));
        }
    }
}
 
Example 11
Source Project: mule-intellij-plugins   Source File: WeavePsiImplUtils.java    License: Apache License 2.0 6 votes vote down vote up
public static ItemPresentation getPresentation(WeaveArrayExpression document) {
    return new ItemPresentation() {

        @Nullable
        @Override
        public String getPresentableText() {
            return "";
        }

        @Nullable
        @Override
        public String getLocationString() {
            return null;
        }

        @Nullable
        @Override
        public Icon getIcon(boolean b) {
            return AllIcons.Json.Array;
        }
    };
}
 
Example 12
Source Project: mule-intellij-plugins   Source File: WeavePsiImplUtils.java    License: Apache License 2.0 6 votes vote down vote up
public static ItemPresentation getPresentation(final WeaveSimpleKeyValuePair kvp) {
    return new ItemPresentation() {

        @Nullable
        @Override
        public String getPresentableText() {
            return kvp.getKey().getExpression().getText();
        }

        @Nullable
        @Override
        public String getLocationString() {
            return null;
        }

        @Nullable
        @Override
        public Icon getIcon(boolean b) {
            return AllIcons.Json.Property_braces;
        }
    };
}
 
Example 13
public static void open() {
    Analytics.event("landingPage", "clicked");
    int ok = Messages.showOkCancelDialog("This feature is planned for a \nfuture release of the premium version.\n" +
                    "If you are interested, please visit: \n\n" + URL, "Premium Version", "Find more", "Cancel",
            AllIcons.General.QuestionDialog);
    if (ok == 0) {
        Analytics.event("landingPage", "land");
        try {
            Desktop.getDesktop().browse(URI.create(URL));
        } catch (Exception e) {
            BrowserLauncher.getInstance().browse(URI.create(URL));
        }
    } else {
        Analytics.event("landingPage", "cancel");
    }
}
 
Example 14
private void createUIComponents() {
    // place custom component creation code here
    this.remindTypeOptions = new ComboBox<>();
    for (ConfigState.RemindTypeEnum remindType : ConfigState.RemindTypeEnum.values()) {
        this.remindTypeOptions.addItem(remindType.description);
    }

    ConfigState configState = ConfigService.getInstance().getState();
    List<String> remindImages = configState.getRemindImages();
    this.pluginSettingTable = new PluginSettingTable(remindImages);
    this.imageUrlList = ToolbarDecorator.createDecorator(pluginSettingTable)
        /*
         * at version 1.5 fix a bug: 2020.1 版本 AllIcons.Actions.Reset_to_default 过时问题
         * see https://github.com/fantasticmao/ycy-intellij-plugin/issues/27
         */
        .addExtraAction(new AnActionButton("Reset", AllIcons.Actions.Rollback) {
            @Override
            public void actionPerformed(AnActionEvent e) {
                pluginSettingTable.resetTableList();
            }

            @Override
            public boolean isDumbAware() {
                return true; // 使用「后台更新」模式
            }
        })
        .createPanel();
}
 
Example 15
Icon getFlutterDecoratedIcon() {
  Icon icon = AllIcons.Welcome.CreateNewProject;
  Icon badgeIcon = new OffsetIcon(0, FlutterIcons.Flutter_badge).scale(0.666f);

  LayeredIcon decorated = new LayeredIcon(2);
  decorated.setIcon(badgeIcon, 0, 7, 7);
  decorated.setIcon(icon, 1, 0, 0);
  return decorated;
}
 
Example 16
public JComponent getComponent() {
    ButtonGroup group = new ButtonGroup();
    group.add(this.defaultRadioButton);
    group.add(this.customRadioButton);
    ActionListener listener = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            QuarkusCodeEndpointChooserStep.this.updateCustomUrl();
        }
    };
    this.defaultRadioButton.addActionListener(listener);
    this.customRadioButton.addActionListener(listener);
    FormBuilder builder = new FormBuilder();
    builder.addComponent(new JBLabel("Choose Quarkus Code endpoint URL."));
    BorderLayoutPanel defaultPanel = JBUI.Panels.simplePanel(10, 0);
    defaultPanel.addToLeft(this.defaultRadioButton);
    HyperlinkLabel label = new HyperlinkLabel(QUARKUS_CODE_URL);
    label.setHyperlinkTarget(QUARKUS_CODE_URL);
    defaultPanel.addToCenter(label);
    builder.addComponent(defaultPanel);
    BorderLayoutPanel customPanel = JBUI.Panels.simplePanel(10, 0);
    customPanel.addToLeft(this.customRadioButton);
    this.customUrlWithBrowseButton.setButtonIcon(AllIcons.Actions.ShowViewer);
    customPanel.addToCenter(this.customUrlWithBrowseButton);
    builder.addComponent(customPanel);
    builder.addTooltip("Make sure your network connection is active before continuing.");
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(builder.getPanel(), "North");
    return panel;
}
 
Example 17
@Override
public boolean beforeAction() {
    String exePath = RNPathUtil.getExecuteFileFullPath(EXEC);

    if (exePath == null || EXEC.equals(RNPathUtil.getExecuteFileFullPath(EXEC))) {
        int options = Messages.showIdeaMessageDialog(getProject(),
                "Would you like to install " + EXEC + " globally now?\n" +
                        "This might take one or two minutes without any console update, please wait for the final result.\n" +
                        "After that, you'll need to click this button again.",
                "Can Not Found " + EXEC, new String[]{"Yes", "No"}, 0,
                AllIcons.General.QuestionDialog, new DialogWrapper.DoNotAskOption.Adapter() {
                    @Override
                    public void rememberChoice(boolean b, int i) {

                    }
                });
        if (options == 0) {
            cmd = INSTALL_CMD;
            return true;
        } else {
            RNConsole consoleView = terminal.getRNConsole(getText(), getIcon());

            if (consoleView != null) {
                consoleView.clear();
                consoleView.print(
                        "Can't found " + EXEC + ", if you were first running this command, make sure you have " + EXEC + " installed globally.\n" +
                                "To install, please run in terminal with command: \n" +
                                INSTALL_CMD +
                                "\n\n",
                        ConsoleViewContentType.ERROR_OUTPUT);

            }
            return false;
        }

    }

    cmd = EXEC;
    return true;
}
 
Example 18
@Override
    public boolean beforeAction() {
        String exePath = RNPathUtil.getExecuteFileFullPath(EXEC);
        if (exePath == null || EXEC.equals(RNPathUtil.getExecuteFileFullPath(EXEC))) {
//            GlobalPropertyBasedDoNotAskOption dontAsk = new GlobalPropertyBasedDoNotAskOption("react-devtools.to.show"); // TODO no use so far
            int options = Messages.showIdeaMessageDialog(getProject(),
                    "Would you like to install react-devtools globally now?\n" +
                            "This might take one or two minutes without any console update, please wait for the final result.\n" +
                            "After that, you'll need to click this button again.",
                    "Can Not Found React-Devtools", new String[]{"Yes", "No"}, 0,
                    AllIcons.General.QuestionDialog, new DialogWrapper.DoNotAskOption.Adapter() {
                        @Override
                        public void rememberChoice(boolean b, int i) {

                        }
                    });
            if (options == 0) {
                cmd = "npm install -g react-devtools";
                return true;
            } else {
                RNConsole consoleView = terminal.getRNConsole(getText(), getIcon());

                if (consoleView != null) {
                    consoleView.clear();
                    consoleView.print(
                            "Can't found " + EXEC + ", if you were first running this command, make sure you have react-devtools installed globally.\n" +
                                    "To install by yourself, please run in terminal with command: \n" +
                                    "npm install -g react-devtools\n\n",
                            ConsoleViewContentType.ERROR_OUTPUT);

                }
                return false;
            }

        }

        cmd = EXEC;
        return true;
    }
 
Example 19
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element) {
    PsiElement queryElement = PsiTraversalUtilities.Cypher.getCypherStatement(element);
    PsiElement lastQueryChild = isNull(queryElement) ? null : getFirstLeaf(queryElement);
    if (element == lastQueryChild) {
        return new LineMarkerInfo<PsiElement>(element,
                element.getTextRange(),
                AllIcons.Actions.Execute,
                element1 -> "Execute Query",
                (mouseEvent, psiElement) ->
                        getDataContext().ifPresent(c ->
                                ActionUtil.invokeAction(new ExecuteQueryAction(queryElement), c, "", mouseEvent, null)),
                GutterIconRenderer.Alignment.CENTER) {
            @Override
            public GutterIconRenderer createGutterRenderer() {
                return new LineMarkerGutterIconRenderer<PsiElement>(this) {
                    @Override
                    public AnAction getClickAction() {
                        return new ExecuteQueryAction(queryElement);
                    }

                    @Override
                    public boolean isNavigateAction() {
                        return true;
                    }
                };
            }
        };
    }
    return null;
}
 
Example 20
@Override
protected void actionPerformed(AnActionEvent e, Project project, Editor editor, String query, Map<String, Object> parameters) {
    String gremlin = new OpenCypherGremlinSimpleTranslator().translate(query, parameters);

    JTextArea translation = new JTextArea(gremlin);
    translation.setEditable(false);
    translation.setLineWrap(true);

    JButton configure = new JButton("Configure/optimize translation");
    configure.addActionListener(v -> LandingPageAction.open());

    JBPopup popup = JBPopupFactory.getInstance().createComponentPopupBuilder(translation, null)
            .setAdText("Query translated using Cypher for Gremlin")
            .setSettingButtons(configure)
            .setCancelButton(new IconButton("Cancel", AllIcons.Actions.Cancel))
            .setRequestFocus(true)
            .setResizable(true)
            .setMovable(true)
            .setMinSize(new Dimension(200, 150))
            .createPopup();

    if (editor == null) {
        popup.showCenteredInCurrentWindow(project);
    } else {
        popup.showInBestPositionFor(editor);
    }
}
 
Example 21
@Nullable
@Override
public Info getInfo(PsiElement element) {
  if (!enabled.getValue() || !isRunContext(element)) {
    return null;
  }
  AnAction[] actions = ExecutorAction.getActions();
  return new Info(
      AllIcons.RunConfigurations.TestState.Run,
      actions,
      psiElement ->
          StringUtil.join(
              ContainerUtil.mapNotNull(actions, action -> getText(action, psiElement)), "\n"));
}
 
Example 22
Source Project: logviewer   Source File: LogView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns an action that creates a gist
 */
private AnAction createGistAction() {
    return new AnAction("Share Log", "Share log using Gist", AllIcons.Actions.Share) {
        @Override
        public void actionPerformed(AnActionEvent anActionEvent) {
            gistCreator.createGist(myProject, myLogConsole.getSelectedText(true), LogView.this);
        }
    };
}
 
Example 23
Source Project: component-runtime   Source File: Suggestion.java    License: Apache License 2.0 5 votes vote down vote up
private Icon findSubmit() {
    return Stream.of("SetDefault", "Submit1").flatMap(it -> {
        try {
            final Field declaredField = AllIcons.Actions.class.getField(it);
            return Stream.of(Icon.class.cast(declaredField.get(null)));
        } catch (final Exception e) {
            return Stream.empty();
        }
    }).findFirst().orElse(AllIcons.Actions.Forward);
}
 
Example 24
private Icon getIcon() {
  if (myIsException) return AllIcons.Debugger.Db_exception_breakpoint;

  if (myFieldRef != null) {
    if (myFieldRef.isStatic() && (myFieldRef.isFinal() || myFieldRef.isConst())) {
      return STATIC_FINAL_FIELD_ICON;
    }
    if (myFieldRef.isStatic()) {
      return STATIC_FIELD_ICON;
    }
    if (myFieldRef.isFinal() || myFieldRef.isConst()) {
      return FINAL_FIELD_ICON;
    }
    return AllIcons.Nodes.Field;
  }

  final InstanceKind kind = myInstanceRef.getKind();

  if (kind == InstanceKind.Map || isListKind(kind)) return AllIcons.Debugger.Db_array;

  if (kind == InstanceKind.Null ||
      kind == InstanceKind.Bool ||
      kind == InstanceKind.Double ||
      kind == InstanceKind.Int ||
      kind == InstanceKind.String) {
    return AllIcons.Debugger.Db_primitive;
  }

  return AllIcons.Debugger.Value;
}
 
Example 25
Source Project: NutzCodeInsight   Source File: HtmlTemplateLineUtil.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 取得模版图标
 *
 * @param bindingElement
 * @return
 */
public static Icon getTemplateIcon(PsiElement bindingElement) {
    String path = getTemplateFilePathAndName(bindingElement);
    Iterator<String> iterable = resNames.iterator();
    while (iterable.hasNext()) {
        String fileExtension = iterable.next();
        if (path.endsWith(fileExtension)) {
            return IconUtil.getTemplateIcon(fileExtension);
        }
    }
    return AllIcons.FileTypes.Any_type;
}
 
Example 26
Source Project: intellij   Source File: SkylarkExecutionStack.java    License: Apache License 2.0 5 votes vote down vote up
private static Icon getThreadIcon(PausedThread threadInfo) {
  if (threadInfo.getPauseReason() == PauseReason.HIT_BREAKPOINT
      || threadInfo.getPauseReason() == PauseReason.CONDITIONAL_BREAKPOINT_ERROR) {
    return AllIcons.Debugger.ThreadAtBreakpoint;
  }
  return AllIcons.Debugger.ThreadSuspended;
}
 
Example 27
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement psiElement) {
    try {
        if (SqlsXmlUtil.isSqsXmlFile(psiElement)) {
            Icon icon = AllIcons.FileTypes.Java;
            return new LineMarkerInfo<>(psiElement, psiElement.getTextRange(), icon,
                    new FunctionTooltip(), new Sqls2XmlNavigationHandler(),
                    GutterIconRenderer.Alignment.LEFT);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
Example 28
Source Project: CodeMaker   Source File: CodeMakerConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
private void addPlusTab() {
    tabbedPane.addTab("+", new JPanel());
    final JLabel addButton = new JLabel(AllIcons.Welcome.CreateNewProject);
    addButton.setToolTipText("Add New Template");
    addButton.addMouseListener(onMouseClick(e -> createNewTemplate()));
    final int index = tabbedPane.getTabCount() - 1;
    tabbedPane.setTabComponentAt(index, addButton);
    tabbedPane.setEnabledAt(index, false);
}
 
Example 29
Source Project: CodeMaker   Source File: CodeMakerConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
private Component tabTitleComponent(final String title, final String templateKey) {
    return with(
        new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)), p -> {
                p.add(with(new JLabel(title), t -> t.setOpaque(false)));
                p.setOpaque(false);
                p.add(with(new JLabel(AllIcons.Actions.Close), b  -> {
                    b.setOpaque(false);
                    b.setToolTipText("Delete Template");
                    b.addMouseListener(onMouseClick(e -> onDeleteClicked(title, templateKey)));
                }));
    });
}
 
Example 30
Source Project: PackageTemplates   Source File: DirectoryWrapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void buildView(Project project, JPanel container) {
    if (panel == null) {
        panel = new JPanel(new MigLayout(new LC().insets("0").gridGapY("2pt").fillX()));
    } else {
        panel.removeAll();
    }

    jlName = new JLabel(AllIcons.Nodes.Package, SwingConstants.LEFT);
    jlName.setDisabledIcon(jlName.getIcon());
    jlName.setText(Localizer.get("Directory"));

    etfDescription = UIHelper.getEditorTextField(getDirectory().getName(), project);
    addMouseListener();

    container.add(getOptionsPanel(), new CC().spanX().split(3));
    container.add(jlName, new CC().pad(0, 0, 0, UIHelper.PADDING_LABEL));
    container.add(etfDescription, new CC().growX().pushX().wrap());

    updateComponentsState();

    //Children
    if (!getListElementWrapper().isEmpty()) {
        for (ElementWrapper elementWrapper : getListElementWrapper()) {
            elementWrapper.buildView(project, panel);
        }

        UIHelper.setLeftPadding(panel, UIHelper.PADDING + UIHelper.DEFAULT_PADDING);
        container.add(panel, new CC().spanX().growX().pushX().wrap());
    }
}