Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.acceleo/src/org/eclipse/papyrus/acceleo/AcceleoDriver.java67
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.acceleo/src/org/eclipse/papyrus/acceleo/GenericGenUtils.java (renamed from extraplugins/codegen/org.eclipse.papyrus.acceleo/src/org/eclipse/papyrus/acceleo/GenUtils.java)2
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java12
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/.classpath2
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/META-INF/MANIFEST.MF14
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/build.acceleo2
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/acceleo/AcceleoDriverWrapper.java118
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/CompImplSync.java10
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CompImplTrafos.java14
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java12
10 files changed, 139 insertions, 114 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo/src/org/eclipse/papyrus/acceleo/AcceleoDriver.java b/extraplugins/codegen/org.eclipse.papyrus.acceleo/src/org/eclipse/papyrus/acceleo/AcceleoDriver.java
index 3d8ca42d8e3..e669f023ec3 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.acceleo/src/org/eclipse/papyrus/acceleo/AcceleoDriver.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo/src/org/eclipse/papyrus/acceleo/AcceleoDriver.java
@@ -12,7 +12,6 @@
package org.eclipse.papyrus.acceleo;
import java.io.File;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
@@ -30,6 +29,7 @@ import org.eclipse.acceleo.parser.AcceleoSourceBuffer;
import org.eclipse.acceleo.parser.cst.ModuleImportsValue;
import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
@@ -50,13 +50,15 @@ public class AcceleoDriver {
public static void init() {
engine = new AcceleoEngine();
parser = new AcceleoParser();
+ hasErrors = false;
+ lastErrors = false;
// some errors are silently captured inside the evaluation query (@see AcceleoEvaluationVisiton.visitExpression). Yet they produce
// an event in the Acceleo log which is captured via this listener.
AcceleoEnginePlugin.getDefault().getLog().addLogListener(new ILogListener() {
public void logging(IStatus status, String plugin) {
- logEntries.add(status);
-
+ hasErrors = true;
+ lastErrors = true;
}
});
acceleoResourceSet = new AcceleoResourceSetImpl();
@@ -111,8 +113,12 @@ public class AcceleoDriver {
Resource r = acceleoResourceSet.getResource(uri, true);
if(r != null) {
// use absolute path, if possible, i.e. if file exists at absolute path
- // this is required, since Acceleo references dependent file using a relative
- // path
+ // this is required, since Acceleo references dependent files using a relative
+ // path.
+ // This workaround is no longer required. In the contrary, it is harmful for binary
+ // build
+
+ /*
String absoluteFileName = Utils.getAbsoluteFN(uri.toString());
if(absoluteFileName != null) {
File fileCandidate = new File(absoluteFileName);
@@ -122,6 +128,7 @@ public class AcceleoDriver {
return URI.createFileURI(fileCandidate.getAbsolutePath());
}
}
+ */
return uri;
}
} catch (Exception e) {
@@ -238,7 +245,7 @@ public class AcceleoDriver {
try {
EList<URI> depURIs = new BasicEList<URI>();
- logEntries.clear();
+ lastErrors = false;
// deps.add(outputURI);
// check, if imports are already in resource set
@@ -310,7 +317,12 @@ public class AcceleoDriver {
}
try {
// return evaluateURI(URI.createURI("org.eclipse.papyrus.cpp.codegen" + "/" + uriStr.replace(".", "/") + "." + IAcceleoConstants.EMTL_FILE_EXTENSION), element);
- return evaluateURI(findFileInPlugin(moduleName), templateName, element);
+ URI uri = findFileInPlugin(moduleName);
+ if (uri == null) {
+ throw new RuntimeException("Cannot find Acceleo module " + moduleName + //$NON-NLS-1$
+ ". Check whether the .emtl file exists and whether it is exported"); //$NON-NLS-1$
+ }
+ return evaluateURI(uri, templateName, element);
} catch (AcceleoException e) {
}
return null;
@@ -352,22 +364,20 @@ public class AcceleoDriver {
boolean dontCheck = (module.getOwnedModuleElement().size() == 1);
for(ModuleElement me : module.getOwnedModuleElement()) {
if((me instanceof Template) && (dontCheck || me.getName().equals(templateName))) {
- logEntries.clear();
+ lastErrors = false;
Object stringResult = engine.evaluate((Template)me, arguments, new PreviewStrategy(), null);
- if(logEntries.size() > 0) {
- IStatus e = logEntries.get(0);
- Throwable exception = e.getException();
- String message = exception.getMessage();
-
- if(exception.getCause() instanceof InvocationTargetException) {
- Throwable targetException = ((InvocationTargetException)exception.getCause()).getTargetException();
- if(targetException != null) {
- message = targetException.getMessage();
- }
+ if (lastErrors) {
+ // we do not throw an exception, since it would imply that the evaluation result is
+ // lost. For a users, the (partially) evaluated result might be more useful to locate
+ // the problem than the actual error message.
+ // log additional info about template, which are not present in the acceleo log
+ String message = "an acceleo error occurred during the evaluation of template <" + //$NON-NLS-1$
+ templateName + ">. Check previous errors in the log."; //$NON-NLS-1$
+ if (templateStr.length() > 0) {
+ message += "Template contents:\n" + templateStr; //$NON-NLS-1$
}
- throw new AcceleoException("Acceleo evaluation problems (showing only first): " + message +
- "\n\nTemplate: " + templateName + "\n" + templateStr);
-
+ AcceleoEnginePlugin.getDefault().getLog().log(
+ new Status(Status.INFO, AcceleoEnginePlugin.PLUGIN_ID, message));
}
if(stringResult instanceof String) {
return (String)stringResult;
@@ -379,8 +389,19 @@ public class AcceleoDriver {
throw new AcceleoEvaluationException("Template " + templateName + " not found");
}
- protected static EList<IStatus> logEntries = new BasicEList<IStatus>();
-
+ public static void clearErrors() {
+ hasErrors = false;
+ lastErrors = false;
+ }
+
+ public static boolean hasErrors() {
+ return hasErrors;
+ }
+
+ protected static boolean hasErrors;
+
+ protected static boolean lastErrors;
+
protected static AcceleoEngine engine = null;
protected static ResourceSet acceleoResourceSet;
diff --git a/extraplugins/codegen/org.eclipse.papyrus.acceleo/src/org/eclipse/papyrus/acceleo/GenUtils.java b/extraplugins/codegen/org.eclipse.papyrus.acceleo/src/org/eclipse/papyrus/acceleo/GenericGenUtils.java
index a8db150a582..5bf3d9df19a 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.acceleo/src/org/eclipse/papyrus/acceleo/GenUtils.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.acceleo/src/org/eclipse/papyrus/acceleo/GenericGenUtils.java
@@ -46,7 +46,7 @@ import org.eclipse.uml2.uml.Type;
* @author wassim
*
*/
-public class GenUtils {
+public class GenericGenUtils {
/**
* Retrieve template bindings for the class passed as a Parameter
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java
index 9232fe2c0f7..019afb0fc19 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen.ui/src/org/eclipse/papyrus/cpp/codegen/ui/handler/GenerateCodeHandler.java
@@ -24,10 +24,13 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.acceleo.AcceleoDriver;
import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils;
import org.eclipse.papyrus.cpp.codegen.transformation.CppModelElementsCreator;
import org.eclipse.papyrus.infra.emf.utils.BusinessModelResolver;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Classifier;
@@ -91,13 +94,18 @@ public class GenerateCodeHandler extends AbstractHandler {
// get the container for the current element
String headerSuffix = CppCodeGenUtils.getHeaderSuffix();
String bodySuffix = CppCodeGenUtils.getBodySuffix();
+ AcceleoDriver.clearErrors();
CppModelElementsCreator mec = new CppModelElementsCreator(modelProject);
IContainer srcPkg = mec.getContainer(classifier);
try {
mec.createPackageableElement(srcPkg, null, classifier);
- IFile cppFile = srcPkg.getFile(new Path(name + "." + bodySuffix));
- IFile hFile = srcPkg.getFile(new Path(name + "." + headerSuffix));
+ if (AcceleoDriver.hasErrors()) {
+ MessageDialog.openInformation(new Shell(), "Errors during code generation", //$NON-NLS-1$
+ "Errors occured during code generation. Please check the error log"); //$NON-NLS-1$
+ }
+ IFile cppFile = srcPkg.getFile(new Path(name + "." + bodySuffix)); //$NON-NLS-1$
+ IFile hFile = srcPkg.getFile(new Path(name + "." + headerSuffix)); //$NON-NLS-1$
if(!cppFile.exists()) {
return null;
}
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/.classpath b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/.classpath
index 64c5e31b7a2..ad32c83a788 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/.classpath
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/META-INF/MANIFEST.MF b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/META-INF/MANIFEST.MF
index 647ebebb0c1..98b2ab730e2 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/META-INF/MANIFEST.MF
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/META-INF/MANIFEST.MF
@@ -16,9 +16,13 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.filesystem;bundle-version="1.3.200",
org.eclipse.papyrus.acceleo;bundle-version="0.10.0"
Eclipse-LazyStart: true
-Export-Package: org.eclipse.papyrus.cpp.codegen,
- org.eclipse.papyrus.cpp.codegen.preferences,
- org.eclipse.papyrus.cpp.codegen.transformation,
- org.eclipse.papyrus.cpp.codegen.utils
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.cpp.codegen;uses:="org.eclipse.ui.plugin,org.osgi.framework,org.eclipse.uml2.uml",
+ org.eclipse.papyrus.cpp.codegen.preferences;uses:="org.eclipse.jface.preference,org.eclipse.core.runtime.preferences",
+ org.eclipse.papyrus.cpp.codegen.transformation;
+ uses:="org.eclipse.core.runtime,
+ org.eclipse.papyrus.acceleo,
+ org.eclipse.core.resources,
+ org.eclipse.uml2.uml",
+ org.eclipse.papyrus.cpp.codegen.utils;uses:="org.eclipse.emf.ecore,org.eclipse.emf.common.util,org.eclipse.uml2.uml"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/build.acceleo b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/build.acceleo
index fa77f031417..79bfb831167 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/build.acceleo
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/build.acceleo
@@ -18,7 +18,7 @@
<acceleoCompiler
sourceFolder="${target.folder}"
outputFolder="${target.folder}"
- dependencies="${target.folder}/../../org.eclipse.papyrus.fcm.profile;${target.folder}/../../org.eclipse.papyrus.infra.core;${target.folder}/../../org.eclipse.papyrus.infra.core.sasheditor;${target.folder}/../../org.eclipse.papyrus.uml.diagram.common;${target.folder}/../../org.eclipse.papyrus.uml.tools.utils;${target.folder}/../../org.eclipse.papyrus.infra.emf;${target.folder}/../../org.eclipse.papyrus.editor;${target.folder}/../../org.eclipse.papyrus.infra.gmfdiag.common;${target.folder}/../../org.eclipse.papyrus.infra.gmfdiag.commands;${target.folder}/../../org.eclipse.papyrus.uml.tools;${target.folder}/../../org.eclipse.papyrus.infra.services.validation;${target.folder}/../../org.eclipse.papyrus.infra.services.decoration;${target.folder}/../../org.eclipse.papyrus.infra.services.markerlistener;${target.folder}/../../org.eclipse.papyrus.infra.gmfdiag.navigation;${target.folder}/../../org.eclipse.papyrus.views.modelexplorer;${target.folder}/../../org.eclipse.papyrus.uml.diagram.navigation;${target.folder}/../../org.eclipse.papyrus.infra.services.resourceloading;${target.folder}/../../org.eclipse.papyrus.qompass.designer.vsl;${target.folder}/../../org.eclipse.papyrus.uml.properties;${target.folder}/../../org.eclipse.papyrus.views.properties;${target.folder}/../../org.eclipse.papyrus.xwt;${target.folder}/../../org.eclipse.papyrus.cpp.profile;${target.folder}/../../org.eclipse.papyrus.acceleo;"
+ dependencies="${target.folder}/../../org.eclipse.papyrus.fcm.profile;${target.folder}/../../org.eclipse.papyrus.infra.core;${target.folder}/../../org.eclipse.papyrus.infra.core.sasheditor;${target.folder}/../../org.eclipse.papyrus.uml.diagram.common;${target.folder}/../../org.eclipse.papyrus.uml.tools.utils;${target.folder}/../../org.eclipse.papyrus.infra.emf;${target.folder}/../../org.eclipse.papyrus.editor;${target.folder}/../../org.eclipse.papyrus.infra.gmfdiag.common;${target.folder}/../../org.eclipse.papyrus.infra.gmfdiag.commands;${target.folder}/../../org.eclipse.papyrus.infra.gmfdiag.navigation;${target.folder}/../../org.eclipse.papyrus.views.modelexplorer;${target.folder}/../../org.eclipse.papyrus.infra.services.decoration;${target.folder}/../../org.eclipse.papyrus.infra.services.markerlistener;${target.folder}/../../org.eclipse.papyrus.uml.diagram.navigation;${target.folder}/../../org.eclipse.papyrus.infra.services.resourceloading;${target.folder}/../../org.eclipse.papyrus.qompass.designer.vsl;${target.folder}/../../org.eclipse.papyrus.uml.properties;${target.folder}/../../org.eclipse.papyrus.views.properties;${target.folder}/../../org.eclipse.papyrus.cpp.profile;${target.folder}/../../org.eclipse.papyrus.acceleo;"
binaryResource="false"
packagesToRegister="">
</acceleoCompiler>
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/acceleo/AcceleoDriverWrapper.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/acceleo/AcceleoDriverWrapper.java
index 52ae269adb7..3f2804cd048 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/acceleo/AcceleoDriverWrapper.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/acceleo/AcceleoDriverWrapper.java
@@ -11,80 +11,52 @@
package org.eclipse.papyrus.qompass.designer.core.acceleo;
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.acceleo.common.IAcceleoConstants;
-import org.eclipse.acceleo.engine.AcceleoEnginePlugin;
-import org.eclipse.acceleo.engine.AcceleoEvaluationException;
-import org.eclipse.acceleo.engine.generation.AcceleoEngine;
-import org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy;
-import org.eclipse.acceleo.model.mtl.Module;
-import org.eclipse.acceleo.model.mtl.ModuleElement;
-import org.eclipse.acceleo.model.mtl.Template;
-import org.eclipse.acceleo.model.mtl.resource.AcceleoResourceSetImpl;
-import org.eclipse.acceleo.parser.AcceleoParser;
-import org.eclipse.acceleo.parser.AcceleoSourceBuffer;
-import org.eclipse.acceleo.parser.cst.ModuleImportsValue;
-import org.eclipse.core.runtime.ILogListener;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.common.util.BasicEList;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.OpaqueBehavior;
import org.eclipse.papyrus.acceleo.AcceleoDriver;
import org.eclipse.papyrus.acceleo.AcceleoException;
-import org.eclipse.papyrus.qompass.designer.core.Utils;
import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationException;
+import org.eclipse.uml2.uml.Element;
public class AcceleoDriverWrapper {
- /**
- * Execute a script passed as parameter. It will be executed in the context
- * of a base script that declares the meta-model (UML2) and has additional
- * imports (currently none).
- *
- * @param template
- * The template in string form
- * @param element
- * The UML element to which the template is applied
- * @return the evaluated template
- */
- public static String bind(String templateStr, Element element) throws TransformationException {
- try {
- return AcceleoDriver.evaluate(templateStr, element, null);
- } catch (AcceleoException e) {
- throw new TransformationException(e.getMessage());
- }
- }
+ /**
+ * Execute a script passed as parameter. It will be executed in the context
+ * of a base script that declares the meta-model (UML2) and has additional
+ * imports (currently none).
+ *
+ * @param template
+ * The template in string form
+ * @param element
+ * The UML element to which the template is applied
+ * @return the evaluated template
+ */
+ public static String bind(String templateStr, Element element) throws TransformationException {
+ try {
+ return AcceleoDriver.evaluate(templateStr, element, null);
+ } catch (AcceleoException e) {
+ throw new TransformationException(e.getMessage());
+ }
+ }
- /**
- * Execute a script passed as parameter. It will be executed in the context
- * of a base script that declares the meta-model (UML2) and has additional
- * imports (currently none).
- *
- * @param template
- * The template in string form
- * @param element
- * The UML element to which the template is applied
- * @return the evaluated template
- */
- public static String evaluate(String templateStr, Element element, Object args[]) throws TransformationException {
- try {
- return AcceleoDriver.evaluate(templateStr, element, args);
- } catch (AcceleoException e) {
- throw new TransformationException(e.getMessage());
- }
- }
+ /**
+ * Execute a script passed as parameter. It will be executed in the context
+ * of a base script that declares the meta-model (UML2) and has additional
+ * imports (currently none).
+ *
+ * @param template
+ * The template in string form
+ * @param element
+ * The UML element to which the template is applied
+ * @return the evaluated template
+ */
+ public static String evaluate(String templateStr, Element element, Object args[]) throws TransformationException {
+ try {
+ return AcceleoDriver.evaluate(templateStr, element, args);
+ } catch (AcceleoException e) {
+ throw new TransformationException(e.getMessage());
+ }
+ }
- /**
+ /**
* Evaluate an Acceleo template
*
* @param templateStr
@@ -100,11 +72,11 @@ public class AcceleoDriverWrapper {
* (TODO: currently not evaluated)
* @return the evaluated template
*/
- public static String evaluate(String templateStr, String templateName, Element element, Object args[]) throws TransformationException {
- try {
- return AcceleoDriver.evaluate(templateStr, templateName, element, args);
- } catch (AcceleoException e) {
- throw new TransformationException(e.getMessage());
- }
- }
+ public static String evaluate(String templateStr, String templateName, Element element, Object args[]) throws TransformationException {
+ try {
+ return AcceleoDriver.evaluate(templateStr, templateName, element, args);
+ } catch (AcceleoException e) {
+ throw new TransformationException(e.getMessage());
+ }
+ }
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/CompImplSync.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/CompImplSync.java
index 093c59dd53f..fdd1698fe0b 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/CompImplSync.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/CompImplSync.java
@@ -251,11 +251,11 @@ public class CompImplSync {
ConnectorEnd connEnd = ConnectorUtils.getDelegation(implementation, portInfo.getPort());
// check that there is no delegation to a part which in turn has to implement the operations.
if((providedIntf != null) && (connEnd == null)) {
- if(false && providedIntfs.contains(providedIntf)) {
- // Turn that into a warning?
- throw new RuntimeException("The interface " + providedIntf.getName() +
- " is provided by more than one port of class <" + implementation.getQualifiedName() +
- ">, inputs would therefore be undistinguishable");
+ if(providedIntfs.contains(providedIntf)) {
+ // emit warning that more than one provider for same interface
+ Log.log(Status.WARNING, Log.TRAFO_SYNC, "The interface " + providedIntf.getName() + //$NON-NLS-1$
+ " is provided by more than one port of class <" + implementation.getQualifiedName() + //$NON-NLS-1$
+ ">, inputs would therefore be undistinguishable"); //$NON-NLS-1$
}
providedIntfs.add(providedIntf);
InterfaceRealization ir = getRealization(implementation, providedIntf);
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CompImplTrafos.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CompImplTrafos.java
index ae172015ecf..782929612ca 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CompImplTrafos.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CompImplTrafos.java
@@ -78,7 +78,7 @@ public class CompImplTrafos {
// we may not apply the transformation to the boot-loader itself, in particular it would transform
// singletons into pointers.
if(Utils.isCompImpl(implementation) && (implementation != bootloader)) {
- addGetPortOperation(implementation);
+ addGetPortOperation(copy, implementation);
addConnectPortOperation(copy, implementation);
markPartsPointer(implementation);
}
@@ -95,7 +95,7 @@ public class CompImplTrafos {
*
* @param implementation
*/
- private static void addGetPortOperation(Class implementation) {
+ private static void addGetPortOperation(Copy copy, Class implementation) {
for(PortInfo portInfo : PortUtils.flattenExtendedPorts(PortUtils.getAllPorts2(implementation))) {
Interface providedIntf = portInfo.getProvided();
if(providedIntf != null) {
@@ -140,7 +140,15 @@ public class CompImplTrafos {
}
} else {
// no delegation, check whether port implements provided interface
- if(implementation.getInterfaceRealization(null, providedIntf) != null) {
+ boolean implementsIntf = implementation.getInterfaceRealization(null, providedIntf) != null;
+ if (!implementsIntf) {
+ // The extended port itself is not copied to the target model (since referenced via a stereotype). Therefore,
+ // a port of an extended port still points to the original model. We try whether the providedIntf within
+ // the target model is within the interface realizations.
+ Interface providedIntfInCopy = (Interface) copy.get(providedIntf);
+ implementsIntf = implementation.getInterfaceRealization(null, providedIntfInCopy) != null;
+ }
+ if (implementsIntf) {
body = "return this;"; //$NON-NLS-1$
} else {
throw new RuntimeException("Interface <" + providedIntf.getName() + "> provided by port <" + //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java
index 5a0d599e31c..4bf597c7e30 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java
@@ -29,6 +29,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.papyrus.FCM.Configuration;
import org.eclipse.papyrus.FCM.DeploymentPlan;
import org.eclipse.papyrus.FCM.util.MapUtil;
+import org.eclipse.papyrus.acceleo.AcceleoDriver;
import org.eclipse.papyrus.qompass.designer.core.Log;
import org.eclipse.papyrus.qompass.designer.core.ModelManagement;
import org.eclipse.papyrus.qompass.designer.core.ProjectManagement;
@@ -89,6 +90,7 @@ public class InstantiateDepPlan {
boolean generateCode = (genOptions & GenerationOptions.MODEL_ONLY) == 0;
boolean generateCACOnly = (genOptions & GenerationOptions.CAC_ONLY) != 0;
+ AcceleoDriver.clearErrors();
Package cdp;
Configuration configuration = null;
if(cdpOrConfig instanceof Package) {
@@ -316,6 +318,16 @@ public class InstantiateDepPlan {
if(tmpMM != null) {
tmpMM.dispose();
}
+ if (AcceleoDriver.hasErrors()) {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ Shell shell = new Shell();
+ MessageDialog.openInformation(shell, "Acceleo errors occured", //$NON-NLS-1$
+ "Acceleo errors occured during code generation. Please check the error log"); //$NON-NLS-1$
+ }
+ });
+ }
+
}

Back to the top