Search in sources :

Example 1 with SingleRowPassInfo

use of com.intellij.ui.tabs.impl.singleRow.SingleRowPassInfo 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)

Aggregations

SingleRowPassInfo (com.intellij.ui.tabs.impl.singleRow.SingleRowPassInfo)1 PopupMenuEvent (javax.swing.event.PopupMenuEvent)1 PopupMenuListener (javax.swing.event.PopupMenuListener)1