Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet')
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/Activator.java102
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/JavaQueryUIRuntimeException.java46
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/Messages.java110
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/dialog/JavaQueryStrategy.java156
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/messages.properties76
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/widget/GetMultiValuesWidgetComposite.java112
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/widget/GetOrCreateJavaImplementationWidgetComposite.java228
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/widget/query/JavaQueryWidget.java150
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/JavaQueryUtils.java90
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/JdtUtils.java522
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/SelectOrCreateJavaClassWizard.java354
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/page/CreateQueryClassWizardPage.java254
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/page/SelectJavaClassWizardPage.java240
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/page/SelectOrCreateJavaClassWizardPage.java150
14 files changed, 1295 insertions, 1295 deletions
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/Activator.java
index 6e0fa0c5734..d8db7f615f9 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/Activator.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/Activator.java
@@ -1,51 +1,51 @@
-/**
- * Copyright (c) 2012 CEA LIST.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates
- */
-package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-// Copied from /org.eclipse.papyrus.emf.facet.aggregate.metamodel.notgenerated/src/org/eclipse/emf/facet/aggregate/metamodel/notgenerated/internal/Activator.java
-@SuppressWarnings("PMD.UseSingleton")
-// @SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because
-// this class is an Eclipse plug-in activator which will be instantiated by the
-// Eclipse framework.
-public class Activator extends Plugin {
-
- private static Activator plugin;
-
- @Override
- @SuppressWarnings("PMD.SignatureDeclareThrowsException")
- // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use
- // this signature because this is an override of an Eclipse framework's
- // method.
- public void start(final BundleContext bundleContext) throws Exception {
- super.start(bundleContext);
- Activator.plugin = this;
- }
-
- @Override
- @SuppressWarnings("PMD.SignatureDeclareThrowsException")
- // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use
- // this signature because this is an override of an Eclipse framework's
- // method.
- public void stop(final BundleContext bundleContext) throws Exception {
- // NOPMD: PMD say "Assigning an Object to null is a code smell."
- // No choice to right it in another way : this is an Eclipse pattern.
- Activator.plugin = null; // NOPMD by gdupe on 30/03/12 10:19
- super.stop(bundleContext);
- }
-
- public static Plugin getDefault() {
- return Activator.plugin;
- }
-
-}
+/**
+ * Copyright (c) 2012 CEA LIST.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates
+ */
+package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+// Copied from /org.eclipse.papyrus.emf.facet.aggregate.metamodel.notgenerated/src/org/eclipse/emf/facet/aggregate/metamodel/notgenerated/internal/Activator.java
+@SuppressWarnings("PMD.UseSingleton")
+// @SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because
+// this class is an Eclipse plug-in activator which will be instantiated by the
+// Eclipse framework.
+public class Activator extends Plugin {
+
+ private static Activator plugin;
+
+ @Override
+ @SuppressWarnings("PMD.SignatureDeclareThrowsException")
+ // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use
+ // this signature because this is an override of an Eclipse framework's
+ // method.
+ public void start(final BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ Activator.plugin = this;
+ }
+
+ @Override
+ @SuppressWarnings("PMD.SignatureDeclareThrowsException")
+ // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use
+ // this signature because this is an override of an Eclipse framework's
+ // method.
+ public void stop(final BundleContext bundleContext) throws Exception {
+ // NOPMD: PMD say "Assigning an Object to null is a code smell."
+ // No choice to right it in another way : this is an Eclipse pattern.
+ Activator.plugin = null; // NOPMD by gdupe on 30/03/12 10:19
+ super.stop(bundleContext);
+ }
+
+ public static Plugin getDefault() {
+ return Activator.plugin;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/JavaQueryUIRuntimeException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/JavaQueryUIRuntimeException.java
index db9e1b8e49b..80be0c600d7 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/JavaQueryUIRuntimeException.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/JavaQueryUIRuntimeException.java
@@ -1,23 +1,23 @@
-/**
- * Copyright (c) 2012 Mia-Software.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
- * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
- */
-package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal;
-
-public class JavaQueryUIRuntimeException extends RuntimeException {
-
- private static final long serialVersionUID = 8815972557940912330L;
-
- public JavaQueryUIRuntimeException(final Throwable cause) {
- super(cause);
- }
-
-}
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal;
+
+public class JavaQueryUIRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = 8815972557940912330L;
+
+ public JavaQueryUIRuntimeException(final Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/Messages.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/Messages.java
index e0c502520f2..b2301517803 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/Messages.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/Messages.java
@@ -1,55 +1,55 @@
-/**
- * Copyright (c) 2011 Mia-Software.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Nicolas Guyomar (Mia-Software) - Bug 349556 - EMF Facet Java Query wizard
- * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
- */
-package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal;
-
-import org.eclipse.osgi.util.NLS;
-
-// copy from /org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/emf/facet/query/java/sdk/ui/internal/Messages.java
-public final class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.messages"; //$NON-NLS-1$
- public static String Choose_an_operation;
- public static String Choose_an_operation_desc;
- public static String Create_new_java_class;
- public static String JavaQueryWizardPage_Can_be_cached;
- public static String JavaQueryWizardPage_has_side_effect;
- public static String JavaQueryWizardPage_Java_Class_Name;
- public static String JavaQueryWizardPage_Java_Query;
- public static String JavaQueryWizardPage_Java_query_creation_page;
- public static String JavaQueryWizardPage_lower_bound;
- public static String JavaQueryWizardPage_Query_name;
- public static String JavaQueryWizardPage_Browse;
- public static String JavaQueryWizardPage_Create;
- public static String JavaQueryWizardPage_interface_constraints;
- public static String JavaQueryWizardPage_Please_select_a_scope;
- public static String JavaQueryWizardPage_Please_select_create_IJavaQuery_Class;
- public static String JavaQueryWizardPage_Scope;
- public static String JavaQueryWizardPage_upper_bound;
- public static String NewClassWizardPage_CreateANewJavaClass;
- public static String NewClassWizardPage_JavaClass;
- public static String NewQueryClassWizardPage_Failed_to_create_java_class;
- public static String NewQueryClassWizardPage_Failed_to_create_query_implementation;
- public static String Select_existing_java_class;
- public static String SelectJavaClassWizardPage_SeclectAJavaClassLongDescription;
- public static String SelectJavaClassWizardPage_SelectAJavaClass;
- public static String Upper_bound;
- public static String Multi_Values;
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nicolas Guyomar (Mia-Software) - Bug 349556 - EMF Facet Java Query wizard
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+// copy from /org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/emf/facet/query/java/sdk/ui/internal/Messages.java
+public final class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.messages"; //$NON-NLS-1$
+ public static String Choose_an_operation;
+ public static String Choose_an_operation_desc;
+ public static String Create_new_java_class;
+ public static String JavaQueryWizardPage_Can_be_cached;
+ public static String JavaQueryWizardPage_has_side_effect;
+ public static String JavaQueryWizardPage_Java_Class_Name;
+ public static String JavaQueryWizardPage_Java_Query;
+ public static String JavaQueryWizardPage_Java_query_creation_page;
+ public static String JavaQueryWizardPage_lower_bound;
+ public static String JavaQueryWizardPage_Query_name;
+ public static String JavaQueryWizardPage_Browse;
+ public static String JavaQueryWizardPage_Create;
+ public static String JavaQueryWizardPage_interface_constraints;
+ public static String JavaQueryWizardPage_Please_select_a_scope;
+ public static String JavaQueryWizardPage_Please_select_create_IJavaQuery_Class;
+ public static String JavaQueryWizardPage_Scope;
+ public static String JavaQueryWizardPage_upper_bound;
+ public static String NewClassWizardPage_CreateANewJavaClass;
+ public static String NewClassWizardPage_JavaClass;
+ public static String NewQueryClassWizardPage_Failed_to_create_java_class;
+ public static String NewQueryClassWizardPage_Failed_to_create_query_implementation;
+ public static String Select_existing_java_class;
+ public static String SelectJavaClassWizardPage_SeclectAJavaClassLongDescription;
+ public static String SelectJavaClassWizardPage_SelectAJavaClass;
+ public static String Upper_bound;
+ public static String Multi_Values;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(Messages.BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/dialog/JavaQueryStrategy.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/dialog/JavaQueryStrategy.java
index 10eef5817f1..9d958845047 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/dialog/JavaQueryStrategy.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/dialog/JavaQueryStrategy.java
@@ -1,78 +1,78 @@
-/**
- * Copyright (c) 2012 Mia-Software.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
- * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
- */
-package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.dialog;
-
-import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
-import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.exported.IQueryContext;
-import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.exported.IQueryDialogFactoryStrategy;
-import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.query.AbstractQueryDialogFactory;
-import org.eclipse.papyrus.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery;
-import org.eclipse.papyrus.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryFactory;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Messages;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.widget.query.JavaQueryWidget;
-import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.widget.IAbstractWidget;
-import org.eclipse.papyrus.emf.facet.util.ui.utils.PropertyElement2;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This class will be used for the creation of a java query.
- *
- * @see AbstractQueryDialogFactory
- * @see JavaQueryWidget
- */
-public class JavaQueryStrategy implements IQueryDialogFactoryStrategy {
-
- private final PropertyElement2<String> implClassNameProp;
-
- public JavaQueryStrategy() {
- this.implClassNameProp = new PropertyElement2<String>(true);
- }
-
- @Override
- public IAbstractWidget createWidget(
- final Composite parent, final IQueryContext queryContext) {
- return new JavaQueryWidget(parent, queryContext,
- this.implClassNameProp);
- }
-
- @Override
- public Query createQuery(final boolean canBeCached,
- final boolean sideEffects, final IQueryContext queryContext) {
- JavaQuery result = null;
- final String implClassName = (String) this.implClassNameProp.getValue();
- final JavaQuery query = JavaQueryFactory.eINSTANCE.createJavaQuery();
- query.setCanBeCached(canBeCached);
- query.setCanHaveSideEffects(sideEffects);
- if (implClassName != null) {
- query.setImplementationClassName(implClassName);
- result = query;
- }
- return result;
- }
-
- @Override
- public String getDialogMessage() {
- return Messages.JavaQueryWizardPage_Java_query_creation_page;
- }
-
- @Override
- public String getDialogTitle() {
- return Messages.JavaQueryWizardPage_Java_Query;
- }
-
- @Override
- public String getConclusionText() {
- return this.implClassNameProp.getValue2();
- }
-
-}
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.dialog;
+
+import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.exported.IQueryContext;
+import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.exported.IQueryDialogFactoryStrategy;
+import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.query.AbstractQueryDialogFactory;
+import org.eclipse.papyrus.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery;
+import org.eclipse.papyrus.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQueryFactory;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Messages;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.widget.query.JavaQueryWidget;
+import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.widget.IAbstractWidget;
+import org.eclipse.papyrus.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This class will be used for the creation of a java query.
+ *
+ * @see AbstractQueryDialogFactory
+ * @see JavaQueryWidget
+ */
+public class JavaQueryStrategy implements IQueryDialogFactoryStrategy {
+
+ private final PropertyElement2<String> implClassNameProp;
+
+ public JavaQueryStrategy() {
+ this.implClassNameProp = new PropertyElement2<String>(true);
+ }
+
+ @Override
+ public IAbstractWidget createWidget(
+ final Composite parent, final IQueryContext queryContext) {
+ return new JavaQueryWidget(parent, queryContext,
+ this.implClassNameProp);
+ }
+
+ @Override
+ public Query createQuery(final boolean canBeCached,
+ final boolean sideEffects, final IQueryContext queryContext) {
+ JavaQuery result = null;
+ final String implClassName = (String) this.implClassNameProp.getValue();
+ final JavaQuery query = JavaQueryFactory.eINSTANCE.createJavaQuery();
+ query.setCanBeCached(canBeCached);
+ query.setCanHaveSideEffects(sideEffects);
+ if (implClassName != null) {
+ query.setImplementationClassName(implClassName);
+ result = query;
+ }
+ return result;
+ }
+
+ @Override
+ public String getDialogMessage() {
+ return Messages.JavaQueryWizardPage_Java_query_creation_page;
+ }
+
+ @Override
+ public String getDialogTitle() {
+ return Messages.JavaQueryWizardPage_Java_Query;
+ }
+
+ @Override
+ public String getConclusionText() {
+ return this.implClassNameProp.getValue2();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/messages.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/messages.properties
index b4b09cf65ab..6b244f3f8de 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/messages.properties
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/messages.properties
@@ -1,39 +1,39 @@
-##########################################################################
-# Copyright (c) 2011 Mia-Software.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Nicolas Guyomar (Mia-Software) - Bug 349556 - EMF Facet Java Query wizard
-# Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
-###########################################################################
-# Copy from /org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/emf/facet/query/java/sdk/ui/internal/messages.properties
-Choose_an_operation=Choose an operation:
-Choose_an_operation_desc=Choose whether you want to create a new Java class, or to select an existing one
-Create_new_java_class=Create a new Java Class
-JavaQueryWizardPage_Can_be_cached=Can be cached:
-JavaQueryWizardPage_has_side_effect=Has side effect:
-JavaQueryWizardPage_Java_Class_Name=Java Class name:
-JavaQueryWizardPage_Java_Query=Java Query
-JavaQueryWizardPage_Java_query_creation_page=Java query creation page
-JavaQueryWizardPage_lower_bound=Lower bound:
-JavaQueryWizardPage_Query_name=Query name:
-JavaQueryWizardPage_Browse=Browse
-JavaQueryWizardPage_upper_bound=Upper bound:
-JavaQueryWizardPage_Create=Create
-JavaQueryWizardPage_interface_constraints=The selected class has to implements
-JavaQueryWizardPage_Please_select_a_scope=Please select a scope for this query
-JavaQueryWizardPage_Please_select_create_IJavaQuery_Class=Please select or create an IJavaQuery Class
-JavaQueryWizardPage_Scope=Scope:
-NewClassWizardPage_CreateANewJavaClass=Create a new Java class.
-NewClassWizardPage_JavaClass=Java Class
-NewQueryClassWizardPage_Failed_to_create_java_class=Failed to create a Java class
-NewQueryClassWizardPage_Failed_to_create_query_implementation=Failed to create the Java model query implementation class.
-Select_existing_java_class=Select an existing Java Class
-SelectJavaClassWizardPage_SeclectAJavaClassLongDescription=Select a Java class
-SelectJavaClassWizardPage_SelectAJavaClass=Select a Java class
-Upper_bound=Upper Bound:
+##########################################################################
+# Copyright (c) 2011 Mia-Software.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Nicolas Guyomar (Mia-Software) - Bug 349556 - EMF Facet Java Query wizard
+# Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+###########################################################################
+# Copy from /org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/emf/facet/query/java/sdk/ui/internal/messages.properties
+Choose_an_operation=Choose an operation:
+Choose_an_operation_desc=Choose whether you want to create a new Java class, or to select an existing one
+Create_new_java_class=Create a new Java Class
+JavaQueryWizardPage_Can_be_cached=Can be cached:
+JavaQueryWizardPage_has_side_effect=Has side effect:
+JavaQueryWizardPage_Java_Class_Name=Java Class name:
+JavaQueryWizardPage_Java_Query=Java Query
+JavaQueryWizardPage_Java_query_creation_page=Java query creation page
+JavaQueryWizardPage_lower_bound=Lower bound:
+JavaQueryWizardPage_Query_name=Query name:
+JavaQueryWizardPage_Browse=Browse
+JavaQueryWizardPage_upper_bound=Upper bound:
+JavaQueryWizardPage_Create=Create
+JavaQueryWizardPage_interface_constraints=The selected class has to implements
+JavaQueryWizardPage_Please_select_a_scope=Please select a scope for this query
+JavaQueryWizardPage_Please_select_create_IJavaQuery_Class=Please select or create an IJavaQuery Class
+JavaQueryWizardPage_Scope=Scope:
+NewClassWizardPage_CreateANewJavaClass=Create a new Java class.
+NewClassWizardPage_JavaClass=Java Class
+NewQueryClassWizardPage_Failed_to_create_java_class=Failed to create a Java class
+NewQueryClassWizardPage_Failed_to_create_query_implementation=Failed to create the Java model query implementation class.
+Select_existing_java_class=Select an existing Java Class
+SelectJavaClassWizardPage_SeclectAJavaClassLongDescription=Select a Java class
+SelectJavaClassWizardPage_SelectAJavaClass=Select a Java class
+Upper_bound=Upper Bound:
Multi_Values=Multi-values: \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/widget/GetMultiValuesWidgetComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/widget/GetMultiValuesWidgetComposite.java
index d3a2a4a01ab..a78250ada86 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/widget/GetMultiValuesWidgetComposite.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/widget/GetMultiValuesWidgetComposite.java
@@ -1,56 +1,56 @@
-/**
- * Copyright (c) 2012 Mia-Software.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
- */
-package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.widget;
-
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Messages;
-import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.util.widget.component.properties.AbstractGetPropertyWidget;
-import org.eclipse.papyrus.emf.facet.util.ui.utils.PropertyElement;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This class create a boolean widget to check if the returned value is multiple
- * or not (1 or *).
- */
-public class GetMultiValuesWidgetComposite extends AbstractGetPropertyWidget {
-
- private static final int LABEL_WIDTH_HINT = 110;
-
- /**
- * Constructor.
- *
- * @param parent
- * the parent of this widget.
- * @param propertyElement
- * the property element edited by this widget.
- */
- public GetMultiValuesWidgetComposite(final Composite parent,
- final PropertyElement propertyElement) {
- super(parent, propertyElement);
- setLabelWidthHint(LABEL_WIDTH_HINT);
- }
-
- @Override
- protected String getLabel() {
- return Messages.Multi_Values;
- }
-
- @Override
- public String getError() {
- return null;
- }
-
- @Override
- public void notifyChanged() {
- // Nothing.
- }
-
-}
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.widget;
+
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Messages;
+import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.util.widget.component.properties.AbstractGetPropertyWidget;
+import org.eclipse.papyrus.emf.facet.util.ui.utils.PropertyElement;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This class create a boolean widget to check if the returned value is multiple
+ * or not (1 or *).
+ */
+public class GetMultiValuesWidgetComposite extends AbstractGetPropertyWidget {
+
+ private static final int LABEL_WIDTH_HINT = 110;
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of this widget.
+ * @param propertyElement
+ * the property element edited by this widget.
+ */
+ public GetMultiValuesWidgetComposite(final Composite parent,
+ final PropertyElement propertyElement) {
+ super(parent, propertyElement);
+ setLabelWidthHint(LABEL_WIDTH_HINT);
+ }
+
+ @Override
+ protected String getLabel() {
+ return Messages.Multi_Values;
+ }
+
+ @Override
+ public String getError() {
+ return null;
+ }
+
+ @Override
+ public void notifyChanged() {
+ // Nothing.
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/widget/GetOrCreateJavaImplementationWidgetComposite.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/widget/GetOrCreateJavaImplementationWidgetComposite.java
index c3a503c50ac..16b3e4303a7 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/widget/GetOrCreateJavaImplementationWidgetComposite.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/widget/GetOrCreateJavaImplementationWidgetComposite.java
@@ -1,114 +1,114 @@
-/**
- * Copyright (c) 2012 Mia-Software.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
- * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
- */
-package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.widget;
-
-import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.exported.IQueryContext;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.JavaQueryUIRuntimeException;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Messages;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.SelectOrCreateJavaClassWizard;
-import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.dialog.IDialogCallback;
-import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWithWizardButtonWidget;
-import org.eclipse.papyrus.emf.facet.util.ui.utils.PropertyElement2;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Widget for the recovery or creation of a java query class.
- */
-public class GetOrCreateJavaImplementationWidgetComposite extends
- AbstractGetOrCreateElementWithWizardButtonWidget<String, SelectOrCreateJavaClassWizard> {
-
- private final IQueryContext queryContext;
-
- /**
- * Constructor.
- *
- * @param parent
- * the parent of this widget.
- * @param properties
- * the properties.
- * @param queryContext
- * the main queryContext of the model.
- * @param facet
- * the current facet of the model.
- */
- public GetOrCreateJavaImplementationWidgetComposite(final Composite parent,
- final PropertyElement2<String> implClassNameProp,
- final IQueryContext queryContext) {
- super(parent, implClassNameProp);
- this.queryContext = queryContext;
- }
-
- @Override
- protected String getLabel() {
- return Messages.JavaQueryWizardPage_Java_Class_Name;
- }
-
- @Override
- protected String getErrorMessage() {
- return Messages.JavaQueryWizardPage_Please_select_create_IJavaQuery_Class;
- }
-
- @Override
- protected String getTextFieldInitialText() {
- return null;
- }
-
- @Override
- public void notifyChanged() {
- // Nothing to do.
- }
-
- @Override
- protected SelectOrCreateJavaClassWizard createIWizard() {
- SelectOrCreateJavaClassWizard classCreation = null;
- final IDialogCallback<String> callBack = new IDialogCallback<String>() {
- @Override
- public void committed(final String result) {
- GetOrCreateJavaImplementationWidgetComposite.this
- .onWizardCommited(result);
- }
- };
- try {
- classCreation = new SelectOrCreateJavaClassWizard(this.queryContext,
- callBack);
- } catch (Exception e) {
- throw new JavaQueryUIRuntimeException(e);
- }
- return classCreation;
- }
-
- protected final void onWizardCommited(final String classQAName) {
- this.getPropertyElement().setValue(classQAName);
- this.getTextField().setText(classQAName);
- }
-
- @Override
- protected void onWizardCanceled() {
- // Not used because SelectOrCreateJavaClassWizard manage event using
- // the call back pattern.
- }
-
- @Override
- protected void onWizardCommited(final SelectOrCreateJavaClassWizard wizard) {
- // Not used because SelectOrCreateJavaClassWizard manage event using
- // the call back pattern.
- }
-
- @Override
- protected SelectOrCreateJavaClassWizard createSynchronizedWizard(
- final SelectOrCreateJavaClassWizard wizard) {
-
- return null;
- }
-
-}
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.widget;
+
+import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.exported.IQueryContext;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.JavaQueryUIRuntimeException;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Messages;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.SelectOrCreateJavaClassWizard;
+import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.dialog.IDialogCallback;
+import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.util.widget.component.getorcreate.AbstractGetOrCreateElementWithWizardButtonWidget;
+import org.eclipse.papyrus.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Widget for the recovery or creation of a java query class.
+ */
+public class GetOrCreateJavaImplementationWidgetComposite extends
+ AbstractGetOrCreateElementWithWizardButtonWidget<String, SelectOrCreateJavaClassWizard> {
+
+ private final IQueryContext queryContext;
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of this widget.
+ * @param properties
+ * the properties.
+ * @param queryContext
+ * the main queryContext of the model.
+ * @param facet
+ * the current facet of the model.
+ */
+ public GetOrCreateJavaImplementationWidgetComposite(final Composite parent,
+ final PropertyElement2<String> implClassNameProp,
+ final IQueryContext queryContext) {
+ super(parent, implClassNameProp);
+ this.queryContext = queryContext;
+ }
+
+ @Override
+ protected String getLabel() {
+ return Messages.JavaQueryWizardPage_Java_Class_Name;
+ }
+
+ @Override
+ protected String getErrorMessage() {
+ return Messages.JavaQueryWizardPage_Please_select_create_IJavaQuery_Class;
+ }
+
+ @Override
+ protected String getTextFieldInitialText() {
+ return null;
+ }
+
+ @Override
+ public void notifyChanged() {
+ // Nothing to do.
+ }
+
+ @Override
+ protected SelectOrCreateJavaClassWizard createIWizard() {
+ SelectOrCreateJavaClassWizard classCreation = null;
+ final IDialogCallback<String> callBack = new IDialogCallback<String>() {
+ @Override
+ public void committed(final String result) {
+ GetOrCreateJavaImplementationWidgetComposite.this
+ .onWizardCommited(result);
+ }
+ };
+ try {
+ classCreation = new SelectOrCreateJavaClassWizard(this.queryContext,
+ callBack);
+ } catch (Exception e) {
+ throw new JavaQueryUIRuntimeException(e);
+ }
+ return classCreation;
+ }
+
+ protected final void onWizardCommited(final String classQAName) {
+ this.getPropertyElement().setValue(classQAName);
+ this.getTextField().setText(classQAName);
+ }
+
+ @Override
+ protected void onWizardCanceled() {
+ // Not used because SelectOrCreateJavaClassWizard manage event using
+ // the call back pattern.
+ }
+
+ @Override
+ protected void onWizardCommited(final SelectOrCreateJavaClassWizard wizard) {
+ // Not used because SelectOrCreateJavaClassWizard manage event using
+ // the call back pattern.
+ }
+
+ @Override
+ protected SelectOrCreateJavaClassWizard createSynchronizedWizard(
+ final SelectOrCreateJavaClassWizard wizard) {
+
+ return null;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/widget/query/JavaQueryWidget.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/widget/query/JavaQueryWidget.java
index 928502c2f4b..80981c331cc 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/widget/query/JavaQueryWidget.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/widget/query/JavaQueryWidget.java
@@ -1,75 +1,75 @@
-/**
- * Copyright (c) 2012 Mia-Software.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
- * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
- */
-package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.widget.query;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.ecore.ETypedElement;
-import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.exported.IQueryContext;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.widget.GetOrCreateJavaImplementationWidgetComposite;
-import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.util.widget.query.AbstractQueryWidget;
-import org.eclipse.papyrus.emf.facet.util.ui.utils.PropertyElement2;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This class provide the main widget for the creation of a Java query.
- */
-public class JavaQueryWidget extends AbstractQueryWidget<ETypedElement> {
-
- private final PropertyElement2<String> implClassNameProp;
- private final IQueryContext queryContext;
-
- /**
- * Constructor.
- *
- * @param parent
- * the parent of this widget.
- * @param editingDomain
- * the current editing domain.
- * @param properties
- * the properties.
- * @param facetSet
- * the main facetSet of the model.
- * @param facet
- * the current facet of the model.
- */
- public JavaQueryWidget(final Composite parent,
- final IQueryContext queryContext,
- final PropertyElement2<String> implClassNameProp) {
- super(parent);
- this.implClassNameProp = implClassNameProp;
- this.queryContext = queryContext;
- }
-
- @Override
- protected void addSubWidgets() {
- final GetOrCreateJavaImplementationWidgetComposite widget = new GetOrCreateJavaImplementationWidgetComposite(this,
- this.implClassNameProp, this.queryContext);
- addSubWidget(widget);
- }
-
- @Override
- public Command getCommand() {
- // No Command to return.
- return null;
- }
-
- @Override
- public void notifyChanged() {
- // Nothing to do.
- }
-
- @Override
- public void onDialogValidation() {
- // Nothing to do.
- }
-}
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.widget.query;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.exported.IQueryContext;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.widget.GetOrCreateJavaImplementationWidgetComposite;
+import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.util.widget.query.AbstractQueryWidget;
+import org.eclipse.papyrus.emf.facet.util.ui.utils.PropertyElement2;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This class provide the main widget for the creation of a Java query.
+ */
+public class JavaQueryWidget extends AbstractQueryWidget<ETypedElement> {
+
+ private final PropertyElement2<String> implClassNameProp;
+ private final IQueryContext queryContext;
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * the parent of this widget.
+ * @param editingDomain
+ * the current editing domain.
+ * @param properties
+ * the properties.
+ * @param facetSet
+ * the main facetSet of the model.
+ * @param facet
+ * the current facet of the model.
+ */
+ public JavaQueryWidget(final Composite parent,
+ final IQueryContext queryContext,
+ final PropertyElement2<String> implClassNameProp) {
+ super(parent);
+ this.implClassNameProp = implClassNameProp;
+ this.queryContext = queryContext;
+ }
+
+ @Override
+ protected void addSubWidgets() {
+ final GetOrCreateJavaImplementationWidgetComposite widget = new GetOrCreateJavaImplementationWidgetComposite(this,
+ this.implClassNameProp, this.queryContext);
+ addSubWidget(widget);
+ }
+
+ @Override
+ public Command getCommand() {
+ // No Command to return.
+ return null;
+ }
+
+ @Override
+ public void notifyChanged() {
+ // Nothing to do.
+ }
+
+ @Override
+ public void onDialogValidation() {
+ // Nothing to do.
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/JavaQueryUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/JavaQueryUtils.java
index df696ea41c5..5f0821516db 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/JavaQueryUtils.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/JavaQueryUtils.java
@@ -1,45 +1,45 @@
-/**
- * Copyright (c) 2012 Mia-Software.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
- * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
- */
-package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard;
-
-import java.util.Locale;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.papyrus.emf.facet.efacet.core.FacetUtils;
-import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet;
-import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.exported.IQueryContext;
-
-public final class JavaQueryUtils {
-
- private JavaQueryUtils() {
- // Must no be used
- }
-
- private static final String UNKONWN = "unkonwn"; //$NON-NLS-1$
-
- public static String getDefaultPackageName(
- final IQueryContext queryContext,
- final IJavaProject javaProject) {
- String sourceClassName = UNKONWN;
- final Facet facet = queryContext.getFacet();
- final EClass eClass = FacetUtils.findExtendedEClass(facet);
- if (eClass != null) {
- sourceClassName = eClass.getName();
- }
- final String packageName = javaProject.getProject().getName()
- + ".queries." + sourceClassName.toLowerCase(Locale.getDefault()); //$NON-NLS-1$
- return packageName;
- }
-
-}
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard;
+
+import java.util.Locale;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.papyrus.emf.facet.efacet.core.FacetUtils;
+import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet;
+import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.exported.IQueryContext;
+
+public final class JavaQueryUtils {
+
+ private JavaQueryUtils() {
+ // Must no be used
+ }
+
+ private static final String UNKONWN = "unkonwn"; //$NON-NLS-1$
+
+ public static String getDefaultPackageName(
+ final IQueryContext queryContext,
+ final IJavaProject javaProject) {
+ String sourceClassName = UNKONWN;
+ final Facet facet = queryContext.getFacet();
+ final EClass eClass = FacetUtils.findExtendedEClass(facet);
+ if (eClass != null) {
+ sourceClassName = eClass.getName();
+ }
+ final String packageName = javaProject.getProject().getName()
+ + ".queries." + sourceClassName.toLowerCase(Locale.getDefault()); //$NON-NLS-1$
+ return packageName;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/JdtUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/JdtUtils.java
index 18ff714615d..909c8344789 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/JdtUtils.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/JdtUtils.java
@@ -1,261 +1,261 @@
-/**
- * Copyright (c) 2012 Mia-Software.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
- * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
- */
-package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.jar.Manifest;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.plugin.EcorePlugin;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.osgi.util.ManifestElement;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Activator;
-import org.eclipse.papyrus.emf.facet.util.core.Logger;
-import org.eclipse.papyrus.emf.facet.util.core.internal.JavaUtils;
-import org.eclipse.papyrus.emf.facet.util.pde.core.internal.exported.PluginUtils;
-
-public final class JdtUtils {
-
- private JdtUtils() {
- // Must no be used
- }
-
- public static ICompilationUnit createJavaClass(
- final EClassifier returnTypeClass,
- final boolean multiValues, final EClassifier scope,
- final IPackageFragment packageFragment,
- final IPackageFragmentRoot root,
- final String typeName, final String cuName)
- throws JavaModelException {
- IPackageFragment packgeFragment2;
- if (packageFragment == null) {
- packgeFragment2 = root.getPackageFragment(""); //$NON-NLS-1$
- } else {
- packgeFragment2 = packageFragment;
- }
- final String packageName = packgeFragment2.getElementName();
- if (!packgeFragment2.exists()) {
- packgeFragment2 = root.createPackageFragment(packageName, true,
- new NullProgressMonitor());
- }
- final StringBuilder contents = new StringBuilder();
- createJavaClassContents(contents, typeName, packageName,
- returnTypeClass, multiValues, scope);
- return packgeFragment2.createCompilationUnit(cuName,
- contents.toString(),
- false, new NullProgressMonitor());
- }
-
- private static void createJavaClassContents(final StringBuilder contents,
- final String name, final String packageName,
- final EClassifier returnTypeClass, final boolean multiValues,
- final EClassifier scope) {
- if (packageName.length() > 0) {
- contents.append("package "); //$NON-NLS-1$
- contents.append(packageName);
- contents.append(";\n\n"); //$NON-NLS-1$
- }
- boolean importCollection = false;
-
- String returnType;
- String shortReturnType;
- if (returnTypeClass == null) {
- returnType = "java.lang.Object"; //$NON-NLS-1$
- shortReturnType = "Object"; //$NON-NLS-1$
- } else {
- returnType = returnTypeClass.getInstanceClassName();
- returnType = JavaUtils.objectType(returnType);
- final int lastDotPos = returnType.lastIndexOf('.');
- if (multiValues) {
- importCollection = true;
- shortReturnType = "Collection<" + returnType.substring(lastDotPos + 1) + ">"; //$NON-NLS-1$//$NON-NLS-2$
- } else {
- shortReturnType = returnType.substring(lastDotPos + 1);
- }
- }
-
- // EList<EClass> scope = modelQuery.getScope();
- String scopeType;
- String shortScopeType;
- // if (scope != null && scope.size() == 1) {
- if (scope == null) {
- scopeType = "org.eclipse.emf.ecore.EObject"; //$NON-NLS-1$
- shortScopeType = "EObject"; //$NON-NLS-1$
- } else {
- scopeType = scope.getInstanceClassName();
- scopeType = JavaUtils.objectType(scopeType);
- shortScopeType = scopeType
- .substring(scopeType.lastIndexOf('.') + 1);
- }
-
- if (importCollection) {
- contents.append("import java.util.Collection;\n"); //$NON-NLS-1$
- }
- if (mustImport(returnType)) {
- contents.append("import " + returnType + ";\n"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (!returnType.equals(scopeType) && mustImport(scopeType)) {
- contents.append("import " + scopeType + ";\n"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- contents.append("import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager;\n"); //$NON-NLS-1$
- contents.append("import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException;\n"); //$NON-NLS-1$
- contents.append("import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;\n"); //$NON-NLS-1$
- contents.append("import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;\n"); //$NON-NLS-1$
- contents.append("\n"); //$NON-NLS-1$
- contents.append("public class " + name + " implements IJavaQuery2<" + shortScopeType + ", " + shortReturnType + "> {\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- contents.append(" public " + shortReturnType + " evaluate(final " + shortScopeType + " context, \n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- contents.append(" final IParameterValueList2 parameterValues,\n"); //$NON-NLS-1$
- contents.append(" final IFacetManager facetManager)\n"); //$NON-NLS-1$
- contents.append(" throws DerivedTypedElementException {\n"); //$NON-NLS-1$
- contents.append(" \n"); //$NON-NLS-1$
- contents.append(" return null;\n"); //$NON-NLS-1$
- contents.append(" }\n"); //$NON-NLS-1$
- contents.append("}\n"); //$NON-NLS-1$
- }
-
- private static boolean mustImport(final String type) {
- return type.contains(".") && !type.startsWith("java.lang."); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Setup the given project's Manifest so that metamodels referenced by the
- * query's <code>returnType</code> and <code>scope</code> are available on
- * the classpath.
- */
- public static void setupProject(final IProject project,
- final EClassifier returnType, final EClassifier scope) {
- try {
- final String[] requiredBundles = findRequiredBundles(returnType,
- scope);
- // start with all and then remove those already present
- final List<String> missingBundles = new ArrayList<String>();
- for (final String requiredBundle : requiredBundles) {
- missingBundles.add(requiredBundle);
- }
- missingBundles.add("org.eclipse.papyrus.emf.facet.efacet.core"); //$NON-NLS-1$
- missingBundles.add("org.eclipse.papyrus.emf.facet.query.java.core"); //$NON-NLS-1$
-
- PluginUtils.configureAsPluginProject(project);
- final IFile manifestResource = (IFile) project.findMember(new Path("/META-INF/MANIFEST.MF")); //$NON-NLS-1$
- manifestResource.refreshLocal(IResource.DEPTH_ONE,
- new NullProgressMonitor());
- final InputStream contents = manifestResource.getContents();
- final Manifest manifest = new Manifest(contents);
- final String requires = manifest.getMainAttributes().getValue("Require-Bundle"); //$NON-NLS-1$
- if (requires != null) {
- final ManifestElement[] manifestElements = ManifestElement
- .parseHeader("Require-Bundle", requires); //$NON-NLS-1$
- for (final ManifestElement manifestElement : manifestElements) {
- // make sure it won't be duplicated
- missingBundles.remove(manifestElement.getValue());
- }
- }
-
- final StringBuilder newRequires = new StringBuilder();
- if (requires != null) {
- newRequires.append(requires);
- }
- for (int i = 0; i < missingBundles.size(); i++) {
- final String missingBundle = missingBundles.get(i);
- if ((i != 0) || (requires != null)) {
- newRequires.append(","); //$NON-NLS-1$
- }
- newRequires.append(missingBundle);
- }
-
- manifest.getMainAttributes().putValue("Require-Bundle", newRequires.toString()); //$NON-NLS-1$
-
- final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- manifest.write(outputStream);
- final ByteArrayInputStream inputStream = new ByteArrayInputStream(
- outputStream.toByteArray());
- manifestResource.setContents(inputStream, true, true,
- new NullProgressMonitor());
- } catch (final Exception e) {
- Logger.logError(e, Activator.getDefault());
- }
- }
-
- /**
- * Find the bundles containing the implementations of the metamodels
- * referenced by the given classifiers.
- */
- private static String[] findRequiredBundles(final EClassifier returnType,
- final EClassifier scope) {
- final Set<String> requiredBundles = new HashSet<String>();
- final Set<EPackage> requiredEPackages = new HashSet<EPackage>();
- if (returnType != null) {
- requiredEPackages.add(returnType.getEPackage());
- }
- if (scope != null) {
- requiredEPackages.add(scope.getEPackage());
- }
-
- final Map<String, URI> genModelLocMap = EcorePlugin
- .getEPackageNsURIToGenModelLocationMap();
-
- for (final EPackage ePackage : requiredEPackages) {
- try {
- final URI genModelURI = genModelLocMap.get(ePackage.getNsURI());
- if (genModelURI == null) {
- Logger.logWarning(
- "Couldn't add the metamodel implementation plug-in" //$NON-NLS-1$
- + " to the dependencies automatically because" //$NON-NLS-1$
- + " the corresponding genmodel couldn't be found: " //$NON-NLS-1$
- + ePackage.getNsURI(),
- Activator.getDefault());
- } else {
- final ResourceSet resourceSet = createResource();
- final Resource resource = resourceSet
- .createResource(genModelURI);
- resource.load(Collections.emptyMap());
- final GenModel genModel = (GenModel) resource.getContents()
- .get(0);
- final String modelPluginID = genModel.getModelPluginID();
- if (modelPluginID != null) {
- requiredBundles.add(modelPluginID);
- }
- }
- } catch (final Exception e) {
- Logger.logError(e, Activator.getDefault());
- }
- }
- return requiredBundles.toArray(new String[requiredBundles.size()]);
- }
-
- private static ResourceSetImpl createResource() {
- return new ResourceSetImpl();
- }
-}
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.Manifest;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.osgi.util.ManifestElement;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Activator;
+import org.eclipse.papyrus.emf.facet.util.core.Logger;
+import org.eclipse.papyrus.emf.facet.util.core.internal.JavaUtils;
+import org.eclipse.papyrus.emf.facet.util.pde.core.internal.exported.PluginUtils;
+
+public final class JdtUtils {
+
+ private JdtUtils() {
+ // Must no be used
+ }
+
+ public static ICompilationUnit createJavaClass(
+ final EClassifier returnTypeClass,
+ final boolean multiValues, final EClassifier scope,
+ final IPackageFragment packageFragment,
+ final IPackageFragmentRoot root,
+ final String typeName, final String cuName)
+ throws JavaModelException {
+ IPackageFragment packgeFragment2;
+ if (packageFragment == null) {
+ packgeFragment2 = root.getPackageFragment(""); //$NON-NLS-1$
+ } else {
+ packgeFragment2 = packageFragment;
+ }
+ final String packageName = packgeFragment2.getElementName();
+ if (!packgeFragment2.exists()) {
+ packgeFragment2 = root.createPackageFragment(packageName, true,
+ new NullProgressMonitor());
+ }
+ final StringBuilder contents = new StringBuilder();
+ createJavaClassContents(contents, typeName, packageName,
+ returnTypeClass, multiValues, scope);
+ return packgeFragment2.createCompilationUnit(cuName,
+ contents.toString(),
+ false, new NullProgressMonitor());
+ }
+
+ private static void createJavaClassContents(final StringBuilder contents,
+ final String name, final String packageName,
+ final EClassifier returnTypeClass, final boolean multiValues,
+ final EClassifier scope) {
+ if (packageName.length() > 0) {
+ contents.append("package "); //$NON-NLS-1$
+ contents.append(packageName);
+ contents.append(";\n\n"); //$NON-NLS-1$
+ }
+ boolean importCollection = false;
+
+ String returnType;
+ String shortReturnType;
+ if (returnTypeClass == null) {
+ returnType = "java.lang.Object"; //$NON-NLS-1$
+ shortReturnType = "Object"; //$NON-NLS-1$
+ } else {
+ returnType = returnTypeClass.getInstanceClassName();
+ returnType = JavaUtils.objectType(returnType);
+ final int lastDotPos = returnType.lastIndexOf('.');
+ if (multiValues) {
+ importCollection = true;
+ shortReturnType = "Collection<" + returnType.substring(lastDotPos + 1) + ">"; //$NON-NLS-1$//$NON-NLS-2$
+ } else {
+ shortReturnType = returnType.substring(lastDotPos + 1);
+ }
+ }
+
+ // EList<EClass> scope = modelQuery.getScope();
+ String scopeType;
+ String shortScopeType;
+ // if (scope != null && scope.size() == 1) {
+ if (scope == null) {
+ scopeType = "org.eclipse.emf.ecore.EObject"; //$NON-NLS-1$
+ shortScopeType = "EObject"; //$NON-NLS-1$
+ } else {
+ scopeType = scope.getInstanceClassName();
+ scopeType = JavaUtils.objectType(scopeType);
+ shortScopeType = scopeType
+ .substring(scopeType.lastIndexOf('.') + 1);
+ }
+
+ if (importCollection) {
+ contents.append("import java.util.Collection;\n"); //$NON-NLS-1$
+ }
+ if (mustImport(returnType)) {
+ contents.append("import " + returnType + ";\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if (!returnType.equals(scopeType) && mustImport(scopeType)) {
+ contents.append("import " + scopeType + ";\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ contents.append("import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager;\n"); //$NON-NLS-1$
+ contents.append("import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException;\n"); //$NON-NLS-1$
+ contents.append("import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;\n"); //$NON-NLS-1$
+ contents.append("import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;\n"); //$NON-NLS-1$
+ contents.append("\n"); //$NON-NLS-1$
+ contents.append("public class " + name + " implements IJavaQuery2<" + shortScopeType + ", " + shortReturnType + "> {\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ contents.append(" public " + shortReturnType + " evaluate(final " + shortScopeType + " context, \n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ contents.append(" final IParameterValueList2 parameterValues,\n"); //$NON-NLS-1$
+ contents.append(" final IFacetManager facetManager)\n"); //$NON-NLS-1$
+ contents.append(" throws DerivedTypedElementException {\n"); //$NON-NLS-1$
+ contents.append(" \n"); //$NON-NLS-1$
+ contents.append(" return null;\n"); //$NON-NLS-1$
+ contents.append(" }\n"); //$NON-NLS-1$
+ contents.append("}\n"); //$NON-NLS-1$
+ }
+
+ private static boolean mustImport(final String type) {
+ return type.contains(".") && !type.startsWith("java.lang."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Setup the given project's Manifest so that metamodels referenced by the
+ * query's <code>returnType</code> and <code>scope</code> are available on
+ * the classpath.
+ */
+ public static void setupProject(final IProject project,
+ final EClassifier returnType, final EClassifier scope) {
+ try {
+ final String[] requiredBundles = findRequiredBundles(returnType,
+ scope);
+ // start with all and then remove those already present
+ final List<String> missingBundles = new ArrayList<String>();
+ for (final String requiredBundle : requiredBundles) {
+ missingBundles.add(requiredBundle);
+ }
+ missingBundles.add("org.eclipse.papyrus.emf.facet.efacet.core"); //$NON-NLS-1$
+ missingBundles.add("org.eclipse.papyrus.emf.facet.query.java.core"); //$NON-NLS-1$
+
+ PluginUtils.configureAsPluginProject(project);
+ final IFile manifestResource = (IFile) project.findMember(new Path("/META-INF/MANIFEST.MF")); //$NON-NLS-1$
+ manifestResource.refreshLocal(IResource.DEPTH_ONE,
+ new NullProgressMonitor());
+ final InputStream contents = manifestResource.getContents();
+ final Manifest manifest = new Manifest(contents);
+ final String requires = manifest.getMainAttributes().getValue("Require-Bundle"); //$NON-NLS-1$
+ if (requires != null) {
+ final ManifestElement[] manifestElements = ManifestElement
+ .parseHeader("Require-Bundle", requires); //$NON-NLS-1$
+ for (final ManifestElement manifestElement : manifestElements) {
+ // make sure it won't be duplicated
+ missingBundles.remove(manifestElement.getValue());
+ }
+ }
+
+ final StringBuilder newRequires = new StringBuilder();
+ if (requires != null) {
+ newRequires.append(requires);
+ }
+ for (int i = 0; i < missingBundles.size(); i++) {
+ final String missingBundle = missingBundles.get(i);
+ if ((i != 0) || (requires != null)) {
+ newRequires.append(","); //$NON-NLS-1$
+ }
+ newRequires.append(missingBundle);
+ }
+
+ manifest.getMainAttributes().putValue("Require-Bundle", newRequires.toString()); //$NON-NLS-1$
+
+ final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ manifest.write(outputStream);
+ final ByteArrayInputStream inputStream = new ByteArrayInputStream(
+ outputStream.toByteArray());
+ manifestResource.setContents(inputStream, true, true,
+ new NullProgressMonitor());
+ } catch (final Exception e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+
+ /**
+ * Find the bundles containing the implementations of the metamodels
+ * referenced by the given classifiers.
+ */
+ private static String[] findRequiredBundles(final EClassifier returnType,
+ final EClassifier scope) {
+ final Set<String> requiredBundles = new HashSet<String>();
+ final Set<EPackage> requiredEPackages = new HashSet<EPackage>();
+ if (returnType != null) {
+ requiredEPackages.add(returnType.getEPackage());
+ }
+ if (scope != null) {
+ requiredEPackages.add(scope.getEPackage());
+ }
+
+ final Map<String, URI> genModelLocMap = EcorePlugin
+ .getEPackageNsURIToGenModelLocationMap();
+
+ for (final EPackage ePackage : requiredEPackages) {
+ try {
+ final URI genModelURI = genModelLocMap.get(ePackage.getNsURI());
+ if (genModelURI == null) {
+ Logger.logWarning(
+ "Couldn't add the metamodel implementation plug-in" //$NON-NLS-1$
+ + " to the dependencies automatically because" //$NON-NLS-1$
+ + " the corresponding genmodel couldn't be found: " //$NON-NLS-1$
+ + ePackage.getNsURI(),
+ Activator.getDefault());
+ } else {
+ final ResourceSet resourceSet = createResource();
+ final Resource resource = resourceSet
+ .createResource(genModelURI);
+ resource.load(Collections.emptyMap());
+ final GenModel genModel = (GenModel) resource.getContents()
+ .get(0);
+ final String modelPluginID = genModel.getModelPluginID();
+ if (modelPluginID != null) {
+ requiredBundles.add(modelPluginID);
+ }
+ }
+ } catch (final Exception e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+ return requiredBundles.toArray(new String[requiredBundles.size()]);
+ }
+
+ private static ResourceSetImpl createResource() {
+ return new ResourceSetImpl();
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/SelectOrCreateJavaClassWizard.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/SelectOrCreateJavaClassWizard.java
index 5674e9206f6..a15fcf5d7c2 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/SelectOrCreateJavaClassWizard.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/SelectOrCreateJavaClassWizard.java
@@ -1,177 +1,177 @@
-/*******************************************************************************
- * Copyright (c) 2010 Mia-Software.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Gregoire Dupe (Mia-Software)
- * Nicolas Bros (Mia-Software)
- * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
- * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
- *******************************************************************************/
-package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase;
-import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.exported.IQueryContext;
-import org.eclipse.papyrus.emf.facet.query.java.core.internal.exceptions.ClassAlreadyExistsException;
-import org.eclipse.papyrus.emf.facet.query.java.core.internal.exceptions.ResourceURIExpectedException;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Activator;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Messages;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.page.CreateQueryClassWizardPage;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.page.SelectJavaClassWizardPage;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.page.SelectOrCreateJavaClassWizardPage;
-import org.eclipse.papyrus.emf.facet.util.core.Logger;
-import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.dialog.IDialogCallback;
-import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.wizard.IExtendedWizard;
-
-// Copied from org.eclipse.papyrus.emf.facet.query.java.ui.internal.wizard.SelectOrCreateJavaClassWizard
-public class SelectOrCreateJavaClassWizard extends Wizard implements
- IExtendedWizard {
-
-
- private final WizardDialog dialog;
- private CreateQueryClassWizardPage createClassPage;
- private SelectOrCreateJavaClassWizardPage firstPage;
-
- private final IDialogCallback<String> callBack;
- private SelectJavaClassWizardPage selectClassPage;
- private final IQueryContext queryContext;
-
- public SelectOrCreateJavaClassWizard(final IQueryContext queryContext,
- final IDialogCallback<String> callBack)
- throws ClassAlreadyExistsException, ResourceURIExpectedException,
- JavaModelException {
- super();
- this.queryContext = queryContext;
- this.callBack = callBack;
- this.dialog = new WizardDialog(getShell(), this);
- setWindowTitle(Messages.Choose_an_operation);
-
- // check that the resource is from a platform URI
- final Resource resource = queryContext.getResource();
- final URI uri = resource.getURI();
- if (!uri.isPlatformResource()) {
- throw new ResourceURIExpectedException();
- }
- // check that the class doesn't already exist
- final String projectName = uri.segment(1);
- final IWorkspace workspace = ResourcesPlugin.getWorkspace();
- final IProject project = workspace.getRoot().getProject(projectName);
- final IJavaProject javaProject = JavaCore.create(project);
- final StringBuffer implClassName = new StringBuffer(
- this.queryContext.getDerivedTypedElementName());
- final EObject intermediate = this.queryContext.getIntermediateEObject();
- if (intermediate instanceof ETypedElementCase) {
- final ETypedElementCase eTECase = (ETypedElementCase) intermediate;
- if (eTECase.getCase() != null) {
- implClassName.append(eTECase.getCase().getName());
- }
- }
- implClassName.append("Query"); //$NON-NLS-1$
- if (javaProject.findType(implClassName.toString()) != null) {
- throw new ClassAlreadyExistsException();
- }
- }
-
- @Override
- public void addPages() {
- this.firstPage = new SelectOrCreateJavaClassWizardPage();
- addPage(this.firstPage);
- this.createClassPage = new CreateQueryClassWizardPage(
- this.queryContext);
- addPage(this.createClassPage);
- this.selectClassPage = new SelectJavaClassWizardPage();
- addPage(this.selectClassPage);
- }
-
- private String createJavaClass() {
- return this.createClassPage.apply(this.queryContext.getReturnType(),
- this.queryContext.getUpperBound() > 1,
- this.queryContext.getExtendedEClass());
- }
-
- @Override
- public boolean canFinish() {
- return getContainer().getCurrentPage().isPageComplete();
- }
-
- @Override
- public boolean performFinish() {
- return finish();
- }
-
- @Override
- public int open() {
- return this.dialog.open();
- }
-
- @Override
- public IWizardPage getCurrentPage() {
- return getContainer().getCurrentPage();
- }
-
- @Override
- public IWizardPage next() {
- final IWizardPage nextPage = getNextPage(this.getCurrentPage());
- this.dialog.showPage(nextPage);
- return nextPage;
- }
-
- @Override
- public IWizardPage previous() {
- final IWizardPage previousPage = getPreviousPage(this.getCurrentPage());
- this.dialog.showPage(previousPage);
- return previousPage;
- }
-
- @Override
- public boolean finish() {
- boolean result = true;
- try {
- if (getContainer().getCurrentPage() == this.createClassPage) {
- final String classQName = createJavaClass();
- this.callBack.committed(classQName);
- } else if (getContainer().getCurrentPage() == this.selectClassPage) {
- this.callBack.committed(this.selectClassPage.getResult()
- .toString());
- }
- } catch (final Exception e) {
- Logger.logError(e, Activator.getDefault());
- result = false;
- }
- return result;
- }
-
- @Override
- public boolean performCancel() {
- return true;
- }
-
- @Override
- public IWizardPage getNextPage(final IWizardPage page) {
- IWizardPage result = null;
- if (page == this.firstPage) {
- if (this.firstPage.isSelect()) {
- result = this.selectClassPage;
- } else {
- result = this.createClassPage;
- }
- }
- return result;
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 Mia-Software.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Gregoire Dupe (Mia-Software)
+ * Nicolas Bros (Mia-Software)
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ *******************************************************************************/
+package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase;
+import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.exported.IQueryContext;
+import org.eclipse.papyrus.emf.facet.query.java.core.internal.exceptions.ClassAlreadyExistsException;
+import org.eclipse.papyrus.emf.facet.query.java.core.internal.exceptions.ResourceURIExpectedException;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Activator;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Messages;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.page.CreateQueryClassWizardPage;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.page.SelectJavaClassWizardPage;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.page.SelectOrCreateJavaClassWizardPage;
+import org.eclipse.papyrus.emf.facet.util.core.Logger;
+import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.dialog.IDialogCallback;
+import org.eclipse.papyrus.emf.facet.util.ui.internal.exported.wizard.IExtendedWizard;
+
+// Copied from org.eclipse.papyrus.emf.facet.query.java.ui.internal.wizard.SelectOrCreateJavaClassWizard
+public class SelectOrCreateJavaClassWizard extends Wizard implements
+ IExtendedWizard {
+
+
+ private final WizardDialog dialog;
+ private CreateQueryClassWizardPage createClassPage;
+ private SelectOrCreateJavaClassWizardPage firstPage;
+
+ private final IDialogCallback<String> callBack;
+ private SelectJavaClassWizardPage selectClassPage;
+ private final IQueryContext queryContext;
+
+ public SelectOrCreateJavaClassWizard(final IQueryContext queryContext,
+ final IDialogCallback<String> callBack)
+ throws ClassAlreadyExistsException, ResourceURIExpectedException,
+ JavaModelException {
+ super();
+ this.queryContext = queryContext;
+ this.callBack = callBack;
+ this.dialog = new WizardDialog(getShell(), this);
+ setWindowTitle(Messages.Choose_an_operation);
+
+ // check that the resource is from a platform URI
+ final Resource resource = queryContext.getResource();
+ final URI uri = resource.getURI();
+ if (!uri.isPlatformResource()) {
+ throw new ResourceURIExpectedException();
+ }
+ // check that the class doesn't already exist
+ final String projectName = uri.segment(1);
+ final IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ final IProject project = workspace.getRoot().getProject(projectName);
+ final IJavaProject javaProject = JavaCore.create(project);
+ final StringBuffer implClassName = new StringBuffer(
+ this.queryContext.getDerivedTypedElementName());
+ final EObject intermediate = this.queryContext.getIntermediateEObject();
+ if (intermediate instanceof ETypedElementCase) {
+ final ETypedElementCase eTECase = (ETypedElementCase) intermediate;
+ if (eTECase.getCase() != null) {
+ implClassName.append(eTECase.getCase().getName());
+ }
+ }
+ implClassName.append("Query"); //$NON-NLS-1$
+ if (javaProject.findType(implClassName.toString()) != null) {
+ throw new ClassAlreadyExistsException();
+ }
+ }
+
+ @Override
+ public void addPages() {
+ this.firstPage = new SelectOrCreateJavaClassWizardPage();
+ addPage(this.firstPage);
+ this.createClassPage = new CreateQueryClassWizardPage(
+ this.queryContext);
+ addPage(this.createClassPage);
+ this.selectClassPage = new SelectJavaClassWizardPage();
+ addPage(this.selectClassPage);
+ }
+
+ private String createJavaClass() {
+ return this.createClassPage.apply(this.queryContext.getReturnType(),
+ this.queryContext.getUpperBound() > 1,
+ this.queryContext.getExtendedEClass());
+ }
+
+ @Override
+ public boolean canFinish() {
+ return getContainer().getCurrentPage().isPageComplete();
+ }
+
+ @Override
+ public boolean performFinish() {
+ return finish();
+ }
+
+ @Override
+ public int open() {
+ return this.dialog.open();
+ }
+
+ @Override
+ public IWizardPage getCurrentPage() {
+ return getContainer().getCurrentPage();
+ }
+
+ @Override
+ public IWizardPage next() {
+ final IWizardPage nextPage = getNextPage(this.getCurrentPage());
+ this.dialog.showPage(nextPage);
+ return nextPage;
+ }
+
+ @Override
+ public IWizardPage previous() {
+ final IWizardPage previousPage = getPreviousPage(this.getCurrentPage());
+ this.dialog.showPage(previousPage);
+ return previousPage;
+ }
+
+ @Override
+ public boolean finish() {
+ boolean result = true;
+ try {
+ if (getContainer().getCurrentPage() == this.createClassPage) {
+ final String classQName = createJavaClass();
+ this.callBack.committed(classQName);
+ } else if (getContainer().getCurrentPage() == this.selectClassPage) {
+ this.callBack.committed(this.selectClassPage.getResult()
+ .toString());
+ }
+ } catch (final Exception e) {
+ Logger.logError(e, Activator.getDefault());
+ result = false;
+ }
+ return result;
+ }
+
+ @Override
+ public boolean performCancel() {
+ return true;
+ }
+
+ @Override
+ public IWizardPage getNextPage(final IWizardPage page) {
+ IWizardPage result = null;
+ if (page == this.firstPage) {
+ if (this.firstPage.isSelect()) {
+ result = this.selectClassPage;
+ } else {
+ result = this.createClassPage;
+ }
+ }
+ return result;
+
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/page/CreateQueryClassWizardPage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/page/CreateQueryClassWizardPage.java
index bfdf501128a..2949ad68ebb 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/page/CreateQueryClassWizardPage.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/page/CreateQueryClassWizardPage.java
@@ -1,127 +1,127 @@
-/*******************************************************************************
- * Copyright (c) 2010 Mia-Software.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Gregoire Dupe (Mia-Software)
- * Nicolas Bros (Mia-Software)
- * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
- * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
- *******************************************************************************/
-package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.page;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase;
-import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.exported.IQueryContext;
-import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Activator;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Messages;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.JavaQueryUtils;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.JdtUtils;
-import org.eclipse.papyrus.emf.facet.util.core.Logger;
-import org.eclipse.papyrus.emf.facet.util.core.internal.exported.StringUtils;
-
-// Copied from org.eclipse.papyrus.emf.facet.query.java.ui.internal.wizard.page.NewQueryClassWizardPage
-public class CreateQueryClassWizardPage extends NewClassWizardPage {
-
- // This class has been copied from
- // org.eclipse.papyrus.emf.facet.infra.query.ui.wizards.NewQueryClassWizardPage
-
- public CreateQueryClassWizardPage(final IQueryContext queryContainer) {
- super();
- final IJavaProject javaProject = JavaCore.create(queryContainer
- .getProject());
- final List<String> interfaceList = new ArrayList<String>();
- interfaceList.add(IJavaQuery2.class.getName());
- setSuperInterfaces(interfaceList, false);
- final String packageName = JavaQueryUtils.getDefaultPackageName(
- queryContainer,
- javaProject);
- final String typeName = getClassName(queryContainer);
- setTypeName(typeName, true);
- selectPackage(javaProject, packageName);
- setModifiers(this.F_PUBLIC, false);
- setSuperClass("", false); //$NON-NLS-1$
- setEnclosingTypeSelection(false, false);
- setAddComments(false, false);
- }
-
- private static String getClassName(final IQueryContext queryContext) {
- final StringBuffer result = new StringBuffer();
- final EObject intermediate = queryContext.getIntermediateEObject();
- if (intermediate instanceof ETypedElementCase) {
- final ETypedElementCase eteCase = (ETypedElementCase) intermediate;
- String caseLabel = ""; //$NON-NLS-1$
- if (eteCase.getCase() != null) {
- caseLabel = eteCase.getCase().getName();
- }
- result.append(StringUtils.firstLetterToUpperCase(caseLabel));
- }
- result.append(StringUtils.firstLetterToUpperCase(queryContext
- .getDerivedTypedElementName()));
- result.append("Query"); //$NON-NLS-1$
- return result.toString();
- }
-
- private void selectPackage(final IJavaProject javaProject,
- final String packageName) {
- try {
- for (final IPackageFragmentRoot packageFragmentRootToTest : javaProject
- .getPackageFragmentRoots()) {
- if (packageFragmentRootToTest.getKind() == IPackageFragmentRoot.K_SOURCE) {
- final IPackageFragmentRoot pkgFragmentRoot = packageFragmentRootToTest;
- setPackageFragmentRoot(pkgFragmentRoot, false);
- final IPackageFragment packageFragment = pkgFragmentRoot
- .getPackageFragment(packageName);
- setPackageFragment(packageFragment, true);
- break;
- }
- }
- } catch (final JavaModelException e1) {
- Logger.logError(e1, Activator.getDefault());
- }
- }
-
- public String apply(final EClassifier returnType,
- final boolean multiValues,
- final EClassifier scope) {
- String result = ""; //$NON-NLS-1$
- try {
- final IPackageFragmentRoot root = getPackageFragmentRoot();
- final IPackageFragment packageFragment = getPackageFragment();
- final String typeName = getTypeName();
- final String cuName = getCompilationUnitName(typeName);
- final ICompilationUnit javaClass = JdtUtils.createJavaClass(
- returnType, multiValues, scope, packageFragment, root,
- typeName, cuName);
- final IProject project = javaClass.getCorrespondingResource()
- .getProject();
- JdtUtils.setupProject(project, returnType, scope);
- result = packageFragment.getElementName() + '.' + typeName;
- } catch (final Exception e) {
- Logger.logError(e, Activator.getDefault());
- MessageDialog
- .openError(
- getShell(),
- Messages.NewQueryClassWizardPage_Failed_to_create_java_class,
- Messages.NewQueryClassWizardPage_Failed_to_create_query_implementation);
- }
- return result;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 Mia-Software.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Gregoire Dupe (Mia-Software)
+ * Nicolas Bros (Mia-Software)
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ *******************************************************************************/
+package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.page;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase;
+import org.eclipse.papyrus.emf.facet.efacet.sdk.ui.internal.exported.IQueryContext;
+import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Activator;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Messages;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.JavaQueryUtils;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.JdtUtils;
+import org.eclipse.papyrus.emf.facet.util.core.Logger;
+import org.eclipse.papyrus.emf.facet.util.core.internal.exported.StringUtils;
+
+// Copied from org.eclipse.papyrus.emf.facet.query.java.ui.internal.wizard.page.NewQueryClassWizardPage
+public class CreateQueryClassWizardPage extends NewClassWizardPage {
+
+ // This class has been copied from
+ // org.eclipse.papyrus.emf.facet.infra.query.ui.wizards.NewQueryClassWizardPage
+
+ public CreateQueryClassWizardPage(final IQueryContext queryContainer) {
+ super();
+ final IJavaProject javaProject = JavaCore.create(queryContainer
+ .getProject());
+ final List<String> interfaceList = new ArrayList<String>();
+ interfaceList.add(IJavaQuery2.class.getName());
+ setSuperInterfaces(interfaceList, false);
+ final String packageName = JavaQueryUtils.getDefaultPackageName(
+ queryContainer,
+ javaProject);
+ final String typeName = getClassName(queryContainer);
+ setTypeName(typeName, true);
+ selectPackage(javaProject, packageName);
+ setModifiers(this.F_PUBLIC, false);
+ setSuperClass("", false); //$NON-NLS-1$
+ setEnclosingTypeSelection(false, false);
+ setAddComments(false, false);
+ }
+
+ private static String getClassName(final IQueryContext queryContext) {
+ final StringBuffer result = new StringBuffer();
+ final EObject intermediate = queryContext.getIntermediateEObject();
+ if (intermediate instanceof ETypedElementCase) {
+ final ETypedElementCase eteCase = (ETypedElementCase) intermediate;
+ String caseLabel = ""; //$NON-NLS-1$
+ if (eteCase.getCase() != null) {
+ caseLabel = eteCase.getCase().getName();
+ }
+ result.append(StringUtils.firstLetterToUpperCase(caseLabel));
+ }
+ result.append(StringUtils.firstLetterToUpperCase(queryContext
+ .getDerivedTypedElementName()));
+ result.append("Query"); //$NON-NLS-1$
+ return result.toString();
+ }
+
+ private void selectPackage(final IJavaProject javaProject,
+ final String packageName) {
+ try {
+ for (final IPackageFragmentRoot packageFragmentRootToTest : javaProject
+ .getPackageFragmentRoots()) {
+ if (packageFragmentRootToTest.getKind() == IPackageFragmentRoot.K_SOURCE) {
+ final IPackageFragmentRoot pkgFragmentRoot = packageFragmentRootToTest;
+ setPackageFragmentRoot(pkgFragmentRoot, false);
+ final IPackageFragment packageFragment = pkgFragmentRoot
+ .getPackageFragment(packageName);
+ setPackageFragment(packageFragment, true);
+ break;
+ }
+ }
+ } catch (final JavaModelException e1) {
+ Logger.logError(e1, Activator.getDefault());
+ }
+ }
+
+ public String apply(final EClassifier returnType,
+ final boolean multiValues,
+ final EClassifier scope) {
+ String result = ""; //$NON-NLS-1$
+ try {
+ final IPackageFragmentRoot root = getPackageFragmentRoot();
+ final IPackageFragment packageFragment = getPackageFragment();
+ final String typeName = getTypeName();
+ final String cuName = getCompilationUnitName(typeName);
+ final ICompilationUnit javaClass = JdtUtils.createJavaClass(
+ returnType, multiValues, scope, packageFragment, root,
+ typeName, cuName);
+ final IProject project = javaClass.getCorrespondingResource()
+ .getProject();
+ JdtUtils.setupProject(project, returnType, scope);
+ result = packageFragment.getElementName() + '.' + typeName;
+ } catch (final Exception e) {
+ Logger.logError(e, Activator.getDefault());
+ MessageDialog
+ .openError(
+ getShell(),
+ Messages.NewQueryClassWizardPage_Failed_to_create_java_class,
+ Messages.NewQueryClassWizardPage_Failed_to_create_query_implementation);
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/page/SelectJavaClassWizardPage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/page/SelectJavaClassWizardPage.java
index e7ce1063060..01657f38c9b 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/page/SelectJavaClassWizardPage.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/page/SelectJavaClassWizardPage.java
@@ -1,120 +1,120 @@
-/**
- * Copyright (c) 2011 Mia-Software.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Nicolas Guyomar (Mia-Software) - Bug 349556 - EMF Facet Java Query wizard
- * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
- * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
- */
-package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.page;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Activator;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Messages;
-import org.eclipse.papyrus.emf.facet.util.core.Logger;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.SelectionDialog;
-
-// Copied from org.eclipse.papyrus.emf.facet.query.java.ui.internal.wizard.page.SelectOrCreateJavaClassWizardPage
-public class SelectJavaClassWizardPage extends WizardPage {
-
- private String result;
- private Text text;
-
- public SelectJavaClassWizardPage() {
- super("SelectJavaClass"); //$NON-NLS-1$
- setTitle(Messages.SelectJavaClassWizardPage_SelectAJavaClass);
- setDescription(Messages.SelectJavaClassWizardPage_SeclectAJavaClassLongDescription);
- }
-
- @Override
- public void createControl(final Composite parent) {
- final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- final Button dialogBtn = new Button(composite, SWT.PUSH);
- dialogBtn.setText("Open the class selection wizard..."); //$NON-NLS-1$
- final SelectionListener listener = new SelectionListener() {
- @Override
- public void widgetSelected(final SelectionEvent event) {
- SelectJavaClassWizardPage.this.openSelectionDialog();
- }
-
- @Override
- public void widgetDefaultSelected(final SelectionEvent event) {
- // Noting to do
- }
- };
- dialogBtn.addSelectionListener(listener);
- this.text = new Text(composite, SWT.BORDER);
- setControl(composite);
- setPageComplete(false);
- }
-
- protected void openSelectionDialog() {
- final Display display = Display.getDefault();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- final Shell shell = new Shell(display);
- SelectionDialog dialog;
- try {
- dialog = JavaUI.createTypeDialog(shell,
- new ProgressMonitorDialog(shell),
- SearchEngine.createWorkspaceScope(),
- IJavaElementSearchConstants.CONSIDER_CLASSES, false);
- dialog.open();
- final boolean cancelled = (dialog.getReturnCode() == Window.CANCEL);
- Object dilaogResult = null;
- if (!cancelled && dialog.getResult()[0] instanceof IType) {
- final IType type = (IType) dialog.getResult()[0];
- dilaogResult = type.getFullyQualifiedName();
- }
- SelectJavaClassWizardPage.this.dialogClosed(dilaogResult,
- cancelled);
- } catch (JavaModelException e) {
- Logger.logError(e, Activator.getDefault());
- SelectJavaClassWizardPage.this.dialogClosed(null, true);
- }
- }
- });
- }
-
- protected void dialogClosed(final Object dialogResult, final boolean cancelled) {
- if (cancelled) {
- this.getPreviousPage();
- } else {
- if (dialogResult != null && dialogResult.toString().length() > 0) {
- this.result = dialogResult.toString();
- this.text.setText(dialogResult.toString());
- setPageComplete(true);
- } else {
- setPageComplete(false);
- }
- }
- }
-
- public String getResult() {
- return this.result;
- }
-
-}
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nicolas Guyomar (Mia-Software) - Bug 349556 - EMF Facet Java Query wizard
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.page;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.ui.IJavaElementSearchConstants;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Activator;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Messages;
+import org.eclipse.papyrus.emf.facet.util.core.Logger;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+// Copied from org.eclipse.papyrus.emf.facet.query.java.ui.internal.wizard.page.SelectOrCreateJavaClassWizardPage
+public class SelectJavaClassWizardPage extends WizardPage {
+
+ private String result;
+ private Text text;
+
+ public SelectJavaClassWizardPage() {
+ super("SelectJavaClass"); //$NON-NLS-1$
+ setTitle(Messages.SelectJavaClassWizardPage_SelectAJavaClass);
+ setDescription(Messages.SelectJavaClassWizardPage_SeclectAJavaClassLongDescription);
+ }
+
+ @Override
+ public void createControl(final Composite parent) {
+ final Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ final Button dialogBtn = new Button(composite, SWT.PUSH);
+ dialogBtn.setText("Open the class selection wizard..."); //$NON-NLS-1$
+ final SelectionListener listener = new SelectionListener() {
+ @Override
+ public void widgetSelected(final SelectionEvent event) {
+ SelectJavaClassWizardPage.this.openSelectionDialog();
+ }
+
+ @Override
+ public void widgetDefaultSelected(final SelectionEvent event) {
+ // Noting to do
+ }
+ };
+ dialogBtn.addSelectionListener(listener);
+ this.text = new Text(composite, SWT.BORDER);
+ setControl(composite);
+ setPageComplete(false);
+ }
+
+ protected void openSelectionDialog() {
+ final Display display = Display.getDefault();
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ final Shell shell = new Shell(display);
+ SelectionDialog dialog;
+ try {
+ dialog = JavaUI.createTypeDialog(shell,
+ new ProgressMonitorDialog(shell),
+ SearchEngine.createWorkspaceScope(),
+ IJavaElementSearchConstants.CONSIDER_CLASSES, false);
+ dialog.open();
+ final boolean cancelled = (dialog.getReturnCode() == Window.CANCEL);
+ Object dilaogResult = null;
+ if (!cancelled && dialog.getResult()[0] instanceof IType) {
+ final IType type = (IType) dialog.getResult()[0];
+ dilaogResult = type.getFullyQualifiedName();
+ }
+ SelectJavaClassWizardPage.this.dialogClosed(dilaogResult,
+ cancelled);
+ } catch (JavaModelException e) {
+ Logger.logError(e, Activator.getDefault());
+ SelectJavaClassWizardPage.this.dialogClosed(null, true);
+ }
+ }
+ });
+ }
+
+ protected void dialogClosed(final Object dialogResult, final boolean cancelled) {
+ if (cancelled) {
+ this.getPreviousPage();
+ } else {
+ if (dialogResult != null && dialogResult.toString().length() > 0) {
+ this.result = dialogResult.toString();
+ this.text.setText(dialogResult.toString());
+ setPageComplete(true);
+ } else {
+ setPageComplete(false);
+ }
+ }
+ }
+
+ public String getResult() {
+ return this.result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/page/SelectOrCreateJavaClassWizardPage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/page/SelectOrCreateJavaClassWizardPage.java
index a96a87b9670..34a98dfbf89 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/page/SelectOrCreateJavaClassWizardPage.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.query.java.sdk.ui/src/org/eclipse/papyrus/emf/facet/query/java/sdk/ui/internal/wizard/page/SelectOrCreateJavaClassWizardPage.java
@@ -1,75 +1,75 @@
-/**
- * Copyright (c) 2011 Mia-Software.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Nicolas Guyomar (Mia-Software) - Bug 349556 - EMF Facet Java Query wizard
- * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
- * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
- */
-package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.page;
-
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Messages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-// Copied from org.eclipse.papyrus.emf.facet.query.java.ui.internal.wizard.page.SelectOrCreateJavaClassWizardPage
-public class SelectOrCreateJavaClassWizardPage extends WizardPage {
-
- private Button selectButton;
-
- private final SelectionListener selectionListener = new SelectionListener() {
- @Override
- public void widgetSelected(final SelectionEvent event) {
- onSelection();
- }
-
- @Override
- public void widgetDefaultSelected(final SelectionEvent event) {
- // Nothing
- }
- };
-
- public SelectOrCreateJavaClassWizardPage() {
- super("Whatever"); //$NON-NLS-1$
- setTitle(Messages.Choose_an_operation);
- setDescription(Messages.Choose_an_operation_desc);
- }
-
- @Override
- public void createControl(final Composite parent) {
- final Composite container = new Composite(parent, SWT.NONE);
- container.setLayout(new GridLayout(1, false));
- // Create the creation radio button
- final Button createButton = new Button(container, SWT.RADIO);
- createButton.setText(Messages.Create_new_java_class);
- createButton.addSelectionListener(this.selectionListener);
- // Create the creation radio button
- this.selectButton = new Button(container, SWT.RADIO);
- this.selectButton.setText(Messages.Select_existing_java_class);
- this.selectButton.addSelectionListener(this.selectionListener);
- setControl(container);
- }
-
- public boolean canFinish() {
- return this.selectButton.getSelection();
- }
-
-
- protected void onSelection() {
- getContainer().updateButtons();
- }
-
- public boolean isSelect() {
- return this.selectButton.getSelection();
- }
-}
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nicolas Guyomar (Mia-Software) - Bug 349556 - EMF Facet Java Query wizard
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.page;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+// Copied from org.eclipse.papyrus.emf.facet.query.java.ui.internal.wizard.page.SelectOrCreateJavaClassWizardPage
+public class SelectOrCreateJavaClassWizardPage extends WizardPage {
+
+ private Button selectButton;
+
+ private final SelectionListener selectionListener = new SelectionListener() {
+ @Override
+ public void widgetSelected(final SelectionEvent event) {
+ onSelection();
+ }
+
+ @Override
+ public void widgetDefaultSelected(final SelectionEvent event) {
+ // Nothing
+ }
+ };
+
+ public SelectOrCreateJavaClassWizardPage() {
+ super("Whatever"); //$NON-NLS-1$
+ setTitle(Messages.Choose_an_operation);
+ setDescription(Messages.Choose_an_operation_desc);
+ }
+
+ @Override
+ public void createControl(final Composite parent) {
+ final Composite container = new Composite(parent, SWT.NONE);
+ container.setLayout(new GridLayout(1, false));
+ // Create the creation radio button
+ final Button createButton = new Button(container, SWT.RADIO);
+ createButton.setText(Messages.Create_new_java_class);
+ createButton.addSelectionListener(this.selectionListener);
+ // Create the creation radio button
+ this.selectButton = new Button(container, SWT.RADIO);
+ this.selectButton.setText(Messages.Select_existing_java_class);
+ this.selectButton.addSelectionListener(this.selectionListener);
+ setControl(container);
+ }
+
+ public boolean canFinish() {
+ return this.selectButton.getSelection();
+ }
+
+
+ protected void onSelection() {
+ getContainer().updateButtons();
+ }
+
+ public boolean isSelect() {
+ return this.selectButton.getSelection();
+ }
+}

Back to the top