Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/SashLayoutCommandFactory.java')
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/SashLayoutCommandFactory.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/SashLayoutCommandFactory.java b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/SashLayoutCommandFactory.java
index 61c931b1ec4..b72840bec46 100644
--- a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/SashLayoutCommandFactory.java
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/internal/commands/SashLayoutCommandFactory.java
@@ -131,15 +131,13 @@ public class SashLayoutCommandFactory {
void moveContents(Resource fromResource, Resource toResource) {
// Safe copy to allow concurrent modifications
for (EObject root : new ArrayList<>(fromResource.getContents())) {
- EObject toReplace = (EObject) EcoreUtil.getObjectByType(toResource.getContents(), root.eClass());
- if (toReplace != null) {
- EcoreUtil.replace(toReplace, root);
- } else {
- if (root instanceof SashWindowsMngr) {
+ if (root instanceof SashWindowsMngr) {
+ EObject toReplace = (EObject) EcoreUtil.getObjectByType(toResource.getContents(), root.eClass());
+ if (toReplace != null) {
+ EcoreUtil.replace(toReplace, root);
+ } else {
// This one is expected always to be first
toResource.getContents().add(0, root);
- } else {
- toResource.getContents().add(root);
}
}
}

Back to the top