mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
Bug 573646: Open primary terminal view when there is no last available
Change-Id: I286d039d6cb3eb1e73fdb5b76c8743a8e0870d94
This commit is contained in:
parent
cb89216031
commit
f71d92114f
1 changed files with 23 additions and 4 deletions
|
@ -237,8 +237,9 @@ public class ConsoleManager {
|
||||||
|
|
||||||
for (IViewReference ref : getActiveWorkbenchPage().getViewReferences()) {
|
for (IViewReference ref : getActiveWorkbenchPage().getViewReferences()) {
|
||||||
if (ref.getId().equals(id)) {
|
if (ref.getId().equals(id)) {
|
||||||
|
String refSecondaryId = ref.getSecondaryId();
|
||||||
if (ITerminalsConnectorConstants.ANY_ACTIVE_SECONDARY_ID.equals(secondaryId)
|
if (ITerminalsConnectorConstants.ANY_ACTIVE_SECONDARY_ID.equals(secondaryId)
|
||||||
|| Objects.equals(secondaryId, ref.getSecondaryId())) {
|
|| Objects.equals(secondaryId, refSecondaryId)) {
|
||||||
return ref.getView(restore);
|
return ref.getView(restore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -268,7 +269,14 @@ public class ConsoleManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (part == null) {
|
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) {
|
if (part != null) {
|
||||||
lastActiveViewId = part.getViewSite().getId();
|
lastActiveViewId = part.getViewSite().getId();
|
||||||
lastActiveSecondaryViewId = part.getViewSite().getSecondaryId();
|
lastActiveSecondaryViewId = part.getViewSite().getSecondaryId();
|
||||||
|
@ -339,8 +347,19 @@ public class ConsoleManager {
|
||||||
try {
|
try {
|
||||||
// show the view
|
// show the view
|
||||||
IViewPart part = getActiveTerminalsView(id != null ? id : IUIConstants.ID, secondaryId);
|
IViewPart part = getActiveTerminalsView(id != null ? id : IUIConstants.ID, secondaryId);
|
||||||
if (part == null)
|
if (part == null) {
|
||||||
part = page.showView(id != null ? id : IUIConstants.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
|
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
|
// and force the view to the foreground
|
||||||
page.bringToTop(part);
|
page.bringToTop(part);
|
||||||
return part;
|
return part;
|
||||||
|
|
Loading…
Add table
Reference in a new issue