Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2014-06-25 08:41:25 +0000
committerAnsgar Radermacher2014-06-25 08:43:05 +0000
commited6f3cf2118cc31fa1ce723c8e46277015f03979 (patch)
tree7c647ff537757d872b4f610b1e5b7906f58cf960
parent5abd6bc9d22f4141df85414195bb71309d948085 (diff)
downloadorg.eclipse.papyrus-ed6f3cf2118cc31fa1ce723c8e46277015f03979.tar.gz
org.eclipse.papyrus-ed6f3cf2118cc31fa1ce723c8e46277015f03979.tar.xz
org.eclipse.papyrus-ed6f3cf2118cc31fa1ce723c8e46277015f03979.zip
436368 - [C++ codegen] plugin org.eclipse.papyrus.cpp.codegen.tests needs to be moved into tests/junit/extraplugins/codegen - Add CDT feature and better handle cancel
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.cdtproject/src/org/eclipse/papyrus/cpp/cdtproject/C_CppLanguageSupport.java11
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/LocateCppProject.java3
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java16
-rw-r--r--features/papyrus-extra-features/org.eclipse.papyrus.extra.cpp.feature/feature.xml4
4 files changed, 31 insertions, 3 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.cdtproject/src/org/eclipse/papyrus/cpp/cdtproject/C_CppLanguageSupport.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.cdtproject/src/org/eclipse/papyrus/cpp/cdtproject/C_CppLanguageSupport.java
index ba8392d5cd4..948ab57e707 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.cdtproject/src/org/eclipse/papyrus/cpp/cdtproject/C_CppLanguageSupport.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.cdtproject/src/org/eclipse/papyrus/cpp/cdtproject/C_CppLanguageSupport.java
@@ -51,6 +51,8 @@ public class C_CppLanguageSupport implements ILangSupport {
private static final String CPP = "cpp"; //$NON-NLS-1$
+ private int dialogStatus;
+
/**
* Caller should test before calling, whether the project exists already
*
@@ -62,6 +64,7 @@ public class C_CppLanguageSupport implements ILangSupport {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject project = root.getProject(projectName);
+ dialogStatus = 0;
try {
IWorkbench wb = PlatformUI.getWorkbench();
@@ -77,15 +80,19 @@ public class C_CppLanguageSupport implements ILangSupport {
WizardDialog wizDiag = new WizardDialog(Display.getCurrent().getActiveShell(), wiz);
wizDiag.create();
- wizDiag.open();
+ dialogStatus = wizDiag.open();
}
});
} catch (Exception e) {
e.printStackTrace();
project = null;
}
+ if (dialogStatus == 1) {
+ // corresponds to Cancel
+ return null;
+ }
if((project == null) || !project.exists()) {
- throw new RuntimeException("could not create CDT project ..."); //$NON-NLS-1$
+ throw new RuntimeException("Could not create CDT project. This might indicate that there is a problem with your CDT installation."); //$NON-NLS-1$
}
setProject(project);
setSettings(targetOS);
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/LocateCppProject.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/LocateCppProject.java
index c172369fd9b..56367253848 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/LocateCppProject.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/LocateCppProject.java
@@ -80,6 +80,9 @@ public class LocateCppProject {
if (langSupport != null) {
langSupport.resetConfigurationData();
modelProject = langSupport.createProject(projectName, null);
+ if (modelProject == null) {
+ return null;
+ }
}
else {
return null;
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 6a24ca63003..bf3b40d1b22 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
@@ -331,7 +331,10 @@ public class InstantiateDepPlan {
ILangSupport langSupport = configureLanguageSupport(mainInstance,
existingModel, node);
-
+ if (langSupport == null) {
+ return;
+ }
+
Deploy deployment = new Deploy(targetCopy, langSupport, node,
nodeIndex, nodes.size());
InstanceSpecification nodeRootIS = deployment
@@ -366,6 +369,14 @@ public class InstantiateDepPlan {
genModelManagement.dispose();
}
+ /**
+ *
+ * @param mainInstance
+ * @param existingModel
+ * @param node
+ * @return null, if no language support is available or no project could be created.
+ * @throws TransformationException
+ */
private ILangSupport configureLanguageSupport(
InstanceSpecification mainInstance, Model existingModel,
InstanceSpecification node) throws TransformationException {
@@ -377,6 +388,9 @@ public class InstantiateDepPlan {
IProject genProject = ProjectManagement.getNamedProject(modelName);
if ((genProject == null) || !genProject.exists()) {
genProject = langSupport.createProject(modelName, getTargetOS(node));
+ if (genProject == null) {
+ return null;
+ }
} else {
langSupport.setProject(genProject);
if ((generationOptions & GenerationOptions.REWRITE_SETTINGS) != 0) {
diff --git a/features/papyrus-extra-features/org.eclipse.papyrus.extra.cpp.feature/feature.xml b/features/papyrus-extra-features/org.eclipse.papyrus.extra.cpp.feature/feature.xml
index 7a96ca80d37..1fe31dba97e 100644
--- a/features/papyrus-extra-features/org.eclipse.papyrus.extra.cpp.feature/feature.xml
+++ b/features/papyrus-extra-features/org.eclipse.papyrus.extra.cpp.feature/feature.xml
@@ -26,6 +26,10 @@ http://www.eclipse.org/legal/epl-v10.html
%license
</license>
+ <requires>
+ <import feature="org.eclipse.cdt" version="8.4.0.201406031009"/>
+ </requires>
+
<plugin
id="org.eclipse.papyrus.cpp.codegen"
download-size="0"

Back to the top