diff options
author | Vincent Lorenzo | 2019-02-27 10:46:00 +0000 |
---|---|---|
committer | vincent lorenzo | 2019-03-07 13:48:13 +0000 |
commit | 8c610474fdccfe67457d5ec517d0358c6541e7a7 (patch) | |
tree | 290218d83bf027b4d4d38e2106db04aafc56429c | |
parent | 29246e30e06bbab5e1759478ed09154c85a432bf (diff) | |
download | org.eclipse.papyrus-8c610474fdccfe67457d5ec517d0358c6541e7a7.tar.gz org.eclipse.papyrus-8c610474fdccfe67457d5ec517d0358c6541e7a7.tar.xz org.eclipse.papyrus-8c610474fdccfe67457d5ec517d0358c6541e7a7.zip |
Bug 544869: [Properties][Toolsmiths] AssertionFailedException in the property view generation, when a dependency at ecore model level can't be resolved
- fix the bug
- add exsd files in the build.properties of the plugin oep.infra.properties
- add 2 non-nls tags
Change-Id: I810f12fc9d66f7a6571506a38232c13ec5547ba0
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
6 files changed, 48 insertions, 22 deletions
diff --git a/plugins/infra/properties/org.eclipse.papyrus.infra.properties/build.properties b/plugins/infra/properties/org.eclipse.papyrus.infra.properties/build.properties index 136d7745c8c..f06fb5850c3 100644 --- a/plugins/infra/properties/org.eclipse.papyrus.infra.properties/build.properties +++ b/plugins/infra/properties/org.eclipse.papyrus.infra.properties/build.properties @@ -1,8 +1,14 @@ # #Mon Sep 12 09:30:04 CEST 2011 output.. = bin/ -bin.includes=.,META-INF/,plugin.xml,plugin.properties,Model/,about.html +bin.includes = .,\ + META-INF/,\ + plugin.xml,\ + plugin.properties,\ + Model/,\ + about.html,\ + schema/ jars.compile.order=. src.includes = about.html -src-gen.includes=Model/,META-INF/,plugin.xml,plugin.properties -source..=src-gen/,src/ +source.. = src-gen/,\ + src/
\ No newline at end of file diff --git a/plugins/infra/properties/org.eclipse.papyrus.infra.properties/pom.xml b/plugins/infra/properties/org.eclipse.papyrus.infra.properties/pom.xml index 3da7320b20a..4abd61fdd1d 100644 --- a/plugins/infra/properties/org.eclipse.papyrus.infra.properties/pom.xml +++ b/plugins/infra/properties/org.eclipse.papyrus.infra.properties/pom.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> diff --git a/plugins/infra/properties/org.eclipse.papyrus.infra.properties/src/org/eclipse/papyrus/infra/properties/catalog/PropertiesURIHandler.java b/plugins/infra/properties/org.eclipse.papyrus.infra.properties/src/org/eclipse/papyrus/infra/properties/catalog/PropertiesURIHandler.java index 8886a5f56ad..0f19144d3be 100644 --- a/plugins/infra/properties/org.eclipse.papyrus.infra.properties/src/org/eclipse/papyrus/infra/properties/catalog/PropertiesURIHandler.java +++ b/plugins/infra/properties/org.eclipse.papyrus.infra.properties/src/org/eclipse/papyrus/infra/properties/catalog/PropertiesURIHandler.java @@ -61,11 +61,11 @@ public class PropertiesURIHandler implements URIHandler { public InputStream createInputStream(URI uri, Map<?, ?> options) throws IOException { URI convertedURI = getConvertedURI(uri); if (convertedURI == null) { - throw new IOException(uri.toString() + " not found"); + throw new IOException(uri.toString() + " not found"); //$NON-NLS-1$ } URIHandler handler = getDelegateHandler(convertedURI); if (handler == null) { - throw new IOException(uri.toString() + " : no handler found"); + throw new IOException(uri.toString() + " : no handler found"); //$NON-NLS-1$ } return handler.createInputStream(convertedURI, options); } diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.generation/META-INF/MANIFEST.MF b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.generation/META-INF/MANIFEST.MF index 82e3fd8337b..836c502a193 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.generation/META-INF/MANIFEST.MF +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.generation/META-INF/MANIFEST.MF @@ -17,7 +17,7 @@ Bundle-Vendor: %Bundle-Vendor Bundle-ActivationPolicy: lazy Bundle-ClassPath: ., bin -Bundle-Version: 2.1.0.qualifier +Bundle-Version: 2.1.100.qualifier Eclipse-BuddyPolicy: dependent Bundle-Name: %Bundle-Name Bundle-ManifestVersion: 2 diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.generation/pom.xml b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.generation/pom.xml index 0ff691e8cce..415fa1310b4 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.generation/pom.xml +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.generation/pom.xml @@ -1,16 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - - <!-- This plugin is not released ouside of the Toolsmith feature and therefore must be part of the toolsmith build --> + + <!-- This plugin is not released ouside of the Toolsmith feature and therefore + must be part of the toolsmith build --> <parent> <groupId>org.eclipse.papyrus</groupId> - <artifactId>org.eclipse.papyrus-toolsmiths</artifactId> + <artifactId>org.eclipse.papyrus-toolsmiths</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../../../toolsmiths/pom.xml</relativePath> </parent> <artifactId>org.eclipse.papyrus.uml.properties.generation</artifactId> - <version>2.1.0-SNAPSHOT</version> + <version>2.1.100-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project>
\ No newline at end of file diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/generators/EcoreGenerator.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/generators/EcoreGenerator.java index b591746c3f3..40cacd80a4c 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/generators/EcoreGenerator.java +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/generators/EcoreGenerator.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2010 CEA LIST. + * Copyright (c) 2010, 2019 CEA LIST. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -11,6 +11,7 @@ * Contributors: * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation * Thibault Le Ouay t.leouay@sherpa-eng.com - Strategy improvement of generated files + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Bug 544869 *****************************************************************************/ package org.eclipse.papyrus.customization.properties.generation.generators; @@ -38,6 +39,7 @@ import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.m2m.qvt.oml.BasicModelExtent; import org.eclipse.m2m.qvt.oml.ModelExtent; +import org.eclipse.osgi.util.NLS; import org.eclipse.papyrus.customization.properties.generation.Activator; import org.eclipse.papyrus.customization.properties.generation.messages.Messages; import org.eclipse.papyrus.customization.properties.generation.wizard.widget.FileChooser; @@ -65,6 +67,7 @@ public class EcoreGenerator extends AbstractQVTGenerator { protected List<EPackage> listEPackages; + @Override public void createControls(Composite parent) { Composite root = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); @@ -81,22 +84,26 @@ public class EcoreGenerator extends AbstractQVTGenerator { sourceFileChooser.setFilterExtensions(new String[] { "ecore" }); //$NON-NLS-1$ sourceFileChooser.addListener(this); - listEPackages = new ArrayList<EPackage>(); + listEPackages = new ArrayList<>(); } + @Override public String getDescription() { return Messages.EcoreGenerator_ecoreGeneratorDescription; } + @Override public boolean isReady() { return sourceFileChooser.getFilePath() != null; } + @Override public String getName() { return Messages.EcoreGenerator_ecoreGeneratorName; } + @Override public boolean isSelectedSingle(Property property) { EStructuralFeature feature = getFeature(property); if (feature == null) { @@ -201,7 +208,7 @@ public class EcoreGenerator extends AbstractQVTGenerator { private List<String> getPath(DataContextElement element) { List<String> result; if (element.getPackage() == null) { - result = new LinkedList<String>(); + result = new LinkedList<>(); } else { result = getPath(element.getPackage()); } @@ -210,6 +217,7 @@ public class EcoreGenerator extends AbstractQVTGenerator { return result; } + @Override public boolean isSelectedMultiple(Property property) { if (!isSelectedSingle(property)) { return false; @@ -217,7 +225,7 @@ public class EcoreGenerator extends AbstractQVTGenerator { EStructuralFeature feature = getFeature(property); - Set<String> validDataTypes = new HashSet<String>(Arrays.asList(new String[] { "int", "boolean", "float", "double" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + Set<String> validDataTypes = new HashSet<>(Arrays.asList(new String[] { "int", "boolean", "float", "double" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ if (feature.getEType() instanceof EDataType) { if (validDataTypes.contains(((EDataType) feature.getEType()).getInstanceTypeName())) { @@ -232,10 +240,12 @@ public class EcoreGenerator extends AbstractQVTGenerator { return false; } + @Override public boolean isSelectedSingle(Property property, DataContextElement element) { return isSelectedSingle(property); } + @Override public boolean isSelectedMultiple(Property property, DataContextElement element) { return isSelectedMultiple(property); } @@ -248,7 +258,7 @@ public class EcoreGenerator extends AbstractQVTGenerator { @Override protected List<ModelExtent> getModelExtents() { - LinkedList<ModelExtent> result = new LinkedList<ModelExtent>(); + LinkedList<ModelExtent> result = new LinkedList<>(); ModelExtent temp = new BasicModelExtent(); ModelExtent inPackage = new BasicModelExtent(Collections.singletonList(ecorePackage)); @@ -282,6 +292,7 @@ public class EcoreGenerator extends AbstractQVTGenerator { return sourceFileChooser.getObservableValue(); } + @Override public List<Object> getExternalReference() { URI packageURI = URI.createPlatformResourceURI(sourceFileChooser.getFilePath(), true); @@ -294,7 +305,7 @@ public class EcoreGenerator extends AbstractQVTGenerator { EcoreUtil.resolveAll(ecorePackage); - List<Object> listePackage = new ArrayList<Object>(); + List<Object> listePackage = new ArrayList<>(); if (!listePackage.contains(ecorePackage)) { listePackage.add(ecorePackage); } @@ -329,10 +340,15 @@ public class EcoreGenerator extends AbstractQVTGenerator { if (object instanceof EClass) { EClass eclass = (EClass) object; - List<EClass> liste = eclass.getESuperTypes(); - for (EClass item : liste) { + List<EClass> list = eclass.getESuperTypes(); + for (EClass item : list) { if (!listePackage.contains(item.getEPackage())) { - listePackage.add(item.getEPackage()); + final EPackage epackage = item.getEPackage(); + if (null != epackage && !listePackage.contains(item.getEPackage())) { + listePackage.add(item.getEPackage()); + } else if (null == epackage) { + Activator.log.warn(NLS.bind("The EPackage for {0} can't be resolved.", item)); //$NON-NLS-1$ + } } } @@ -343,6 +359,7 @@ public class EcoreGenerator extends AbstractQVTGenerator { return listePackage; } + @Override public void addCheckElement(Object obj) { if (obj instanceof EPackage) { @@ -361,7 +378,7 @@ public class EcoreGenerator extends AbstractQVTGenerator { ModelExtent inPackage = new BasicModelExtent(Collections.singletonList(currentPackage)); PropertiesRoot root = ConfigurationManager.getInstance().getPropertiesRoot(); ModelExtent inRoot = new BasicModelExtent(Collections.singletonList(root)); - LinkedList<ModelExtent> result = new LinkedList<ModelExtent>(); + LinkedList<ModelExtent> result = new LinkedList<>(); result.add(inPackage); result.add(inPackage); result.add(inRoot); |