Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2018-06-26 09:18:25 -0400
committerBenoit Maggi2018-06-26 09:18:25 -0400
commitcf395d386737492295710894ecfefb01fb49af9b (patch)
tree5851d2c856907f96ed23fabf950a795bfa104a29
parent42b09296f7ec5240d422e86a71b05f8a3ce64542 (diff)
downloadorg.eclipse.papyrus-cf395d386737492295710894ecfefb01fb49af9b.tar.gz
org.eclipse.papyrus-cf395d386737492295710894ecfefb01fb49af9b.tar.xz
org.eclipse.papyrus-cf395d386737492295710894ecfefb01fb49af9b.zip
Bug 535393 - [AFViewpoints] Exception when unknown
context/representationkind - return an empty list when context null => this allow to open the model without crashing Change-Id: I09e6293292f215666d7534d286fbc44368859312 Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
-rw-r--r--plugins/infra/architecture/org.eclipse.papyrus.infra.architecture/src/org/eclipse/papyrus/infra/architecture/ArchitectureDescriptionUtils.java26
1 files changed, 15 insertions, 11 deletions
diff --git a/plugins/infra/architecture/org.eclipse.papyrus.infra.architecture/src/org/eclipse/papyrus/infra/architecture/ArchitectureDescriptionUtils.java b/plugins/infra/architecture/org.eclipse.papyrus.infra.architecture/src/org/eclipse/papyrus/infra/architecture/ArchitectureDescriptionUtils.java
index a4bc58ac74d..53948334700 100644
--- a/plugins/infra/architecture/org.eclipse.papyrus.infra.architecture/src/org/eclipse/papyrus/infra/architecture/ArchitectureDescriptionUtils.java
+++ b/plugins/infra/architecture/org.eclipse.papyrus.infra.architecture/src/org/eclipse/papyrus/infra/architecture/ArchitectureDescriptionUtils.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2017 CEA LIST.
+ * Copyright (c) 2017,2018 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,7 +8,7 @@
*
* Contributors:
* Maged Elaasar - Initial API and implementation
- *
+ * Benoit Maggi - Bug 535393
*
*/
package org.eclipse.papyrus.infra.architecture;
@@ -18,7 +18,6 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CompoundCommand;
@@ -111,20 +110,25 @@ public class ArchitectureDescriptionUtils {
/**
* Gets the architecture viewpoint ids set in the model set
*
- * @return a collection of architecture viewpoin ids
+ * @return a collection of architecture viewpoint ids
*/
public Collection<String> getArchitectureViewpointIds() {
ArchitectureDescriptionPreferences preferences = SashModelUtils.getArchitectureDescriptionPreferences(modelSet);
- if (preferences != null)
+ if (preferences != null) {
return preferences.getViewpointIds();
+ }
+ Collection<String> viewpointIds = new LinkedHashSet<>();
MergedArchitectureContext context = getArchitectureContext();
- Collection<MergedArchitectureViewpoint> viewpoints = context.getDefaultViewpoints();
- if (viewpoints.isEmpty())
- viewpoints = context.getViewpoints();
- Set<String> viewpointIds = new LinkedHashSet<>();
- for (MergedArchitectureViewpoint viewpoint : viewpoints) {
- viewpointIds.add(viewpoint.getId());
+ if (context != null) {
+ Collection<MergedArchitectureViewpoint> viewpoints = context.getDefaultViewpoints();
+ if (viewpoints.isEmpty()) {
+ viewpoints = context.getViewpoints();
+ }
+ for (MergedArchitectureViewpoint viewpoint : viewpoints) {
+ viewpointIds.add(viewpoint.getId());
+ }
}
+
return viewpointIds;
}

Back to the top