/** * {@inheritDoc} */ @NotNull @Override protected DefaultActionGroup createPopupActionGroup(JComponent button) { if (myItems == null) { myItems = new DefaultActionGroup(null, true); for (final ClasspathType classpathType : ClasspathType.values()) { myItems.addAction(new DumbAwareAction(classpathType.getDescription()) { @Override public void actionPerformed(AnActionEvent e) { mySettings.setRuntime(classpathType.isRuntime()); mySettings.setTest(classpathType.isTest()); updateTree(); } }); } } return myItems; }
@NotNull JBPopup createPopup() { JPanel panel = new JPanel(new BorderLayout()); panel.add(myTextField, BorderLayout.CENTER); ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, myTextField) .setCancelOnClickOutside(true) .setAdText(KeymapUtil.getShortcutsText(CommonShortcuts.CTRL_ENTER.getShortcuts()) + " to finish") .setRequestFocus(true) .setResizable(true) .setMayBeParent(true); final JBPopup popup = builder.createPopup(); popup.setMinimumSize(new Dimension(200, 90)); AnAction okAction = new DumbAwareAction() { @Override public void actionPerformed(@NotNull AnActionEvent e) { unregisterCustomShortcutSet(popup.getContent()); popup.closeOk(e.getInputEvent()); } }; okAction.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, popup.getContent()); return popup; }
protected void fillActions(Project project, @NotNull DefaultActionGroup group, @NotNull DataContext dataContext) { final LafManager manager = LafManager.getInstance(); final UIManager.LookAndFeelInfo[] lfs = manager.getInstalledLookAndFeels(); final UIManager.LookAndFeelInfo current = manager.getCurrentLookAndFeel(); for (final UIManager.LookAndFeelInfo lf : lfs) { group.add(new DumbAwareAction(lf.getName(), "", lf == current ? ourCurrentAction : ourNotCurrentAction) { public void actionPerformed(AnActionEvent e) { final UIManager.LookAndFeelInfo cur = manager.getCurrentLookAndFeel(); if (cur == lf) return; boolean needUninstall = UIUtil.isUnderDarcula(); manager.setCurrentLookAndFeel(lf); manager.updateUI(); if (UIUtil.isUnderDarcula()) { DarculaInstaller.install(); } else if (needUninstall) { DarculaInstaller.uninstall(); } } }); } }
@NotNull @Override protected DefaultActionGroup createPopupActionGroup(JComponent button) { final DefaultActionGroup gr = new DefaultActionGroup(); for (final String enabledValue : InstalledPluginsTableModel.ENABLED_VALUES) { gr.add(new DumbAwareAction(enabledValue) { @Override public void actionPerformed(AnActionEvent e) { final IdeaPluginDescriptor[] selection = pluginTable.getSelectedObjects(); final String filter = myFilter.getFilter().toLowerCase(); ((InstalledPluginsTableModel)pluginsModel).setEnabledFilter(enabledValue, filter); if (selection != null) { select(selection); } } }); } return gr; }
@Override protected boolean showHint(final JComponent component) { boolean result = super.showHint(component); if (result && getType() == ValueHintType.MOUSE_OVER_HINT) { myDisposable = Disposer.newDisposable(); ShortcutSet shortcut = ActionManager.getInstance().getAction("ShowErrorDescription").getShortcutSet(); new DumbAwareAction() { @Override public void actionPerformed(@NotNull AnActionEvent e) { hideHint(); final Point point = new Point(myPoint.x, myPoint.y + getEditor().getLineHeight()); new XValueHint(getProject(), getEditor(), point, ValueHintType.MOUSE_CLICK_HINT, myExpressionInfo, myEvaluator, myDebugSession).invokeHint(); } }.registerCustomShortcutSet(shortcut, getEditor().getContentComponent(), myDisposable); } if (result) { XValueHint prev = getEditor().getUserData(HINT_KEY); if (prev != null) { prev.hideHint(); } getEditor().putUserData(HINT_KEY, this); } return result; }
private void fillActionGroup(final DefaultActionGroup group, final List<NamedScope> scopes, final List<Descriptor> defaultDescriptors, final InspectionProfileImpl inspectionProfile, final Set<String> excludedScopeNames) { for (final NamedScope scope : scopes) { final String scopeName = scope.getName(); if (excludedScopeNames.contains(scopeName)) { continue; } group.add(new DumbAwareAction(scopeName) { @Override public void actionPerformed(final AnActionEvent e) { for (final Descriptor defaultDescriptor : defaultDescriptors) { inspectionProfile.addScope(defaultDescriptor.getToolWrapper().createCopy(), scope, defaultDescriptor.getLevel(), true, getEventProject(e)); } onScopeAdded(); } }); } }
private static void selectBranchAndPerformAction(@NotNull VcsLogDataPack dataPack, @NotNull AnActionEvent event, @NotNull final Consumer<String> consumer, @NotNull Collection<VirtualFile> visibleRoots) { ActionGroup actionGroup = BranchFilterPopupComponent.constructActionGroup(dataPack, null, new Function<String, AnAction>() { @Override public AnAction fun(final String s) { return new DumbAwareAction(s) { @Override public void actionPerformed(AnActionEvent e) { consumer.consume(s); } }; } }, visibleRoots); ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup("Select branch to compare", actionGroup, event.getDataContext(), false, false, false, null, -1, null); InputEvent inputEvent = event.getInputEvent(); if (inputEvent instanceof MouseEvent) { popup.show(new RelativePoint((MouseEvent)inputEvent)); } else { popup.showInBestPositionFor(event.getDataContext()); } }
public static void convertActions(@NotNull JComponent component, @NotNull List<TerminalAction> actions, @Nullable final Predicate<KeyEvent> elseAction) { for (final TerminalAction action : actions) { AnAction a = new DumbAwareAction() { @Override public void actionPerformed(AnActionEvent e) { KeyEvent event = e.getInputEvent() instanceof KeyEvent ? (KeyEvent)e.getInputEvent() : null; if (!action.perform(event)) { if (elseAction != null) { elseAction.apply(event); } } } }; a.registerCustomShortcutSet(action.getKeyCode(), action.getModifiers(), component); } }
public void createAddActions(DefaultActionGroup group, final JComponent parent, final Consumer<Sdk> updateTree, @Nullable Condition<SdkTypeId> filter) { final SdkType[] types = SdkType.getAllTypes(); for (final SdkType type : types) { if (filter != null && !filter.value(type)) continue; final AnAction addAction = new DumbAwareAction(type.getPresentableName(), null, type.getIconForAddAction()) { @Override public void actionPerformed(AnActionEvent e) { doAdd(parent, type, updateTree); } }; group.add(addAction); } }
public static void convertActions(@NotNull JComponent component, @NotNull List<TerminalAction> actions, @Nullable final Predicate<KeyEvent> elseAction) { for(final TerminalAction action : actions) { AnAction a = new DumbAwareAction() { @Override public void actionPerformed(AnActionEvent e) { KeyEvent event = e.getInputEvent() instanceof KeyEvent ? (KeyEvent) e.getInputEvent() : null; if(!action.perform(event)) { if(elseAction != null) { elseAction.apply(event); } } } }; a.registerCustomShortcutSet(action.getKeyCode(), action.getModifiers(), component); } }
@Nonnull JBPopup createPopup() { JPanel panel = new JPanel(new BorderLayout()); panel.add(myTextField, BorderLayout.CENTER); ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, myTextField) .setCancelOnClickOutside(true) .setAdText(KeymapUtil.getShortcutsText(CommonShortcuts.CTRL_ENTER.getShortcuts()) + " to finish") .setRequestFocus(true) .setResizable(true) .setMayBeParent(true); final JBPopup popup = builder.createPopup(); popup.setMinimumSize(new JBDimension(200, 90)); AnAction okAction = new DumbAwareAction() { @Override public void actionPerformed(@Nonnull AnActionEvent e) { unregisterCustomShortcutSet(popup.getContent()); popup.closeOk(e.getInputEvent()); } }; okAction.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, popup.getContent()); return popup; }
@Override protected void fillActions(Project project, @Nonnull DefaultActionGroup group, @Nonnull DataContext dataContext) { final LafManager manager = LafManager.getInstance(); final UIManager.LookAndFeelInfo[] lfs = manager.getInstalledLookAndFeels(); final UIManager.LookAndFeelInfo current = manager.getCurrentLookAndFeel(); for (final UIManager.LookAndFeelInfo lf : lfs) { group.add(new DumbAwareAction(lf.getName(), "", lf == current ? ourCurrentAction : ourNotCurrentAction) { @Override public void actionPerformed(AnActionEvent e) { final UIManager.LookAndFeelInfo cur = manager.getCurrentLookAndFeel(); if (cur == lf) return; manager.setCurrentLookAndFeel(lf); manager.updateUI(); } }); } }
@Override protected boolean showHint(final JComponent component) { boolean result = super.showHint(component); if (result && getType() == ValueHintType.MOUSE_OVER_HINT) { myDisposable = Disposer.newDisposable(); ShortcutSet shortcut = ActionManager.getInstance().getAction("ShowErrorDescription").getShortcutSet(); new DumbAwareAction() { @Override public void actionPerformed(@Nonnull AnActionEvent e) { hideHint(); final Point point = new Point(myPoint.x, myPoint.y + getEditor().getLineHeight()); new XValueHint(getProject(), getEditor(), point, ValueHintType.MOUSE_CLICK_HINT, myExpressionInfo, myEvaluator, myDebugSession).invokeHint(); } }.registerCustomShortcutSet(shortcut, getEditor().getContentComponent(), myDisposable); } if (result) { XValueHint prev = getEditor().getUserData(HINT_KEY); if (prev != null) { prev.hideHint(); } getEditor().putUserData(HINT_KEY, this); } return result; }
/** * {@inheritDoc} */ @Nonnull @Override protected DefaultActionGroup createPopupActionGroup(JComponent button) { if (myItems == null) { myItems = new DefaultActionGroup(null, true); for (final ClasspathType classpathType : ClasspathType.values()) { myItems.addAction(new DumbAwareAction(classpathType.getDescription()) { @Override public void actionPerformed(AnActionEvent e) { mySettings.setRuntime(classpathType.isRuntime()); mySettings.setTest(classpathType.isTest()); updateTree(); } }); } } return myItems; }
@Override public void actionPerformed(AnActionEvent e) { List<String> languages = IdeScriptEngineManager.getInstance().getLanguages(); if (languages.size() == 1) { runConsole(e, languages.iterator().next()); return; } DefaultActionGroup actions = new DefaultActionGroup(ContainerUtil.map(languages, (NotNullFunction<String, AnAction>)language -> new DumbAwareAction(language) { @Override public void actionPerformed(@Nonnull AnActionEvent e1) { runConsole(e1, language); } })); JBPopupFactory.getInstance().createActionGroupPopup("Script Engine", actions, e.getDataContext(), JBPopupFactory.ActionSelectionAid.NUMBERING, false). showInBestPositionFor(e.getDataContext()); }
@Nullable @Override public AnAction getClickAction() { return new DumbAwareAction() { @Override public void actionPerformed(AnActionEvent e) { performAction(e); } }; }
protected void init() { if (myWrapper != null) return; myProcessor = createProcessor(); String dialogGroupKey = myProcessor.getContextUserData(DiffUserDataKeys.DIALOG_GROUP_KEY); if (dialogGroupKey == null) dialogGroupKey = "DiffContextDialog"; myWrapper = new WindowWrapperBuilder(DiffUtil.getWindowMode(myHints), new MyPanel(myProcessor.getComponent())) .setProject(myProject) .setParent(myHints.getParent()) .setDimensionServiceKey(dialogGroupKey) .setOnShowCallback(new Runnable() { @Override public void run() { myProcessor.updateRequest(); myProcessor.requestFocus(); // TODO: not needed for modal dialogs. Make a flag in WindowWrapperBuilder ? } }) .build(); myWrapper.setImage(ImageLoader.loadFromResource("/diff/Diff.png")); Disposer.register(myWrapper, myProcessor); new DumbAwareAction() { public void actionPerformed(final AnActionEvent e) { myWrapper.close(); } }.registerCustomShortcutSet(CommonShortcuts.getCloseActiveWindow(), myProcessor.getComponent(), myWrapper); }
private AnAction wrapGroups(AnAction action) { if (action instanceof ActionGroup && ((ActionGroup)action).isPopup()) { final Pair<JPanel, JBList> panel = createActionGroupPanel((ActionGroup)action, mySlidingPanel, new Runnable() { @Override public void run() { goBack(); } }); final Runnable onDone = new Runnable() { @Override public void run() { final JBList list = panel.second; ScrollingUtil.ensureSelectionExists(list); final ListSelectionListener[] listeners = ((DefaultListSelectionModel)list.getSelectionModel()).getListeners(ListSelectionListener.class); //avoid component cashing. This helps in case of LaF change for (ListSelectionListener listener : listeners) { listener.valueChanged(new ListSelectionEvent(list, list.getSelectedIndex(), list.getSelectedIndex(), true)); } list.requestFocus(); } }; final String name = action.getClass().getName(); mySlidingPanel.add(name, panel.first); final Presentation p = action.getTemplatePresentation(); return new DumbAwareAction(p.getText(), p.getDescription(), p.getIcon()) { @Override public void actionPerformed(@NotNull AnActionEvent e) { mySlidingPanel.getLayout().swipe(mySlidingPanel, name, JBCardLayout.SwipeDirection.FORWARD, onDone); } }; } return action; }
private static AnAction createSplitTabsAction(final TabbedContent content) { return new DumbAwareAction("Split '" + content.getTitlePrefix() + "' group") { @Override public void actionPerformed(AnActionEvent e) { content.split(); } }; }
private static AnAction createMergeTabsAction(final ContentManager manager, final String tabPrefix) { return new DumbAwareAction("Merge tabs to '" + tabPrefix + "' group") { @Override public void actionPerformed(AnActionEvent e) { final Content selectedContent = manager.getSelectedContent(); final List<Pair<String, JComponent>> tabs = new ArrayList<Pair<String, JComponent>>(); int selectedTab = -1; for (Content content : manager.getContents()) { if (tabPrefix.equals(content.getUserData(Content.TAB_GROUP_NAME_KEY))) { final String label = content.getTabName().substring(tabPrefix.length() + 2); final JComponent component = content.getComponent(); if (content == selectedContent) { selectedTab = tabs.size(); } tabs.add(Pair.create(label, component)); manager.removeContent(content, false); content.setComponent(null); Disposer.dispose(content); } } PropertiesComponent.getInstance().unsetValue(TabbedContent.SPLIT_PROPERTY_PREFIX + tabPrefix); for (int i = 0; i < tabs.size(); i++) { final Pair<String, JComponent> tab = tabs.get(i); ContentUtilEx.addTabbedContent(manager, tab.second, tabPrefix, tab.first, i == selectedTab); } } }; }
private static void addKeymapAction(final DefaultActionGroup group, final KeymapManagerEx manager, final Keymap current, final Keymap keymap, final boolean addScheme) { group.add(new DumbAwareAction(keymap.getPresentableName(), "", keymap == current ? ourCurrentAction : ourNotCurrentAction) { @Override public void actionPerformed(AnActionEvent e) { if (addScheme) { manager.getSchemesManager().addNewScheme(keymap, false); } manager.setActiveKeymap(keymap); } }); }
private AnAction createFilterByCategoryAction(final String availableCategory) { return new DumbAwareAction(availableCategory) { @Override public void actionPerformed(AnActionEvent e) { final String filter = myFilter.getFilter().toLowerCase(Locale.ENGLISH); ((AvailablePluginsTableModel)pluginsModel).setCategory(availableCategory, filter); } }; }
private AnAction createFilterByRepositoryAction(final String host) { return new DumbAwareAction(host) { @Override public void actionPerformed(AnActionEvent e) { final String filter = myFilter.getFilter().toLowerCase(Locale.ENGLISH); ((AvailablePluginsTableModel)pluginsModel).setRepository(host, filter); TableUtil.ensureSelectionExists(getPluginTable()); } }; }
private AnAction createSortingAction(boolean checked) { boolean currentSetting = UISettings.getInstance().SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY; final boolean newSetting = checked ? currentSetting : !currentSetting; return new DumbAwareAction(newSetting ? "Sort lexicographically" : "Sort by relevance", null, checked ? PlatformIcons.CHECK_ICON : null) { @Override public void actionPerformed(AnActionEvent e) { FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.EDITING_COMPLETION_CHANGE_SORTING); UISettings.getInstance().SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY = newSetting; updateSorting(); } }; }
@NotNull @Override public DefaultActionGroup createPopupActionGroup(final JComponent component) { final DefaultActionGroup group = new DefaultActionGroup(); final List<NamedScope> predefinedScopes = new ArrayList<NamedScope>(); final List<NamedScope> customScopes = new ArrayList<NamedScope>(); for (final NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) { Collections.addAll(customScopes, holder.getEditableScopes()); predefinedScopes.addAll(holder.getPredefinedScopes()); } predefinedScopes.remove(CustomScopesProviderEx.getAllScope()); for (NamedScope predefinedScope : predefinedScopes) { if (predefinedScope instanceof NonProjectFilesScope) { predefinedScopes.remove(predefinedScope); break; } } fillActionGroup(group, predefinedScopes, myDefaultDescriptors, myInspectionProfile, myExcludedScopeNames); group.addSeparator(); fillActionGroup(group, customScopes, myDefaultDescriptors, myInspectionProfile, myExcludedScopeNames); group.addSeparator(); group.add(new DumbAwareAction("Edit Scopes Order...") { @Override public void actionPerformed(final AnActionEvent e) { final ScopesOrderDialog dlg = new ScopesOrderDialog(component, myInspectionProfile, myProject); if (dlg.showAndGet()) { onScopesOrderChanged(); } } }); return group; }
public void registerUpDownHint(JComponent component) { new DumbAwareAction() { @Override public void actionPerformed(AnActionEvent e) { if (e.getInputEvent() instanceof KeyEvent) { final int code = ((KeyEvent)e.getInputEvent()).getKeyCode(); scrollBy(code == KeyEvent.VK_DOWN ? 1 : code == KeyEvent.VK_UP ? -1 : 0); } } }.registerCustomShortcutSet(new CustomShortcutSet(KeyEvent.VK_UP, KeyEvent.VK_DOWN), component); }
private static void addScheme(final DefaultActionGroup group, final InspectionProjectProfileManager projectProfileManager, final Profile current, final Profile scheme) { group.add(new DumbAwareAction(scheme.getName(), "", scheme == current ? ourCurrentAction : ourNotCurrentAction) { @Override public void actionPerformed(@Nullable AnActionEvent e) { projectProfileManager.setProjectProfile(scheme.getName()); } }); }
private static void registerKeymapActions(final TerminalPanel terminalPanel) { ActionManager actionManager = ActionManager.getInstance(); for (String actionId : ACTIONS_TO_SKIP) { final AnAction action = actionManager.getAction(actionId); if (action != null) { AnAction a = new DumbAwareAction() { @Override public void actionPerformed(AnActionEvent e) { if (e.getInputEvent() instanceof KeyEvent) { AnActionEvent event = new AnActionEvent(e.getInputEvent(), e.getDataContext(), e.getPlace(), new Presentation(), e.getActionManager(), e.getModifiers()); action.update(event); if (event.getPresentation().isEnabled()) { action.actionPerformed(event); } else { terminalPanel.handleKeyEvent((KeyEvent)event.getInputEvent()); } event.getInputEvent().consume(); } } }; for (Shortcut sc : action.getShortcutSet().getShortcuts()) { if (sc.isKeyboard() && sc instanceof KeyboardShortcut) { KeyboardShortcut ksc = (KeyboardShortcut)sc; a.registerCustomShortcutSet(ksc.getFirstKeyStroke().getKeyCode(), ksc.getFirstKeyStroke().getModifiers(), terminalPanel); } } } } }
@Override protected void fillActions(final Project project, DefaultActionGroup group, DataContext dataContext) { Settings.Formatter formatter = ProjectComponent.getInstance(project).getSelectedProfile().getFormatter(); for (final Settings.Formatter lf : Settings.Formatter.values()) { group.add(new DumbAwareAction(lf.name(), "", lf == formatter ? ourCurrentAction : ourNotCurrentAction) { @Override public void actionPerformed(AnActionEvent e) { changeFormatter(project, lf); } }); } }
protected void init() { if (myWrapper != null) return; myProcessor = createProcessor(); String dialogGroupKey = myProcessor.getContextUserData(DiffUserDataKeys.DIALOG_GROUP_KEY); if (dialogGroupKey == null) dialogGroupKey = "DiffContextDialog"; myWrapper = new WindowWrapperBuilder(DiffUtil.getWindowMode(myHints), new MyPanel(myProcessor.getComponent())) .setProject(myProject) .setParent(myHints.getParent()) .setDimensionServiceKey(dialogGroupKey) .setOnShowCallback(new Runnable() { @Override public void run() { myProcessor.updateRequest(); myProcessor.requestFocus(); // TODO: not needed for modal dialogs. Make a flag in WindowWrapperBuilder ? } }) .build(); myWrapper.setImage(ImageLoader.loadFromResource("/diff/Diff.png")); Disposer.register(myWrapper, myProcessor); new DumbAwareAction() { public void actionPerformed(final AnActionEvent e) { myWrapper.close(); } }.registerCustomShortcutSet(CommonShortcuts.getCloseActiveWindow(), myProcessor.getComponent()); }
private static AnAction createSplitTabsAction(final TabbedContent content) { return new DumbAwareAction("Split '" + content.getTitlePrefix() + "' group") { @RequiredDispatchThread @Override public void actionPerformed(@Nonnull AnActionEvent e) { content.split(); } }; }
private static AnAction createMergeTabsAction(final ContentManager manager, final String tabPrefix) { return new DumbAwareAction("Merge tabs to '" + tabPrefix + "' group") { @RequiredDispatchThread @Override public void actionPerformed(@Nonnull AnActionEvent e) { final Content selectedContent = manager.getSelectedContent(); final List<Pair<String, JComponent>> tabs = new ArrayList<Pair<String, JComponent>>(); int selectedTab = -1; for (Content content : manager.getContents()) { if (tabPrefix.equals(content.getUserData(Content.TAB_GROUP_NAME_KEY))) { final String label = content.getTabName().substring(tabPrefix.length() + 2); final JComponent component = content.getComponent(); if (content == selectedContent) { selectedTab = tabs.size(); } tabs.add(Pair.create(label, component)); manager.removeContent(content, false); content.setComponent(null); Disposer.dispose(content); } } PropertiesComponent.getInstance().unsetValue(TabbedContent.SPLIT_PROPERTY_PREFIX + tabPrefix); for (int i = 0; i < tabs.size(); i++) { final Pair<String, JComponent> tab = tabs.get(i); ContentUtilEx.addTabbedContent(manager, tab.second, tabPrefix, tab.first, i == selectedTab); } } }; }
public void createAddActions(DefaultActionGroup group, final JComponent parent, final Consumer<Sdk> updateTree, @Nullable Condition<SdkTypeId> filter) { final SdkType[] types = SdkType.EP_NAME.getExtensions(); List<SdkType> list = new ArrayList<SdkType>(types.length); for (SdkType sdkType : types) { if (filter != null && !filter.value(sdkType)) { continue; } list.add(sdkType); } Collections.sort(list, new Comparator<SdkType>() { @Override public int compare(SdkType o1, SdkType o2) { return StringUtil.compare(o1.getPresentableName(), o2.getPresentableName(), true); } }); for (final SdkType type : list) { final AnAction addAction = new DumbAwareAction(type.getPresentableName(), null, type.getIcon()) { @Override public void actionPerformed(AnActionEvent e) { doAdd(parent, type, updateTree); } }; group.add(addAction); } }
@Nonnull @Override public DefaultActionGroup createPopupActionGroup(final JComponent component) { final DefaultActionGroup group = new DefaultActionGroup(); final List<NamedScope> predefinedScopes = new ArrayList<NamedScope>(); final List<NamedScope> customScopes = new ArrayList<NamedScope>(); for (final NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) { Collections.addAll(customScopes, holder.getEditableScopes()); predefinedScopes.addAll(holder.getPredefinedScopes()); } predefinedScopes.remove(CustomScopesProviderEx.getAllScope()); for (NamedScope predefinedScope : predefinedScopes) { if (predefinedScope instanceof NonProjectFilesScope) { predefinedScopes.remove(predefinedScope); break; } } fillActionGroup(group, predefinedScopes, myDefaultDescriptors, myInspectionProfile, myExcludedScopeNames); group.addSeparator(); fillActionGroup(group, customScopes, myDefaultDescriptors, myInspectionProfile, myExcludedScopeNames); group.addSeparator(); group.add(new DumbAwareAction("Edit Scopes Order...") { @Override public void actionPerformed(final AnActionEvent e) { final ScopesOrderDialog dlg = new ScopesOrderDialog(component, myInspectionProfile, myProject); if (dlg.showAndGet()) { onScopesOrderChanged(); } } }); return group; }
private void registerCloseAction(JBPopup popup) { final AnAction escape = ActionManager.getInstance().getAction("EditorEscape"); DumbAwareAction closeAction = new DumbAwareAction() { @Override public void actionPerformed(AnActionEvent e) { if (myBalloon != null && myBalloon.isVisible()) { myIsPinned.set(false); myBalloon.cancel(); } } }; closeAction.registerCustomShortcutSet(escape == null ? CommonShortcuts.ESCAPE : escape.getShortcutSet(), popup.getContent(), popup); }