aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2013-10-23 17:57:21 (EDT)
committerGerrit Code Review @ Eclipse.org2013-10-25 10:24:02 (EDT)
commit501d695fdbc0f795e15b07b98659a220751dcf74 (patch)
tree6d80fcffc82fd40cdc672dc298ba3844ac43bbe0
parentcc2f8b35bd3234dda258782e0892ca0140dad1ea (diff)
downloadeclipse.platform.ui-501d695fdbc0f795e15b07b98659a220751dcf74.zip
eclipse.platform.ui-501d695fdbc0f795e15b07b98659a220751dcf74.tar.gz
eclipse.platform.ui-501d695fdbc0f795e15b07b98659a220751dcf74.tar.bz2
Bug 418275 - [IDE] Source view not in "Show In" menu when requested by IShowInTargetListrefs/changes/15/17715/2
The code used to filter the source view out of the possible targets after gathering all targets. By filtering before adding the targets of IShowInTargetList, we can respect an explicit wish to list the source view as target. Change-Id: If9e6eaa49e5dbd072227b1325e07a2bb1246ff14 Signed-off-by: Robin Stocker <robin@nibor.org>
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInMenu.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInMenu.java
index 2d8d1a6..6a09360 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInMenu.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowInMenu.java
@@ -277,7 +277,15 @@ public class ShowInMenu extends ContributionItem implements
ArrayList targetIds = new ArrayList();
WorkbenchPage page = (WorkbenchPage) getWindow().getActivePage();
if (page != null) {
- targetIds.addAll(page.getShowInPartIds());
+ String srcId = sourcePart == null ? null : sourcePart.getSite().getId();
+ ArrayList<?> pagePartIds = page.getShowInPartIds();
+ for (Object pagePartId : pagePartIds) {
+ // Don't add own view, except when explicitly requested with
+ // IShowInTargetList below
+ if (!pagePartId.equals(srcId)) {
+ targetIds.add(pagePartId);
+ }
+ }
}
IShowInTargetList targetList = getShowInTargetList(sourcePart);
if (targetList != null) {
@@ -376,17 +384,14 @@ public class ShowInMenu extends ContributionItem implements
* Returns the view descriptors to show in the dialog.
*/
private IViewDescriptor[] getViewDescriptors(IWorkbenchPart sourcePart) {
- String srcId = sourcePart == null ? null : sourcePart.getSite().getId();
ArrayList ids = getShowInPartIds(sourcePart);
ArrayList descs = new ArrayList();
IViewRegistry reg = WorkbenchPlugin.getDefault().getViewRegistry();
for (Iterator i = ids.iterator(); i.hasNext();) {
String id = (String) i.next();
- if (!id.equals(srcId)) {
- IViewDescriptor desc = reg.find(id);
- if (desc != null) {
- descs.add(desc);
- }
+ IViewDescriptor desc = reg.find(id);
+ if (desc != null) {
+ descs.add(desc);
}
}
return (IViewDescriptor[]) descs.toArray(new IViewDescriptor[descs