From 05730b4aceb025bf5abc8b4146c2c826e120c1d7 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 10 Dec 2014 20:28:48 +0100 Subject: [PATCH 1/4] add API to expose the RunnerLayoutUi used by a run/debug tab --- .../execution/ui/RunContentDescriptor.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/platform/lang-api/src/com/intellij/execution/ui/RunContentDescriptor.java b/platform/lang-api/src/com/intellij/execution/ui/RunContentDescriptor.java index 5a23ed45b1a9..5ce15464f633 100644 --- a/platform/lang-api/src/com/intellij/execution/ui/RunContentDescriptor.java +++ b/platform/lang-api/src/com/intellij/execution/ui/RunContentDescriptor.java @@ -37,6 +37,7 @@ public class RunContentDescriptor implements Disposable { private final String myDisplayName; private final Icon myIcon; private final String myHelpId; + private RunnerLayoutUi myRunnerLayoutUi = null; private boolean myActivateToolWindowWhenAdded = true; private boolean myReuseToolWindowActivation = false; @@ -72,6 +73,7 @@ public class RunContentDescriptor implements Disposable { public RunContentDescriptor(@NotNull RunProfile profile, @NotNull ExecutionResult executionResult, @NotNull RunnerLayoutUi ui) { this(executionResult.getExecutionConsole(), executionResult.getProcessHandler(), ui.getComponent(), profile.getName(), profile.getIcon()); + myRunnerLayoutUi = ui; if (executionResult instanceof DefaultExecutionResult) { myRestartActions = ((DefaultExecutionResult)executionResult).getRestartActions(); } @@ -209,4 +211,17 @@ public class RunContentDescriptor implements Disposable { public void setAutoFocusContent(boolean autoFocusContent) { myAutoFocusContent = autoFocusContent; } + + /** + * Returns the runner layout UI interface that can be used to manage the sub-tabs in this run/debug tab, if available. + * (The runner layout UI is used, for example, by debugger tabs which have multiple sub-tabs, but is not used by other tabs + * which only display a single piece of content. + * + * @since 14.1 + * @return the RunnerLayoutUi instance or null if this tab does not use RunnerLayoutUi for managing its contents. + */ + @Nullable + RunnerLayoutUi getRunnerLayoutUi() { + return myRunnerLayoutUi; + } } From 12bed33d91e0343b7623354c65b0acf5240724cc Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 10 Dec 2014 20:31:01 +0100 Subject: [PATCH 2/4] public :( --- .../src/com/intellij/execution/ui/RunContentDescriptor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/lang-api/src/com/intellij/execution/ui/RunContentDescriptor.java b/platform/lang-api/src/com/intellij/execution/ui/RunContentDescriptor.java index 5ce15464f633..c2d62005883e 100644 --- a/platform/lang-api/src/com/intellij/execution/ui/RunContentDescriptor.java +++ b/platform/lang-api/src/com/intellij/execution/ui/RunContentDescriptor.java @@ -221,7 +221,7 @@ public class RunContentDescriptor implements Disposable { * @return the RunnerLayoutUi instance or null if this tab does not use RunnerLayoutUi for managing its contents. */ @Nullable - RunnerLayoutUi getRunnerLayoutUi() { + public RunnerLayoutUi getRunnerLayoutUi() { return myRunnerLayoutUi; } } From 2d3728c0074769ee90ab72339aa76655e70fc58d Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 10 Dec 2014 20:34:03 +0100 Subject: [PATCH 3/4] IDEA-133915 Escape does not close Diff (Compare) dialog when background process is running --- .../src/com/intellij/openapi/ui/FrameWrapper.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/FrameWrapper.java b/platform/platform-impl/src/com/intellij/openapi/ui/FrameWrapper.java index 0b1789faf66d..5438aa55774c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/FrameWrapper.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/FrameWrapper.java @@ -17,14 +17,14 @@ package com.intellij.openapi.ui; import com.intellij.ide.DataManager; import com.intellij.openapi.Disposable; -import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.CommonDataKeys; +import com.intellij.openapi.actionSystem.CommonShortcuts; +import com.intellij.openapi.actionSystem.DataProvider; import com.intellij.openapi.actionSystem.ex.ActionManagerEx; import com.intellij.openapi.actionSystem.impl.MouseGestureManager; import com.intellij.openapi.application.impl.ApplicationInfoImpl; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.project.ProjectManager; -import com.intellij.openapi.project.ProjectManagerAdapter; -import com.intellij.openapi.project.ProjectManagerListener; +import com.intellij.openapi.project.*; import com.intellij.openapi.util.ActionCallback; import com.intellij.openapi.util.DimensionService; import com.intellij.openapi.util.Disposer; @@ -228,7 +228,7 @@ public class FrameWrapper implements Disposable, DataProvider { } private void addCloseOnEsc(final RootPaneContainer frame) { - new AnAction() { + new DumbAwareAction() { @Override public void actionPerformed(@NotNull AnActionEvent e) { MenuSelectionManager menuSelectionManager = MenuSelectionManager.defaultManager(); From f22784d90d8db3a44ec80e67b3dcb66ff5a5a438 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 10 Dec 2014 20:34:31 +0100 Subject: [PATCH 4/4] earlier stub-psi mismatch diagnostics revival --- .../intellij/psi/stubs/StubTreeLoaderImpl.java | 16 +++++++++------- .../intellij/psi/stubs/StubUpdatingIndex.java | 10 ++++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubTreeLoaderImpl.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubTreeLoaderImpl.java index e3e4616ee5de..57799a57d4b4 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/StubTreeLoaderImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubTreeLoaderImpl.java @@ -23,6 +23,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; import com.intellij.psi.impl.PsiManagerEx; @@ -94,12 +95,13 @@ public class StubTreeLoaderImpl extends StubTreeLoader { SerializedStubTree stubTree = datas.get(0); if (!stubTree.contentLengthMatches(vFile.getLength(), getCurrentTextContentLength(project, vFile, document))) { - //todo find another way of early stub-ast mismatch prevention - //return processError(vFile, - // "Outdated stub in index: " + StubUpdatingIndex.getIndexingStampInfo(vFile) + - // ", docSaved=" + saved + - // ", queried at " + vFile.getTimeStamp(), - // null); + return processError(vFile, + "Outdated stub in index: " + StubUpdatingIndex.getIndexingStampInfo(vFile) + + ", doc=" + document + + ", docSaved=" + saved + + ", wasIndexedAlready=" + wasIndexedAlready + + ", queried at " + vFile.getTimeStamp(), + null); } Stub stub; @@ -131,7 +133,7 @@ public class StubTreeLoaderImpl extends StubTreeLoader { } if (document != null) { - return document.getTextLength(); + return PsiDocumentManager.getInstance(project).getLastCommittedText(document).length(); } return -1; } diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java index 329820b8297a..85d51fce9cc4 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java @@ -46,7 +46,7 @@ public class StubUpdatingIndex extends CustomImplementationFileBasedIndexExtensi private static final Logger LOG = Logger.getInstance("#com.intellij.psi.stubs.StubUpdatingIndex"); // todo remove once we don't need this for stub-ast mismatch debug info - private static final FileAttribute INDEXED_STAMP = new FileAttribute("stubIndexStamp", 1, false); + private static final FileAttribute INDEXED_STAMP = new FileAttribute("stubIndexStamp", 2, false); public static final ID INDEX_ID = ID.create("Stubs"); @@ -127,7 +127,13 @@ public class StubUpdatingIndex extends CustomImplementationFileBasedIndexExtensi if (rootStub == null) return; VirtualFile file = inputData.getFile(); - int contentLength = file.getFileType().isBinary() ? -1 : inputData.getContentAsText().length(); + int contentLength; + if (file.getFileType().isBinary()) { + contentLength = -1; + } + else { + contentLength = ((FileContentImpl)inputData).getPsiFileForPsiDependentIndex().getTextLength(); + } rememberIndexingStamp(file, contentLength); final BufferExposingByteArrayOutputStream bytes = new BufferExposingByteArrayOutputStream();