com.intellij.openapi.ui.popup.IconButton Java Examples

The following examples show how to use com.intellij.openapi.ui.popup.IconButton. 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: SelectedDependenciesTableModel.java    From intellij-spring-assistant with MIT License 5 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
    boolean hasFocus, int row, int column) {
  InplaceButton inplaceButton = new InplaceButton(
      new IconButton("Click to delete", DeleteContentFolder, DeleteContentFolderRollover),
      e -> {
      });
  Couple<Color> colors = UIUtil.getCellColors(table, isSelected, row, column);
  setForeground(colors.getFirst());
  setBackground(colors.getSecond());
  setEnabled(true);
  inplaceButton.setOpaque(false);
  return inplaceButton;
}
 
Example #2
Source File: TranslateQueryAction.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 5 votes vote down vote up
@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 #3
Source File: DataSourceDialog.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 5 votes vote down vote up
private void createPopup(JPanel popupPanel, JComponent contentPanel) {
    if (contentPanel.isShowing()) {
        JBPopupFactory.getInstance()
                .createComponentPopupBuilder(popupPanel, getPreferredFocusedComponent())
                .setCancelButton(new IconButton("Close", AllIcons.Actions.Close))
                .setTitle("Test connection")
                .setResizable(true)
                .setMovable(true)
                .setCancelButton(new IconButton("Close", AllIcons.Actions.Close, AllIcons.Actions.CloseHovered))
                .createPopup()
                .showInCenterOf(contentPanel);
    }
}
 
Example #4
Source File: LogPanel.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 5 votes vote down vote up
private void showPopup(String title, String details, Exception exception) {
    JPanel popupPanel = new JPanel(new BorderLayout());
    popupPanel.setBorder(JBUI.Borders.empty(THICKNESS));

    JTextArea exceptionDetails = new JTextArea();
    exceptionDetails.setLineWrap(false);
    exceptionDetails.append(details);
    JLabel jLabel = new JLabel(exception.getMessage(), AllIcons.Process.State.RedExcl, JLabel.LEFT);

    JBScrollPane scrollPane = new JBScrollPane(exceptionDetails);
    scrollPane.setPreferredSize(new Dimension(-1, HEIGHT));
    popupPanel.add(jLabel, BorderLayout.NORTH);
    popupPanel.add(scrollPane, BorderLayout.CENTER);
    String gremlinTranslationWarning = exception instanceof OpenCypherGremlinException ? ExceptionErrorMessages.SYNTAX_WARNING.getDescription() : "";

    JBPopupFactory.getInstance()
            .createComponentPopupBuilder(
                    popupPanel,
                    log.getComponent())
            .setTitle(title)
            .setAdText(gremlinTranslationWarning)
            .setResizable(true)
            .setMovable(true)
            .setCancelButton(new IconButton("Close", AllIcons.Actions.Close, AllIcons.Actions.CloseHovered))
            .createPopup()
            .showInFocusCenter();
}
 
Example #5
Source File: InplaceButton.java    From consulo with Apache License 2.0 5 votes vote down vote up
public InplaceButton(IconButton source, final ActionListener listener, final Pass<MouseEvent> me, TimedDeadzone.Length mouseDeadzone) {
  myListener = listener;
  myBehavior = new BaseButtonBehavior(this, mouseDeadzone) {
    @Override
    protected void execute(final MouseEvent e) {
      doClick(e);
    }

    @Override
    protected void repaint(Component c) {
      doRepaintComponent(c);
    }

    @Override
    protected void pass(final MouseEvent e) {
      if (me != null) {
        me.pass(e);
      }
    }
  };

  setIcons(source);

  //setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  setToolTipText(source.getTooltip());
  setOpaque(false);
  setHoveringEnabled(true);
}
 
Example #6
Source File: InlineProgressIndicator.java    From consulo with Apache License 2.0 5 votes vote down vote up
private ProgressButton createCancelButton() {
  InplaceButton cancelButton = new InplaceButton(new IconButton(myInfo.getCancelTooltipText(), AllIcons.Process.Stop, AllIcons.Process.StopHovered), new ActionListener() {
    @Override
    public void actionPerformed(final ActionEvent e) {
      cancelRequest();
    }
  }).setFillBg(false);

  cancelButton.setVisible(myInfo.isCancellable());

  return new ProgressButton(cancelButton, () -> cancelButton.setPainting(!isStopping()));
}
 
Example #7
Source File: SelectedDependencyListItem.java    From intellij-spring-assistant with MIT License 4 votes vote down vote up
private void createUIComponents() {
  deleteButton = new InplaceButton(
      new IconButton("Click to delete", DeleteContentFolder, DeleteContentFolderRollover),
      e -> listener.onDeleteClicked());
}
 
Example #8
Source File: InplaceButton.java    From consulo with Apache License 2.0 4 votes vote down vote up
public InplaceButton(String tooltip, final Icon icon, final ActionListener listener) {
  this(new IconButton(tooltip, icon, icon), listener, null);
}
 
Example #9
Source File: InplaceButton.java    From consulo with Apache License 2.0 4 votes vote down vote up
public InplaceButton(String tooltip, final Icon icon, final ActionListener listener, final Pass<MouseEvent> me) {
  this(new IconButton(tooltip, icon, icon), listener, me);
}
 
Example #10
Source File: InplaceButton.java    From consulo with Apache License 2.0 4 votes vote down vote up
public InplaceButton(IconButton source, final ActionListener listener) {
  this(source, listener, null);
}
 
Example #11
Source File: InplaceButton.java    From consulo with Apache License 2.0 4 votes vote down vote up
public InplaceButton(IconButton source, final ActionListener listener, final Pass<MouseEvent> me) {
  this(source, listener, me, TimedDeadzone.DEFAULT);
}
 
Example #12
Source File: InplaceButton.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void setIcons(IconButton source) {
  setIcons(source.getRegular(), source.getInactive(), source.getHovered());
}