Search in sources :

Example 31 with DefaultActionGroup

use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.

the class XDebuggerEditorBase method createLanguagePopup.

private ListPopup createLanguagePopup() {
    DefaultActionGroup actions = new DefaultActionGroup();
    for (Language language : getSupportedLanguages()) {
        //noinspection ConstantConditions
        actions.add(new AnAction(language.getDisplayName(), null, language.getAssociatedFileType().getIcon()) {

            @Override
            public void actionPerformed(@NotNull AnActionEvent e) {
                XExpression currentExpression = getExpression();
                setExpression(new XExpressionImpl(currentExpression.getExpression(), language, currentExpression.getCustomInfo()));
                requestFocusInEditor();
            }
        });
    }
    DataContext dataContext = DataManager.getInstance().getDataContext(getComponent());
    return JBPopupFactory.getInstance().createActionGroupPopup("Choose Language", actions, dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) Language(com.intellij.lang.Language) XExpressionImpl(com.intellij.xdebugger.impl.breakpoints.XExpressionImpl) XExpression(com.intellij.xdebugger.XExpression) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 32 with DefaultActionGroup

use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.

the class DiffSplitter method createActionComponent.

@Nullable
private static JComponent createActionComponent(@Nullable final AnAction action) {
    if (action == null)
        return null;
    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("", new DefaultActionGroup(action), true);
    toolbar.setReservePlaceAutoPopupIcon(false);
    toolbar.getComponent().setCursor(Cursor.getDefaultCursor());
    return toolbar.getComponent();
}
Also used : ActionToolbar(com.intellij.openapi.actionSystem.ActionToolbar) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) Nullable(org.jetbrains.annotations.Nullable)

Example 33 with DefaultActionGroup

use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.

the class FileSystemTreeFactoryImpl method createDefaultFileSystemActions.

public DefaultActionGroup createDefaultFileSystemActions(FileSystemTree fileSystemTree) {
    DefaultActionGroup group = new DefaultActionGroup();
    final ActionManager actionManager = ActionManager.getInstance();
    group.add(actionManager.getAction("FileChooser.GotoHome"));
    group.add(actionManager.getAction("FileChooser.GotoProject"));
    group.addSeparator();
    group.add(actionManager.getAction("FileChooser.NewFolder"));
    group.add(actionManager.getAction("FileChooser.Delete"));
    group.addSeparator();
    SynchronizeAction action1 = new SynchronizeAction();
    AnAction original = actionManager.getAction(IdeActions.ACTION_SYNCHRONIZE);
    action1.copyFrom(original);
    action1.registerCustomShortcutSet(original.getShortcutSet(), fileSystemTree.getTree());
    group.add(action1);
    group.addSeparator();
    group.add(actionManager.getAction("FileChooser.ShowHiddens"));
    return group;
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) SynchronizeAction(com.intellij.ide.actions.SynchronizeAction) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 34 with DefaultActionGroup

use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.

the class JBTabsDemo method main.

public static void main(String[] args) {
    System.out.println("JBTabs.main");
    IconLoader.activate();
    final JFrame frame = new JFrame();
    frame.getContentPane().setLayout(new BorderLayout(0, 0));
    final int[] count = new int[1];
    final JBTabsImpl tabs = new JBTabsImpl(null, ActionManager.getInstance(), null, Disposer.newDisposable());
    tabs.setTestMode(true);
    //final JPanel flow = new JPanel(new FlowLayout(FlowLayout.CENTER));
    //frame.getContentPane().add(flow);
    //flow.add(tabs.getComponent());
    frame.getContentPane().add(tabs.getComponent(), BorderLayout.CENTER);
    JPanel south = new JPanel(new FlowLayout());
    south.setOpaque(true);
    south.setBackground(Color.white);
    final JComboBox pos = new JComboBox(new Object[] { JBTabsPosition.top, JBTabsPosition.left, JBTabsPosition.right, JBTabsPosition.bottom });
    pos.setSelectedIndex(0);
    south.add(pos);
    pos.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent e) {
            final JBTabsPosition p = (JBTabsPosition) pos.getSelectedItem();
            if (p != null) {
                tabs.getPresentation().setTabsPosition(p);
            }
        }
    });
    final JCheckBox bb = new JCheckBox("Buffered", true);
    bb.addItemListener(new ItemListener() {

        public void itemStateChanged(final ItemEvent e) {
            tabs.setUseBufferedPaint(bb.isSelected());
        }
    });
    south.add(bb);
    final JCheckBox f = new JCheckBox("Focused");
    f.addItemListener(new ItemListener() {

        public void itemStateChanged(final ItemEvent e) {
            tabs.setFocused(f.isSelected());
        }
    });
    south.add(f);
    final JCheckBox v = new JCheckBox("Vertical");
    v.addItemListener(new ItemListener() {

        public void itemStateChanged(final ItemEvent e) {
            tabs.setSideComponentVertical(v.isSelected());
        }
    });
    south.add(v);
    final JCheckBox row = new JCheckBox("Single row", true);
    row.addItemListener(new ItemListener() {

        public void itemStateChanged(final ItemEvent e) {
            tabs.setSingleRow(row.isSelected());
        }
    });
    south.add(row);
    final JCheckBox ghosts = new JCheckBox("Ghosts always visible", false);
    ghosts.addItemListener(new ItemListener() {

        public void itemStateChanged(final ItemEvent e) {
            tabs.setGhostsAlwaysVisible(ghosts.isSelected());
        }
    });
    south.add(ghosts);
    final JCheckBox stealth = new JCheckBox("Stealth tab", tabs.isStealthTabMode());
    stealth.addItemListener(new ItemListener() {

        public void itemStateChanged(final ItemEvent e) {
            tabs.setStealthTabMode(stealth.isSelected());
        }
    });
    south.add(stealth);
    final JCheckBox hide = new JCheckBox("Hide tabs", tabs.isHideTabs());
    hide.addItemListener(new ItemListener() {

        public void itemStateChanged(final ItemEvent e) {
            tabs.setHideTabs(hide.isSelected());
        }
    });
    south.add(hide);
    frame.getContentPane().add(south, BorderLayout.SOUTH);
    tabs.addListener(new TabsListener.Adapter() {

        public void selectionChanged(final TabInfo oldSelection, final TabInfo newSelection) {
            System.out.println("TabsWithActions.selectionChanged old=" + oldSelection + " new=" + newSelection);
        }
    });
    final JTree someTree = new Tree() {

        public void addNotify() {
            //To change body of overridden methods use File | Settings | File Templates.
            super.addNotify();
            System.out.println("JBTabs.addNotify");
        }

        public void removeNotify() {
            System.out.println("JBTabs.removeNotify");
            //To change body of overridden methods use File | Settings | File Templates.
            super.removeNotify();
        }
    };
    //someTree.setBorder(new LineBorder(Color.cyan));
    tabs.addTab(new TabInfo(someTree)).setText("Tree1").setActions(new DefaultActionGroup(), null).setIcon(AllIcons.Debugger.Frame);
    final JTree component = new Tree();
    final TabInfo toAnimate1 = new TabInfo(component);
    //toAnimate1.setIcon(IconLoader.getIcon("/debugger/console.png"));
    final JCheckBox attract1 = new JCheckBox("Attract 1");
    attract1.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent e) {
            if (attract1.isSelected()) {
                toAnimate1.fireAlert();
            } else {
                toAnimate1.stopAlerting();
            }
        }
    });
    south.add(attract1);
    final JCheckBox hide1 = new JCheckBox("Hide 1", toAnimate1.isHidden());
    hide1.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent e) {
            toAnimate1.setHidden(!toAnimate1.isHidden());
        }
    });
    south.add(hide1);
    final JCheckBox block = new JCheckBox("Block", false);
    block.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent e) {
            tabs.setPaintBlocked(!block.isSelected(), true);
        }
    });
    south.add(block);
    final JCheckBox fill = new JCheckBox("Tab fill in", true);
    fill.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent e) {
            tabs.getPresentation().setActiveTabFillIn(fill.isSelected() ? Color.white : null);
        }
    });
    south.add(fill);
    final JButton refire = new JButton("Re-fire attraction");
    refire.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent e) {
            toAnimate1.fireAlert();
        }
    });
    south.add(refire);
    final JEditorPane text = new JEditorPane();
    text.setEditorKit(new HTMLEditorKit());
    StringBuffer buffer = new StringBuffer();
    for (int i = 0; i < 50; i++) {
        buffer.append("1234567890abcdefghijklmnopqrstv1234567890abcdefghijklmnopqrstv1234567890abcdefghijklmnopqrstv<br>");
    }
    text.setText(buffer.toString());
    final JLabel tb = new JLabel("Side comp");
    tb.setBorder(new LineBorder(Color.red));
    tabs.addTab(new TabInfo(ScrollPaneFactory.createScrollPane(text)).setSideComponent(tb)).setText("Text text text");
    tabs.addTab(toAnimate1).append("Tree2", new SimpleTextAttributes(SimpleTextAttributes.STYLE_WAVED, Color.black, Color.red));
    tabs.addTab(new TabInfo(new JTable())).setText("Table 1").setActions(new DefaultActionGroup(), null);
    tabs.addTab(new TabInfo(new JTable())).setText("Table 2").setActions(new DefaultActionGroup(), null);
    tabs.addTab(new TabInfo(new JTable())).setText("Table 3").setActions(new DefaultActionGroup(), null);
    tabs.addTab(new TabInfo(new JTable())).setText("Table 4").setActions(new DefaultActionGroup(), null);
    tabs.addTab(new TabInfo(new JTable())).setText("Table 5").setActions(new DefaultActionGroup(), null);
    tabs.addTab(new TabInfo(new JTable())).setText("Table 6").setActions(new DefaultActionGroup(), null);
    tabs.addTab(new TabInfo(new JTable())).setText("Table 7").setActions(new DefaultActionGroup(), null);
    tabs.addTab(new TabInfo(new JTable())).setText("Table 8").setActions(new DefaultActionGroup(), null);
    tabs.addTab(new TabInfo(new JTable())).setText("Table 9").setActions(new DefaultActionGroup(), null);
    //tabs.getComponent().setBorder(new EmptyBorder(5, 5, 5, 5));
    tabs.setTabSidePaintBorder(5);
    tabs.setPaintBorder(1, 1, 1, 1);
    tabs.getPresentation().setActiveTabFillIn(Color.white);
    tabs.setGhostsAlwaysVisible(true);
    //tabs.setBorder(new LineBorder(Color.blue, 5));
    tabs.setBorder(new EmptyBorder(30, 30, 30, 30));
    tabs.setUiDecorator(new UiDecorator() {

        public UiDecoration getDecoration() {
            return new UiDecoration(null, new Insets(0, -1, 0, -1));
        }
    });
    tabs.setStealthTabMode(true);
    frame.setBounds(1400, 200, 1000, 800);
    frame.show();
}
Also used : JBTabsPosition(com.intellij.ui.tabs.JBTabsPosition) ItemEvent(java.awt.event.ItemEvent) ActionEvent(java.awt.event.ActionEvent) LineBorder(javax.swing.border.LineBorder) TabsListener(com.intellij.ui.tabs.TabsListener) SimpleTextAttributes(com.intellij.ui.SimpleTextAttributes) Tree(com.intellij.ui.treeStructure.Tree) TabInfo(com.intellij.ui.tabs.TabInfo) EmptyBorder(javax.swing.border.EmptyBorder) UiDecorator(com.intellij.ui.tabs.UiDecorator) HTMLEditorKit(javax.swing.text.html.HTMLEditorKit) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) ActionListener(java.awt.event.ActionListener) ItemListener(java.awt.event.ItemListener)

Example 35 with DefaultActionGroup

use of com.intellij.openapi.actionSystem.DefaultActionGroup in project android by JetBrains.

the class NlActionsToolbar method createConfigActions.

private static DefaultActionGroup createConfigActions(ConfigurationHolder configurationHolder, DesignSurface surface) {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new DesignModeAction(surface));
    group.add(new BlueprintModeAction(surface));
    group.add(new BothModeAction(surface));
    group.addSeparator();
    OrientationMenuAction orientationAction = new OrientationMenuAction(configurationHolder);
    group.add(orientationAction);
    group.addSeparator();
    DeviceMenuAction deviceAction = new DeviceMenuAction(configurationHolder);
    group.add(deviceAction);
    TargetMenuAction targetMenuAction = new TargetMenuAction(configurationHolder);
    group.add(targetMenuAction);
    ThemeMenuAction themeAction = new ThemeMenuAction(configurationHolder);
    group.add(themeAction);
    group.addSeparator();
    LocaleMenuAction localeAction = new LocaleMenuAction(configurationHolder);
    group.add(localeAction);
    group.addSeparator();
    ConfigurationMenuAction configAction = new ConfigurationMenuAction(surface);
    group.add(configAction);
    return group;
}
Also used : DesignModeAction(com.android.tools.idea.actions.DesignModeAction) BlueprintModeAction(com.android.tools.idea.actions.BlueprintModeAction) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) BothModeAction(com.android.tools.idea.actions.BothModeAction)

Aggregations

DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)109 NotNull (org.jetbrains.annotations.NotNull)38 AnAction (com.intellij.openapi.actionSystem.AnAction)22 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)16 Nullable (org.jetbrains.annotations.Nullable)11 ActionManager (com.intellij.openapi.actionSystem.ActionManager)8 ActionGroup (com.intellij.openapi.actionSystem.ActionGroup)7 Separator (com.intellij.openapi.actionSystem.Separator)7 ListPopup (com.intellij.openapi.ui.popup.ListPopup)7 Content (com.intellij.ui.content.Content)6 BrowserHelpAction (com.android.tools.idea.actions.BrowserHelpAction)5 Project (com.intellij.openapi.project.Project)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 List (java.util.List)5 RecordingAction (com.android.tools.idea.monitor.actions.RecordingAction)4 ActionToolbar (com.intellij.openapi.actionSystem.ActionToolbar)4 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)4 javax.swing (javax.swing)4 FolderConfiguration (com.android.ide.common.resources.configuration.FolderConfiguration)3 CommonActionsManager (com.intellij.ide.CommonActionsManager)3