Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2021-05-23 13:33:08 +0000
committerJonah Graham2021-05-24 04:30:58 +0000
commitf71d92114f086ae706d0b59a33951748d02bdbdc (patch)
tree336cb28b326730322fe826fbecd4bb675b71738d
parentcb89216031b411eb167a512a79127a5c889031f8 (diff)
downloadorg.eclipse.cdt-f71d92114f086ae706d0b59a33951748d02bdbdc.tar.gz
org.eclipse.cdt-f71d92114f086ae706d0b59a33951748d02bdbdc.tar.xz
org.eclipse.cdt-f71d92114f086ae706d0b59a33951748d02bdbdc.zip
Bug 573646: Open primary terminal view when there is no last available
-rw-r--r--terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/manager/ConsoleManager.java27
1 files changed, 23 insertions, 4 deletions
diff --git a/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/manager/ConsoleManager.java b/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/manager/ConsoleManager.java
index 428ebf5a5f2..8dec9dc5528 100644
--- a/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/manager/ConsoleManager.java
+++ b/terminal/plugins/org.eclipse.tm.terminal.view.ui/src/org/eclipse/tm/terminal/view/ui/manager/ConsoleManager.java
@@ -237,8 +237,9 @@ public class ConsoleManager {
for (IViewReference ref : getActiveWorkbenchPage().getViewReferences()) {
if (ref.getId().equals(id)) {
+ String refSecondaryId = ref.getSecondaryId();
if (ITerminalsConnectorConstants.ANY_ACTIVE_SECONDARY_ID.equals(secondaryId)
- || Objects.equals(secondaryId, ref.getSecondaryId())) {
+ || Objects.equals(secondaryId, refSecondaryId)) {
return ref.getView(restore);
}
}
@@ -268,7 +269,14 @@ public class ConsoleManager {
}
if (part == null) {
- part = getTerminalsViewWithSecondaryId(id, secondaryId, true);
+ String finalSecondaryId;
+ if (ITerminalsConnectorConstants.LAST_ACTIVE_SECONDARY_ID.equals(secondaryId)) {
+ // There is no last available, so get any available instead
+ finalSecondaryId = ITerminalsConnectorConstants.ANY_ACTIVE_SECONDARY_ID;
+ } else {
+ finalSecondaryId = secondaryId;
+ }
+ part = getTerminalsViewWithSecondaryId(id, finalSecondaryId, true);
if (part != null) {
lastActiveViewId = part.getViewSite().getId();
lastActiveSecondaryViewId = part.getViewSite().getSecondaryId();
@@ -339,8 +347,19 @@ public class ConsoleManager {
try {
// show the view
IViewPart part = getActiveTerminalsView(id != null ? id : IUIConstants.ID, secondaryId);
- if (part == null)
- part = page.showView(id != null ? id : IUIConstants.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
+ if (part == null) {
+ String finalSecondaryId;
+ if (ITerminalsConnectorConstants.LAST_ACTIVE_SECONDARY_ID.equals(secondaryId)
+ || ITerminalsConnectorConstants.ANY_ACTIVE_SECONDARY_ID.equals(secondaryId)) {
+ // We have already checked all open views, so since none of the special flags work
+ // we are opening the first view, which means no secondary id.
+ finalSecondaryId = null;
+ } else {
+ finalSecondaryId = secondaryId;
+ }
+ part = page.showView(id != null ? id : IUIConstants.ID, finalSecondaryId,
+ IWorkbenchPage.VIEW_ACTIVATE);
+ }
// and force the view to the foreground
page.bringToTop(part);
return part;

Back to the top