Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-11-05 12:44:27 +0000
committerCamille Letavernier2014-11-05 15:16:00 +0000
commit960c48aa378cf7db60e0e5503a6d5d39e8991a52 (patch)
treeac38a00bff6d76f6b9c582c809960a85775502c1 /plugins/customization/org.eclipse.papyrus.customization.properties.generation
parentf8a0549609b4b0c149bd8b6a9a76fbde61afbc98 (diff)
downloadorg.eclipse.papyrus-960c48aa378cf7db60e0e5503a6d5d39e8991a52.tar.gz
org.eclipse.papyrus-960c48aa378cf7db60e0e5503a6d5d39e8991a52.tar.xz
org.eclipse.papyrus-960c48aa378cf7db60e0e5503a6d5d39e8991a52.zip
450151: [Properties View] Improve the Properties View model, editor and
generation tool https://bugs.eclipse.org/bugs/show_bug.cgi?id=450151 Support transitive dependencies generation
Diffstat (limited to 'plugins/customization/org.eclipse.papyrus.customization.properties.generation')
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/generators/EcoreGenerator.java25
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/messages/messages.properties6
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties.generation/transforms/ecore2datacontext.qvto3
3 files changed, 22 insertions, 12 deletions
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/generators/EcoreGenerator.java b/plugins/customization/org.eclipse.papyrus.customization.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/generators/EcoreGenerator.java
index f55725e948a..e0a44895752 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/generators/EcoreGenerator.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/generators/EcoreGenerator.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.Set;
import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
@@ -32,6 +33,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
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.papyrus.customization.properties.generation.Activator;
@@ -279,6 +281,7 @@ public class EcoreGenerator extends AbstractQVTGenerator {
}
public List<Object> getExternalReference() {
+
URI packageURI = URI.createPlatformResourceURI(sourceFileChooser.getFilePath(), true);
try {
@@ -286,16 +289,24 @@ public class EcoreGenerator extends AbstractQVTGenerator {
} catch (IOException e) {
// nothing
}
- new ArrayList<Object>();
+
+ EcoreUtil.resolveAll(ecorePackage);
+
List<Object> listePackage = new ArrayList<Object>();
if (!listePackage.contains(ecorePackage)) {
listePackage.add(ecorePackage);
}
- TreeIterator<EObject> tree = ecorePackage.eAllContents();
+
+ TreeIterator<Notifier> tree = ecorePackage.eResource().getResourceSet().getAllContents();
while (tree.hasNext()) {
- EObject obj = tree.next();
- if (obj instanceof EStructuralFeature) {
- EStructuralFeature feature = (EStructuralFeature) obj;
+ Notifier next = tree.next();
+ if (!(next instanceof EObject)) {
+ continue;
+ }
+
+ EObject object = (EObject) next;
+ if (object instanceof EStructuralFeature) {
+ EStructuralFeature feature = (EStructuralFeature) object;
EClass eClass = feature.getEContainingClass();
if (eClass != null) {
EClassifier classifier = feature.getEType();
@@ -313,9 +324,9 @@ public class EcoreGenerator extends AbstractQVTGenerator {
}
}
}
- if (obj instanceof EClass) {
+ if (object instanceof EClass) {
- EClass eclass = (EClass) obj;
+ EClass eclass = (EClass) object;
List<EClass> liste = eclass.getESuperTypes();
for (EClass item : liste) {
if (!listePackage.contains(item.getEPackage())) {
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/messages/messages.properties b/plugins/customization/org.eclipse.papyrus.customization.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/messages/messages.properties
index fc8fb26512e..abe6c8fc5ba 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/messages/messages.properties
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties.generation/src/org/eclipse/papyrus/customization/properties/generation/messages/messages.properties
@@ -25,9 +25,9 @@ SelectFieldsPage_selectFields=Select the fields you want to be displayed in the
SelectFieldsPage_title=Select fields
SelectOutputPage_0=Output context Page
SelectOutputPage_1= How would you like to generate your new View Property ? \n Select your strategy and your source
-SelectOutputPage_2=Basic method
-SelectOutputPage_3=Same CTX file
-SelectOutputPage_4=Different CTX files
+SelectOutputPage_2=Don't generate dependencies
+SelectOutputPage_3=Generate dependencies in the same file
+SelectOutputPage_4=Generate dependencies in different files
SourceValidator_2=Source file should be a .Ecore file
SourceValidator_4=Source file should be a .Uml file
SourceValidator_5=Source file does not exist in workspace
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties.generation/transforms/ecore2datacontext.qvto b/plugins/customization/org.eclipse.papyrus.customization.properties.generation/transforms/ecore2datacontext.qvto
index 789ccb106f3..33564913f77 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties.generation/transforms/ecore2datacontext.qvto
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties.generation/transforms/ecore2datacontext.qvto
@@ -12,9 +12,8 @@ main() {
mapping EPackage::toContext() : c: Context, root:DataContextRoot when {
//self.isMainPackage() //Only transform source EPackages ; not their dependencies
-self.isSelected()
+ self.isSelected()
}{
- log("Package " + self.name);
c.name := self.name;
c.dataContexts := root;
c.views := self.eClassifiers->select(e | e.oclIsKindOf(EClass))->map toDataContextElement().viewSingle

Back to the top