use of com.intellij.openapi.command.CommandProcessor in project intellij-community by JetBrains.
the class NextSplitAction method actionPerformed.
public void actionPerformed(AnActionEvent e) {
final Project project = e.getProject();
final CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(project, () -> {
final FileEditorManagerEx manager = FileEditorManagerEx.getInstanceEx(project);
manager.setCurrentWindow(manager.getNextWindow(manager.getCurrentWindow()));
}, IdeBundle.message("command.go.to.next.split"), null);
}
use of com.intellij.openapi.command.CommandProcessor in project intellij-community by JetBrains.
the class CloseAllEditorsAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(project, () -> {
final EditorWindow window = e.getData(EditorWindow.DATA_KEY);
if (window != null) {
final VirtualFile[] files = window.getFiles();
for (final VirtualFile file : files) {
window.closeFile(file);
}
return;
}
FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
VirtualFile selectedFile = fileEditorManager.getSelectedFiles()[0];
VirtualFile[] openFiles = fileEditorManager.getSiblings(selectedFile);
for (final VirtualFile openFile : openFiles) {
fileEditorManager.closeFile(openFile);
}
}, IdeBundle.message("command.close.all.editors"), null);
}
use of com.intellij.openapi.command.CommandProcessor in project intellij-community by JetBrains.
the class AbstractVcsHelperImpl method openMessagesView.
public void openMessagesView(final VcsErrorViewPanel errorTreeView, final String tabDisplayName) {
CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(myProject, new Runnable() {
public void run() {
final MessageView messageView = MessageView.SERVICE.getInstance(myProject);
messageView.runWhenInitialized(new Runnable() {
public void run() {
final Content content = ContentFactory.SERVICE.getInstance().createContent(errorTreeView, tabDisplayName, true);
messageView.getContentManager().addContent(content);
Disposer.register(content, errorTreeView);
messageView.getContentManager().setSelectedContent(content);
removeContents(content, tabDisplayName);
ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW).activate(null);
}
});
}
}, VcsBundle.message("command.name.open.error.message.view"), null);
}
use of com.intellij.openapi.command.CommandProcessor in project intellij-community by JetBrains.
the class DocumentTest method testModificationInsideCommandAssertion.
public void testModificationInsideCommandAssertion() {
CommandProcessor commandProcessor = CommandProcessor.getInstance();
assertTrue(!commandProcessor.isUndoTransparentActionInProgress() && commandProcessor.getCurrentCommand() == null);
final Document doc = new DocumentImpl("xxx");
mustThrow(() -> doc.insertString(1, "x"));
mustThrow(() -> doc.deleteString(1, 2));
mustThrow(() -> doc.replaceString(1, 2, "s"));
WriteCommandAction.runWriteCommandAction(getProject(), () -> doc.insertString(1, "s"));
WriteCommandAction.runWriteCommandAction(getProject(), () -> doc.deleteString(1, 2));
WriteCommandAction.runWriteCommandAction(getProject(), () -> doc.replaceString(1, 2, "xxx"));
WriteCommandAction.runWriteCommandAction(getProject(), () -> doc.setText("sss"));
DocumentImpl console = new DocumentImpl("xxxx", true);
// need no stinking command
console.insertString(1, "s");
console.deleteString(1, 2);
console.replaceString(1, 2, "xxx");
console.setText("sss");
}
use of com.intellij.openapi.command.CommandProcessor in project intellij-community by JetBrains.
the class IdeaLogger method logErrorHeader.
private void logErrorHeader() {
final String info = ourApplicationInfoProvider.getInfo();
if (info != null) {
myLogger.error(info);
}
if (ourCompilationTimestamp != null) {
myLogger.error("Internal version. Compiled " + ourCompilationTimestamp);
}
myLogger.error("JDK: " + System.getProperties().getProperty("java.version", "unknown"));
myLogger.error("VM: " + System.getProperties().getProperty("java.vm.name", "unknown"));
myLogger.error("Vendor: " + System.getProperties().getProperty("java.vendor", "unknown"));
myLogger.error("OS: " + System.getProperties().getProperty("os.name", "unknown"));
ApplicationImpl application = (ApplicationImpl) ApplicationManager.getApplication();
if (application != null && application.isComponentsCreated() && !application.isDisposed()) {
final String lastPreformedActionId = ourLastActionId;
if (lastPreformedActionId != null) {
myLogger.error("Last Action: " + lastPreformedActionId);
}
CommandProcessor commandProcessor = CommandProcessor.getInstance();
if (commandProcessor != null) {
final String currentCommandName = commandProcessor.getCurrentCommandName();
if (currentCommandName != null) {
myLogger.error("Current Command: " + currentCommandName);
}
}
}
}
Aggregations