Search in sources :

Example 6 with PopupMenuListener

use of javax.swing.event.PopupMenuListener in project intellij-community by JetBrains.

the class JBTabsImpl method showMorePopup.

public void showMorePopup(@Nullable final MouseEvent e) {
    final SingleRowPassInfo lastLayout = mySingleRowLayout.myLastSingRowLayout;
    if (lastLayout == null) {
        return;
    }
    mySingleRowLayout.myMorePopup = new JBPopupMenu();
    for (final TabInfo each : getVisibleInfos()) {
        if (!mySingleRowLayout.isTabHidden(each))
            continue;
        final JBMenuItem item = new JBMenuItem(each.getText(), each.getIcon());
        item.setForeground(each.getDefaultForeground());
        item.setBackground(each.getTabColor());
        mySingleRowLayout.myMorePopup.add(item);
        item.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(final ActionEvent e) {
                select(each, true);
            }
        });
    }
    mySingleRowLayout.myMorePopup.addPopupMenuListener(new PopupMenuListener() {

        @Override
        public void popupMenuWillBecomeVisible(final PopupMenuEvent e) {
        }

        @Override
        public void popupMenuWillBecomeInvisible(final PopupMenuEvent e) {
            mySingleRowLayout.myMorePopup = null;
        }

        @Override
        public void popupMenuCanceled(final PopupMenuEvent e) {
            mySingleRowLayout.myMorePopup = null;
        }
    });
    if (e != null) {
        mySingleRowLayout.myMorePopup.show(this, e.getX(), e.getY());
    } else {
        final Rectangle rect = lastLayout.moreRect;
        if (rect != null) {
            mySingleRowLayout.myMorePopup.show(this, rect.x, rect.y + rect.height);
        }
    }
}
Also used : PopupMenuListener(javax.swing.event.PopupMenuListener) PopupMenuEvent(javax.swing.event.PopupMenuEvent) SingleRowPassInfo(com.intellij.ui.tabs.impl.singleRow.SingleRowPassInfo)

Example 7 with PopupMenuListener

use of javax.swing.event.PopupMenuListener in project jdk8u_jdk by JetBrains.

the class bug4966112 method createJPopupMenu.

private static JPopupMenu createJPopupMenu() {
    JPopupMenu jpm = new JPopupMenu();
    jpm.add("One");
    jpm.add("Two");
    jpm.add("Three");
    jpm.addPopupMenuListener(new PopupMenuListener() {

        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            shown = true;
        }

        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
        }

        public void popupMenuCanceled(PopupMenuEvent e) {
        }
    });
    AutoClosable.INSTANCE.setPopup(jpm);
    return jpm;
}
Also used : PopupMenuListener(javax.swing.event.PopupMenuListener) PopupMenuEvent(javax.swing.event.PopupMenuEvent)

Example 8 with PopupMenuListener

use of javax.swing.event.PopupMenuListener in project jabref by JabRef.

the class AutoCompleteSupport method install.

/**
     * Inits the autocompletion popup. After this method is called, further input in the specified textbox will be
     * autocompleted.
     */
public void install() {
    // ActionListeners for navigating the suggested autocomplete items with the arrow keys
    final ActionListener upAction = new MoveAction(-1);
    final ActionListener downAction = new MoveAction(1);
    // ActionListener hiding the autocomplete popup
    final ActionListener hidePopupAction = e -> popup.setVisible(false);
    // ActionListener accepting the currently selected item as the autocompletion
    final ActionListener acceptAction = e -> {
        E itemToInsert = renderer.getSelectedItem();
        if (itemToInsert == null) {
            return;
        }
        String toInsert = autoCompleter.getAutoCompleteText(itemToInsert);
        if (!autoCompleter.isSingleUnitField()) {
            int priv = textComp.getText().length() - 1;
            while ((priv >= 0) && !Character.isWhitespace(textComp.getText().charAt(priv)) && (textComp.getText().charAt(priv) != ',')) {
                priv--;
            }
            textComp.setText(textComp.getText().substring(0, priv + 1) + toInsert);
        } else {
            textComp.setText(toInsert);
        }
        textComp.setCaretPosition(textComp.getText().length());
        popup.setVisible(false);
    };
    // Create popup
    popup.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.LIGHT_GRAY));
    popup.setPopupSize(textComp.getWidth(), 200);
    popup.setLayout(new BorderLayout());
    popup.setFocusable(false);
    popup.setRequestFocusEnabled(false);
    popup.add(renderer.init(acceptAction));
    // Listen for changes to the text -> update autocomplete suggestions
    textComp.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void insertUpdate(DocumentEvent e) {
            postProcessTextChange();
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            postProcessTextChange();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
        // Do nothing
        }
    });
    // Listen for up/down arrow keys -> move currently selected item up or down
    // We have to reimplement this function here since we cannot be sure that a simple list will be used to display the items
    // So better let the renderer decide what to do.
    // (Moreover, the list does not have the focus so probably would not recognize the keystrokes in the first place.)
    textComp.registerKeyboardAction(downAction, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), JComponent.WHEN_FOCUSED);
    textComp.registerKeyboardAction(upAction, KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), JComponent.WHEN_FOCUSED);
    // Listen for ESC key -> hide popup
    textComp.registerKeyboardAction(hidePopupAction, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
    // Listen to focus events -> select all the text on gaining the focus
    this.textComp.addFocusListener(new ComboBoxEditorFocusHandler());
    // Listen for ENTER key if popup is visible -> accept current autocomplete suggestion
    popup.addPopupMenuListener(new PopupMenuListener() {

        @Override
        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            textComp.registerKeyboardAction(acceptAction, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), JComponent.WHEN_FOCUSED);
        }

        @Override
        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            textComp.unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
        }

        @Override
        public void popupMenuCanceled(PopupMenuEvent e) {
        // Do nothing
        }
    });
}
Also used : Color(java.awt.Color) JComponent(javax.swing.JComponent) KeyStroke(javax.swing.KeyStroke) ActionListener(java.awt.event.ActionListener) DocumentListener(javax.swing.event.DocumentListener) AutoCompleter(org.jabref.logic.autocompleter.AutoCompleter) JPopupMenu(javax.swing.JPopupMenu) BorderFactory(javax.swing.BorderFactory) PopupMenuListener(javax.swing.event.PopupMenuListener) KeyEvent(java.awt.event.KeyEvent) ActionEvent(java.awt.event.ActionEvent) JTextComponent(javax.swing.text.JTextComponent) FocusAdapter(java.awt.event.FocusAdapter) List(java.util.List) AbstractAction(javax.swing.AbstractAction) PopupMenuEvent(javax.swing.event.PopupMenuEvent) FocusEvent(java.awt.event.FocusEvent) BorderLayout(java.awt.BorderLayout) DocumentEvent(javax.swing.event.DocumentEvent) DocumentListener(javax.swing.event.DocumentListener) ActionListener(java.awt.event.ActionListener) BorderLayout(java.awt.BorderLayout) PopupMenuListener(javax.swing.event.PopupMenuListener) DocumentEvent(javax.swing.event.DocumentEvent) PopupMenuEvent(javax.swing.event.PopupMenuEvent)

Example 9 with PopupMenuListener

use of javax.swing.event.PopupMenuListener in project JMRI by JMRI.

the class ProfilePreferencesPanel method initComponents.

/**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
@SuppressWarnings("unchecked")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
    profilesPopupMenu = new JPopupMenu();
    renameMI = new JMenuItem();
    jSeparator1 = new JPopupMenu.Separator();
    copyMI = new JMenuItem();
    deleteMI = new JMenuItem();
    grpStartWithSelectors = new ButtonGroup();
    jTabbedPane1 = new JTabbedPane();
    enabledPanel = new JPanel();
    jScrollPane1 = new JScrollPane();
    profilesTbl = new JTable() {

        //Implement table cell tool tips.
        public String getToolTipText(MouseEvent e) {
            try {
                return getValueAt(rowAtPoint(e.getPoint()), -1).toString();
            } catch (RuntimeException e1) {
            //catch null pointer exception if mouse is over an empty line
            }
            return null;
        }
    };
    btnOpenExistingProfile = new JButton();
    btnDeleteProfile = new JButton();
    btnCreateNewProfile = new JButton();
    btnActivateProfile = new JButton();
    btnExportProfile = new JButton();
    btnCopyProfile = new JButton();
    spinnerTimeout = new JSpinner();
    jLabel1 = new JLabel();
    rdoStartWithActiveProfile = new JRadioButton();
    rdoStartWithProfileSelector = new JRadioButton();
    searchPathsPanel = new JPanel();
    btnRemoveSearchPath = new JButton();
    btnAddSearchPath = new JButton();
    jScrollPane3 = new JScrollPane();
    searchPathsTbl = new JTable() {

        //Implement table cell tool tips.
        public String getToolTipText(MouseEvent e) {
            try {
                return getValueAt(rowAtPoint(e.getPoint()), -1).toString();
            } catch (RuntimeException e1) {
            //catch null pointer exception if mouse is over an empty line
            }
            return null;
        }
    };
    profilesPopupMenu.addPopupMenuListener(new PopupMenuListener() {

        public void popupMenuWillBecomeVisible(PopupMenuEvent evt) {
            profilesPopupMenuPopupMenuWillBecomeVisible(evt);
        }

        public void popupMenuWillBecomeInvisible(PopupMenuEvent evt) {
        }

        public void popupMenuCanceled(PopupMenuEvent evt) {
        }
    });
    // NOI18N
    ResourceBundle bundle = ResourceBundle.getBundle("jmri/profile/Bundle");
    // NOI18N
    renameMI.setText(bundle.getString("ProfilePreferencesPanel.renameMI.text"));
    renameMI.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            renameMIActionPerformed(evt);
        }
    });
    profilesPopupMenu.add(renameMI);
    profilesPopupMenu.add(jSeparator1);
    // NOI18N
    copyMI.setText(bundle.getString("ProfilePreferencesPanel.copyMI.text"));
    profilesPopupMenu.add(copyMI);
    // NOI18N
    deleteMI.setText(bundle.getString("ProfilePreferencesPanel.deleteMI.text"));
    profilesPopupMenu.add(deleteMI);
    if (ProfileManager.getDefault().isAutoStartActiveProfile()) {
        this.rdoStartWithActiveProfile.setSelected(true);
    } else {
        this.rdoStartWithProfileSelector.setSelected(true);
    }
    profilesTbl.setModel(new ProfileTableModel());
    profilesTbl.getSelectionModel().addListSelectionListener(new ProfilesSelectionListener());
    profilesTbl.getTableHeader().setReorderingAllowed(false);
    jScrollPane1.setViewportView(profilesTbl);
    // NOI18N
    btnOpenExistingProfile.setText(bundle.getString("ProfilePreferencesPanel.btnOpenExistingProfile.text"));
    // NOI18N
    btnOpenExistingProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnOpenExistingProfile.toolTipText"));
    btnOpenExistingProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnOpenExistingProfileActionPerformed(evt);
        }
    });
    // NOI18N
    btnDeleteProfile.setText(bundle.getString("ProfilePreferencesPanel.btnDeleteProfile.text"));
    // NOI18N
    btnDeleteProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnDeleteProfile.toolTipText"));
    btnDeleteProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnDeleteProfileActionPerformed(evt);
        }
    });
    // NOI18N
    btnCreateNewProfile.setText(bundle.getString("ProfilePreferencesPanel.btnCreateNewProfile.text"));
    // NOI18N
    btnCreateNewProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnCreateNewProfile.toolTipText"));
    btnCreateNewProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnCreateNewProfileActionPerformed(evt);
        }
    });
    // NOI18N
    btnActivateProfile.setText(bundle.getString("ProfilePreferencesPanel.btnActivateProfile.text"));
    // NOI18N
    btnActivateProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnActivateProfile.toolTipText"));
    btnActivateProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnActivateProfileActionPerformed(evt);
        }
    });
    // NOI18N
    btnExportProfile.setText(bundle.getString("ProfilePreferencesPanel.btnExportProfile.text"));
    // NOI18N
    btnExportProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnExportProfile.toolTipText"));
    btnExportProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnExportProfileActionPerformed(evt);
        }
    });
    // NOI18N
    btnCopyProfile.setText(bundle.getString("ProfilePreferencesPanel.btnCopyProfile.text"));
    btnCopyProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnCopyProfileActionPerformed(evt);
        }
    });
    spinnerTimeout.setModel(new SpinnerNumberModel(10, 0, 500, 1));
    spinnerTimeout.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent evt) {
            spinnerTimeoutStateChanged(evt);
        }
    });
    // NOI18N
    jLabel1.setText(bundle.getString("ProfilePreferencesPanel.jLabel1.text"));
    grpStartWithSelectors.add(rdoStartWithActiveProfile);
    // NOI18N
    rdoStartWithActiveProfile.setText(bundle.getString("ProfilePreferencesPanel.rdoStartWithActiveProfile.text"));
    rdoStartWithActiveProfile.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            rdoStartWithActiveProfileActionPerformed(evt);
        }
    });
    grpStartWithSelectors.add(rdoStartWithProfileSelector);
    // NOI18N
    rdoStartWithProfileSelector.setText(bundle.getString("ProfilePreferencesPanel.rdoStartWithProfileSelector.text"));
    rdoStartWithProfileSelector.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            rdoStartWithProfileSelectorActionPerformed(evt);
        }
    });
    GroupLayout enabledPanelLayout = new GroupLayout(enabledPanel);
    enabledPanel.setLayout(enabledPanelLayout);
    enabledPanelLayout.setHorizontalGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(enabledPanelLayout.createSequentialGroup().addContainerGap().addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1).addGroup(enabledPanelLayout.createSequentialGroup().addComponent(btnActivateProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnOpenExistingProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnCreateNewProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnCopyProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnExportProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 60, Short.MAX_VALUE).addComponent(btnDeleteProfile)).addGroup(enabledPanelLayout.createSequentialGroup().addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(rdoStartWithActiveProfile).addGroup(enabledPanelLayout.createSequentialGroup().addComponent(rdoStartWithProfileSelector).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(spinnerTimeout, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel1))).addGap(0, 0, Short.MAX_VALUE))).addContainerGap()));
    enabledPanelLayout.setVerticalGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(enabledPanelLayout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(btnOpenExistingProfile).addComponent(btnCreateNewProfile).addComponent(btnActivateProfile).addComponent(btnExportProfile).addComponent(btnDeleteProfile).addComponent(btnCopyProfile)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(rdoStartWithActiveProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(rdoStartWithProfileSelector).addComponent(spinnerTimeout, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel1))));
    // NOI18N
    jTabbedPane1.addTab(bundle.getString("ProfilePreferencesPanel.enabledPanel.TabConstraints.tabTitle"), enabledPanel);
    // NOI18N
    btnRemoveSearchPath.setText(bundle.getString("ProfilePreferencesPanel.btnRemoveSearchPath.text"));
    // NOI18N
    btnRemoveSearchPath.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnRemoveSearchPath.toolTipText"));
    btnRemoveSearchPath.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnRemoveSearchPathActionPerformed(evt);
        }
    });
    // NOI18N
    btnAddSearchPath.setText(bundle.getString("ProfilePreferencesPanel.btnAddSearchPath.text"));
    // NOI18N
    btnAddSearchPath.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnAddSearchPath.toolTipText"));
    btnAddSearchPath.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            btnAddSearchPathActionPerformed(evt);
        }
    });
    searchPathsTbl.setModel(new SearchPathTableModel());
    searchPathsTbl.getSelectionModel().addListSelectionListener(new SearchPathSelectionListener());
    searchPathsTbl.getTableHeader().setReorderingAllowed(false);
    jScrollPane3.setViewportView(searchPathsTbl);
    GroupLayout searchPathsPanelLayout = new GroupLayout(searchPathsPanel);
    searchPathsPanel.setLayout(searchPathsPanelLayout);
    searchPathsPanelLayout.setHorizontalGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(searchPathsPanelLayout.createSequentialGroup().addContainerGap().addGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane3, GroupLayout.DEFAULT_SIZE, 667, Short.MAX_VALUE).addGroup(searchPathsPanelLayout.createSequentialGroup().addComponent(btnAddSearchPath).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(btnRemoveSearchPath))).addContainerGap()));
    searchPathsPanelLayout.setVerticalGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(searchPathsPanelLayout.createSequentialGroup().addContainerGap().addComponent(jScrollPane3, GroupLayout.DEFAULT_SIZE, 247, Short.MAX_VALUE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(btnAddSearchPath).addComponent(btnRemoveSearchPath)).addContainerGap()));
    // NOI18N
    jTabbedPane1.addTab(bundle.getString("ProfilePreferencesPanel.searchPathsPanel.TabConstraints.tabTitle_1"), searchPathsPanel);
    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jTabbedPane1, GroupLayout.Alignment.TRAILING));
    layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jTabbedPane1));
    // NOI18N
    jTabbedPane1.getAccessibleContext().setAccessibleName(bundle.getString("ProfilePreferencesPanel.enabledPanel.TabConstraints.tabTitle"));
}
Also used : JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) ActionEvent(java.awt.event.ActionEvent) JTabbedPane(javax.swing.JTabbedPane) PopupMenuListener(javax.swing.event.PopupMenuListener) JButton(javax.swing.JButton) PopupMenuEvent(javax.swing.event.PopupMenuEvent) SpinnerNumberModel(javax.swing.SpinnerNumberModel) GroupLayout(javax.swing.GroupLayout) ChangeListener(javax.swing.event.ChangeListener) PropertyChangeListener(java.beans.PropertyChangeListener) JMenuItem(javax.swing.JMenuItem) JScrollPane(javax.swing.JScrollPane) MouseEvent(java.awt.event.MouseEvent) JLabel(javax.swing.JLabel) JPopupMenu(javax.swing.JPopupMenu) ActionListener(java.awt.event.ActionListener) ChangeEvent(javax.swing.event.ChangeEvent) ButtonGroup(javax.swing.ButtonGroup) JTable(javax.swing.JTable) JSpinner(javax.swing.JSpinner) ResourceBundle(java.util.ResourceBundle)

Example 10 with PopupMenuListener

use of javax.swing.event.PopupMenuListener in project processdash by dtuma.

the class DefectLogEditor method createImportButton.

private DropDownButton createImportButton() {
    List importActions = ExtensionManager.getExecutableExtensions("defect-importer", dashboard);
    if (importActions.isEmpty())
        return null;
    DropDownButton result = new DropDownButton(resources.getString("Log.Import_Button"));
    result.setMainButtonBehavior(DropDownButton.OPEN_DROP_DOWN_MENU);
    result.getMenu().getPopupMenu().addPopupMenuListener(new PopupMenuListener() {

        public void popupMenuCanceled(PopupMenuEvent e) {
        }

        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
        }

        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            reupdateImportActions();
        }
    });
    for (Iterator i = importActions.iterator(); i.hasNext(); ) {
        Action a = (Action) i.next();
        if (a.getValue(IMPORT_ACTION_INVALID) != null)
            i.remove();
        else
            result.getMenu().add(a);
    }
    if (result.isEmpty())
        return null;
    else
        return result;
}
Also used : Action(javax.swing.Action) DropDownButton(net.sourceforge.processdash.ui.lib.DropDownButton) PopupMenuListener(javax.swing.event.PopupMenuListener) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) JList(javax.swing.JList) PopupMenuEvent(javax.swing.event.PopupMenuEvent)

Aggregations

PopupMenuEvent (javax.swing.event.PopupMenuEvent)11 PopupMenuListener (javax.swing.event.PopupMenuListener)11 ActionEvent (java.awt.event.ActionEvent)5 ActionListener (java.awt.event.ActionListener)5 List (java.util.List)3 JPopupMenu (javax.swing.JPopupMenu)3 JComponent (javax.swing.JComponent)2 JMenuItem (javax.swing.JMenuItem)2 Ref (com.intellij.openapi.util.Ref)1 SingleRowPassInfo (com.intellij.ui.tabs.impl.singleRow.SingleRowPassInfo)1 BorderLayout (java.awt.BorderLayout)1 Color (java.awt.Color)1 GridLayout (java.awt.GridLayout)1 FocusAdapter (java.awt.event.FocusAdapter)1 FocusEvent (java.awt.event.FocusEvent)1 ItemEvent (java.awt.event.ItemEvent)1 ItemListener (java.awt.event.ItemListener)1 KeyEvent (java.awt.event.KeyEvent)1 MouseEvent (java.awt.event.MouseEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1