1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Bug 470757 - The console manager doesn't use the secondary id for

opening the view

Use the secondary id the caller passed in if it's not null or '*',
otherwise use the auto generated secondary id.  

Change-Id: I25a884bcb6841cb5fc7e1e6f191800b99e42873a
Signed-off-by: Q.S. Wang <wangqs_eclipse@yahoo.com>
This commit is contained in:
Q.S. Wang 2015-06-23 10:13:09 +10:00
parent 90f8ed75c4
commit 6683690349

View file

@ -237,7 +237,7 @@ public class ConsoleManager {
for (int i = 0; i < refs.length; i++) {
IViewReference ref = refs[i];
if (ref.getId().equals(id)) {
if (secondaryId == ANY_SECONDARY_ID
if (ANY_SECONDARY_ID.equals(secondaryId)
|| secondaryId == null && ref.getSecondaryId() == null
|| secondaryId != null && secondaryId.equals(ref.getSecondaryId())) {
IViewPart part = ref.getView(true);
@ -362,12 +362,12 @@ public class ConsoleManager {
return notPinnedPart;
}
// else we need to create a new one
IViewPart newPart = showConsoleView(id != null ? id : IUIConstants.ID, getNextTerminalSecondaryId(id != null ? id : IUIConstants.ID));
IViewPart newPart = showConsoleView(id != null ? id : IUIConstants.ID, getSecondaryId(secondaryId, id));
return newPart;
}
// we found a active terminal page
// if it is pinned search for a non pinned (not active)
if (((ITerminalsView) activePart).isPinned() && secondaryId == ANY_SECONDARY_ID) {
if (((ITerminalsView) activePart).isPinned() && ANY_SECONDARY_ID.equals(secondaryId)) {
// we found one so use it
IViewPart notPinnedPart = getFirstNotPinnedTerminalsView(id != null ? id : IUIConstants.ID);
if (notPinnedPart != null) {
@ -380,7 +380,7 @@ public class ConsoleManager {
return notPinnedPart;
}
// else we need to create a new one
IViewPart newPart = showConsoleView(id != null ? id : IUIConstants.ID, getNextTerminalSecondaryId(id != null ? id : IUIConstants.ID));
IViewPart newPart = showConsoleView(id != null ? id : IUIConstants.ID, getSecondaryId(secondaryId, id));
return newPart;
}
// else return the active one
@ -388,13 +388,27 @@ public class ConsoleManager {
}
// create first new terminal
if (activate) {
IViewPart newPart = showConsoleView(id != null ? id : IUIConstants.ID, getNextTerminalSecondaryId(id != null ? id : IUIConstants.ID));
IViewPart newPart = showConsoleView(id != null ? id : IUIConstants.ID, getSecondaryId(secondaryId, id));
return newPart;
}
}
return null;
}
/**
* Return the secondary id to use.
* @param secondaryId
* @param id
* @return the secondaryId argument is not null, or *, otherwise use the auto generated secondary id.
*/
private String getSecondaryId(String secondaryId, String id){
if(secondaryId==null || ANY_SECONDARY_ID.equals(secondaryId)){
return getNextTerminalSecondaryId(id != null ? id : IUIConstants.ID);
}
return secondaryId;
}
/**
* Opens the console with the given title and connector.
* <p>