diff --git a/com.microsoft.copilot.eclipse.ui.terminal.tm/src/com/microsoft/copilot/eclipse/ui/terminal/tm/RunInTerminalTool.java b/com.microsoft.copilot.eclipse.ui.terminal.tm/src/com/microsoft/copilot/eclipse/ui/terminal/tm/RunInTerminalTool.java index 6844799f..78f12c39 100644 --- a/com.microsoft.copilot.eclipse.ui.terminal.tm/src/com/microsoft/copilot/eclipse/ui/terminal/tm/RunInTerminalTool.java +++ b/com.microsoft.copilot.eclipse.ui.terminal.tm/src/com/microsoft/copilot/eclipse/ui/terminal/tm/RunInTerminalTool.java @@ -97,7 +97,7 @@ public CompletableFuture executeCommand(String command, boolean isBackgr synchronized (lock) { if (!isBackground && this.persistentTerminalViewControl != null) { - bringTerminalViewAndCopilotConsoleToFront(); + revealTerminal(); this.persistentTerminalViewControl.pasteString(finalCommand); return this.resultFuture; } @@ -122,7 +122,7 @@ public CompletableFuture executeCommand(String command, boolean isBackgr if (!isBackground) { this.persistentTerminalViewControl = terminalViewControl; - bringTerminalViewAndCopilotConsoleToFront(); + revealTerminal(); } terminalViewControl.pasteString(finalCommand); } else { @@ -205,7 +205,7 @@ private ITerminalControl getTerminalControl(String terminalTitle, boolean isBack try { IWorkbenchPage page = getActivePage(); if (page != null) { - IViewPart view = page.showView(IUIConstants.ID); + IViewPart view = page.showView(IUIConstants.ID, null, IWorkbenchPage.VIEW_VISIBLE); if (view != null) { tabFolder = view.getAdapter(CTabFolder.class); if (tabFolder != null) { @@ -360,13 +360,13 @@ private DisposeListener buildDisposeListener(String executionId, boolean isBackg }; } - private void bringTerminalViewAndCopilotConsoleToFront() { + private void revealTerminal() { if (tabFolder != null && copilotTabItem != null) { Display.getDefault().syncExec(() -> { try { IWorkbenchPage page = getActivePage(); if (page != null) { - IViewPart view = page.showView(IUIConstants.ID); + IViewPart view = page.showView(IUIConstants.ID, null, IWorkbenchPage.VIEW_VISIBLE); if (tabFolder.isDisposed() && view != null) { tabFolder = view.getAdapter(CTabFolder.class); } diff --git a/com.microsoft.copilot.eclipse.ui.terminal/src/com/microsoft/copilot/eclipse/ui/terminal/RunInTerminalTool.java b/com.microsoft.copilot.eclipse.ui.terminal/src/com/microsoft/copilot/eclipse/ui/terminal/RunInTerminalTool.java index 2edacc0b..721dc954 100644 --- a/com.microsoft.copilot.eclipse.ui.terminal/src/com/microsoft/copilot/eclipse/ui/terminal/RunInTerminalTool.java +++ b/com.microsoft.copilot.eclipse.ui.terminal/src/com/microsoft/copilot/eclipse/ui/terminal/RunInTerminalTool.java @@ -99,7 +99,7 @@ public CompletableFuture executeCommand(String command, boolean isBackgr synchronized (lock) { if (!isBackground && this.persistentTerminalViewControl != null) { - bringTerminalViewAndCopilotConsoleToFront(); + revealTerminal(); this.persistentTerminalViewControl.pasteString(finalCommand); return this.resultFuture; } @@ -124,7 +124,7 @@ public CompletableFuture executeCommand(String command, boolean isBackgr if (!isBackground) { this.persistentTerminalViewControl = terminalViewControl; - bringTerminalViewAndCopilotConsoleToFront(); + revealTerminal(); } terminalViewControl.pasteString(finalCommand); } else { @@ -208,7 +208,7 @@ private ITerminalControl getTerminalControl(String terminalTitle, boolean isBack try { IWorkbenchPage page = getActivePage(); if (page != null) { - IViewPart view = page.showView(IUIConstants.ID); + IViewPart view = page.showView(IUIConstants.ID, null, IWorkbenchPage.VIEW_VISIBLE); if (view != null) { tabFolder = view.getAdapter(CTabFolder.class); if (tabFolder != null) { @@ -360,13 +360,13 @@ private DisposeListener buildDisposeListener(String executionId, boolean isBackg }; } - private void bringTerminalViewAndCopilotConsoleToFront() { + private void revealTerminal() { if (tabFolder != null && copilotTabItem != null) { Display.getDefault().syncExec(() -> { try { IWorkbenchPage page = getActivePage(); if (page != null) { - IViewPart view = page.showView(IUIConstants.ID); + IViewPart view = page.showView(IUIConstants.ID, null, IWorkbenchPage.VIEW_VISIBLE); if (tabFolder.isDisposed() && view != null) { tabFolder = view.getAdapter(CTabFolder.class); }