List of usage examples for com.intellij.openapi.actionSystem PlatformDataKeys IS_MODAL_CONTEXT
DataKey IS_MODAL_CONTEXT
To view the source code for com.intellij.openapi.actionSystem PlatformDataKeys IS_MODAL_CONTEXT.
Click Source Link
From source file:com.intellij.ide.actions.GotoLineAction.java
License:Apache License
public void actionPerformed(AnActionEvent e) { final Project project = e.getData(CommonDataKeys.PROJECT); final Editor editor = e.getData(PlatformDataKeys.EDITOR); if (Boolean.TRUE.equals(e.getData(PlatformDataKeys.IS_MODAL_CONTEXT))) { GotoLineNumberDialog dialog = new GotoLineNumberDialog(project, editor); dialog.show();/* w w w . j av a 2 s . co m*/ } else { CommandProcessor processor = CommandProcessor.getInstance(); processor.executeCommand(project, new Runnable() { public void run() { GotoLineNumberDialog dialog = new GotoLineNumberDialog(project, editor); dialog.show(); IdeDocumentHistory.getInstance(project).includeCurrentCommandAsNavigation(); } }, IdeBundle.message("command.go.to.line"), null); } }
From source file:com.intellij.ide.actions.UndoRedoAction.java
License:Apache License
public void update(AnActionEvent event) { Presentation presentation = event.getPresentation(); DataContext dataContext = event.getDataContext(); FileEditor editor = PlatformDataKeys.FILE_EDITOR.getData(dataContext); // do not allow global undo in dialogs if (editor == null) { final Boolean isModalContext = PlatformDataKeys.IS_MODAL_CONTEXT.getData(dataContext); if (isModalContext != null && isModalContext) { presentation.setEnabled(false); return; }//from w w w. j av a 2 s. c om } UndoManager undoManager = getUndoManager(editor, dataContext); if (undoManager == null) { presentation.setEnabled(false); return; } presentation.setEnabled(isAvailable(editor, undoManager)); Pair<String, String> pair = getActionNameAndDescription(editor, undoManager); presentation.setText(pair.first); presentation.setDescription(pair.second); }
From source file:com.intellij.lang.customFolding.GotoCustomRegionAction.java
License:Apache License
@Override public void actionPerformed(final AnActionEvent e) { final Project project = e.getProject(); final Editor editor = e.getData(CommonDataKeys.EDITOR); if (Boolean.TRUE.equals(e.getData(PlatformDataKeys.IS_MODAL_CONTEXT))) { return;//from w w w . j a v a 2s .c om } if (project != null && editor != null) { if (DumbService.getInstance(project).isDumb()) { DumbService.getInstance(project) .showDumbModeNotification(IdeBundle.message("goto.custom.region.message.dumb.mode")); return; } CommandProcessor processor = CommandProcessor.getInstance(); processor.executeCommand(project, new Runnable() { @Override public void run() { Collection<FoldingDescriptor> foldingDescriptors = getCustomFoldingDescriptors(editor, project); if (foldingDescriptors.size() > 0) { CustomFoldingRegionsPopup regionsPopup = new CustomFoldingRegionsPopup(foldingDescriptors, editor, project); regionsPopup.show(); } else { notifyCustomRegionsUnavailable(editor, project); } } }, IdeBundle.message("goto.custom.region.command"), null); } }