Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'extraplugins/dsml.validation')
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/CreateJavaValidationPluginHandler.java16
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/Messages.java2
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/messages.properties2
3 files changed, 18 insertions, 2 deletions
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/CreateJavaValidationPluginHandler.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/CreateJavaValidationPluginHandler.java
index 035c06912b5..a16fe1d31b6 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/CreateJavaValidationPluginHandler.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/CreateJavaValidationPluginHandler.java
@@ -130,10 +130,22 @@ public class CreateJavaValidationPluginHandler extends AbstractHandler {
existingProject = root.getProject(uri.segment(1));
}
IProject hostingProject = existingProject;
+ Shell shell = Display.getDefault().getActiveShell();
+
+ boolean isPlugin = false;
+ try {
+ isPlugin = hostingProject.getNature("org.eclipse.pde.PluginNature") != null; //$NON-NLS-1$
+ if (!isPlugin) {
+ // hosting project is not a plugin
+ MessageDialog.openWarning(shell, Messages.CreateJavaValidationPluginHandler_ProfileIsNotAPlugin, String.format(Messages.CreateJavaValidationPluginHandler_ProfileIsNotAPluginExplication, hostingProject.getName()));
+ }
+ }
+ catch (CoreException e) {
+ Activator.log.error(e);
+ }
int question = 0;
- Shell shell = Display.getDefault().getActiveShell();
- if ((existingProject != null) && existingProject.exists()) {
+ if ((existingProject != null) && existingProject.exists() && isPlugin) {
MessageDialog dialog = new MessageDialog(shell,
Messages.CreateJavaValidationPluginHandler_ChoosePluginGeneration, null,
Messages.CreateJavaValidationPluginHandler_HowtoGeneratePlugin, MessageDialog.QUESTION,
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/Messages.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/Messages.java
index eb9fa457e06..8be2b41e53a 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/Messages.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/Messages.java
@@ -31,6 +31,8 @@ public class Messages extends NLS {
public static String CreateJavaValidationPluginHandler_SelectExisting;
public static String CreateJavaValidationPluginHandler_HostCurrent;
public static String CreateJavaValidationPluginHandler_HowtoGeneratePlugin;
+ public static String CreateJavaValidationPluginHandler_ProfileIsNotAPlugin;
+ public static String CreateJavaValidationPluginHandler_ProfileIsNotAPluginExplication;
public static String CreateJavaValidationPluginHandler_ProfileMustBeDefined;
static {
// initialize resource bundle
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/messages.properties b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/messages.properties
index e4a290ae752..dfa481433c8 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/messages.properties
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model.ui/src/org/eclipse/papyrus/dsml/validation/generation/ui/messages.properties
@@ -8,4 +8,6 @@ CreateJavaValidationPluginHandler_GenerateIntoExisting=Generate DSML code into e
CreateJavaValidationPluginHandler_HostCurrent=Host in current plugin
CreateJavaValidationPluginHandler_SelectExisting=Select an existing plugin
CreateJavaValidationPluginHandler_HowtoGeneratePlugin=How should the plugin be generated?
+CreateJavaValidationPluginHandler_ProfileIsNotAPlugin=Profile is not a plugin
+CreateJavaValidationPluginHandler_ProfileIsNotAPluginExplication=The project (%s) that hosts the profile is not a plugin. Verify that the project itself is imported into the workspace. If you continue, the option to generate into the hosting plugin is not available. Papyrus will also not be able to create a dependency to the DSML plugin for you.
CreateJavaValidationPluginHandler_ProfileMustBeDefined=The profile must be defined in order to generate OCL Constraints

Back to the top