Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/Activator.java316
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IAdvancedEditorConfiguration.java62
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IModelGenerator.java84
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IPopupEditorConfiguration.java58
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditExecutableExtension.java58
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/EmbeddedEditorReconcilingStrategy.java76
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ErrorAnnotation.java218
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java376
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/GMFEmbeddedEditorActionDelegate.java282
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ILabelEditorDialog.java44
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/IPopupEditorHelper.java46
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java418
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/MultiReconciler.java248
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java590
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/IDirectEditorsIds.java68
15 files changed, 1472 insertions, 1472 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/Activator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/Activator.java
index 7deb6cb6b1a..b957dcae609 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/Activator.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/Activator.java
@@ -1,158 +1,158 @@
-/*******************************************************************************
- * Copyright (c) 2008 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:
- * CEA LIST - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.extensionpoints.editors;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.extensionpoints.editors";
-
- // The shared instance
- private static Activator plugin;
-
- /** Logging helper */
- public static LogHelper log;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- // register the login helper
- log = new LogHelper(plugin);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- log = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- /**
- * Returns an <code>org.eclipse.swt.graphics.Image</code> identified by its key.<BR>
- * By default, it returns a default image. This image is the image placed in the directory <em>resources/icons/default.gif</em>
- *
- * @param key
- * the key of the image
- * @return the Image
- */
- public static Image getImage(String key) {
- ImageRegistry registry = getDefault().getImageRegistry();
- Image image = registry.get(key);
- if (image == null) {
- ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, key);
- registry.put(key, desc);
- image = registry.get(key);
- }
- return image;
- }
-
- /**
- * Returns an <code>org.eclipse.swt.graphics.Image</code> identified by its key and its owning
- * plugin.<BR>
- *
- * @param pluginID
- * the plugin id where to retrieve the image
- * @param key
- * the key of the image
- * @return the Image
- */
- public static Image getImage(String pluginID, String key) {
- ImageRegistry registry = getDefault().getImageRegistry();
- Image image = registry.get(key);
- if (image == null) {
- ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(pluginID, key);
- registry.put(key, desc);
- image = registry.get(key);
- }
- return image;
- }
-
- /**
- * Log a message and an exception in the plugin's log.
- *
- * @param message
- * the message to log
- * @param e
- * the exception to log
- */
- public static void log(String message, Exception e) {
- getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.OK, message, e));
- }
-
- /**
- * Log a message in the plugin's log.
- *
- * @param message
- * the message to log
- */
- public static void log(String message) {
- getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.OK, message, null));
- }
-
- /**
- * Log a message in the plugin's log.
- *
- * @param message
- * the message to log
- */
- public static void log(Exception e) {
- getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.OK, e.getLocalizedMessage(), e));
- }
-
- /**
- * Log a message in the plugin's log.
- *
- * @param message
- * the message to log
- */
- public static void debug(String message) {
- getDefault().getLog().log(new Status(IStatus.INFO, Activator.PLUGIN_ID, IStatus.OK, message, null));
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2008 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:
+ * CEA LIST - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.extensionpoints.editors;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.extensionpoints.editors";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /** Logging helper */
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ // register the login helper
+ log = new LogHelper(plugin);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ log = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an <code>org.eclipse.swt.graphics.Image</code> identified by its key.<BR>
+ * By default, it returns a default image. This image is the image placed in the directory <em>resources/icons/default.gif</em>
+ *
+ * @param key
+ * the key of the image
+ * @return the Image
+ */
+ public static Image getImage(String key) {
+ ImageRegistry registry = getDefault().getImageRegistry();
+ Image image = registry.get(key);
+ if (image == null) {
+ ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, key);
+ registry.put(key, desc);
+ image = registry.get(key);
+ }
+ return image;
+ }
+
+ /**
+ * Returns an <code>org.eclipse.swt.graphics.Image</code> identified by its key and its owning
+ * plugin.<BR>
+ *
+ * @param pluginID
+ * the plugin id where to retrieve the image
+ * @param key
+ * the key of the image
+ * @return the Image
+ */
+ public static Image getImage(String pluginID, String key) {
+ ImageRegistry registry = getDefault().getImageRegistry();
+ Image image = registry.get(key);
+ if (image == null) {
+ ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(pluginID, key);
+ registry.put(key, desc);
+ image = registry.get(key);
+ }
+ return image;
+ }
+
+ /**
+ * Log a message and an exception in the plugin's log.
+ *
+ * @param message
+ * the message to log
+ * @param e
+ * the exception to log
+ */
+ public static void log(String message, Exception e) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.OK, message, e));
+ }
+
+ /**
+ * Log a message in the plugin's log.
+ *
+ * @param message
+ * the message to log
+ */
+ public static void log(String message) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.OK, message, null));
+ }
+
+ /**
+ * Log a message in the plugin's log.
+ *
+ * @param message
+ * the message to log
+ */
+ public static void log(Exception e) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.OK, e.getLocalizedMessage(), e));
+ }
+
+ /**
+ * Log a message in the plugin's log.
+ *
+ * @param message
+ * the message to log
+ */
+ public static void debug(String message) {
+ getDefault().getLog().log(new Status(IStatus.INFO, Activator.PLUGIN_ID, IStatus.OK, message, null));
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IAdvancedEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IAdvancedEditorConfiguration.java
index 690f6b7fdf2..1e04bceba77 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IAdvancedEditorConfiguration.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IAdvancedEditorConfiguration.java
@@ -1,31 +1,31 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.extensionpoints.editors.configuration;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Interface that should be implemented by advanced direct editors for Papyrus.
- */
-public interface IAdvancedEditorConfiguration extends IDirectEditorConfiguration {
-
- /**
- * Creates the dialog for this direct editor
- *
- * @return the dialog created
- */
- public Dialog createDialog(Shell shell, EObject objectToEdit, String textToEdit);
-
-}
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.extensionpoints.editors.configuration;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * Interface that should be implemented by advanced direct editors for Papyrus.
+ */
+public interface IAdvancedEditorConfiguration extends IDirectEditorConfiguration {
+
+ /**
+ * Creates the dialog for this direct editor
+ *
+ * @return the dialog created
+ */
+ public Dialog createDialog(Shell shell, EObject objectToEdit, String textToEdit);
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IModelGenerator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IModelGenerator.java
index c1e8897b35c..7849c97a4a4 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IModelGenerator.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IModelGenerator.java
@@ -1,42 +1,42 @@
-/*****************************************************************************
- * Copyright (c) 2008 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.extensionpoints.editors.configuration;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * Standard interface for classes in charge of model validation and modification from a text
- * representation of a UML element
- */
-public interface IModelGenerator {
-
- /**
- * validates the element, given its textual representation
- *
- * @param label
- * the label to validate
- * @return the {@link IStatus} corresponding to the validation
- */
- public IStatus validate(String label);
-
- /**
- * modifies the element, given its textual representation
- *
- * @param label
- * the label to validate
- * @return the {@link IStatus} corresponding to the validation
- */
- // @unused
- public IStatus modify(String label);
-}
+/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.extensionpoints.editors.configuration;
+
+import org.eclipse.core.runtime.IStatus;
+
+/**
+ * Standard interface for classes in charge of model validation and modification from a text
+ * representation of a UML element
+ */
+public interface IModelGenerator {
+
+ /**
+ * validates the element, given its textual representation
+ *
+ * @param label
+ * the label to validate
+ * @return the {@link IStatus} corresponding to the validation
+ */
+ public IStatus validate(String label);
+
+ /**
+ * modifies the element, given its textual representation
+ *
+ * @param label
+ * the label to validate
+ * @return the {@link IStatus} corresponding to the validation
+ */
+ // @unused
+ public IStatus modify(String label);
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IPopupEditorConfiguration.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IPopupEditorConfiguration.java
index 7e4b55c3b25..c3302935132 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IPopupEditorConfiguration.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/configuration/IPopupEditorConfiguration.java
@@ -1,29 +1,29 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * CEA LIST - initial API and implementation
- *****************************************************************************/
-
-package org.eclipse.papyrus.extensionpoints.editors.configuration;
-
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-
-/**
- * This interface can be used to create an IPopupEditorHelper, that can then be used to show the editor
- */
-public interface IPopupEditorConfiguration extends IDirectEditorConfiguration {
-
- /**
- * Should create an IPopupEditorHelper, that can then be used to show the editor
- *
- * It is expected that the type of the param editPart:Object is instanceof IGraphicalEditPart
- */
- IPopupEditorHelper createPopupEditorHelper(Object editPart);
-
-}
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * CEA LIST - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.extensionpoints.editors.configuration;
+
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+
+/**
+ * This interface can be used to create an IPopupEditorHelper, that can then be used to show the editor
+ */
+public interface IPopupEditorConfiguration extends IDirectEditorConfiguration {
+
+ /**
+ * Should create an IPopupEditorHelper, that can then be used to show the editor
+ *
+ * It is expected that the type of the param editPart:Object is instanceof IGraphicalEditPart
+ */
+ IPopupEditorHelper createPopupEditorHelper(Object editPart);
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditExecutableExtension.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditExecutableExtension.java
index 4e8e26f237d..1161520eb18 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditExecutableExtension.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/DirectEditExecutableExtension.java
@@ -1,29 +1,29 @@
-/*****************************************************************************
- * Copyright (c) 2008 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.extensionpoints.editors.ui;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExecutableExtension;
-
-//@unused
-public class DirectEditExecutableExtension implements IExecutableExtension {
-
- public DirectEditExecutableExtension() {
- }
-
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.extensionpoints.editors.ui;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
+
+//@unused
+public class DirectEditExecutableExtension implements IExecutableExtension {
+
+ public DirectEditExecutableExtension() {
+ }
+
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/EmbeddedEditorReconcilingStrategy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/EmbeddedEditorReconcilingStrategy.java
index c1f4a9ff14b..2ac54c7f837 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/EmbeddedEditorReconcilingStrategy.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/EmbeddedEditorReconcilingStrategy.java
@@ -1,38 +1,38 @@
-/*****************************************************************************
- * Copyright (c) 2008 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.extensionpoints.editors.ui;
-
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.ui.texteditor.spelling.SpellingReconcileStrategy;
-import org.eclipse.ui.texteditor.spelling.SpellingService;
-
-/**
- * Reconcile strategy used for spell checking and semantic verification
- */
-// @unused
-public class EmbeddedEditorReconcilingStrategy extends SpellingReconcileStrategy {
-
- /**
- * Creates a new EmbeddedEditorReconcilingStrategy.
- *
- * @param viewer
- * the source viewer containing the text to reconcile
- * @param spellingService
- * the service in charge of the spelling verification
- */
- public EmbeddedEditorReconcilingStrategy(ISourceViewer viewer, SpellingService spellingService) {
- super(viewer, spellingService);
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.extensionpoints.editors.ui;
+
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.ui.texteditor.spelling.SpellingReconcileStrategy;
+import org.eclipse.ui.texteditor.spelling.SpellingService;
+
+/**
+ * Reconcile strategy used for spell checking and semantic verification
+ */
+// @unused
+public class EmbeddedEditorReconcilingStrategy extends SpellingReconcileStrategy {
+
+ /**
+ * Creates a new EmbeddedEditorReconcilingStrategy.
+ *
+ * @param viewer
+ * the source viewer containing the text to reconcile
+ * @param spellingService
+ * the service in charge of the spelling verification
+ */
+ public EmbeddedEditorReconcilingStrategy(ISourceViewer viewer, SpellingService spellingService) {
+ super(viewer, spellingService);
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ErrorAnnotation.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ErrorAnnotation.java
index a60d6eddab5..fdc7f43094b 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ErrorAnnotation.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ErrorAnnotation.java
@@ -1,109 +1,109 @@
-/**
- *
- */
-package org.eclipse.papyrus.extensionpoints.editors.ui;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationAccessExtension;
-import org.eclipse.jface.text.source.IAnnotationPresentation;
-import org.eclipse.jface.text.source.ImageUtilities;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * Extended annotation class for error annotation in embedded editors
- */
-public class ErrorAnnotation extends Annotation implements IAnnotationPresentation {
-
- /**
- * Creates a new annotation with the given properties.
- *
- * @param type
- * the unique name of this annotation type
- * @param isPersistent
- * <code>true</code> if this annotation is persistent, <code>false</code> otherwise
- * @param text
- * the text associated with this annotation
- */
- public ErrorAnnotation(boolean isPersistent, String text) {
- super(TYPE, isPersistent, text);
- }
-
- /**
- * Creates a new annotation with the given persistence state.
- *
- * @param isPersistent
- * <code>true</code> if persistent, <code>false</code> otherwise
- */
- // @unused
- public ErrorAnnotation(boolean isPersistent) {
- this(isPersistent, "no text");
- }
-
- /**
- * The type of projection annotations.
- */
- public static final String TYPE = "org.eclipse.ui.workbench.texteditor.error"; //$NON-NLS-1$
-
- /** error image */
- private static Image fgErrorImage;
-
- /**
- * Class that disposes image on demand
- */
- private static class DisplayDisposeRunnable implements Runnable {
-
- public void run() {
- if (fgErrorImage != null) {
- fgErrorImage.dispose();
- fgErrorImage = null;
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public int getLayer() {
- return IAnnotationAccessExtension.DEFAULT_LAYER;
- }
-
- /*
- * @see org.eclipse.jface.text.source.IAnnotationPresentation#paint(org.eclipse
- * .swt.graphics.GC, org.eclipse.swt.widgets.Canvas, org.eclipse.swt.graphics.Rectangle)
- */
- public void paint(GC gc, Canvas canvas, Rectangle rectangle) {
- Image image = getImage(canvas.getDisplay());
- if (image != null) {
- ImageUtilities.drawImage(image, gc, canvas, rectangle, SWT.CENTER, SWT.TOP);
- }
- }
-
- /**
- * Returns the image to be drawn
- *
- * @param display
- * the current display
- * @return the image to be drawn
- */
- protected Image getImage(Display display) {
- initializeImages(display);
- return fgErrorImage;
- }
-
- private void initializeImages(Display display) {
- if (fgErrorImage == null) {
-
- ImageDescriptor descriptor = ImageDescriptor.createFromFile(ErrorAnnotation.class, "images/error.gif"); //$NON-NLS-1$
- fgErrorImage = descriptor.createImage(display);
-
- display.disposeExec(new DisplayDisposeRunnable());
- }
- }
-
-}
+/**
+ *
+ */
+package org.eclipse.papyrus.extensionpoints.editors.ui;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationAccessExtension;
+import org.eclipse.jface.text.source.IAnnotationPresentation;
+import org.eclipse.jface.text.source.ImageUtilities;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Extended annotation class for error annotation in embedded editors
+ */
+public class ErrorAnnotation extends Annotation implements IAnnotationPresentation {
+
+ /**
+ * Creates a new annotation with the given properties.
+ *
+ * @param type
+ * the unique name of this annotation type
+ * @param isPersistent
+ * <code>true</code> if this annotation is persistent, <code>false</code> otherwise
+ * @param text
+ * the text associated with this annotation
+ */
+ public ErrorAnnotation(boolean isPersistent, String text) {
+ super(TYPE, isPersistent, text);
+ }
+
+ /**
+ * Creates a new annotation with the given persistence state.
+ *
+ * @param isPersistent
+ * <code>true</code> if persistent, <code>false</code> otherwise
+ */
+ // @unused
+ public ErrorAnnotation(boolean isPersistent) {
+ this(isPersistent, "no text");
+ }
+
+ /**
+ * The type of projection annotations.
+ */
+ public static final String TYPE = "org.eclipse.ui.workbench.texteditor.error"; //$NON-NLS-1$
+
+ /** error image */
+ private static Image fgErrorImage;
+
+ /**
+ * Class that disposes image on demand
+ */
+ private static class DisplayDisposeRunnable implements Runnable {
+
+ public void run() {
+ if (fgErrorImage != null) {
+ fgErrorImage.dispose();
+ fgErrorImage = null;
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getLayer() {
+ return IAnnotationAccessExtension.DEFAULT_LAYER;
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.IAnnotationPresentation#paint(org.eclipse
+ * .swt.graphics.GC, org.eclipse.swt.widgets.Canvas, org.eclipse.swt.graphics.Rectangle)
+ */
+ public void paint(GC gc, Canvas canvas, Rectangle rectangle) {
+ Image image = getImage(canvas.getDisplay());
+ if (image != null) {
+ ImageUtilities.drawImage(image, gc, canvas, rectangle, SWT.CENTER, SWT.TOP);
+ }
+ }
+
+ /**
+ * Returns the image to be drawn
+ *
+ * @param display
+ * the current display
+ * @return the image to be drawn
+ */
+ protected Image getImage(Display display) {
+ initializeImages(display);
+ return fgErrorImage;
+ }
+
+ private void initializeImages(Display display) {
+ if (fgErrorImage == null) {
+
+ ImageDescriptor descriptor = ImageDescriptor.createFromFile(ErrorAnnotation.class, "images/error.gif"); //$NON-NLS-1$
+ fgErrorImage = descriptor.createImage(display);
+
+ display.disposeExec(new DisplayDisposeRunnable());
+ }
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java
index f0f0aaa6a98..f598902ed96 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ExtendedDirectEditionDialog.java
@@ -1,188 +1,188 @@
-/*******************************************************************************
- * Copyright (c) 2006 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:
- * CEA List - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.extensionpoints.editors.ui;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration.Selection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.custom.VerifyKeyListener;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Dialog used in for direct edition, when an extension is provided
- */
-public class ExtendedDirectEditionDialog extends LabelEditorDialog {
-
- /** Title of the Dialog */
- final private static String TITLE = "Edit Label";
-
- /** Edited object */
- protected Object editedObject;
-
- /** Document used by the dialog */
- protected Document document;
-
- /** extension configuration */
- protected IDirectEditorConfiguration configuration;
-
- /**
- * Creates a new ExtendedDirectEditionDialog
- *
- * @param parentShell
- * the parent shell
- * @param parameter
- * the editedObject
- * @param initialValue
- * the initial text value
- */
- public ExtendedDirectEditionDialog(Shell parentShell, Object object, String initialValue,
- IDirectEditorConfiguration configuration) {
- super(parentShell, TITLE, initialValue, configuration.getInputValidator());
- this.editedObject = object;
- this.value = initialValue;
- this.configuration = configuration;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Control createDialogArea(Composite parent) {
- Group composite = new Group(parent, SWT.RESIZE);
- composite.setText("Specification");
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Composite viewerGroup = new Composite(composite, SWT.RESIZE);
- FillLayout viewerLayout = new FillLayout();
- viewerGroup.setLayout(viewerLayout);
- GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- viewerGroup.setLayoutData(data);
- viewer = new SourceViewer(viewerGroup, null, SWT.BORDER | SWT.FILL_EVEN_ODD);
-
- // configure source viewer
- document = new Document();
- document.set(value);
-
- // add completion processor key listener (ctrl+space keys)
- viewer.appendVerifyKeyListener(new LabelKeyListener(viewer));
-
- document.addDocumentListener(new DocumentListener());
- viewer.configure(configuration.getSourceViewerConfiguration());
- viewer.setDocument(document);
-
- Selection selection = configuration.getTextSelection(value, editedObject);
- viewer.setSelectedRange(selection.getStart(), selection.getLentgh());
-
- Composite extendedArea = configuration.createExtendedDialogArea(viewerGroup);
- if (extendedArea != null) {
- extendedArea.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
- }
-
- errorMessageText = new CLabel(composite, SWT.READ_ONLY | SWT.SHADOW_NONE);
- errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
- errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- // Set the error message text
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
- setErrorMessage(errorMessage);
-
- applyDialogFont(composite);
- return composite;
- }
-
- /**
- *
- */
- private class LabelKeyListener implements VerifyKeyListener {
-
- /**
- *
- */
- SourceViewer viewer;
-
- /**
- * Default constructor.
- *
- * @param viewer
- */
- public LabelKeyListener(SourceViewer viewer) {
- this.viewer = viewer;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.custom.VerifyKeyListener#verifyKey(org.eclipse.swt.events.VerifyEvent)
- */
- /**
- *
- *
- * @param event
- */
- public void verifyKey(VerifyEvent event) {
- if ((event.stateMask == SWT.CTRL) && (event.character == ' ')) {
- if (viewer.canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS)) {
- viewer.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
- }
- event.doit = false;
- } else if (event.character == SWT.CR) {
- event.doit = false;
- }
- }
- }
-
- /**
- *
- */
- private class DocumentListener implements IDocumentListener {
-
- /**
- *
- *
- * @param event
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- }
-
- /**
- *
- *
- * @param event
- */
- public void documentChanged(DocumentEvent event) {
- validateInput();
- }
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2006 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:
+ * CEA List - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.extensionpoints.editors.ui;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.DocumentEvent;
+import org.eclipse.jface.text.IDocumentListener;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration.Selection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.VerifyKeyListener;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Dialog used in for direct edition, when an extension is provided
+ */
+public class ExtendedDirectEditionDialog extends LabelEditorDialog {
+
+ /** Title of the Dialog */
+ final private static String TITLE = "Edit Label";
+
+ /** Edited object */
+ protected Object editedObject;
+
+ /** Document used by the dialog */
+ protected Document document;
+
+ /** extension configuration */
+ protected IDirectEditorConfiguration configuration;
+
+ /**
+ * Creates a new ExtendedDirectEditionDialog
+ *
+ * @param parentShell
+ * the parent shell
+ * @param parameter
+ * the editedObject
+ * @param initialValue
+ * the initial text value
+ */
+ public ExtendedDirectEditionDialog(Shell parentShell, Object object, String initialValue,
+ IDirectEditorConfiguration configuration) {
+ super(parentShell, TITLE, initialValue, configuration.getInputValidator());
+ this.editedObject = object;
+ this.value = initialValue;
+ this.configuration = configuration;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Group composite = new Group(parent, SWT.RESIZE);
+ composite.setText("Specification");
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Composite viewerGroup = new Composite(composite, SWT.RESIZE);
+ FillLayout viewerLayout = new FillLayout();
+ viewerGroup.setLayout(viewerLayout);
+ GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.VERTICAL_ALIGN_CENTER);
+ data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+ viewerGroup.setLayoutData(data);
+ viewer = new SourceViewer(viewerGroup, null, SWT.BORDER | SWT.FILL_EVEN_ODD);
+
+ // configure source viewer
+ document = new Document();
+ document.set(value);
+
+ // add completion processor key listener (ctrl+space keys)
+ viewer.appendVerifyKeyListener(new LabelKeyListener(viewer));
+
+ document.addDocumentListener(new DocumentListener());
+ viewer.configure(configuration.getSourceViewerConfiguration());
+ viewer.setDocument(document);
+
+ Selection selection = configuration.getTextSelection(value, editedObject);
+ viewer.setSelectedRange(selection.getStart(), selection.getLentgh());
+
+ Composite extendedArea = configuration.createExtendedDialogArea(viewerGroup);
+ if (extendedArea != null) {
+ extendedArea.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
+ }
+
+ errorMessageText = new CLabel(composite, SWT.READ_ONLY | SWT.SHADOW_NONE);
+ errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
+ errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ // Set the error message text
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
+ setErrorMessage(errorMessage);
+
+ applyDialogFont(composite);
+ return composite;
+ }
+
+ /**
+ *
+ */
+ private class LabelKeyListener implements VerifyKeyListener {
+
+ /**
+ *
+ */
+ SourceViewer viewer;
+
+ /**
+ * Default constructor.
+ *
+ * @param viewer
+ */
+ public LabelKeyListener(SourceViewer viewer) {
+ this.viewer = viewer;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.custom.VerifyKeyListener#verifyKey(org.eclipse.swt.events.VerifyEvent)
+ */
+ /**
+ *
+ *
+ * @param event
+ */
+ public void verifyKey(VerifyEvent event) {
+ if ((event.stateMask == SWT.CTRL) && (event.character == ' ')) {
+ if (viewer.canDoOperation(ISourceViewer.CONTENTASSIST_PROPOSALS)) {
+ viewer.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
+ }
+ event.doit = false;
+ } else if (event.character == SWT.CR) {
+ event.doit = false;
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private class DocumentListener implements IDocumentListener {
+
+ /**
+ *
+ *
+ * @param event
+ */
+ public void documentAboutToBeChanged(DocumentEvent event) {
+ }
+
+ /**
+ *
+ *
+ * @param event
+ */
+ public void documentChanged(DocumentEvent event) {
+ validateInput();
+ }
+
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/GMFEmbeddedEditorActionDelegate.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/GMFEmbeddedEditorActionDelegate.java
index 9814032dbc8..710c271cd04 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/GMFEmbeddedEditorActionDelegate.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/GMFEmbeddedEditorActionDelegate.java
@@ -1,141 +1,141 @@
-/*****************************************************************************
- * Copyright (c) 2008 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.extensionpoints.editors.ui;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * Action delegate for direct editors embedded in GMF editors
- */
-public class GMFEmbeddedEditorActionDelegate extends OpenEmbeddedTextEditorObjectActionDelegate {
-
- /** selected element in the diagram */
- protected IGraphicalEditPart selectedElement;
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Control getControl() {
- IDiagramGraphicalViewer viewer = null;
- if (part instanceof IDiagramGraphicalViewer) {
- viewer = (IDiagramGraphicalViewer) part;
- } else if (part instanceof IAdaptable) {
- viewer = (IDiagramGraphicalViewer) ((IAdaptable) part).getAdapter(IDiagramGraphicalViewer.class);
- }
-
- if (viewer != null) {
- return viewer.getControl();
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected EObject getEditedObject() {
- // should never happened, but...
- if (selectedElement == null) {
- throw new RuntimeException("Impossible to get an element from no selection.");
- }
-
- // retrieves the current model element associated to the graphical selected edit part
- Object model = selectedElement.getModel();
- if (model instanceof View) {
- return ((View) model).getElement();
- }
-
- // nothing was found. throw an exception
- throw new RuntimeException("Impossible to get an element from selected Element " + selectedElement);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Point getPosition() {
- // calculate position in 2 steps:
- // 1. position of the element from the top left corner of he gmf viewer
- // 2. position of the viewer from the top left corner of the screen
- Rectangle rect = selectedElement.getFigure().getBounds().getCopy();
- selectedElement.getFigure().translateToAbsolute(rect);
-
- Point viewerPosition = getViewerPosition();
- return new Point(rect.x + viewerPosition.x, rect.y + viewerPosition.y);
- }
-
- /**
- * Returns the viewer position
- *
- * @return the GMF viewer position
- */
- protected Point getViewerPosition() {
- Control viewerControl = selectedElement.getViewer().getControl();
-
- // get the position of this control in its parent
- Composite parent = viewerControl.getParent();
- Point selectionPoint = new Point(0, 0);
- while (parent.getParent() != null) {
- selectionPoint.x += parent.getLocation().x;
- selectionPoint.y += parent.getLocation().y;
- parent = parent.getParent();
- if (parent.getParent() == null) {
- // this is the display
- selectionPoint.x += parent.getDisplay().getActiveShell().getLocation().x;
- selectionPoint.y += parent.getDisplay().getActiveShell().getLocation().y;
- }
- }
- return selectionPoint;
- }
-
- /**
- * {@inheritDoc}
- */
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- Object o = ((IStructuredSelection) selection).getFirstElement();
- if (o instanceof IGraphicalEditPart) {
- selectedElement = ((IGraphicalEditPart) o);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Composite getParentComposite() {
- Composite parentComposite = (Composite) selectedElement.getViewer().getControl();
- return new Composite(parentComposite, SWT.BORDER);
- }
-
- @Override
- protected org.eclipse.gef.GraphicalEditPart getSelectedElement() {
- return selectedElement;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.extensionpoints.editors.ui;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * Action delegate for direct editors embedded in GMF editors
+ */
+public class GMFEmbeddedEditorActionDelegate extends OpenEmbeddedTextEditorObjectActionDelegate {
+
+ /** selected element in the diagram */
+ protected IGraphicalEditPart selectedElement;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Control getControl() {
+ IDiagramGraphicalViewer viewer = null;
+ if (part instanceof IDiagramGraphicalViewer) {
+ viewer = (IDiagramGraphicalViewer) part;
+ } else if (part instanceof IAdaptable) {
+ viewer = (IDiagramGraphicalViewer) ((IAdaptable) part).getAdapter(IDiagramGraphicalViewer.class);
+ }
+
+ if (viewer != null) {
+ return viewer.getControl();
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected EObject getEditedObject() {
+ // should never happened, but...
+ if (selectedElement == null) {
+ throw new RuntimeException("Impossible to get an element from no selection.");
+ }
+
+ // retrieves the current model element associated to the graphical selected edit part
+ Object model = selectedElement.getModel();
+ if (model instanceof View) {
+ return ((View) model).getElement();
+ }
+
+ // nothing was found. throw an exception
+ throw new RuntimeException("Impossible to get an element from selected Element " + selectedElement);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Point getPosition() {
+ // calculate position in 2 steps:
+ // 1. position of the element from the top left corner of he gmf viewer
+ // 2. position of the viewer from the top left corner of the screen
+ Rectangle rect = selectedElement.getFigure().getBounds().getCopy();
+ selectedElement.getFigure().translateToAbsolute(rect);
+
+ Point viewerPosition = getViewerPosition();
+ return new Point(rect.x + viewerPosition.x, rect.y + viewerPosition.y);
+ }
+
+ /**
+ * Returns the viewer position
+ *
+ * @return the GMF viewer position
+ */
+ protected Point getViewerPosition() {
+ Control viewerControl = selectedElement.getViewer().getControl();
+
+ // get the position of this control in its parent
+ Composite parent = viewerControl.getParent();
+ Point selectionPoint = new Point(0, 0);
+ while (parent.getParent() != null) {
+ selectionPoint.x += parent.getLocation().x;
+ selectionPoint.y += parent.getLocation().y;
+ parent = parent.getParent();
+ if (parent.getParent() == null) {
+ // this is the display
+ selectionPoint.x += parent.getDisplay().getActiveShell().getLocation().x;
+ selectionPoint.y += parent.getDisplay().getActiveShell().getLocation().y;
+ }
+ }
+ return selectionPoint;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ Object o = ((IStructuredSelection) selection).getFirstElement();
+ if (o instanceof IGraphicalEditPart) {
+ selectedElement = ((IGraphicalEditPart) o);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Composite getParentComposite() {
+ Composite parentComposite = (Composite) selectedElement.getViewer().getControl();
+ return new Composite(parentComposite, SWT.BORDER);
+ }
+
+ @Override
+ protected org.eclipse.gef.GraphicalEditPart getSelectedElement() {
+ return selectedElement;
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ILabelEditorDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ILabelEditorDialog.java
index aef7950363c..79b4e2afb79 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ILabelEditorDialog.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/ILabelEditorDialog.java
@@ -1,22 +1,22 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.extensionpoints.editors.ui;
-
-
-/**
- *
- */
-public interface ILabelEditorDialog {
-
- /** gets the value returned by the dialog */
- public String getValue();
-}
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.extensionpoints.editors.ui;
+
+
+/**
+ *
+ */
+public interface ILabelEditorDialog {
+
+ /** gets the value returned by the dialog */
+ public String getValue();
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/IPopupEditorHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/IPopupEditorHelper.java
index eb180594811..108d44f9d56 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/IPopupEditorHelper.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/IPopupEditorHelper.java
@@ -1,23 +1,23 @@
-/*****************************************************************************
- * Copyright (c) 2010 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:
- * CEA LIST - initial API and implementation
- *****************************************************************************/
-
-package org.eclipse.papyrus.extensionpoints.editors.ui;
-
-/**
- * This interface provides a method for displaying a popupeditor
- */
-public interface IPopupEditorHelper {
-
- /** Displays the editor encapsulated by the IPopupEditorHelper */
- void showEditor();
-
-}
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * CEA LIST - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.extensionpoints.editors.ui;
+
+/**
+ * This interface provides a method for displaying a popupeditor
+ */
+public interface IPopupEditorHelper {
+
+ /** Displays the editor encapsulated by the IPopupEditorHelper */
+ void showEditor();
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java
index 4e539193960..1a2f65e85b0 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java
@@ -1,209 +1,209 @@
-/*******************************************************************************
- * Copyright (c) 2006 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:
- * CEA List - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.extensionpoints.editors.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-// equivalent au inputDialog (code recopie) mais donne un sourceviewer a la place du label
-/**
- *
- */
-public class LabelEditorDialog extends Dialog implements ILabelEditorDialog {
-
- /**
- * The title of the dialog.
- */
- protected String title;
-
- /**
- * The input value; the empty string by default.
- */
- protected String value = "";//$NON-NLS-1$
-
- /**
- * The input validator, or <code>null</code> if none.
- */
- protected IInputValidator validator;
-
- /**
- * Ok button widget.
- */
- protected Button okButton;
-
- /**
- * Error message label widget.
- */
- protected CLabel errorMessageText;
-
- /**
- * Error message string.
- */
- protected String errorMessage;
-
- /**
- * SourceViewer : area that displays text.
- */
- protected SourceViewer viewer;
-
- /**
- * Creates a dialog with OK and Cancel buttons. Note that the dialog will have no visual
- * representation (no widgets) until it is told to open.
- * <p>
- * Note that the <code>open</code> method blocks for input dialogs.
- * </p>
- *
- * @param dialogTitle
- * the dialog title, or <code>null</code> if none
- * @param validator
- * an input validator, or <code>null</code> if none
- * @param parentShell
- * the parent shell, or <code>null</code> to create a top-level shell
- * @param initialValue
- * the initial input value, or <code>null</code> if none (equivalent to the empty
- * string)
- */
- public LabelEditorDialog(Shell parentShell, String dialogTitle, String initialValue, IInputValidator validator) {
- super(parentShell);
- this.title = dialogTitle;
- if (initialValue == null) {
- value = "";//$NON-NLS-1$
- } else {
- value = initialValue;
- }
- this.validator = validator;
- }
-
- /*
- * (non-Javadoc) Method declared on Dialog.
- */
- /**
- *
- *
- * @param buttonId
- */
- @Override
- protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- value = viewer.getDocument().get();
- } else {
- value = null;
- }
- super.buttonPressed(buttonId);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets .Shell)
- */
- /**
- *
- *
- * @param shell
- */
- @Override
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- if (title != null) {
- shell.setText(title);
- }
- }
-
- /**
- * Returns the ok button.
- *
- * @return the ok button
- */
- // @unused
- protected Button getOkButton() {
- return okButton;
- }
-
- /**
- * Returns the text area.
- *
- * @return the text area
- */
- // @unused
- protected SourceViewer getSourceViewer() {
- return viewer;
- }
-
- /**
- * Returns the validator.
- *
- * @return the validator
- */
- // @unused
- protected IInputValidator getValidator() {
- return validator;
- }
-
- /**
- * Returns the string typed into this input dialog.
- *
- * @return the input string
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Validates the input.
- * <p>
- * The default implementation of this framework method delegates the request to the supplied input validator object; if it finds the input invalid, the error message is displayed in the dialog's message line. This hook method is called whenever the text
- * changes in the input field.
- * </p>
- */
- protected void validateInput() {
- String errorMessage = null;
- if (validator != null) {
- errorMessage = validator.isValid(viewer.getDocument().get());
- }
- // Bug 16256: important not to treat "" (blank error) the same as null
- // (no error)
- setErrorMessage(errorMessage);
- }
-
- /**
- * Sets or clears the error message. If not <code>null</code>, the OK button is disabled.
- *
- * @param errorMessage
- * the error message, or <code>null</code> to clear
- *
- * @since 3.0
- */
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- if ((errorMessageText != null) && !errorMessageText.isDisposed()) {
- Image errorImage = Activator.getImage("icons/error.gif");
- errorMessageText.setImage(errorMessage == null ? null : errorImage);
- errorMessageText.setText(errorMessage == null ? "" : errorMessage); //$NON-NLS-1$
- errorMessageText.getParent().update();
- // Access the ok button by id, in case clients have overridden
- // button creation.
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643
- Control button = getButton(IDialogConstants.OK_ID);
- if (button != null) {
- button.setEnabled(errorMessage == null);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006 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:
+ * CEA List - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.extensionpoints.editors.ui;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+// equivalent au inputDialog (code recopie) mais donne un sourceviewer a la place du label
+/**
+ *
+ */
+public class LabelEditorDialog extends Dialog implements ILabelEditorDialog {
+
+ /**
+ * The title of the dialog.
+ */
+ protected String title;
+
+ /**
+ * The input value; the empty string by default.
+ */
+ protected String value = "";//$NON-NLS-1$
+
+ /**
+ * The input validator, or <code>null</code> if none.
+ */
+ protected IInputValidator validator;
+
+ /**
+ * Ok button widget.
+ */
+ protected Button okButton;
+
+ /**
+ * Error message label widget.
+ */
+ protected CLabel errorMessageText;
+
+ /**
+ * Error message string.
+ */
+ protected String errorMessage;
+
+ /**
+ * SourceViewer : area that displays text.
+ */
+ protected SourceViewer viewer;
+
+ /**
+ * Creates a dialog with OK and Cancel buttons. Note that the dialog will have no visual
+ * representation (no widgets) until it is told to open.
+ * <p>
+ * Note that the <code>open</code> method blocks for input dialogs.
+ * </p>
+ *
+ * @param dialogTitle
+ * the dialog title, or <code>null</code> if none
+ * @param validator
+ * an input validator, or <code>null</code> if none
+ * @param parentShell
+ * the parent shell, or <code>null</code> to create a top-level shell
+ * @param initialValue
+ * the initial input value, or <code>null</code> if none (equivalent to the empty
+ * string)
+ */
+ public LabelEditorDialog(Shell parentShell, String dialogTitle, String initialValue, IInputValidator validator) {
+ super(parentShell);
+ this.title = dialogTitle;
+ if (initialValue == null) {
+ value = "";//$NON-NLS-1$
+ } else {
+ value = initialValue;
+ }
+ this.validator = validator;
+ }
+
+ /*
+ * (non-Javadoc) Method declared on Dialog.
+ */
+ /**
+ *
+ *
+ * @param buttonId
+ */
+ @Override
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == IDialogConstants.OK_ID) {
+ value = viewer.getDocument().get();
+ } else {
+ value = null;
+ }
+ super.buttonPressed(buttonId);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets .Shell)
+ */
+ /**
+ *
+ *
+ * @param shell
+ */
+ @Override
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ if (title != null) {
+ shell.setText(title);
+ }
+ }
+
+ /**
+ * Returns the ok button.
+ *
+ * @return the ok button
+ */
+ // @unused
+ protected Button getOkButton() {
+ return okButton;
+ }
+
+ /**
+ * Returns the text area.
+ *
+ * @return the text area
+ */
+ // @unused
+ protected SourceViewer getSourceViewer() {
+ return viewer;
+ }
+
+ /**
+ * Returns the validator.
+ *
+ * @return the validator
+ */
+ // @unused
+ protected IInputValidator getValidator() {
+ return validator;
+ }
+
+ /**
+ * Returns the string typed into this input dialog.
+ *
+ * @return the input string
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Validates the input.
+ * <p>
+ * The default implementation of this framework method delegates the request to the supplied input validator object; if it finds the input invalid, the error message is displayed in the dialog's message line. This hook method is called whenever the text
+ * changes in the input field.
+ * </p>
+ */
+ protected void validateInput() {
+ String errorMessage = null;
+ if (validator != null) {
+ errorMessage = validator.isValid(viewer.getDocument().get());
+ }
+ // Bug 16256: important not to treat "" (blank error) the same as null
+ // (no error)
+ setErrorMessage(errorMessage);
+ }
+
+ /**
+ * Sets or clears the error message. If not <code>null</code>, the OK button is disabled.
+ *
+ * @param errorMessage
+ * the error message, or <code>null</code> to clear
+ *
+ * @since 3.0
+ */
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ if ((errorMessageText != null) && !errorMessageText.isDisposed()) {
+ Image errorImage = Activator.getImage("icons/error.gif");
+ errorMessageText.setImage(errorMessage == null ? null : errorImage);
+ errorMessageText.setText(errorMessage == null ? "" : errorMessage); //$NON-NLS-1$
+ errorMessageText.getParent().update();
+ // Access the ok button by id, in case clients have overridden
+ // button creation.
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643
+ Control button = getButton(IDialogConstants.OK_ID);
+ if (button != null) {
+ button.setEnabled(errorMessage == null);
+ }
+ }
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/MultiReconciler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/MultiReconciler.java
index 4bf552fd942..dc4666afef5 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/MultiReconciler.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/MultiReconciler.java
@@ -1,124 +1,124 @@
-/*****************************************************************************
- * Copyright (c) 2008 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:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.extensionpoints.editors.ui;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.reconciler.AbstractReconciler;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
-import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
-import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension;
-
-/**
- * Reconciler that uses several independent strategies.
- */
-public class MultiReconciler extends AbstractReconciler {
-
- /** The reconciling strategy. */
- private final List<IReconcilingStrategy> fStrategies;
-
- /**
- * Creates a new reconciler that uses several reconciling strategies to reconcile its document
- * independent of the type of the document's contents.
- *
- * @param strategies
- * the reconciling strategies to be used
- * @param isIncremental
- * the indication whether strategy is incremental or not
- */
- // @unused
- public MultiReconciler(List<IReconcilingStrategy> strategies, boolean isIncremental) {
- Assert.isNotNull(strategies);
- fStrategies = strategies;
- for (IReconcilingStrategy strategy : fStrategies) {
- if (strategy instanceof IReconcilingStrategyExtension) {
- IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy;
- extension.setProgressMonitor(getProgressMonitor());
- }
- }
-
- setIsIncrementalReconciler(isIncremental);
- }
-
- /*
- * @see IReconciler#getReconcilingStrategy(String)
- */
- public IReconcilingStrategy getReconcilingStrategy(String contentType) {
- Assert.isNotNull(contentType);
- return fStrategies.get(0);
- }
-
- /*
- * @see AbstractReconciler#process(DirtyRegion)
- */
- @Override
- protected void process(DirtyRegion dirtyRegion) {
-
- for (IReconcilingStrategy strategy : fStrategies) {
- if (dirtyRegion != null) {
- strategy.reconcile(dirtyRegion, dirtyRegion);
- } else {
- IDocument document = getDocument();
- if (document != null) {
- strategy.reconcile(new Region(0, document.getLength()));
- }
- }
- }
- }
-
- /*
- * @see AbstractReconciler#reconcilerDocumentChanged(IDocument)
- */
- @Override
- protected void reconcilerDocumentChanged(IDocument document) {
- for (IReconcilingStrategy strategy : fStrategies) {
- strategy.setDocument(document);
- }
- }
-
- /*
- * @see AbstractReconciler#setProgressMonitor(IProgressMonitor)
- */
- @Override
- public void setProgressMonitor(IProgressMonitor monitor) {
- super.setProgressMonitor(monitor);
-
- for (IReconcilingStrategy strategy : fStrategies) {
- if (strategy instanceof IReconcilingStrategyExtension) {
- IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy;
- extension.setProgressMonitor(monitor);
- }
- }
-
- }
-
- /*
- * @see AbstractReconciler#initialProcess()
- */
- @Override
- protected void initialProcess() {
-
- for (IReconcilingStrategy strategy : fStrategies) {
- if (strategy instanceof IReconcilingStrategyExtension) {
- IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy;
- extension.initialReconcile();
- }
- }
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.extensionpoints.editors.ui;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.reconciler.AbstractReconciler;
+import org.eclipse.jface.text.reconciler.DirtyRegion;
+import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
+import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension;
+
+/**
+ * Reconciler that uses several independent strategies.
+ */
+public class MultiReconciler extends AbstractReconciler {
+
+ /** The reconciling strategy. */
+ private final List<IReconcilingStrategy> fStrategies;
+
+ /**
+ * Creates a new reconciler that uses several reconciling strategies to reconcile its document
+ * independent of the type of the document's contents.
+ *
+ * @param strategies
+ * the reconciling strategies to be used
+ * @param isIncremental
+ * the indication whether strategy is incremental or not
+ */
+ // @unused
+ public MultiReconciler(List<IReconcilingStrategy> strategies, boolean isIncremental) {
+ Assert.isNotNull(strategies);
+ fStrategies = strategies;
+ for (IReconcilingStrategy strategy : fStrategies) {
+ if (strategy instanceof IReconcilingStrategyExtension) {
+ IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy;
+ extension.setProgressMonitor(getProgressMonitor());
+ }
+ }
+
+ setIsIncrementalReconciler(isIncremental);
+ }
+
+ /*
+ * @see IReconciler#getReconcilingStrategy(String)
+ */
+ public IReconcilingStrategy getReconcilingStrategy(String contentType) {
+ Assert.isNotNull(contentType);
+ return fStrategies.get(0);
+ }
+
+ /*
+ * @see AbstractReconciler#process(DirtyRegion)
+ */
+ @Override
+ protected void process(DirtyRegion dirtyRegion) {
+
+ for (IReconcilingStrategy strategy : fStrategies) {
+ if (dirtyRegion != null) {
+ strategy.reconcile(dirtyRegion, dirtyRegion);
+ } else {
+ IDocument document = getDocument();
+ if (document != null) {
+ strategy.reconcile(new Region(0, document.getLength()));
+ }
+ }
+ }
+ }
+
+ /*
+ * @see AbstractReconciler#reconcilerDocumentChanged(IDocument)
+ */
+ @Override
+ protected void reconcilerDocumentChanged(IDocument document) {
+ for (IReconcilingStrategy strategy : fStrategies) {
+ strategy.setDocument(document);
+ }
+ }
+
+ /*
+ * @see AbstractReconciler#setProgressMonitor(IProgressMonitor)
+ */
+ @Override
+ public void setProgressMonitor(IProgressMonitor monitor) {
+ super.setProgressMonitor(monitor);
+
+ for (IReconcilingStrategy strategy : fStrategies) {
+ if (strategy instanceof IReconcilingStrategyExtension) {
+ IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy;
+ extension.setProgressMonitor(monitor);
+ }
+ }
+
+ }
+
+ /*
+ * @see AbstractReconciler#initialProcess()
+ */
+ @Override
+ protected void initialProcess() {
+
+ for (IReconcilingStrategy strategy : fStrategies) {
+ if (strategy instanceof IReconcilingStrategyExtension) {
+ IReconcilingStrategyExtension extension = (IReconcilingStrategyExtension) strategy;
+ extension.initialReconcile();
+ }
+ }
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java
index 8809416701b..9a3c4005037 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/DirectEditorsUtil.java
@@ -1,295 +1,295 @@
-/*****************************************************************************
- * Copyright (c) 2008 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:
- * Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.extensionpoints.editors.utils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.DefaultDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint;
-import org.eclipse.papyrus.extensionpoints.editors.definition.DirectEditorExtensionPoint;
-import org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
-
-public class DirectEditorsUtil {
-
- /** The Constant UNKNOWN_PRIORITY. */
- private static final int UNKNOWN_PRIORITY = 100;
-
- /**
- * Finds a editor for specific language and object to edit type
- *
- * @param language
- * the language to edit
- * @param objectToEdit
- * the type of object to edit
- * @return the extension point proxy that manages this kind of editor
- *
- * @deprecated Use {@link #findEditorConfiguration(String language, EObject eObjectToEdit)} instead
- */
- @Deprecated
- public static IDirectEditorConfiguration findEditorConfiguration(String language, String objectToEdit) {
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- final String lang = directEditorExtensionPoint.getLanguage();
- final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
- if (lang.equals(language) && oToEdit.equals(objectToEdit)) {
- // extension point found!
- return directEditorExtensionPoint.getDirectEditorConfiguration();
- }
- }
- return new DefaultDirectEditorConfiguration();
- }
-
- /**
- * Finds a editor for specific language and object to edit type
- *
- * @param language
- * the language to edit
- * @param semanticObjectToEdit
- * the semantic object to edit
- * @param selectedElement
- * The real selected element (e.g. widget, edit part, ...)
- * @return the extension point proxy that manages this kind of editor
- */
- public static IDirectEditorConfiguration findEditorConfiguration(String language, Object semanticObjectToEdit, Object selectedElement) {
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- IDirectEditorConfiguration editorConfiguration = new DefaultDirectEditorConfiguration();
- int configurationPriority = UNKNOWN_PRIORITY;
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- final String lang = directEditorExtensionPoint.getLanguage();
- final Class<? extends EObject> classToEdit = directEditorExtensionPoint.getObjectClassToEdit();
- if (lang.equals(language) && classToEdit.isInstance(semanticObjectToEdit)) {
- IDirectEditorConstraint constraint = directEditorExtensionPoint.getAdditionalConstraint();
- if ((constraint == null || constraint.appliesTo(selectedElement)) && directEditorExtensionPoint.getPriority() < configurationPriority) {
- // extension point found!
- editorConfiguration = directEditorExtensionPoint.getDirectEditorConfiguration();
- configurationPriority = directEditorExtensionPoint.getPriority();
- }
- }
- }
- return editorConfiguration;
- }
-
- /**
- * finds if an editor for specific language and object is available to edit type
- *
- * @param language
- * the language to edit
- * @param objectToEdit
- * the object to edit
- * @return <code>true</code> if an editor exists
- *
- * @deprecated Use {@link #hasSpecificEditorConfiguration(String language, EObject eObjectToEdit)} instead
- */
- @Deprecated
- public static boolean hasSpecificEditorConfiguration(String language, String objectToEdit) {
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- final String lang = directEditorExtensionPoint.getLanguage();
- final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
- if (lang.equals(language) && oToEdit.equals(objectToEdit)) {
- // extension point found!
- return true;
- }
- }
- return false;
- }
-
- /**
- * finds if an editor for specific language and object is available to edit type
- *
- * @param language
- * the language to edit
- * @param semanticObjectToEdit
- * the semantic object to edit
- * @param selectedElement
- * The real selected element (e.g. widget, edit part, ...)
- * @return <code>true</code> if an editor exists
- */
- public static boolean hasSpecificEditorConfiguration(String language, Object semanticObjectToEdit, Object selectedElement) {
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- final String lang = directEditorExtensionPoint.getLanguage();
- final Class<? extends EObject> classToEdit = directEditorExtensionPoint.getObjectClassToEdit();
- if (lang.equals(language) && classToEdit.isInstance(semanticObjectToEdit)) {
- IDirectEditorConstraint constraint = directEditorExtensionPoint.getAdditionalConstraint();
- if (constraint == null || constraint.appliesTo(selectedElement)) {
- // extension point found!
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * finds if an editor for specific object is available to edit type
- *
- * @param language
- * the language to edit
- * @param objectToEdit
- * the type of object to edit
- * @return <code>true</code> if an editor exists
- *
- * @deprecated Use {@link #hasSpecificEditorConfiguration(EObject)} instead
- */
- @Deprecated
- public static boolean hasSpecificEditorConfiguration(String objectToEdit) {
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
- if (oToEdit.equals(objectToEdit)) {
- // extension point found!
- return true;
- }
- }
- return false;
- }
-
- /**
- * finds if an editor for specific object is available to edit type
- *
- * @param language
- * the language to edit
- * @param semanticObjectToEdit
- * the semantic object to edit
- * @param selectedElement
- * The real selected element (e.g. widget, edit part, ...)
- * @return <code>true</code> if an editor exists
- */
- public static boolean hasSpecificEditorConfiguration(Object semanticObjectToEdit, Object selectedElement) {
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- final Class<? extends EObject> classToEdit = directEditorExtensionPoint.getObjectClassToEdit();
- if (classToEdit.isInstance(semanticObjectToEdit)) {
- IDirectEditorConstraint constraint = directEditorExtensionPoint.getAdditionalConstraint();
- if (constraint == null || constraint.appliesTo(selectedElement)) {
- // extension point found!
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Retrieves the preferred editor configuration for the specified type
- *
- * @param class_
- * the type of element to edit
- * @return the preferred editor configuration for the specified type or <code>null</code>
- */
- public static IDirectEditorExtensionPoint getDefautDirectEditorConfiguration(Object semanticObjectToEdit, Object selectedObject) {
- // retrieves preference for this element
- String language = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + semanticObjectToEdit.getClass().asSubclass(EObject.class));
- if (language == null || IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(language)) {
- return null;
- }
- IDirectEditorExtensionPoint currentConfiguration = null;
- int currentPriority = UNKNOWN_PRIORITY;
- Collection<IDirectEditorExtensionPoint> configs = getDirectEditorConfigurations(semanticObjectToEdit, selectedObject);
-
- for (IDirectEditorExtensionPoint extensionPoint : configs) {
- if (language.equals(extensionPoint.getLanguage()) && extensionPoint.getPriority() < currentPriority) {
- currentConfiguration = extensionPoint;
- currentPriority = extensionPoint.getPriority();
- }
- }
-
- return currentConfiguration;
- }
-
- /**
- * Returns the set of transformations registered in the platform for the specified kind of
- * element
- *
- * @param the
- * type of element to be edited
- * @return the set of transformations registered in the platform for the specified kind of
- * element
- */
- public static Collection<IDirectEditorExtensionPoint> getDirectEditorConfigurations(Object semanticObjectToEdit, Object selectedObject) {
- // list of configuration to be returned. They correspond to
- // configuration to edit the
- // specified type
- final List<IDirectEditorExtensionPoint> elementConfigurations = new ArrayList<IDirectEditorExtensionPoint>();
-
- // check each configuration in the platform and select corresponding
- // ones.
- for (IDirectEditorExtensionPoint configuration : DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations()) {
- // both class are compatibles ?
- if (configuration.getObjectClassToEdit() != null) {
- if (configuration.getObjectClassToEdit().isInstance(semanticObjectToEdit)) {
- IDirectEditorConstraint constraint = configuration.getAdditionalConstraint();
- if (constraint == null || constraint.appliesTo(selectedObject))
- elementConfigurations.add(configuration);
- }
- }
- }
- return elementConfigurations;
- }
-
- /**
- * Finds a editor for specific language and object to edit type with the higher priority.
- *
- * @param language
- * the language to edit
- * @param objectToEdit
- * the type of object to edit
- * @return the extension point proxy that manages this kind of editor
- */
- public static IDirectEditorConfiguration findEditorConfigurationWithPriority(String language, String objectToEdit) {
- IDirectEditorConfiguration result = null;
- int currentPrority = UNKNOWN_PRIORITY;
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- final String lang = directEditorExtensionPoint.getLanguage();
- final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
- if (lang.equals(language) && oToEdit.equals(objectToEdit)) {
- // extension point found!
- int directEditorExtensionPointPriority = directEditorExtensionPoint.getPriority() != null ? directEditorExtensionPoint.getPriority() : UNKNOWN_PRIORITY;
- if (result == null || (directEditorExtensionPointPriority < currentPrority)) {
- result = directEditorExtensionPoint.getDirectEditorConfiguration();
- currentPrority = directEditorExtensionPointPriority;
- }
- }
- }
- return result != null ? result : new DefaultDirectEditorConfiguration();
- }
-
- /**
- * returns the list of languages that are available from extension points
- *
- * @return the list of languages that have an extended editor
- */
- public static List<String> getLanguages(String objectToEdit) {
- List<String> languages = new ArrayList<String>();
- IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
- for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
- if (objectToEdit == null || directEditorExtensionPoint.getObjectToEdit().equals(objectToEdit)) {
- String lang = directEditorExtensionPoint.getLanguage();
- if (!languages.contains(lang)) {
- languages.add(lang);
- }
- }
- }
- return languages;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.extensionpoints.editors.utils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.extensionpoints.editors.Activator;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.DefaultDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConstraint;
+import org.eclipse.papyrus.extensionpoints.editors.definition.DirectEditorExtensionPoint;
+import org.eclipse.papyrus.extensionpoints.editors.definition.IDirectEditorExtensionPoint;
+
+public class DirectEditorsUtil {
+
+ /** The Constant UNKNOWN_PRIORITY. */
+ private static final int UNKNOWN_PRIORITY = 100;
+
+ /**
+ * Finds a editor for specific language and object to edit type
+ *
+ * @param language
+ * the language to edit
+ * @param objectToEdit
+ * the type of object to edit
+ * @return the extension point proxy that manages this kind of editor
+ *
+ * @deprecated Use {@link #findEditorConfiguration(String language, EObject eObjectToEdit)} instead
+ */
+ @Deprecated
+ public static IDirectEditorConfiguration findEditorConfiguration(String language, String objectToEdit) {
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ final String lang = directEditorExtensionPoint.getLanguage();
+ final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
+ if (lang.equals(language) && oToEdit.equals(objectToEdit)) {
+ // extension point found!
+ return directEditorExtensionPoint.getDirectEditorConfiguration();
+ }
+ }
+ return new DefaultDirectEditorConfiguration();
+ }
+
+ /**
+ * Finds a editor for specific language and object to edit type
+ *
+ * @param language
+ * the language to edit
+ * @param semanticObjectToEdit
+ * the semantic object to edit
+ * @param selectedElement
+ * The real selected element (e.g. widget, edit part, ...)
+ * @return the extension point proxy that manages this kind of editor
+ */
+ public static IDirectEditorConfiguration findEditorConfiguration(String language, Object semanticObjectToEdit, Object selectedElement) {
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ IDirectEditorConfiguration editorConfiguration = new DefaultDirectEditorConfiguration();
+ int configurationPriority = UNKNOWN_PRIORITY;
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ final String lang = directEditorExtensionPoint.getLanguage();
+ final Class<? extends EObject> classToEdit = directEditorExtensionPoint.getObjectClassToEdit();
+ if (lang.equals(language) && classToEdit.isInstance(semanticObjectToEdit)) {
+ IDirectEditorConstraint constraint = directEditorExtensionPoint.getAdditionalConstraint();
+ if ((constraint == null || constraint.appliesTo(selectedElement)) && directEditorExtensionPoint.getPriority() < configurationPriority) {
+ // extension point found!
+ editorConfiguration = directEditorExtensionPoint.getDirectEditorConfiguration();
+ configurationPriority = directEditorExtensionPoint.getPriority();
+ }
+ }
+ }
+ return editorConfiguration;
+ }
+
+ /**
+ * finds if an editor for specific language and object is available to edit type
+ *
+ * @param language
+ * the language to edit
+ * @param objectToEdit
+ * the object to edit
+ * @return <code>true</code> if an editor exists
+ *
+ * @deprecated Use {@link #hasSpecificEditorConfiguration(String language, EObject eObjectToEdit)} instead
+ */
+ @Deprecated
+ public static boolean hasSpecificEditorConfiguration(String language, String objectToEdit) {
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ final String lang = directEditorExtensionPoint.getLanguage();
+ final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
+ if (lang.equals(language) && oToEdit.equals(objectToEdit)) {
+ // extension point found!
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * finds if an editor for specific language and object is available to edit type
+ *
+ * @param language
+ * the language to edit
+ * @param semanticObjectToEdit
+ * the semantic object to edit
+ * @param selectedElement
+ * The real selected element (e.g. widget, edit part, ...)
+ * @return <code>true</code> if an editor exists
+ */
+ public static boolean hasSpecificEditorConfiguration(String language, Object semanticObjectToEdit, Object selectedElement) {
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ final String lang = directEditorExtensionPoint.getLanguage();
+ final Class<? extends EObject> classToEdit = directEditorExtensionPoint.getObjectClassToEdit();
+ if (lang.equals(language) && classToEdit.isInstance(semanticObjectToEdit)) {
+ IDirectEditorConstraint constraint = directEditorExtensionPoint.getAdditionalConstraint();
+ if (constraint == null || constraint.appliesTo(selectedElement)) {
+ // extension point found!
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * finds if an editor for specific object is available to edit type
+ *
+ * @param language
+ * the language to edit
+ * @param objectToEdit
+ * the type of object to edit
+ * @return <code>true</code> if an editor exists
+ *
+ * @deprecated Use {@link #hasSpecificEditorConfiguration(EObject)} instead
+ */
+ @Deprecated
+ public static boolean hasSpecificEditorConfiguration(String objectToEdit) {
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
+ if (oToEdit.equals(objectToEdit)) {
+ // extension point found!
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * finds if an editor for specific object is available to edit type
+ *
+ * @param language
+ * the language to edit
+ * @param semanticObjectToEdit
+ * the semantic object to edit
+ * @param selectedElement
+ * The real selected element (e.g. widget, edit part, ...)
+ * @return <code>true</code> if an editor exists
+ */
+ public static boolean hasSpecificEditorConfiguration(Object semanticObjectToEdit, Object selectedElement) {
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ final Class<? extends EObject> classToEdit = directEditorExtensionPoint.getObjectClassToEdit();
+ if (classToEdit.isInstance(semanticObjectToEdit)) {
+ IDirectEditorConstraint constraint = directEditorExtensionPoint.getAdditionalConstraint();
+ if (constraint == null || constraint.appliesTo(selectedElement)) {
+ // extension point found!
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Retrieves the preferred editor configuration for the specified type
+ *
+ * @param class_
+ * the type of element to edit
+ * @return the preferred editor configuration for the specified type or <code>null</code>
+ */
+ public static IDirectEditorExtensionPoint getDefautDirectEditorConfiguration(Object semanticObjectToEdit, Object selectedObject) {
+ // retrieves preference for this element
+ String language = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + semanticObjectToEdit.getClass().asSubclass(EObject.class));
+ if (language == null || IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(language)) {
+ return null;
+ }
+ IDirectEditorExtensionPoint currentConfiguration = null;
+ int currentPriority = UNKNOWN_PRIORITY;
+ Collection<IDirectEditorExtensionPoint> configs = getDirectEditorConfigurations(semanticObjectToEdit, selectedObject);
+
+ for (IDirectEditorExtensionPoint extensionPoint : configs) {
+ if (language.equals(extensionPoint.getLanguage()) && extensionPoint.getPriority() < currentPriority) {
+ currentConfiguration = extensionPoint;
+ currentPriority = extensionPoint.getPriority();
+ }
+ }
+
+ return currentConfiguration;
+ }
+
+ /**
+ * Returns the set of transformations registered in the platform for the specified kind of
+ * element
+ *
+ * @param the
+ * type of element to be edited
+ * @return the set of transformations registered in the platform for the specified kind of
+ * element
+ */
+ public static Collection<IDirectEditorExtensionPoint> getDirectEditorConfigurations(Object semanticObjectToEdit, Object selectedObject) {
+ // list of configuration to be returned. They correspond to
+ // configuration to edit the
+ // specified type
+ final List<IDirectEditorExtensionPoint> elementConfigurations = new ArrayList<IDirectEditorExtensionPoint>();
+
+ // check each configuration in the platform and select corresponding
+ // ones.
+ for (IDirectEditorExtensionPoint configuration : DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations()) {
+ // both class are compatibles ?
+ if (configuration.getObjectClassToEdit() != null) {
+ if (configuration.getObjectClassToEdit().isInstance(semanticObjectToEdit)) {
+ IDirectEditorConstraint constraint = configuration.getAdditionalConstraint();
+ if (constraint == null || constraint.appliesTo(selectedObject))
+ elementConfigurations.add(configuration);
+ }
+ }
+ }
+ return elementConfigurations;
+ }
+
+ /**
+ * Finds a editor for specific language and object to edit type with the higher priority.
+ *
+ * @param language
+ * the language to edit
+ * @param objectToEdit
+ * the type of object to edit
+ * @return the extension point proxy that manages this kind of editor
+ */
+ public static IDirectEditorConfiguration findEditorConfigurationWithPriority(String language, String objectToEdit) {
+ IDirectEditorConfiguration result = null;
+ int currentPrority = UNKNOWN_PRIORITY;
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ final String lang = directEditorExtensionPoint.getLanguage();
+ final String oToEdit = directEditorExtensionPoint.getObjectToEdit();
+ if (lang.equals(language) && oToEdit.equals(objectToEdit)) {
+ // extension point found!
+ int directEditorExtensionPointPriority = directEditorExtensionPoint.getPriority() != null ? directEditorExtensionPoint.getPriority() : UNKNOWN_PRIORITY;
+ if (result == null || (directEditorExtensionPointPriority < currentPrority)) {
+ result = directEditorExtensionPoint.getDirectEditorConfiguration();
+ currentPrority = directEditorExtensionPointPriority;
+ }
+ }
+ }
+ return result != null ? result : new DefaultDirectEditorConfiguration();
+ }
+
+ /**
+ * returns the list of languages that are available from extension points
+ *
+ * @return the list of languages that have an extended editor
+ */
+ public static List<String> getLanguages(String objectToEdit) {
+ List<String> languages = new ArrayList<String>();
+ IDirectEditorExtensionPoint[] extensionPoints = DirectEditorExtensionPoint.getInstance().getDirectEditorConfigurations();
+ for (IDirectEditorExtensionPoint directEditorExtensionPoint : extensionPoints) {
+ if (objectToEdit == null || directEditorExtensionPoint.getObjectToEdit().equals(objectToEdit)) {
+ String lang = directEditorExtensionPoint.getLanguage();
+ if (!languages.contains(lang)) {
+ languages.add(lang);
+ }
+ }
+ }
+ return languages;
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/IDirectEditorsIds.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/IDirectEditorsIds.java
index ede255078f8..98c677c4c00 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/IDirectEditorsIds.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/utils/IDirectEditorsIds.java
@@ -1,34 +1,34 @@
-/*****************************************************************************
- * Copyright (c) 2008 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:
- * Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.extensionpoints.editors.utils;
-
-/**
- * Ids and constants for the editors extension point plugin
- */
-public interface IDirectEditorsIds {
-
- /** Constant for the UML language */
- public final String UML_LANGUAGE = "Papyrus UML";
-
- /** Constant for the SysML language */
- public final String SYSML_LANGUAGE = "Papyrus SysML";
-
- /** Constant for the direct editors */
- public static final String SIMPLE_DIRECT_EDITOR = "Simple Direct Editor"; //$NON-NLS-1$
-
- /** constant for preferences */
- public static final String EDITOR_FOR_ELEMENT = "papyrus.directeditor.";
-
-}
+/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Remi Schnekenburger (CEA LIST) Remi.Schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.extensionpoints.editors.utils;
+
+/**
+ * Ids and constants for the editors extension point plugin
+ */
+public interface IDirectEditorsIds {
+
+ /** Constant for the UML language */
+ public final String UML_LANGUAGE = "Papyrus UML";
+
+ /** Constant for the SysML language */
+ public final String SYSML_LANGUAGE = "Papyrus SysML";
+
+ /** Constant for the direct editors */
+ public static final String SIMPLE_DIRECT_EDITOR = "Simple Direct Editor"; //$NON-NLS-1$
+
+ /** constant for preferences */
+ public static final String EDITOR_FOR_ELEMENT = "papyrus.directeditor.";
+
+}

Back to the top