Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2015-01-07 14:22:59 +0000
committerCamille Letavernier2015-01-07 14:22:59 +0000
commit4af64c91d5e7e1e2c31b6cff65f91b6f9383696d (patch)
treef82070e1a840f2c4727d70b058b632694c4e4405 /plugins/infra/viewpoints
parentf8b24161ba5bceb7a15843ec4f87cac2b89bebd0 (diff)
parentc0b08c0da273449173cb2d50f57f8e2d7e7eed29 (diff)
downloadorg.eclipse.papyrus-4af64c91d5e7e1e2c31b6cff65f91b6f9383696d.tar.gz
org.eclipse.papyrus-4af64c91d5e7e1e2c31b6cff65f91b6f9383696d.tar.xz
org.eclipse.papyrus-4af64c91d5e7e1e2c31b6cff65f91b6f9383696d.zip
Merge branch 'change/34540-vp/1'
Diffstat (limited to 'plugins/infra/viewpoints')
-rw-r--r--[-rwxr-xr-x]plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/src/org/eclipse/papyrus/infra/viewpoints/policy/PolicyChecker.java46
1 files changed, 23 insertions, 23 deletions
diff --git a/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/src/org/eclipse/papyrus/infra/viewpoints/policy/PolicyChecker.java b/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/src/org/eclipse/papyrus/infra/viewpoints/policy/PolicyChecker.java
index b89c66eb7d6..ea0c50a8dd7 100755..100644
--- a/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/src/org/eclipse/papyrus/infra/viewpoints/policy/PolicyChecker.java
+++ b/plugins/infra/viewpoints/org.eclipse.papyrus.infra.viewpoints.policy/src/org/eclipse/papyrus/infra/viewpoints/policy/PolicyChecker.java
@@ -26,6 +26,7 @@ import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
@@ -120,31 +121,30 @@ public class PolicyChecker {
* @return The loaded configuration, or <code>null</code> if the operation failed
*/
public static PapyrusConfiguration loadConfigurationFrom(String location) {
- try {
- if (location == null) {
- return null;
- }
- if (location.isEmpty()) {
- return null;
- }
- URI uri = null;
- if (location.startsWith("platform:/")) {
- uri = URI.createURI(location);
- } else {
- uri = URI.createFileURI(location);
- }
- location = uri.toString();
- PapyrusConfiguration config = CONFIGURATIONS_CACHE.get(location);
- if (config != null) {
- return config;
- }
- Resource res = CONFIGURATIONS_RESOURCE_SET.getResource(uri, true);
- config = (PapyrusConfiguration) res.getContents().get(0);
- CONFIGURATIONS_CACHE.put(location, config);
+ if (location == null) {
+ return null;
+ }
+ if (location.isEmpty()) {
+ return null;
+ }
+ URI uri = null;
+ if (location.startsWith("platform:/")) {
+ uri = URI.createURI(location);
+ } else {
+ uri = URI.createFileURI(location);
+ }
+ location = uri.toString();
+ PapyrusConfiguration config = CONFIGURATIONS_CACHE.get(location);
+ if (config != null) {
return config;
- } catch (NullPointerException e) {
}
- return null;
+ Resource res = CONFIGURATIONS_RESOURCE_SET.getResource(uri, true);
+ EList<EObject> contents = res.getContents();
+ if (contents.size() >0){
+ config = (PapyrusConfiguration) contents.get(0);
+ CONFIGURATIONS_CACHE.put(location, config);
+ }
+ return config;
}
/**

Back to the top