summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorDean Roberts2011-09-20 11:54:13 (EDT)
committer Remy Suen2011-09-20 11:54:13 (EDT)
commit3f4f91b76e12039dfc898b47f51ff70dd62437cb (patch)
tree82032f769766baed6b5ae87442795acf1b976ba4
parent0b7cafe4c5a1c8686bb9d4492bbd70c2016939d4 (diff)
downloadeclipse.platform.ui-3f4f91b76e12039dfc898b47f51ff70dd62437cb.zip
eclipse.platform.ui-3f4f91b76e12039dfc898b47f51ff70dd62437cb.tar.gz
eclipse.platform.ui-3f4f91b76e12039dfc898b47f51ff70dd62437cb.tar.bz2
Bug 339130 Unable to save perspective
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java4
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java13
2 files changed, 8 insertions, 9 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java
index dc1b3a3..d6e876b 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java
@@ -253,9 +253,11 @@ public class ModelServiceImpl implements EModelService {
MUIElement clone = (MUIElement) EcoreUtil.copy(eObj);
if (snippetContainer != null) {
+ MUIElement snippet = findSnippet(snippetContainer, element.getElementId());
+ if (snippet != null)
+ snippetContainer.getSnippets().remove(snippet);
snippetContainer.getSnippets().add(clone);
}
-
return clone;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java
index fa3e3d5..4a35f4e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -118,13 +118,10 @@ public class PerspectiveRegistry implements IPerspectiveRegistry, IExtensionChan
}
private MUIElement removeSnippet(MSnippetContainer snippetContainer, String id) {
- List<MUIElement> snippets = snippetContainer.getSnippets();
- for (int i = 0; i < snippets.size(); i++) {
- if (snippets.get(i).getElementId().equals(id)) {
- return snippets.remove(i);
- }
- }
- return null;
+ MUIElement snippet = modelService.findSnippet(snippetContainer, id);
+ if (snippet != null)
+ snippetContainer.getSnippets().remove(snippet);
+ return snippet;
}
/**