diff options
author | Quentin Le Menez | 2018-01-09 10:09:46 +0000 |
---|---|---|
committer | Quentin Le Menez | 2018-01-09 13:18:15 +0000 |
commit | d98116b5b376f18b6cf626ba4158a35fe9a4a64e (patch) | |
tree | 4458c9c5ada0a216b385813a56ea9a9b8c7b6509 /plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties | |
parent | 453e99bc2dcbd5fabad100f9d0d5f682013c3b19 (diff) | |
download | org.eclipse.papyrus-d98116b5b376f18b6cf626ba4158a35fe9a4a64e.tar.gz org.eclipse.papyrus-d98116b5b376f18b6cf626ba4158a35fe9a4a64e.tar.xz org.eclipse.papyrus-d98116b5b376f18b6cf626ba4158a35fe9a4a64e.zip |
Bug 515367 - [releng] Uniformization of the end of lines to Unix standard
- Format the EOL of all the files matched by: grep -rIUs . | xargs -Ifile dos2unix -k 'file'
Change-Id: I5c41d540a9a67b50de9b912ab35e16cc9a912961
Signed-off-by: Quentin Le Menez <quentin.lemenez@cea.fr>
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties')
19 files changed, 1310 insertions, 1310 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/Activator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/Activator.java index 0d33f31bdd3..53efb034187 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/Activator.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/Activator.java @@ -1,74 +1,74 @@ -/*****************************************************************************
- * 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.properties;
-
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-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.infra.gmfdiag.properties"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * This plug-in's LogHelper
- */
- 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;
- log = new LogHelper(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
+/***************************************************************************** + * 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: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.properties; + +import org.eclipse.papyrus.infra.core.log.LogHelper; +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.infra.gmfdiag.properties"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * This plug-in's LogHelper + */ + 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; + log = new LogHelper(this); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/AppearanceConstraint.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/AppearanceConstraint.java index 342554d9970..ef925063cdf 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/AppearanceConstraint.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/AppearanceConstraint.java @@ -1,101 +1,101 @@ -/*****************************************************************************
- * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others.
- *
- * 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Christian W. Damus - bug 485220
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.properties.constraint;
-
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.papyrus.infra.constraints.ConstraintDescriptor;
-import org.eclipse.papyrus.infra.constraints.DisplayUnit;
-import org.eclipse.papyrus.infra.constraints.constraints.Constraint;
-import org.eclipse.papyrus.infra.gmfdiag.properties.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.properties.extension.StyleHandlerManager;
-import org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.StyleHandlerProvider;
-
-/**
- * A constraint matching an Object on which the Appearance properties can
- * be applied. This constraint dispatches
- *
- * @author Camille Letavernier
- */
-public class AppearanceConstraint implements Constraint {
-
- private final List<Constraint> constraints;
-
- private DisplayUnit display;
-
- private ConstraintDescriptor descriptor;
-
- public AppearanceConstraint() {
- constraints = new LinkedList<Constraint>();
- for (StyleHandlerProvider provider : StyleHandlerManager.instance.getStyleHandlerProviders()) {
- try {
- Constraint constraint = provider.createConstraint();
- if (constraint == null) {
- Activator.log.warn("StyleHandlerProvider " + provider.getClass().getName() + " provided an invalid Constraint");
- } else {
- constraints.add(constraint);
- }
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- }
- }
-
- public boolean overrides(Constraint constraint) {
- // Unsupported. The appearance property view constraints are not automatically overrideable
- return false;
- }
-
- public boolean match(Collection<?> selection) {
- for (Constraint constraint : constraints) {
- if (constraint.match(selection)) {
- return true;
- }
- }
- return false;
- }
-
- public void setConstraintDescriptor(ConstraintDescriptor descriptor) {
- this.descriptor = descriptor;
- display = getDisplay(descriptor);
-
- for (Constraint constraint : constraints) {
- try {
- constraint.setConstraintDescriptor(descriptor);
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- }
- }
-
- public DisplayUnit getDisplayUnit() {
- return display;
- }
-
- private DisplayUnit getDisplay(ConstraintDescriptor descriptor) {
- if (descriptor.getDisplay() == null) {
- if (descriptor.eContainer() instanceof ConstraintDescriptor) {
- return getDisplay((ConstraintDescriptor) descriptor.eContainer());
- }
- }
- return descriptor.getDisplay();
- }
-
- public ConstraintDescriptor getDescriptor() {
- return descriptor;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others. + * + * 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: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.properties.constraint; + +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; + +import org.eclipse.papyrus.infra.constraints.ConstraintDescriptor; +import org.eclipse.papyrus.infra.constraints.DisplayUnit; +import org.eclipse.papyrus.infra.constraints.constraints.Constraint; +import org.eclipse.papyrus.infra.gmfdiag.properties.Activator; +import org.eclipse.papyrus.infra.gmfdiag.properties.extension.StyleHandlerManager; +import org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.StyleHandlerProvider; + +/** + * A constraint matching an Object on which the Appearance properties can + * be applied. This constraint dispatches + * + * @author Camille Letavernier + */ +public class AppearanceConstraint implements Constraint { + + private final List<Constraint> constraints; + + private DisplayUnit display; + + private ConstraintDescriptor descriptor; + + public AppearanceConstraint() { + constraints = new LinkedList<Constraint>(); + for (StyleHandlerProvider provider : StyleHandlerManager.instance.getStyleHandlerProviders()) { + try { + Constraint constraint = provider.createConstraint(); + if (constraint == null) { + Activator.log.warn("StyleHandlerProvider " + provider.getClass().getName() + " provided an invalid Constraint"); + } else { + constraints.add(constraint); + } + } catch (Exception ex) { + Activator.log.error(ex); + } + } + } + + public boolean overrides(Constraint constraint) { + // Unsupported. The appearance property view constraints are not automatically overrideable + return false; + } + + public boolean match(Collection<?> selection) { + for (Constraint constraint : constraints) { + if (constraint.match(selection)) { + return true; + } + } + return false; + } + + public void setConstraintDescriptor(ConstraintDescriptor descriptor) { + this.descriptor = descriptor; + display = getDisplay(descriptor); + + for (Constraint constraint : constraints) { + try { + constraint.setConstraintDescriptor(descriptor); + } catch (Exception ex) { + Activator.log.error(ex); + } + } + } + + public DisplayUnit getDisplayUnit() { + return display; + } + + private DisplayUnit getDisplay(ConstraintDescriptor descriptor) { + if (descriptor.getDisplay() == null) { + if (descriptor.eContainer() instanceof ConstraintDescriptor) { + return getDisplay((ConstraintDescriptor) descriptor.eContainer()); + } + } + return descriptor.getDisplay(); + } + + public ConstraintDescriptor getDescriptor() { + return descriptor; + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/GMFNotationConstraint.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/GMFNotationConstraint.java index 9d90e9a5c1e..f21f3a07ade 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/GMFNotationConstraint.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/GMFNotationConstraint.java @@ -1,39 +1,39 @@ -/*****************************************************************************
- * Copyright (c) 2011 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.properties.constraint;
-
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.constraints.constraints.EMFInstanceOfConstraint;
-import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
-
-/**
- * A constraint for the GMF Notation metamodel
- * Retrieves the notation model from the selection,
- * then applies an EMFInstanceOfConstraint on the resulting
- * EObject
- *
- * @author Camille Letavernier
- *
- */
-public class GMFNotationConstraint extends EMFInstanceOfConstraint {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean match(Object selection) {
- View view = NotationHelper.findView(selection);
-
- return view == null ? false : super.match(view);
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2011 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: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.properties.constraint; + +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.constraints.constraints.EMFInstanceOfConstraint; +import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper; + +/** + * A constraint for the GMF Notation metamodel + * Retrieves the notation model from the selection, + * then applies an EMFInstanceOfConstraint on the resulting + * EObject + * + * @author Camille Letavernier + * + */ +public class GMFNotationConstraint extends EMFInstanceOfConstraint { + + /** + * {@inheritDoc} + */ + @Override + public boolean match(Object selection) { + View view = NotationHelper.findView(selection); + + return view == null ? false : super.match(view); + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/HasEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/HasEditPolicy.java index e8368db3517..f40a1798c9a 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/HasEditPolicy.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/HasEditPolicy.java @@ -1,68 +1,68 @@ -/*****************************************************************************
- * Copyright (c) 2011, 2015 CEA LIST, Christian W. Damus, and others.
- *
- * 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Christian W. Damus - bug 433206
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.properties.constraint;
-
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.papyrus.infra.constraints.SimpleConstraint;
-import org.eclipse.papyrus.infra.constraints.constraints.AbstractConstraint;
-import org.eclipse.papyrus.infra.constraints.constraints.Constraint;
-
-import com.google.common.base.Objects;
-
-/**
- *
- * A constraint to test whether an object has the given EditPolicy or not
- *
- * @author Camille Letavernier
- *
- */
-public class HasEditPolicy extends AbstractConstraint {
-
- /**
- * The ID of the edit policy to look for
- */
- protected String editPolicyID;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean match(Object selection) {
- if (editPolicyID != null && selection instanceof GraphicalEditPart) {
- return ((GraphicalEditPart) selection).getEditPolicy(editPolicyID) != null;
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setDescriptor(SimpleConstraint descriptor) {
- editPolicyID = getValue("editPolicy"); //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean equivalent(Constraint constraint) {
- if (constraint == null) {
- return false;
- }
-
- return constraint instanceof HasEditPolicy && Objects.equal(((HasEditPolicy) constraint).editPolicyID, editPolicyID);
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2011, 2015 CEA LIST, Christian W. Damus, and others. + * + * 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: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 433206 + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.properties.constraint; + +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.papyrus.infra.constraints.SimpleConstraint; +import org.eclipse.papyrus.infra.constraints.constraints.AbstractConstraint; +import org.eclipse.papyrus.infra.constraints.constraints.Constraint; + +import com.google.common.base.Objects; + +/** + * + * A constraint to test whether an object has the given EditPolicy or not + * + * @author Camille Letavernier + * + */ +public class HasEditPolicy extends AbstractConstraint { + + /** + * The ID of the edit policy to look for + */ + protected String editPolicyID; + + /** + * {@inheritDoc} + */ + @Override + public boolean match(Object selection) { + if (editPolicyID != null && selection instanceof GraphicalEditPart) { + return ((GraphicalEditPart) selection).getEditPolicy(editPolicyID) != null; + } + + return false; + } + + /** + * {@inheritDoc} + */ + @Override + protected void setDescriptor(SimpleConstraint descriptor) { + editPolicyID = getValue("editPolicy"); //$NON-NLS-1$ + } + + /** + * {@inheritDoc} + */ + @Override + protected boolean equivalent(Constraint constraint) { + if (constraint == null) { + return false; + } + + return constraint instanceof HasEditPolicy && Objects.equal(((HasEditPolicy) constraint).editPolicyID, editPolicyID); + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsDecorableElementConstraint.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsDecorableElementConstraint.java index ca1aa292aae..087e099114f 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsDecorableElementConstraint.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsDecorableElementConstraint.java @@ -1,61 +1,61 @@ -/*****************************************************************************
- * Copyright (c) 2011 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.infra.gmfdiag.properties.constraint;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.gmf.runtime.notation.DescriptionStyle;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.constraints.constraints.AbstractConstraint;
-import org.eclipse.papyrus.infra.constraints.constraints.Constraint;
-
-//import org.eclipse.papyrus.infra.gmfdiag.common.providers.ShapeDecorator;
-
-
-/**
- * Constraint that test if selection can be decorated
- */
-public class IsDecorableElementConstraint extends AbstractConstraint {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean match(Object selection) {
- if (selection instanceof IAdaptable) {
- View node = (View) ((IAdaptable) selection).getAdapter(View.class);
- if (node != null && !(node instanceof Diagram)) {
- DescriptionStyle descStyle = (DescriptionStyle) node.getStyle(NotationPackage.eINSTANCE.getDescriptionStyle());
- if (descStyle != null) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean equivalent(Constraint constraint) {
- if (constraint == null) {
- return false;
- }
-
- return constraint instanceof IsDecorableElementConstraint;
- }
-}
+/***************************************************************************** + * Copyright (c) 2011 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.infra.gmfdiag.properties.constraint; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.gmf.runtime.notation.DescriptionStyle; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.constraints.constraints.AbstractConstraint; +import org.eclipse.papyrus.infra.constraints.constraints.Constraint; + +//import org.eclipse.papyrus.infra.gmfdiag.common.providers.ShapeDecorator; + + +/** + * Constraint that test if selection can be decorated + */ +public class IsDecorableElementConstraint extends AbstractConstraint { + + /** + * {@inheritDoc} + */ + @Override + public boolean match(Object selection) { + if (selection instanceof IAdaptable) { + View node = (View) ((IAdaptable) selection).getAdapter(View.class); + if (node != null && !(node instanceof Diagram)) { + DescriptionStyle descStyle = (DescriptionStyle) node.getStyle(NotationPackage.eINSTANCE.getDescriptionStyle()); + if (descStyle != null) { + return true; + } + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + @Override + protected boolean equivalent(Constraint constraint) { + if (constraint == null) { + return false; + } + + return constraint instanceof IsDecorableElementConstraint; + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsEditPartConstraint.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsEditPartConstraint.java index 5b71aefd735..4d15407f71b 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsEditPartConstraint.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsEditPartConstraint.java @@ -1,42 +1,42 @@ -/*****************************************************************************
- * Copyright (c) 2011 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.properties.constraint;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.papyrus.infra.constraints.constraints.AbstractConstraint;
-import org.eclipse.papyrus.infra.constraints.constraints.Constraint;
-
-/**
- * Tests if the selection is an EditPart (Excluding DiagramEditPart)
- *
- * @author Camille Letavernier
- */
-public class IsEditPartConstraint extends AbstractConstraint {
-
- @Override
- public boolean match(Object selection) {
- return selection instanceof EditPart && !(selection instanceof DiagramEditPart);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean equivalent(Constraint constraint) {
- // TODO : This should probably not always be false
- // Potential issue : the CompositeConstraint won't be able to
- // automatically find the overriding constraints
- return false;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2011 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: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.properties.constraint; + +import org.eclipse.gef.EditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; +import org.eclipse.papyrus.infra.constraints.constraints.AbstractConstraint; +import org.eclipse.papyrus.infra.constraints.constraints.Constraint; + +/** + * Tests if the selection is an EditPart (Excluding DiagramEditPart) + * + * @author Camille Letavernier + */ +public class IsEditPartConstraint extends AbstractConstraint { + + @Override + public boolean match(Object selection) { + return selection instanceof EditPart && !(selection instanceof DiagramEditPart); + } + + /** + * {@inheritDoc} + */ + @Override + protected boolean equivalent(Constraint constraint) { + // TODO : This should probably not always be false + // Potential issue : the CompositeConstraint won't be able to + // automatically find the overriding constraints + return false; + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsSingleDiagramEditorConstraint.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsSingleDiagramEditorConstraint.java index df8c9b4013e..7e413e1f414 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsSingleDiagramEditorConstraint.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/constraint/IsSingleDiagramEditorConstraint.java @@ -1,42 +1,42 @@ -/*****************************************************************************
- * Copyright (c) 2013 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.infra.gmfdiag.properties.constraint;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.papyrus.infra.constraints.constraints.JavaQuery;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
-
-/**
- *
- * A constraint to know if we are able to get a diagram editor from the selection
- *
- */
-public class IsSingleDiagramEditorConstraint implements JavaQuery {
-
-
- /**
- *
- * @see org.eclipse.papyrus.infra.constraints.constraints.JavaQuery#match(java.lang.Object)
- *
- * @param selection
- * @return
- */
- public boolean match(Object selection) {
- if (selection instanceof EditPart) {
- return DiagramEditPartsUtil.getDiagramWorkspacePreferenceStore((EditPart) selection) != null;
- }
- return false;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2013 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.infra.gmfdiag.properties.constraint; + +import org.eclipse.gef.EditPart; +import org.eclipse.papyrus.infra.constraints.constraints.JavaQuery; +import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil; + +/** + * + * A constraint to know if we are able to get a diagram editor from the selection + * + */ +public class IsSingleDiagramEditorConstraint implements JavaQuery { + + + /** + * + * @see org.eclipse.papyrus.infra.constraints.constraints.JavaQuery#match(java.lang.Object) + * + * @param selection + * @return + */ + public boolean match(Object selection) { + if (selection instanceof EditPart) { + return DiagramEditPartsUtil.getDiagramWorkspacePreferenceStore((EditPart) selection) != null; + } + return false; + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/AbstractDiagramPreferencesObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/AbstractDiagramPreferencesObservableValue.java index 0ba3a861e14..5c8e27e7192 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/AbstractDiagramPreferencesObservableValue.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/AbstractDiagramPreferencesObservableValue.java @@ -1,103 +1,103 @@ -/*****************************************************************************
- * Copyright (c) 2013 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.infra.gmfdiag.properties.databinding;
-
-import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
-import org.eclipse.core.databinding.observable.value.ValueDiff;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-/**
- *
- * This observable value listen the preference store to send event and refresh itself when a preferences has changed
- *
- */
-public abstract class AbstractDiagramPreferencesObservableValue extends AbstractObservableValue {
-
- /**
- * the name of the edited preference
- */
- private String preferenceName;
-
- /**
- * the edited preference store
- */
- private IPreferenceStore editedPreferenceStore;
-
- /**
- * the listener on the preference store used to force refresh
- */
- private IPropertyChangeListener listener;
-
- /**
- *
- * Constructor.
- *
- * @param diagram
- * the diagram for which we re editing a preference
- * @param preferenceName
- * the name of edited the preference
- */
- public AbstractDiagramPreferencesObservableValue(final Diagram diagram, final String preferenceName, final IPreferenceStore editedPreferenceStore) {
- this.preferenceName = preferenceName;
- this.editedPreferenceStore = editedPreferenceStore;
- this.editedPreferenceStore.addPropertyChangeListener(this.listener = new IPropertyChangeListener() {
-
- public void propertyChange(final PropertyChangeEvent event) {
- if (getEditedPreference().equals(event.getProperty())) {
- ValueDiff diff = new ValueDiff() {
-
- @Override
- public Object getOldValue() {
- return event.getOldValue();
- }
-
- @Override
- public Object getNewValue() {
- return event.getNewValue();
- }
- };
- fireValueChange(diff);
- }
- }
- });
- }
-
-
- @Override
- public synchronized void dispose() {
- super.dispose();
- this.editedPreferenceStore.removePropertyChangeListener(this.listener);
- }
-
- /**
- *
- * @return
- * the edited preferences
- */
- public final String getEditedPreference() {
- return this.preferenceName;
- }
-
- /**
- *
- * @return
- * the edited preference store
- */
- public final IPreferenceStore getEditedPreferenceStore() {
- return this.editedPreferenceStore;
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 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.infra.gmfdiag.properties.databinding; + +import org.eclipse.core.databinding.observable.value.AbstractObservableValue; +import org.eclipse.core.databinding.observable.value.ValueDiff; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; + +/** + * + * This observable value listen the preference store to send event and refresh itself when a preferences has changed + * + */ +public abstract class AbstractDiagramPreferencesObservableValue extends AbstractObservableValue { + + /** + * the name of the edited preference + */ + private String preferenceName; + + /** + * the edited preference store + */ + private IPreferenceStore editedPreferenceStore; + + /** + * the listener on the preference store used to force refresh + */ + private IPropertyChangeListener listener; + + /** + * + * Constructor. + * + * @param diagram + * the diagram for which we re editing a preference + * @param preferenceName + * the name of edited the preference + */ + public AbstractDiagramPreferencesObservableValue(final Diagram diagram, final String preferenceName, final IPreferenceStore editedPreferenceStore) { + this.preferenceName = preferenceName; + this.editedPreferenceStore = editedPreferenceStore; + this.editedPreferenceStore.addPropertyChangeListener(this.listener = new IPropertyChangeListener() { + + public void propertyChange(final PropertyChangeEvent event) { + if (getEditedPreference().equals(event.getProperty())) { + ValueDiff diff = new ValueDiff() { + + @Override + public Object getOldValue() { + return event.getOldValue(); + } + + @Override + public Object getNewValue() { + return event.getNewValue(); + } + }; + fireValueChange(diff); + } + } + }); + } + + + @Override + public synchronized void dispose() { + super.dispose(); + this.editedPreferenceStore.removePropertyChangeListener(this.listener); + } + + /** + * + * @return + * the edited preferences + */ + public final String getEditedPreference() { + return this.preferenceName; + } + + /** + * + * @return + * the edited preference store + */ + public final IPreferenceStore getEditedPreferenceStore() { + return this.editedPreferenceStore; + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/BooleanDiagramViewObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/BooleanDiagramViewObservableValue.java index 88724629823..1edc98022a4 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/BooleanDiagramViewObservableValue.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/BooleanDiagramViewObservableValue.java @@ -1,79 +1,79 @@ -/*****************************************************************************
- * Copyright (c) 2013 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.infra.gmfdiag.properties.databinding;
-
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-/**
- *
- * Class used to edit boolean preference
- *
- */
-public class BooleanDiagramViewObservableValue extends AbstractDiagramPreferencesObservableValue {
-
- /**
- *
- * Constructor.
- *
- * @param diagram
- * the edited diagram
- * @param preferenceName
- * the edited preference
- * @param preferenceStore
- * the edited preference store
- */
- public BooleanDiagramViewObservableValue(final Diagram diagram, final String preferenceName, IPreferenceStore preferenceStore) {
- super(diagram, preferenceName, preferenceStore);
- }
-
- /**
- *
- * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType()
- *
- * @return
- */
- public final Object getValueType() {
- return EcorePackage.eINSTANCE.getEBoolean();
- }
-
- /**
- *
- * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue()
- *
- * @return
- */
- @Override
- protected final Object doGetValue() {
- final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore();
- return wsPreferenceStore.getBoolean(getEditedPreference());
- }
-
- /**
- *
- * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object)
- *
- * @param value
- */
- @Override
- protected void doSetValue(Object value) {
- if (value instanceof Boolean) {
- final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore();
- wsPreferenceStore.setValue(getEditedPreference(), ((Boolean) value).booleanValue());
- }
- }
-
-
-}
+/***************************************************************************** + * Copyright (c) 2013 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.infra.gmfdiag.properties.databinding; + +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * + * Class used to edit boolean preference + * + */ +public class BooleanDiagramViewObservableValue extends AbstractDiagramPreferencesObservableValue { + + /** + * + * Constructor. + * + * @param diagram + * the edited diagram + * @param preferenceName + * the edited preference + * @param preferenceStore + * the edited preference store + */ + public BooleanDiagramViewObservableValue(final Diagram diagram, final String preferenceName, IPreferenceStore preferenceStore) { + super(diagram, preferenceName, preferenceStore); + } + + /** + * + * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType() + * + * @return + */ + public final Object getValueType() { + return EcorePackage.eINSTANCE.getEBoolean(); + } + + /** + * + * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue() + * + * @return + */ + @Override + protected final Object doGetValue() { + final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore(); + return wsPreferenceStore.getBoolean(getEditedPreference()); + } + + /** + * + * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object) + * + * @param value + */ + @Override + protected void doSetValue(Object value) { + if (value instanceof Boolean) { + final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore(); + wsPreferenceStore.setValue(getEditedPreference(), ((Boolean) value).booleanValue()); + } + } + + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/DoubleDiagramViewObservaleValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/DoubleDiagramViewObservaleValue.java index 58f7ef22c18..651dfb4d955 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/DoubleDiagramViewObservaleValue.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/DoubleDiagramViewObservaleValue.java @@ -1,83 +1,83 @@ -package org.eclipse.papyrus.infra.gmfdiag.properties.databinding;
-
-import org.eclipse.core.databinding.observable.value.ValueDiff;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-/**
- *
- * Class used to edit double preferences
- *
- */
-public class DoubleDiagramViewObservaleValue extends AbstractDiagramPreferencesObservableValue {
-
- /**
- *
- * Constructor.
- *
- * @param diagram
- * the edited diagram
- * @param preferenceName
- * the edited preference
- * @param store
- * the edited preference store
- */
- public DoubleDiagramViewObservaleValue(final Diagram diagram, final String preferenceName, final IPreferenceStore store) {
- super(diagram, preferenceName, store);
- }
-
- /**
- *
- * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType()
- *
- * @return
- */
- public final Object getValueType() {
- return EcorePackage.eINSTANCE.getEFloat();
- }
-
- /**
- *
- * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue()
- *
- * @return
- */
- @Override
- protected Object doGetValue() {
- final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore();
- return wsPreferenceStore.getDouble(getEditedPreference());
- }
-
- /**
- *
- * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object)
- *
- * @param value
- */
- @Override
- protected void doSetValue(final Object value) {
- if (value instanceof Float) {
- final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore();
- final double oldValue = (Double) doGetValue();
- wsPreferenceStore.setValue(getEditedPreference(), ((Float) value).doubleValue());
- final ValueDiff diff = new ValueDiff() {
-
- @Override
- public Object getOldValue() {
- return oldValue;
- }
-
- @Override
- public Object getNewValue() {
- return ((Float) value).doubleValue();
- }
- };
- fireValueChange(diff);
- }
- }
-
-
-
-
-}
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding; + +import org.eclipse.core.databinding.observable.value.ValueDiff; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * + * Class used to edit double preferences + * + */ +public class DoubleDiagramViewObservaleValue extends AbstractDiagramPreferencesObservableValue { + + /** + * + * Constructor. + * + * @param diagram + * the edited diagram + * @param preferenceName + * the edited preference + * @param store + * the edited preference store + */ + public DoubleDiagramViewObservaleValue(final Diagram diagram, final String preferenceName, final IPreferenceStore store) { + super(diagram, preferenceName, store); + } + + /** + * + * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType() + * + * @return + */ + public final Object getValueType() { + return EcorePackage.eINSTANCE.getEFloat(); + } + + /** + * + * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue() + * + * @return + */ + @Override + protected Object doGetValue() { + final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore(); + return wsPreferenceStore.getDouble(getEditedPreference()); + } + + /** + * + * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object) + * + * @param value + */ + @Override + protected void doSetValue(final Object value) { + if (value instanceof Float) { + final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore(); + final double oldValue = (Double) doGetValue(); + wsPreferenceStore.setValue(getEditedPreference(), ((Float) value).doubleValue()); + final ValueDiff diff = new ValueDiff() { + + @Override + public Object getOldValue() { + return oldValue; + } + + @Override + public Object getNewValue() { + return ((Float) value).doubleValue(); + } + }; + fireValueChange(diff); + } + } + + + + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/GradientDataObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/GradientDataObservableValue.java index b2fafd21d2a..16f03aaa25b 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/GradientDataObservableValue.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/GradientDataObservableValue.java @@ -1,123 +1,123 @@ -/*****************************************************************************
- * Copyright (c) 2011 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.properties.databinding;
-
-import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
-import org.eclipse.gmf.runtime.notation.datatype.GradientData;
-
-/**
- * An ObservableValue for GradientData
- * The GradientData is not a pure EMF object
- *
- * @author Camille Letavernier
- */
-public class GradientDataObservableValue extends AbstractObservableValue {
-
- private GradientData data;
-
- private GradientProperty property;
-
- /**
- *
- * Constructor.
- *
- * @param data
- * The GradientData to observe
- * @param property
- * The name of the property to observe
- */
- public GradientDataObservableValue(GradientData data, String property) {
- this.data = data;
- this.property = GradientProperty.valueOf(property);
- }
-
- public Object getValueType() {
- return Object.class;
- }
-
- @Override
- protected Object doGetValue() {
- if (data == null) {
- return null;
- }
-
- switch (property) {
- case gradientColor1:
- return data.getGradientColor1();
- case gradientColor2:
- return data.getGradientColor2();
- case gradientStyle:
- return data.getGradientStyle();
- case activate:
- if (data instanceof ObservableGradientData) {
- return ((ObservableGradientData) data).getActivate();
- } else {
- return true;
- }
- }
-
- return null;
- }
-
- @Override
- protected void doSetValue(Object value) {
- if (data == null) {
- return;
- }
-
- switch (property) {
- case gradientColor1:
- data.setGradientColor1((Integer) value);
- break;
- case gradientColor2:
- data.setGradientColor2((Integer) value);
- break;
- case gradientStyle:
- data.setGradientStyle((Integer) value);
- break;
- case activate:
- if (data instanceof ObservableGradientData) {
- ((ObservableGradientData) data).setActivate((Boolean) value);
- }
- }
- }
-
- /**
- * The list of properties that can be used by the GradientDataObservableValue
- *
- * @author Camille Letavernier
- */
- public static enum GradientProperty {
- /**
- * The gradientColor2 property
- * (In Papyrus diagrams, it is actually the fillColor that is used
- * instead of the gradientColor2)
- */
- gradientColor2,
-
- /**
- * The gradientColor1 property
- */
- gradientColor1,
-
- /**
- * The gradientStyle property (Vertical or Horizontal)
- */
- gradientStyle,
-
- /**
- * Whether the gradient is activated or not
- */
- activate
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2011 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: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.properties.databinding; + +import org.eclipse.core.databinding.observable.value.AbstractObservableValue; +import org.eclipse.gmf.runtime.notation.datatype.GradientData; + +/** + * An ObservableValue for GradientData + * The GradientData is not a pure EMF object + * + * @author Camille Letavernier + */ +public class GradientDataObservableValue extends AbstractObservableValue { + + private GradientData data; + + private GradientProperty property; + + /** + * + * Constructor. + * + * @param data + * The GradientData to observe + * @param property + * The name of the property to observe + */ + public GradientDataObservableValue(GradientData data, String property) { + this.data = data; + this.property = GradientProperty.valueOf(property); + } + + public Object getValueType() { + return Object.class; + } + + @Override + protected Object doGetValue() { + if (data == null) { + return null; + } + + switch (property) { + case gradientColor1: + return data.getGradientColor1(); + case gradientColor2: + return data.getGradientColor2(); + case gradientStyle: + return data.getGradientStyle(); + case activate: + if (data instanceof ObservableGradientData) { + return ((ObservableGradientData) data).getActivate(); + } else { + return true; + } + } + + return null; + } + + @Override + protected void doSetValue(Object value) { + if (data == null) { + return; + } + + switch (property) { + case gradientColor1: + data.setGradientColor1((Integer) value); + break; + case gradientColor2: + data.setGradientColor2((Integer) value); + break; + case gradientStyle: + data.setGradientStyle((Integer) value); + break; + case activate: + if (data instanceof ObservableGradientData) { + ((ObservableGradientData) data).setActivate((Boolean) value); + } + } + } + + /** + * The list of properties that can be used by the GradientDataObservableValue + * + * @author Camille Letavernier + */ + public static enum GradientProperty { + /** + * The gradientColor2 property + * (In Papyrus diagrams, it is actually the fillColor that is used + * instead of the gradientColor2) + */ + gradientColor2, + + /** + * The gradientColor1 property + */ + gradientColor1, + + /** + * The gradientStyle property (Vertical or Horizontal) + */ + gradientStyle, + + /** + * Whether the gradient is activated or not + */ + activate + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/IntegerDiagramViewObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/IntegerDiagramViewObservableValue.java index f5d49660741..790d96d8bf8 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/IntegerDiagramViewObservableValue.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/IntegerDiagramViewObservableValue.java @@ -1,79 +1,79 @@ -/*****************************************************************************
- * Copyright (c) 2013 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.infra.gmfdiag.properties.databinding;
-
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-/**
- *
- * Class used to edit integer preferences
- *
- */
-public class IntegerDiagramViewObservableValue extends AbstractDiagramPreferencesObservableValue {
-
- /**
- *
- * Constructor.
- *
- * @param diagram
- * the edited diagram
- * @param preferenceName
- * the name of the edited preference
- * @param store
- * the edited preference store
- */
- public IntegerDiagramViewObservableValue(final Diagram diagram, final String preferenceName, final IPreferenceStore store) {
- super(diagram, preferenceName, store);
- }
-
- /**
- *
- * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType()
- *
- * @return
- */
- public final Object getValueType() {
- return EcorePackage.eINSTANCE.getEInt();
- }
-
- /**
- *
- * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue()
- *
- * @return
- */
- @Override
- protected final Object doGetValue() {
- final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore();
- return wsPreferenceStore.getInt(getEditedPreference());
- }
-
- /**
- *
- * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object)
- *
- * @param value
- */
- @Override
- protected void doSetValue(Object value) {
- if (value instanceof Integer) {
- final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore();
- wsPreferenceStore.setValue(getEditedPreference(), ((Integer) value).intValue());
- }
- }
-
-
-}
+/***************************************************************************** + * Copyright (c) 2013 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.infra.gmfdiag.properties.databinding; + +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * + * Class used to edit integer preferences + * + */ +public class IntegerDiagramViewObservableValue extends AbstractDiagramPreferencesObservableValue { + + /** + * + * Constructor. + * + * @param diagram + * the edited diagram + * @param preferenceName + * the name of the edited preference + * @param store + * the edited preference store + */ + public IntegerDiagramViewObservableValue(final Diagram diagram, final String preferenceName, final IPreferenceStore store) { + super(diagram, preferenceName, store); + } + + /** + * + * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType() + * + * @return + */ + public final Object getValueType() { + return EcorePackage.eINSTANCE.getEInt(); + } + + /** + * + * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue() + * + * @return + */ + @Override + protected final Object doGetValue() { + final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore(); + return wsPreferenceStore.getInt(getEditedPreference()); + } + + /** + * + * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object) + * + * @param value + */ + @Override + protected void doSetValue(Object value) { + if (value instanceof Integer) { + final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore(); + wsPreferenceStore.setValue(getEditedPreference(), ((Integer) value).intValue()); + } + } + + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/ObservableGradientData.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/ObservableGradientData.java index 5d353a4294b..e11830d1b24 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/ObservableGradientData.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/ObservableGradientData.java @@ -1,144 +1,144 @@ -/*****************************************************************************
- * Copyright (c) 2011, 2014 CEA LIST and others.
- *
- * 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Christian W. Damus (CEA) - bug 323802
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.properties.databinding;
-
-import org.eclipse.core.databinding.observable.IObserving;
-import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.notation.datatype.GradientData;
-
-/**
- * This class encapsulates a gradient data, which may be null (If the
- * gradient is not activated).
- *
- * If the gradient data is null, it will be created just-in-time when
- * setters are called.
- *
- * This class has an additional property, {@link #activate}.
- * activate = false implies that the gradient data has not been set
- * (gradient data = null)
- *
- * @author Camille Letavernier
- */
-public class ObservableGradientData extends GradientData {
-
- private IObservableValue source;
-
- private GradientData encapsulated;
-
- private boolean activate;
-
- /**
- *
- * Constructor.
- *
- * @param source
- * The IObservableValue containing the gradient data. It will be
- * notified when the gradient data is changed
- * @param encapsulated
- * The encapsulated gradient data. May be null
- */
- public ObservableGradientData(IObservableValue source, GradientData encapsulated) {
- this.encapsulated = new GradientData(encapsulated);
- this.source = source;
- this.activate = encapsulated != null;
- }
-
- @Override
- public int getGradientColor1() {
- return encapsulated.getGradientColor1();
- }
-
- @Override
- public int getGradientColor2() {
- return encapsulated.getGradientColor2();
- }
-
- @Override
- public int getGradientStyle() {
- return encapsulated.getGradientStyle();
- }
-
- /**
- * Notifies the object owned the gradient data that a change
- * occurred
- */
- protected void notifySource() {
- if (activate) {
- source.setValue(new GradientData(encapsulated));
- } else {
- source.setValue(null);
- }
- }
-
- @Override
- public void setGradientColor1(int color) {
- encapsulated.setGradientColor1(color);
- notifySource();
- }
-
- @Override
- public void setGradientColor2(int color) {
- encapsulated.setGradientColor2(color);
- notifySource();
- }
-
- @Override
- public void setGradientStyle(int style) {
- encapsulated.setGradientStyle(style);
- notifySource();
- }
-
- @Override
- public int hashCode() {
- return encapsulated.hashCode();
- }
-
- @Override
- public boolean equals(Object other) {
- return encapsulated.equals(other);
- }
-
- /**
- *
- * @return true if this gradient data is activated
- */
- public boolean getActivate() {
- return activate;
- }
-
- /**
- * Activates or de-activates this gradient data
- *
- * @param value
- * Whether the gradient data should be activated or de-activated
- */
- public void setActivate(boolean value) {
- this.activate = value;
- notifySource();
- }
-
- public EObject getOwner() {
- EObject result = null;
-
- if (source instanceof IObserving) {
- Object owner = ((IObserving) source).getObserved();
- if (owner instanceof EObject) {
- result = (EObject) owner;
- }
- }
-
- return result;
- }
-}
+/***************************************************************************** + * Copyright (c) 2011, 2014 CEA LIST and others. + * + * 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: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus (CEA) - bug 323802 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.properties.databinding; + +import org.eclipse.core.databinding.observable.IObserving; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.notation.datatype.GradientData; + +/** + * This class encapsulates a gradient data, which may be null (If the + * gradient is not activated). + * + * If the gradient data is null, it will be created just-in-time when + * setters are called. + * + * This class has an additional property, {@link #activate}. + * activate = false implies that the gradient data has not been set + * (gradient data = null) + * + * @author Camille Letavernier + */ +public class ObservableGradientData extends GradientData { + + private IObservableValue source; + + private GradientData encapsulated; + + private boolean activate; + + /** + * + * Constructor. + * + * @param source + * The IObservableValue containing the gradient data. It will be + * notified when the gradient data is changed + * @param encapsulated + * The encapsulated gradient data. May be null + */ + public ObservableGradientData(IObservableValue source, GradientData encapsulated) { + this.encapsulated = new GradientData(encapsulated); + this.source = source; + this.activate = encapsulated != null; + } + + @Override + public int getGradientColor1() { + return encapsulated.getGradientColor1(); + } + + @Override + public int getGradientColor2() { + return encapsulated.getGradientColor2(); + } + + @Override + public int getGradientStyle() { + return encapsulated.getGradientStyle(); + } + + /** + * Notifies the object owned the gradient data that a change + * occurred + */ + protected void notifySource() { + if (activate) { + source.setValue(new GradientData(encapsulated)); + } else { + source.setValue(null); + } + } + + @Override + public void setGradientColor1(int color) { + encapsulated.setGradientColor1(color); + notifySource(); + } + + @Override + public void setGradientColor2(int color) { + encapsulated.setGradientColor2(color); + notifySource(); + } + + @Override + public void setGradientStyle(int style) { + encapsulated.setGradientStyle(style); + notifySource(); + } + + @Override + public int hashCode() { + return encapsulated.hashCode(); + } + + @Override + public boolean equals(Object other) { + return encapsulated.equals(other); + } + + /** + * + * @return true if this gradient data is activated + */ + public boolean getActivate() { + return activate; + } + + /** + * Activates or de-activates this gradient data + * + * @param value + * Whether the gradient data should be activated or de-activated + */ + public void setActivate(boolean value) { + this.activate = value; + notifySource(); + } + + public EObject getOwner() { + EObject result = null; + + if (source instanceof IObserving) { + Object owner = ((IObserving) source).getObserved(); + if (owner instanceof EObject) { + result = (EObject) owner; + } + } + + return result; + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/RulersUnitObservableValue.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/RulersUnitObservableValue.java index d15e5433ce5..4bf1cec5f3a 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/RulersUnitObservableValue.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/databinding/RulersUnitObservableValue.java @@ -1,65 +1,65 @@ -package org.eclipse.papyrus.infra.gmfdiag.properties.databinding;
-
-import java.text.NumberFormat;
-import java.text.ParseException;
-
-import org.eclipse.gmf.runtime.diagram.ui.internal.properties.WorkspaceViewerProperties;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.UnitsConverterUtils;
-
-
-
-@SuppressWarnings("restriction")
-// suppress warning for WorkspaceViewerProperties
-public class RulersUnitObservableValue extends IntegerDiagramViewObservableValue {
-
- /**
- *
- * Constructor.
- *
- * @param view
- * the view
- * @param store
- * the edited preference store
- */
- public RulersUnitObservableValue(final Diagram view, final IPreferenceStore store) {
- super(view, WorkspaceViewerProperties.RULERUNIT, store);
- }
-
-
- /**
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.properties.databinding.IntegerDiagramViewObservableValue#doSetValue(java.lang.Object)
- *
- * @param value
- */
- @Override
- protected void doSetValue(final Object value) {
- if (value instanceof Integer) {
- final Integer oldValue = (Integer) doGetValue();
- final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore();
- final Double oldGridSpacing = wsPreferenceStore.getDouble(WorkspaceViewerProperties.GRIDSPACING);
-
-
- final String newValue = UnitsConverterUtils.convertUnits(oldValue, (Integer) value, NumberFormat.getInstance().format(oldGridSpacing));
-
- Number number = null;
- try {
- number = NumberFormat.getInstance().parse(newValue);
- } catch (ParseException e) {
- // nothing to do
- number = null;
- return;
- }
-
- // we set the new unit value
- super.doSetValue(value);
-
- // we set the new spacing value
- final double newGridSpacing = number.doubleValue();
- wsPreferenceStore.setValue(WorkspaceViewerProperties.GRIDSPACING, newGridSpacing);
- }
- }
-
-}
+package org.eclipse.papyrus.infra.gmfdiag.properties.databinding; + +import java.text.NumberFormat; +import java.text.ParseException; + +import org.eclipse.gmf.runtime.diagram.ui.internal.properties.WorkspaceViewerProperties; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.common.utils.UnitsConverterUtils; + + + +@SuppressWarnings("restriction") +// suppress warning for WorkspaceViewerProperties +public class RulersUnitObservableValue extends IntegerDiagramViewObservableValue { + + /** + * + * Constructor. + * + * @param view + * the view + * @param store + * the edited preference store + */ + public RulersUnitObservableValue(final Diagram view, final IPreferenceStore store) { + super(view, WorkspaceViewerProperties.RULERUNIT, store); + } + + + /** + * + * @see org.eclipse.papyrus.infra.gmfdiag.properties.databinding.IntegerDiagramViewObservableValue#doSetValue(java.lang.Object) + * + * @param value + */ + @Override + protected void doSetValue(final Object value) { + if (value instanceof Integer) { + final Integer oldValue = (Integer) doGetValue(); + final IPreferenceStore wsPreferenceStore = getEditedPreferenceStore(); + final Double oldGridSpacing = wsPreferenceStore.getDouble(WorkspaceViewerProperties.GRIDSPACING); + + + final String newValue = UnitsConverterUtils.convertUnits(oldValue, (Integer) value, NumberFormat.getInstance().format(oldGridSpacing)); + + Number number = null; + try { + number = NumberFormat.getInstance().parse(newValue); + } catch (ParseException e) { + // nothing to do + number = null; + return; + } + + // we set the new unit value + super.doSetValue(value); + + // we set the new spacing value + final double newGridSpacing = number.doubleValue(); + wsPreferenceStore.setValue(WorkspaceViewerProperties.GRIDSPACING, newGridSpacing); + } + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/extension/StyleHandlerManager.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/extension/StyleHandlerManager.java index 5b083c9ef52..914c9648cd7 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/extension/StyleHandlerManager.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/extension/StyleHandlerManager.java @@ -1,57 +1,57 @@ -/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.properties.extension;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.papyrus.infra.gmfdiag.properties.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.StyleHandlerProvider;
-
-
-public class StyleHandlerManager {
-
- public static final String EXTENSION_ID = Activator.PLUGIN_ID + ".stylehandler";
-
- private final List<StyleHandlerProvider> providers;
-
- private StyleHandlerManager() {
- Map<Integer, StyleHandlerProvider> providersMap = new TreeMap<Integer, StyleHandlerProvider>();
-
- IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
-
- for (IConfigurationElement e : config) {
- try {
- StyleHandlerProvider provider = (StyleHandlerProvider) e.createExecutableExtension("provider"); //$NON-NLS-1$
- String priorityString = e.getAttribute("priority");
- int priority = Integer.parseInt(priorityString);
- providersMap.put(priority, provider);
- } catch (NumberFormatException ex) {
- Activator.log.error("The plugin " + e.getContributor() + " provided an invalid extension for " + EXTENSION_ID, ex);
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- }
-
- providers = new LinkedList<StyleHandlerProvider>(providersMap.values());
- }
-
- public List<StyleHandlerProvider> getStyleHandlerProviders() {
- return providers;
- }
-
- public static StyleHandlerManager instance = new StyleHandlerManager();
-}
+/***************************************************************************** + * Copyright (c) 2012 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.properties.extension; + +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.Platform; +import org.eclipse.papyrus.infra.gmfdiag.properties.Activator; +import org.eclipse.papyrus.infra.gmfdiag.properties.modelelement.StyleHandlerProvider; + + +public class StyleHandlerManager { + + public static final String EXTENSION_ID = Activator.PLUGIN_ID + ".stylehandler"; + + private final List<StyleHandlerProvider> providers; + + private StyleHandlerManager() { + Map<Integer, StyleHandlerProvider> providersMap = new TreeMap<Integer, StyleHandlerProvider>(); + + IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID); + + for (IConfigurationElement e : config) { + try { + StyleHandlerProvider provider = (StyleHandlerProvider) e.createExecutableExtension("provider"); //$NON-NLS-1$ + String priorityString = e.getAttribute("priority"); + int priority = Integer.parseInt(priorityString); + providersMap.put(priority, provider); + } catch (NumberFormatException ex) { + Activator.log.error("The plugin " + e.getContributor() + " provided an invalid extension for " + EXTENSION_ID, ex); + } catch (Exception ex) { + Activator.log.error(ex); + } + } + + providers = new LinkedList<StyleHandlerProvider>(providersMap.values()); + } + + public List<StyleHandlerProvider> getStyleHandlerProviders() { + return providers; + } + + public static StyleHandlerManager instance = new StyleHandlerManager(); +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/Messages.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/Messages.java index 508eb15e8fa..abe731f3ec5 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/Messages.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/Messages.java @@ -1,50 +1,50 @@ -/*****************************************************************************
- * Copyright (c) 2011 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.properties.messages;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.gmfdiag.properties.messages.messages"; //$NON-NLS-1$
-
- public static String DecoratedModelElement_CENTER;
-
- public static String DecoratedModelElement_EAST;
-
- public static String DecoratedModelElement_NORTH;
-
- public static String DecoratedModelElement_NORTH_EAST;
-
- public static String DecoratedModelElement_NORTH_WEST;
-
- public static String DecoratedModelElement_SOUTH;
-
- public static String DecoratedModelElement_SOUTH_EAST;
-
- public static String DecoratedModelElement_SOUTH_WEST;
-
- public static String DecoratedModelElement_WEST;
-
- public static String DiagramPreferencesDefaultButton_ResetDefault;
-
- public static String GradientDataModelElement_Horizontal;
-
- public static String GradientDataModelElement_Vertical;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+/***************************************************************************** + * Copyright (c) 2011 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: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.properties.messages; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + + private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.gmfdiag.properties.messages.messages"; //$NON-NLS-1$ + + public static String DecoratedModelElement_CENTER; + + public static String DecoratedModelElement_EAST; + + public static String DecoratedModelElement_NORTH; + + public static String DecoratedModelElement_NORTH_EAST; + + public static String DecoratedModelElement_NORTH_WEST; + + public static String DecoratedModelElement_SOUTH; + + public static String DecoratedModelElement_SOUTH_EAST; + + public static String DecoratedModelElement_SOUTH_WEST; + + public static String DecoratedModelElement_WEST; + + public static String DiagramPreferencesDefaultButton_ResetDefault; + + public static String GradientDataModelElement_Horizontal; + + public static String GradientDataModelElement_Vertical; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/messages.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/messages.properties index 7da85c2df8a..960f112d19b 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/messages.properties +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/messages/messages.properties @@ -1,12 +1,12 @@ -DecoratedModelElement_CENTER=Center
-DecoratedModelElement_EAST=Right
-DecoratedModelElement_NORTH=Top
-DecoratedModelElement_NORTH_EAST=Top Right
-DecoratedModelElement_NORTH_WEST=Top Left
-DecoratedModelElement_SOUTH=Bottom
-DecoratedModelElement_SOUTH_EAST=Bottom Right
-DecoratedModelElement_SOUTH_WEST=Bottom Left
-DecoratedModelElement_WEST=Left
-DiagramPreferencesDefaultButton_ResetDefault=Reset Default
-GradientDataModelElement_Horizontal=Horizontal
-GradientDataModelElement_Vertical=Vertical
+DecoratedModelElement_CENTER=Center +DecoratedModelElement_EAST=Right +DecoratedModelElement_NORTH=Top +DecoratedModelElement_NORTH_EAST=Top Right +DecoratedModelElement_NORTH_WEST=Top Left +DecoratedModelElement_SOUTH=Bottom +DecoratedModelElement_SOUTH_EAST=Bottom Right +DecoratedModelElement_SOUTH_WEST=Bottom Left +DecoratedModelElement_WEST=Left +DiagramPreferencesDefaultButton_ResetDefault=Reset Default +GradientDataModelElement_Horizontal=Horizontal +GradientDataModelElement_Vertical=Vertical diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/NotationUtil.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/NotationUtil.java index 34a6cfde70b..1c4749a0c33 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/NotationUtil.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/NotationUtil.java @@ -1,41 +1,41 @@ -/*****************************************************************************
- * Copyright (c) 2013 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.infra.gmfdiag.properties.util;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-
-
-public class NotationUtil {
-
- /**
- * Retrieve the IGraphicalEditPart from the given Object
- *
- * @param source
- * The object to resolve
- * @return
- * The IGraphicalEditPart, or null if it couldn't be resolved
- */
- public static IGraphicalEditPart resolveEditPart(Object source) {
- if (source instanceof IGraphicalEditPart) {
- return (IGraphicalEditPart) source;
- }
-
- if (source instanceof IAdaptable) {
- return (IGraphicalEditPart) ((IAdaptable) source).getAdapter(IGraphicalEditPart.class);
- }
-
- return null;
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 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.infra.gmfdiag.properties.util; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; + + +public class NotationUtil { + + /** + * Retrieve the IGraphicalEditPart from the given Object + * + * @param source + * The object to resolve + * @return + * The IGraphicalEditPart, or null if it couldn't be resolved + */ + public static IGraphicalEditPart resolveEditPart(Object source) { + if (source instanceof IGraphicalEditPart) { + return (IGraphicalEditPart) source; + } + + if (source instanceof IAdaptable) { + return (IGraphicalEditPart) ((IAdaptable) source).getAdapter(IGraphicalEditPart.class); + } + + return null; + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/RulersAndGridPropertyConstants.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/RulersAndGridPropertyConstants.java index d4a665778f9..9dbe8626549 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/RulersAndGridPropertyConstants.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/util/RulersAndGridPropertyConstants.java @@ -1,47 +1,47 @@ -/*****************************************************************************
- * Copyright (c) 2013 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.infra.gmfdiag.properties.util;
-
-/**
- *
- *
- * This class provides the constants used in the declaration of the property view for Rulers and Grid
- */
-public class RulersAndGridPropertyConstants {
-
- private RulersAndGridPropertyConstants() {
- // to prevent instanciation
- }
-
- /**
- * the edited data
- */
- public static final String GRID_IS_DISPLAYING_GRID = "grid.isDisplayingGrid";
-
- public static final String RULERS_IS_DISPLAYING_RULER = "rulers.isDisplayingRulers";
-
- public static final String GRID_IS_IN_FRONT = "grid.isInFront";
-
- public static final String GRID_COLOR = "grid.color";
-
- public static final String GRID_STYLE = "grid.style";
-
- public static final String GRID_SPACING = "grid.spacing";
-
- public static final String GRID_IS_SNAP_TO_GRID = "grid.isSnapToGrid";
-
- public static final String GRID_IS_SNAP_TO_SHAPE = "grid.isSnapToShapes";
-
- public static final String RULERS_UNITS = "rulers.units";
-}
+/***************************************************************************** + * Copyright (c) 2013 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.infra.gmfdiag.properties.util; + +/** + * + * + * This class provides the constants used in the declaration of the property view for Rulers and Grid + */ +public class RulersAndGridPropertyConstants { + + private RulersAndGridPropertyConstants() { + // to prevent instanciation + } + + /** + * the edited data + */ + public static final String GRID_IS_DISPLAYING_GRID = "grid.isDisplayingGrid"; + + public static final String RULERS_IS_DISPLAYING_RULER = "rulers.isDisplayingRulers"; + + public static final String GRID_IS_IN_FRONT = "grid.isInFront"; + + public static final String GRID_COLOR = "grid.color"; + + public static final String GRID_STYLE = "grid.style"; + + public static final String GRID_SPACING = "grid.spacing"; + + public static final String GRID_IS_SNAP_TO_GRID = "grid.isSnapToGrid"; + + public static final String GRID_IS_SNAP_TO_SHAPE = "grid.isSnapToShapes"; + + public static final String RULERS_UNITS = "rulers.units"; +} |