mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Bugfix: do not activate Run/Debug tool window when myActivateToolWindow is false (GO-9369, IDEA-CR-1543)
Before this fix if you pass 'false' to 'withActivateToolWindow' the tool window is shown but without focus. With the fix it is not shown in that case. To show it without focus new 'withFocusToolWindow' method is added. Along the way with this fix we avoid activating tool window twice in case of 'true' passed to 'withActivateToolWindow'. GitOrigin-RevId: 3b7928ba535ebbb365d7735034897d88f87f569e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
aa9f275434
commit
33afa59ac6
@@ -22,8 +22,6 @@ import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.wm.ToolWindowId;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -48,6 +46,7 @@ public class RunContentExecutor implements Disposable {
|
||||
private String myTitle = "Output";
|
||||
private String myHelpId = null;
|
||||
private boolean myActivateToolWindow = true;
|
||||
private boolean myFocusToolWindow = true;
|
||||
/**
|
||||
* User-provided console that has to be used instead of newly created
|
||||
*/
|
||||
@@ -94,6 +93,11 @@ public class RunContentExecutor implements Disposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public RunContentExecutor withFocusToolWindow(boolean focusToolWindow) {
|
||||
myFocusToolWindow = focusToolWindow;
|
||||
return this;
|
||||
}
|
||||
|
||||
private ConsoleView createConsole() {
|
||||
TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(myProject);
|
||||
consoleBuilder.filters(myFilterList);
|
||||
@@ -107,6 +111,8 @@ public class RunContentExecutor implements Disposable {
|
||||
|
||||
final JComponent consolePanel = createConsolePanel(console, actions);
|
||||
RunContentDescriptor descriptor = new RunContentDescriptor(console, myProcess, consolePanel, myTitle);
|
||||
descriptor.setActivateToolWindowWhenAdded(myActivateToolWindow);
|
||||
descriptor.setAutoFocusContent(myFocusToolWindow);
|
||||
|
||||
Disposer.register(descriptor, this);
|
||||
Disposer.register(descriptor, console);
|
||||
@@ -116,11 +122,6 @@ public class RunContentExecutor implements Disposable {
|
||||
actions.add(new CloseAction(executor, descriptor, myProject));
|
||||
|
||||
RunContentManager.getInstance(myProject).showRunContent(executor, descriptor);
|
||||
|
||||
if (myActivateToolWindow) {
|
||||
activateToolWindow();
|
||||
}
|
||||
|
||||
return console;
|
||||
}
|
||||
|
||||
@@ -141,11 +142,6 @@ public class RunContentExecutor implements Disposable {
|
||||
myProcess.startNotify();
|
||||
}
|
||||
|
||||
public void activateToolWindow() {
|
||||
ApplicationManager.getApplication().invokeLater(
|
||||
() -> ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.RUN).activate(null));
|
||||
}
|
||||
|
||||
private static JComponent createConsolePanel(ConsoleView view, ActionGroup actions) {
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new BorderLayout());
|
||||
|
||||
Reference in New Issue
Block a user