diff options
author | Benoit Maggi | 2017-05-15 13:42:51 +0000 |
---|---|---|
committer | Benoit Maggi | 2017-06-01 05:11:06 +0000 |
commit | fdf5650b204a1e3a625a08735d91bf1d8df0e098 (patch) | |
tree | fbbca998ceafa9642d475aa14fb342fcad29cd28 /plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse | |
parent | 735a84b375cb02b7c58c9a6540d4d070d1728822 (diff) | |
download | org.eclipse.papyrus-fdf5650b204a1e3a625a08735d91bf1d8df0e098.tar.gz org.eclipse.papyrus-fdf5650b204a1e3a625a08735d91bf1d8df0e098.tar.xz org.eclipse.papyrus-fdf5650b204a1e3a625a08735d91bf1d8df0e098.zip |
Bug 516687 - [SysML 1.1] Move SysML 1.1 to an independent repository
- remove sysml 1.1 plugins and feature from master branch
- note: some weak reference are still in the code a simple sysml grep
will show all remaining typos
Change-Id: I00173658659cfb5f3cec47391c6a3b1216bafcff
Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
Diffstat (limited to 'plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse')
43 files changed, 0 insertions, 4444 deletions
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/Activator.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/Activator.java deleted file mode 100644 index 761cc1f12bc..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/Activator.java +++ /dev/null @@ -1,107 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric; - -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.papyrus.infra.core.log.LogHelper; -import org.eclipse.papyrus.sysml.diagram.parametric.preferences.CustomPreferenceInitializer; -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.sysml.diagram.parametric"; - - /** The plug-in shared instance */ - private static Activator plugin; - - /** The logging helper */ - public static LogHelper log; - - /** The plug-in Preference store */ - public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(PLUGIN_ID); - - /** Default 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); - - // register the preference store - PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore()); - - // Preferences initialization - CustomPreferenceInitializer diagramPreferenceInitializer = new CustomPreferenceInitializer(); - diagramPreferenceInitializer.initializeDefaultPreferences(); - } - - /* - * (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 getInstance() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given plug-in relative path. - * - * @generated - * @param path - * the path - * @return the image descriptor - */ - public static ImageDescriptor getBundledImageDescriptor(String path) { - return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path); - } - - /** - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore() - * - * @return Shared Preference Store. - */ - @Override - public IPreferenceStore getPreferenceStore() { - IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore(); - return store; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCondition.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCondition.java deleted file mode 100644 index 7d051b7ea9c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/ParametricDiagramCondition.java +++ /dev/null @@ -1,32 +0,0 @@ -/***************************************************************************** - * 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: - * chevrel.regis@gmail.com - * CEA LIST - Initial API and implementation - * Laurent Wouters (CEA LIST) laurent.wouters@cea.fr - Viewpoints application - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.infra.ui.extension.commands.PerspectiveContextDependence; - -/** - * ParametricDiagramCondition to set conditions for the diagram creation - */ -public class ParametricDiagramCondition extends PerspectiveContextDependence { - - /** - * {@inheritDoc} - */ - @Override - public boolean create(EObject selectedElement) { - return false; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorCreateCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorCreateCommand.java deleted file mode 100644 index 80089b8bf55..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorCreateCommand.java +++ /dev/null @@ -1,155 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.commands; - -import java.util.List; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.sysml.blocks.Block; -import org.eclipse.papyrus.sysml.blocks.BlocksPackage; -import org.eclipse.papyrus.sysml.diagram.common.utils.ConstraintBlockHelper; -import org.eclipse.papyrus.uml.service.types.utils.ConnectorUtils; -import org.eclipse.papyrus.uml.service.types.utils.RequestParameterUtils; -import org.eclipse.uml2.uml.Connector; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.StructuredClassifier; -import org.eclipse.uml2.uml.Type; -import org.eclipse.uml2.uml.util.UMLUtil; -import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper; - -/** - * - */ -public class CustomBindingConnectorCreateCommand extends EditElementCommand { - - private final EObject source; - private final EObject target; - - public CustomBindingConnectorCreateCommand(final CreateRelationshipRequest request) { - super(request.getLabel(), null, request); - this.source = request.getSource(); - this.target = request.getTarget(); - } - - /** - * A BindingConnector could be created in Parametric only if at least one end is a ConstraintParameter. - * Also check Block.isEncapsulated (could not cross a Block which is encapsulted) - * - * @return - */ - @Override - public boolean canExecute() { - if (this.source == null) { - return false; - } - if (this.target == null) { - return true; - } - if (this.source == this.target) { - return false; - } - if (this.source != null && this.target != null) { - - boolean hasEncapsulationViolation = !checkEncapsulationCrossing(); - - return hasEncapsulationViolation ? false : - // one of the end must be a ConstraintParameter - ConstraintBlockHelper.isConstraintParameter((Element) source, RequestParameterUtils.getSourceView(getRequest())) - || ConstraintBlockHelper.isConstraintParameter((Element) target, RequestParameterUtils.getTargetView(getRequest())); - } - return false; - } - - /** - * Check that BindingConnector do not cross a "Block.isEncapsulated" Part/Reference/ConstraintProperty - * - * @return true no encapsulation problem, false else - */ - private boolean checkEncapsulationCrossing() { - org.eclipse.papyrus.sysml.service.types.utils.ConnectorUtils util = new org.eclipse.papyrus.sysml.service.types.utils.ConnectorUtils(); - - // source end - get the nestedPath - List<Property> nestedPropertyPath = util.getNestedPropertyPath(RequestParameterUtils.getSourceView(getRequest()), RequestParameterUtils.getTargetView(getRequest())); - // check for each level of path if crossing an isEncapsultaed Block - for (Property property : nestedPropertyPath) { - Type type = property.getType(); - Block stereotypeApplication = UMLUtil.getStereotypeApplication(type, Block.class); - if (stereotypeApplication != null) { - if (stereotypeApplication.isEncapsulated()) { - return false; - } - } - } - - // target end - get the nestedPath - nestedPropertyPath = util.getNestedPropertyPath(RequestParameterUtils.getTargetView(getRequest()), RequestParameterUtils.getSourceView(getRequest())); - // check for each level of path if crossing an isEncapsultaed Block - for (Property property : nestedPropertyPath) { - Type type = property.getType(); - Block stereotypeApplication = UMLUtil.getStereotypeApplication(type, Block.class); - if (stereotypeApplication != null) { - if (stereotypeApplication.isEncapsulated()) { - return false; - } - } - } - return true; - } - - /** - * Create the connector, affect its owner, calculate nestedPath - * - * @param monitor - * @param info - * @return CommandResult contains the created Connector - */ - @Override - protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { - - if (!canExecute()) { - throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$ - } - - // Create the Connector and its ConnectorEnd. Correct container are set and paths are set in case of <<NestedConnectorEnd>>. - StructuredClassifier deducedContainer = new ConnectorUtils().deduceContainer(RequestParameterUtils.getSourceView(getRequest()), RequestParameterUtils.getTargetView(getRequest())); - ((CreateRelationshipRequest) getRequest()).setContainer(deducedContainer); - IElementEditService commandProvider = ElementEditServiceUtils.getCommandProvider(deducedContainer); - ICommand editCommand = commandProvider.getEditCommand(getRequest()); - - if (editCommand.canExecute()) { - editCommand.execute(monitor, info); - Object newObject = editCommand.getCommandResult().getReturnValue(); - - if (newObject instanceof Connector) { - Connector connector = (Connector) newObject; - // Apply the <<BindingConnector>> stereotype - StereotypeApplicationHelper.INSTANCE.applyStereotype(connector, BlocksPackage.eINSTANCE.getBindingConnector()); - } - - return CommandResult.newOKCommandResult(newObject); - } - return CommandResult.newErrorCommandResult("Invalid arguments in create link command"); - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorReorientCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorReorientCommand.java deleted file mode 100644 index 86c945d3427..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomBindingConnectorReorientCommand.java +++ /dev/null @@ -1,265 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.commands; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.sysml.blocks.Block; -import org.eclipse.papyrus.sysml.blocks.BlocksPackage; -import org.eclipse.papyrus.sysml.blocks.NestedConnectorEnd; -import org.eclipse.papyrus.sysml.diagram.common.utils.ConstraintBlockHelper; -import org.eclipse.papyrus.sysml.service.types.utils.ConnectorUtils; -import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil; -import org.eclipse.papyrus.uml.service.types.command.ConnectorReorientCommand; -import org.eclipse.uml2.uml.Connector; -import org.eclipse.uml2.uml.ConnectorEnd; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.StructuredClassifier; -import org.eclipse.uml2.uml.Type; -import org.eclipse.uml2.uml.util.UMLUtil; -import org.eclipse.uml2.uml.util.UMLUtil.StereotypeApplicationHelper; - -public class CustomBindingConnectorReorientCommand extends ConnectorReorientCommand { - - private final EObject source; - - private final EObject target; - - public CustomBindingConnectorReorientCommand(ReorientReferenceRelationshipRequestWithGraphical request) { - super(request); - source = reorientDirection == ReorientRequest.REORIENT_SOURCE ? request.getNewRelationshipEnd() : request.getReferenceOwner(); - target = reorientDirection == ReorientRequest.REORIENT_SOURCE ? request.getReferenceOwner() : request.getNewRelationshipEnd(); - } - - - /** - * A BindingConnector could be reoriented in Parametric only if at least one end is a ConstraintParameter. - * Also check Block.isEncapsulated (could not cross a Block which is encapsulted) - * - * @return - */ - @Override - public boolean canExecute() { - - if (this.source == this.target) { - return false; - } - - Object connectorView = getRequest().getParameter(DefaultSemanticEditPolicy.GRAPHICAL_RECONNECTED_EDGE); - if (connectorView instanceof org.eclipse.gmf.runtime.notation.Connector) { - View sourceView = getSourceView(); - View targetView = getTargetView(); - - if (this.source != null && this.target != null) { - boolean hasEncapsulationViolation = !checkEncapsulationCrossing(); - - return hasEncapsulationViolation ? false : - // one of the end must be a ConstraintParameter - ConstraintBlockHelper.isConstraintParameter((Element) source, sourceView) - || ConstraintBlockHelper.isConstraintParameter((Element) target, targetView); - } - } - return false; - } - - /** - * Check that BindingConnector do not cross a "Block.isEncapsulated" Part/Reference/ConstraintProperty - * - * @return true no encapsulation problem, false else - */ - private boolean checkEncapsulationCrossing() { - org.eclipse.papyrus.sysml.service.types.utils.ConnectorUtils util = new org.eclipse.papyrus.sysml.service.types.utils.ConnectorUtils(); - // source end - get the nestedPath - List<Property> nestedPropertyPath = util.getNestedPropertyPath(getSourceView(), getTargetView()); - // check for each level of path if crossing an isEncapsultaed Block - for (Property property : nestedPropertyPath) { - Type type = property.getType(); - Block stereotypeApplication = UMLUtil.getStereotypeApplication(type, Block.class); - if (stereotypeApplication != null) { - if (stereotypeApplication.isEncapsulated()) { - return false; - } - } - } - - // target end - get the nestedPath - nestedPropertyPath = util.getNestedPropertyPath(getTargetView(), getSourceView()); - // check for each level of path if crossing an isEncapsultaed Block - for (Property property : nestedPropertyPath) { - Type type = property.getType(); - Block stereotypeApplication = UMLUtil.getStereotypeApplication(type, Block.class); - if (stereotypeApplication != null) { - if (stereotypeApplication.isEncapsulated()) { - return false; - } - } - } - return true; - } - - @Override - /** - * Get the link to re-orient. - * - * @return the edited {@link Connector} - */ - protected Connector getLink() { - return (Connector) (getConnectorView()).getElement(); - } - - @Override - protected void replaceOwner(Connector connector, StructuredClassifier newOwner) { - - View sourceView = getSourceView(); - View targetView = getTargetView(); - - StructuredClassifier deducedContainer = new ConnectorUtils().deduceContainer(sourceView, targetView); - if (connector.getOwner() != deducedContainer) { - super.replaceOwner(connector, deducedContainer); - } - } - - private org.eclipse.gmf.runtime.notation.Connector getConnectorView() { - return (org.eclipse.gmf.runtime.notation.Connector) getRequest().getParameter(DefaultSemanticEditPolicy.GRAPHICAL_RECONNECTED_EDGE); - } - - private View getSourceView() { - return reorientDirection == ReorientRequest.REORIENT_SOURCE ? - (View) ((ReorientReferenceRelationshipRequestWithGraphical) getRequest()).getSourceEditPart().getModel() : - getConnectorView().getSource(); - } - - private View getTargetView() { - return reorientDirection == ReorientRequest.REORIENT_TARGET ? - (View) ((ReorientReferenceRelationshipRequestWithGraphical) getRequest()).getTargetEditPart().getModel() : - getConnectorView().getTarget(); - - } - - @Override - protected Property findNewOppositePartWithPort() { - // no Port allowed in Parametric - return null; - } - - @Override - protected Property findNewPartWithPort() { - // no Port allowed in Parametric - return null; - } - - /** - * Reorient connector - recalculate nestedPath - remove connector deprecated representations (all diagrams) - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - CommandResult result = super.doExecuteWithResult(monitor, info); - - // apply or update NestedConnectorEnd stereotype and its PropertyPath if needed - Connector connector = getLink(); - if (connector.getEnds().size() == 2) { - updateNestedPropertyPath(connector.getEnds().get(0), getSourceView(), getTargetView()); - updateNestedPropertyPath(connector.getEnds().get(1), getTargetView(), getSourceView()); - } - - Set<View> memberViewsToDestroy = getMemberViewsToDestroy(connector); - // Suppress Connector representation which are not coherant with the new ConnectorEnd - for (View view : memberViewsToDestroy) { - // exclude reoriented connector representation - if (view != getConnectorView()) { - // Check Connector View ends matches with semantic ConnectorEnds - View sourceNode = ((org.eclipse.gmf.runtime.notation.Connector) view).getSource(); - View targetNode = ((org.eclipse.gmf.runtime.notation.Connector) view).getTarget(); - - EObject sourceElement = sourceNode.getElement(); - EObject targetElement = targetNode.getElement(); - - EList<ConnectorEnd> ends = connector.getEnds(); - boolean isSameEnds = true; - for (ConnectorEnd connectorEnd : ends) { - if (connectorEnd.getRole() != sourceElement && connectorEnd.getRole() != targetElement) { - isSameEnds = false; - break; - } - } - - // if no matching between graphical and semantic, we destroy the representation - if (!isSameEnds) { - final DestroyElementRequest destroyRequest = new DestroyElementRequest(getRequest().getEditingDomain(), view, false); - final IElementEditService commandProvider = ElementEditServiceUtils.getCommandProvider(view); - ICommand editCommand = commandProvider.getEditCommand(destroyRequest); - editCommand.execute(monitor, info); - } - } - } - - return result; - } - - - protected Set<View> getMemberViewsToDestroy(final Connector connector) { - Set<View> viewsToDestroy = new HashSet<View>(); - - // Find Views in Composite Structure Diagram that are referencing current member - Iterator<View> viewIt = CrossReferencerUtil.getCrossReferencingViews(connector, null).iterator(); - while (viewIt.hasNext()) { - View view = viewIt.next(); - viewsToDestroy.add(view); - } - - return viewsToDestroy; - } - - private void updateNestedPropertyPath(ConnectorEnd connectorEnd, View sourceView, View targetView) { - ConnectorUtils utils = new ConnectorUtils(); - List<Property> nestedPropertyPath = utils.getNestedPropertyPath(sourceView, targetView); - if (!nestedPropertyPath.isEmpty()) { - // Search for existing stereotype application - NestedConnectorEnd nestedConnectorEnd = UMLUtil.getStereotypeApplication(connectorEnd, NestedConnectorEnd.class); - if (nestedConnectorEnd == null) { - // apply stereotype if no application found - nestedConnectorEnd = (NestedConnectorEnd) StereotypeApplicationHelper.INSTANCE.applyStereotype(connectorEnd, BlocksPackage.eINSTANCE.getNestedConnectorEnd()); - } - // set new path - nestedConnectorEnd.getPropertyPath().clear(); - nestedConnectorEnd.getPropertyPath().addAll(nestedPropertyPath); - } - else { - // remove all NestedConnectorEnd Stereotype applications - for (EObject stereotypeApplication : connectorEnd.getStereotypeApplications()) { - if (NestedConnectorEnd.class.isInstance(stereotypeApplication)) { - EcoreUtil.delete(stereotypeApplication, true); - } - } - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomParametricContextLinkCreateCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomParametricContextLinkCreateCommand.java deleted file mode 100644 index 4ec0ac24a7c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomParametricContextLinkCreateCommand.java +++ /dev/null @@ -1,140 +0,0 @@ -/*****************************************************************************
- * 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:
- * Régis CHEVREL: chevrel.regis <at> gmail.com
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.commands;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature.Setting;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.service.types.command.ConstraintConstrainedElementsCreateCommand;
-import org.eclipse.papyrus.uml.service.types.utils.NamedElementHelper;
-import org.eclipse.uml2.common.util.CacheAdapter;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.Property;
-
-public class CustomParametricContextLinkCreateCommand extends
- ConstraintConstrainedElementsCreateCommand {
-
- public CustomParametricContextLinkCreateCommand(
- CreateRelationshipRequest request) {
- super(request);
- }
-
- /**
- * Can execute if :
- * - source is Constraint
- * - target is a Namespace or a Namespace typed property
- * - there is no context link already outgoing from the source Constraint
- */
- @Override
- public boolean canExecute() {
- if (source == null && target == null) {
- return false;
- }
- if (source != null && !(source instanceof Constraint)) {
- return false;
- }
- if (target != null && !(target instanceof Namespace)) {
- if (target instanceof Property) {
- if (!(((Property) target).getType() instanceof Namespace)) {
- // not a Part / Reference / ConstraintProperty => could not create context link
- return false;
- }
- }
- else {
- // not a Property, not a Namespace => could not create context link
- return false;
- }
- }
- if (getSource() == null) {
- return true; // link creation is in progress; source is not defined yet
- }
- View viewSource = findView(source);
-
- // Only one context link per Constraint
- if (viewSource != null && source instanceof Constraint) {
- List<?> sourceConnections = ViewUtil.getSourceConnections(viewSource);
- if (!sourceConnections.isEmpty()) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Set the Constraint context and update Constraint name with new owner ownedRules if necessary
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if (!canExecute()) {
- throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
- }
- Namespace context = getTarget();
- if (getSource() != null && context != null) {
- getSource().setContext(context);
- String defaultNameWithIncrementFromBase = NamedElementHelper.getDefaultNameWithIncrementFromBase(Constraint.class.getSimpleName(), context.getOwnedRules(), getSource());
- getSource().setName(defaultNameWithIncrementFromBase);
- return CommandResult.newOKCommandResult();
- }
- else {
- return CommandResult.newErrorCommandResult("Try to define Constraint context to a non Namespace element");
- }
- }
-
- private View findView(EObject element) {
- if (element == null) {
- return null;
- }
- Collection<Setting> settings = CacheAdapter.getInstance().getNonNavigableInverseReferences(element);
- for (Setting ref : settings) {
- if (NotationPackage.eINSTANCE.getView_Element().equals(ref.getEStructuralFeature())) {
- View view = (View) ref.getEObject();
- if (view != null) {
- return view;
- }
- }
- }
- return null;
- }
-
- /**
- * Get the property Namespace in case of property typed by a Namespace
- */
- @Override
- protected Namespace getTarget() {
- EObject targetNamespace;
- if (target instanceof Property) {
- targetNamespace = ((Property) target).getType();
- }
- else {
- targetNamespace = target;
- }
- if (targetNamespace instanceof Namespace) {
- return (Namespace) targetNamespace;
- }
- else {
- return null;
- }
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomParametricContextLinkReorientCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomParametricContextLinkReorientCommand.java deleted file mode 100644 index 9be8d88e6c6..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/CustomParametricContextLinkReorientCommand.java +++ /dev/null @@ -1,159 +0,0 @@ -/*****************************************************************************
- * 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:
- * Régis CHEVREL: chevrel.regis <at> gmail.com
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.commands;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.service.types.utils.NamedElementHelper;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.Type;
-
-/**
- * A context link must have a Constraint as source and a Namespace as target
- *
- * @See ContextLinkReorientCommand
- *
- */
-public class CustomParametricContextLinkReorientCommand extends EditElementCommand {
-
- private final int reorientDirection;
-
- protected ReorientReferenceRelationshipRequestWithGraphical request;
- protected EObject referenceOwner;
- protected EObject oldSource;
- protected EObject newSource;
- protected EObject oldTarget;
- protected EObject newTarget;
-
- public CustomParametricContextLinkReorientCommand(
- ReorientReferenceRelationshipRequestWithGraphical request) {
- super(request.getLabel(), null, request);
- this.request = request;
- reorientDirection = request.getDirection();
- referenceOwner = request.getReferenceOwner();
- oldSource = reorientDirection == ReorientRequest.REORIENT_SOURCE ? request.getOldRelationshipEnd() : request.getReferenceOwner();
- newSource = reorientDirection == ReorientRequest.REORIENT_SOURCE ? request.getNewRelationshipEnd() : request.getReferenceOwner();
- oldTarget = reorientDirection == ReorientRequest.REORIENT_SOURCE ? request.getReferenceOwner() : request.getOldRelationshipEnd();
- newTarget = reorientDirection == ReorientRequest.REORIENT_SOURCE ? request.getReferenceOwner() : request.getNewRelationshipEnd();
- }
-
- @Override
- public boolean canExecute() {
- return getNewSource() instanceof Constraint && resolveNamespace(getNewTarget()) instanceof Namespace;
- }
-
- /**
- * Get the property Namespace in case of property typed by a Namespace
- */
- protected Namespace resolveNamespace(Element element) {
- if (element instanceof Namespace) {
- return (Namespace) element;
- }
- if (element instanceof Property) {
- Type type = ((Property) element).getType();
- if (type instanceof Namespace) {
- return (Namespace) type;
- }
- }
- return null;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- if (!canExecute()) {
- throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
- }
- if (reorientDirection == ReorientRequest.REORIENT_SOURCE) {
- return reorientSource();
- }
- if (reorientDirection == ReorientRequest.REORIENT_TARGET) {
- return reorientTarget();
- }
- throw new IllegalStateException();
- }
-
- /**
- * Set a default container for old Constraint (diagram consistency).
- * Set the new context for new Constraint
- * Update new Constraint name with new owner ownedRules if necessary
- */
- protected CommandResult reorientSource() {
- EditPart sourceEditPart = request.getSourceEditPart();
- Namespace nearestNamespace = getNearestNamespace(sourceEditPart);
- getOldSource().setContext(nearestNamespace); // set a default container
- Namespace context = resolveNamespace(getNewTarget());
- // Check name
- String defaultNameWithIncrementFromBase = NamedElementHelper.getDefaultNameWithIncrementFromBase(Constraint.class.getSimpleName(), context.getOwnedRules(), getNewSource());
- ((Constraint) getNewSource()).setName(defaultNameWithIncrementFromBase);
- // set the context
- ((Constraint) getNewSource()).setContext(resolveNamespace(getNewTarget()));
-
- return CommandResult.newOKCommandResult(referenceOwner);
- }
-
- private Namespace getNearestNamespace(EditPart editPart) {
- if (editPart != null) {
- EObject semanticElement = ViewUtil.resolveSemanticElement((View) editPart.getModel());
- if (semanticElement != null) {
- Namespace resolvedNamespace = resolveNamespace((Element) semanticElement);
- if (resolvedNamespace instanceof Namespace) {
- return resolvedNamespace;
- }
- return getNearestNamespace(editPart.getParent());
- }
- }
- return null;
- }
-
- /**
- * Set the new context for new Constraint
- * Update new Constraint name with new owner ownedRules if necessary
- */
- protected CommandResult reorientTarget() {
- Namespace context = resolveNamespace(getNewTarget());
- // Check name
- String defaultNameWithIncrementFromBase = NamedElementHelper.getDefaultNameWithIncrementFromBase(Constraint.class.getSimpleName(), context.getOwnedRules(), getNewSource());
- ((Constraint) getNewSource()).setName(defaultNameWithIncrementFromBase);
- // Set the context
- ((Constraint) getNewSource()).setContext(context);
- return CommandResult.newOKCommandResult(referenceOwner);
- }
-
- protected Constraint getOldSource() {
- return (Constraint) oldSource;
- }
-
- protected Element getNewSource() {
- return (Element) newSource;
- }
-
- protected Element getOldTarget() {
- return (Element) oldTarget;
- }
-
- protected Element getNewTarget() {
- return (Element) newTarget;
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/ReorientReferenceRelationshipRequestWithGraphical.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/ReorientReferenceRelationshipRequestWithGraphical.java deleted file mode 100644 index 5bad23d08ad..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/ReorientReferenceRelationshipRequestWithGraphical.java +++ /dev/null @@ -1,51 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.commands; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; - -/** - * This class extends "classical" ReorientReferenceRelationshipRequest with the source and the target editPart. - * These EditPart are needed for algorithms based on graphics: - * - determine if a property is a ConstraintParameter - * - calculate nestedPath - */ -public class ReorientReferenceRelationshipRequestWithGraphical extends - ReorientReferenceRelationshipRequest { - - private EditPart sourceEditPart; - private EditPart targetEditPart; - - public ReorientReferenceRelationshipRequestWithGraphical( - TransactionalEditingDomain editingDomain, EObject referenceOwner, - EObject newRelationshipEnd, EObject oldRelationshipEnd, - int direction, EditPart sourceEditPart, EditPart targetEditPart) { - super(editingDomain, referenceOwner, newRelationshipEnd, oldRelationshipEnd, direction); - this.sourceEditPart = sourceEditPart; - this.targetEditPart = targetEditPart; - } - - - public EditPart getSourceEditPart() { - return sourceEditPart; - } - - public EditPart getTargetEditPart() { - return targetEditPart; - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/ShowHideConstraintExpressionCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/ShowHideConstraintExpressionCommand.java deleted file mode 100644 index 87ff2fdcde7..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/ShowHideConstraintExpressionCommand.java +++ /dev/null @@ -1,72 +0,0 @@ -/*****************************************************************************
- * 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:
- * Régis CHEVREL: chevrel.regis <at> gmail.com
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.commands.switchrepresentation;
-
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomConstraintBlockPropertyCompositeEditPart;
-import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintNodeLabelEditPart;
-
-/**
- * This command allow to show/hide the Constraint expression of a ConstraintProperty
- */
-public class ShowHideConstraintExpressionCommand extends Command {
-
- private final GraphicalEditPart editPartToSwitch;
-
- public GraphicalEditPart getEditPartToSwitch() {
- return editPartToSwitch;
- }
-
- public ShowHideConstraintExpressionCommand(final GraphicalEditPart editPartToRefresh) {
- this.editPartToSwitch = editPartToRefresh;
- }
-
- @Override
- public void execute() {
- if (this.getEditPartToSwitch() instanceof CustomConstraintBlockPropertyCompositeEditPart) {
- CustomConstraintBlockPropertyCompositeEditPart constraintBlockPropertyCompositeEditPart = (CustomConstraintBlockPropertyCompositeEditPart) this.getEditPartToSwitch();
- // get the Constraint expression graphical label
- WrappingLabel constraintLabel = constraintBlockPropertyCompositeEditPart.getPrimaryShape().getConstraintLabel();
- ConstraintNodeLabelEditPart constraintNodeLabelEditPart = null;
- // get the EditPart which contains this label
- for (Object currentEditPart : constraintBlockPropertyCompositeEditPart.getChildren()) {
- if (currentEditPart instanceof ConstraintNodeLabelEditPart) {
- if (((ConstraintNodeLabelEditPart) currentEditPart).getFigure() == constraintLabel) {
- constraintNodeLabelEditPart = (ConstraintNodeLabelEditPart) currentEditPart;
- }
- }
- }
-
- // switch visibility of this EditPart
- if (constraintNodeLabelEditPart != null) {
- View constraintLabelView = (View) constraintNodeLabelEditPart.getModel();
- constraintLabelView.setVisible(!constraintLabelView.isVisible());
- }
- }
- }
-
- @Override
- public void undo() {
- execute(); // switch
- }
-
- @Override
- public void redo() {
- execute(); // switch
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/ShowHideConstraintExpressionCommandHandler.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/ShowHideConstraintExpressionCommandHandler.java deleted file mode 100644 index 1bf8802b52a..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/ShowHideConstraintExpressionCommandHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -/*****************************************************************************
- * 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:
- * Régis CHEVREL: chevrel.regis <at> gmail.com
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.commands.switchrepresentation;
-
-import java.util.List;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomConstraintBlockPropertyCompositeEditPart;
-import org.eclipse.papyrus.uml.diagram.common.handlers.GraphicalCommandHandler;
-
-public class ShowHideConstraintExpressionCommandHandler extends GraphicalCommandHandler {
-
- @Override
- protected Command getCommand() {
- CompoundCommand command = new CompoundCommand("Show/Hide ConstraintProperty Constraint Expression");
- final List<IGraphicalEditPart> selectedElements = getSelectedElements();
- for (final IGraphicalEditPart selectedElement : selectedElements) {
- if (selectedElement instanceof CustomConstraintBlockPropertyCompositeEditPart) {
- command.add(new ShowHideConstraintExpressionCommand(selectedElement));
- }
- }
- return command;
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/SwitchConstraintPropertyRepresentationCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/SwitchConstraintPropertyRepresentationCommand.java deleted file mode 100644 index 3eb6b985581..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/SwitchConstraintPropertyRepresentationCommand.java +++ /dev/null @@ -1,138 +0,0 @@ -/*****************************************************************************
- * 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:
- * Régis CHEVREL: chevrel.regis <at> gmail.com
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.commands.switchrepresentation;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.StringValueStyle;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintBlockPropertyCompositeEditPart;
-import org.eclipse.papyrus.sysml.diagram.common.figure.ConstraintBlockPropertyCompositeFigure;
-import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomConstraintBlockPropertyCompositeEditPart;
-
-/**
- * This command allow to switch ConstraintProperty representation to rounded corner one to square one with structure compartment
- */
-public class SwitchConstraintPropertyRepresentationCommand extends Command {
-
- private final GraphicalEditPart editPartToSwitch;
-
- public SwitchConstraintPropertyRepresentationCommand(final GraphicalEditPart editPartToRefresh) {
- this.editPartToSwitch = editPartToRefresh;
- }
-
- public GraphicalEditPart getEditPartToSwitch() {
- return this.editPartToSwitch;
- }
-
-
- @Override
- public void execute() {
- if (this.getEditPartToSwitch() instanceof CustomConstraintBlockPropertyCompositeEditPart) {
- CustomConstraintBlockPropertyCompositeEditPart constraintBlockPropertyCompositeEditPart = (CustomConstraintBlockPropertyCompositeEditPart) this.getEditPartToSwitch();
- ConstraintBlockPropertyCompositeFigure figure = constraintBlockPropertyCompositeEditPart.getPrimaryShape();
- if (figure instanceof ConstraintBlockPropertyCompositeFigure) {
- if (figure.getCorner() != 0) {
- switchToSquareRepresentationWithStructure(constraintBlockPropertyCompositeEditPart, figure);
- }
- else {
- switchToRoundedRepresentationWithoutStructure(constraintBlockPropertyCompositeEditPart, figure);
- }
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- private void switchToSquareRepresentationWithStructure(CustomConstraintBlockPropertyCompositeEditPart editPart, IFigure figure) {
-
- // Set corner as square
- int newCorner = 0;
- ((ConstraintBlockPropertyCompositeFigure) figure).setCorner(newCorner);
-
- // add structure compartment (create if does not exist, set visible if exist)
- View structureCompartment = editPart.getChildViewBySemanticHint(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID);
- if (structureCompartment != null) {
- structureCompartment.setVisible(true);
- }
- else {
- structureCompartment = ViewService.createNode((View) editPart.getModel(), SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID, new PreferencesHint("org.eclipse.papyrus.sysml.diagram.parametric"));
- if (structureCompartment != null) {
- structureCompartment.setElement(editPart.resolveSemanticElement());
- }
- }
-
- // add the << constraint >> tag
- editPart.getPrimaryShape().setTagLabel(String.valueOf("\u00AB") + "constraint" + String.valueOf("\u00BB"));
-
- // set the style to persist representation
- StringValueStyle style = (StringValueStyle) ((View) editPart.getModel()).getStyle(NotationPackage.eINSTANCE.getStringValueStyle());
- if (style == null) {
- ((View) editPart.getModel()).getStyles().add(NotationFactory.eINSTANCE.createStringValueStyle());
- }
- style = (StringValueStyle) ((View) editPart.getModel()).getStyle(NotationPackage.eINSTANCE.getStringValueStyle());
- style.setName(ConstraintBlockPropertyCompositeEditPart.REPRESENTATION_MODE_STYLE);
- style.setStringValue(ConstraintBlockPropertyCompositeEditPart.SQUARE_REPRESENTATION_WITH_STRUCTURE);
-
- // set the default style for new elements
- ConstraintBlockPropertyCompositeEditPart.setLastRepresentation(ConstraintBlockPropertyCompositeEditPart.SQUARE_REPRESENTATION_WITH_STRUCTURE);
- editPart.setCornerLocators(newCorner);
- }
-
- @SuppressWarnings("unchecked")
- private void switchToRoundedRepresentationWithoutStructure(CustomConstraintBlockPropertyCompositeEditPart editPart, IFigure figure) {
- // rounded corner
- int newCorner = 50;
- ((ConstraintBlockPropertyCompositeFigure) figure).setCorner(newCorner);
-
-
- // hide structure compartment if exist
- View structureCompartmentFigure = editPart.getChildViewBySemanticHint(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID);
- if (structureCompartmentFigure != null) {
- structureCompartmentFigure.setVisible(false);
- }
-
- // remove the << constraint >> tag
- editPart.getPrimaryShape().setTagLabel("");
-
- // set the style to persist representation
- StringValueStyle style = (StringValueStyle) ((View) editPart.getModel()).getStyle(NotationPackage.eINSTANCE.getStringValueStyle());
- if (style == null) {
- ((View) editPart.getModel()).getStyles().add(NotationFactory.eINSTANCE.createStringValueStyle());
- }
- style = (StringValueStyle) ((View) editPart.getModel()).getStyle(NotationPackage.eINSTANCE.getStringValueStyle());
- style.setName(ConstraintBlockPropertyCompositeEditPart.REPRESENTATION_MODE_STYLE);
- style.setStringValue(ConstraintBlockPropertyCompositeEditPart.ROUNDED_REPRESENTATION);
-
- // set the default style for new elements
- ConstraintBlockPropertyCompositeEditPart.setLastRepresentation(ConstraintBlockPropertyCompositeEditPart.ROUNDED_REPRESENTATION);
- editPart.setCornerLocators(newCorner);
- }
-
- @Override
- public void undo() {
- execute(); // switch
- }
-
- @Override
- public void redo() {
- execute(); // switch
- }
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/SwitchConstraintPropertyRepresentationCommandHandler.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/SwitchConstraintPropertyRepresentationCommandHandler.java deleted file mode 100644 index 68f12cea669..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/commands/switchrepresentation/SwitchConstraintPropertyRepresentationCommandHandler.java +++ /dev/null @@ -1,42 +0,0 @@ -/*****************************************************************************
- * 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:
- * Régis CHEVREL: chevrel.regis <at> gmail.com
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.commands.switchrepresentation;
-
-import java.util.List;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CompoundCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomConstraintBlockPropertyCompositeEditPart;
-import org.eclipse.papyrus.uml.diagram.common.handlers.GraphicalCommandHandler;
-
-public class SwitchConstraintPropertyRepresentationCommandHandler extends GraphicalCommandHandler {
-
- @Override
- protected Command getCommand() {
- CompoundCommand command = new CompoundCommand("Switch ConstraintProperty Representation");
- final List<IGraphicalEditPart> selectedElements = getSelectedElements();
- for (final IGraphicalEditPart selectedElement : selectedElements) {
- if (selectedElement instanceof CustomConstraintBlockPropertyCompositeEditPart) {
- if (selectedElement.getParent() instanceof GraphicalEditPart) {
- command.add(new SwitchConstraintPropertyRepresentationCommand(selectedElement));
- }
- }
- }
- return command;
- }
-
-
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockCompositeEditPartTN.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockCompositeEditPartTN.java deleted file mode 100644 index 05e26dcca13..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockCompositeEditPartTN.java +++ /dev/null @@ -1,153 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.edit.part; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.sysml.blocks.Block; -import org.eclipse.papyrus.sysml.constraints.ConstraintBlock; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockLabelNameEditPart; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.StructureCompartmentEditPart; -import org.eclipse.papyrus.sysml.diagram.parametric.figures.ParametricDiagramFrameFigure; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintParameterAffixedNodeEditPart; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AffixedNodeAlignmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideRelatedContentsEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.locator.FullInsidePortPositionLocator; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.util.UMLUtil; - - -public class CustomBlockCompositeEditPartTN extends AbstractElementEditPart { - - public CustomBlockCompositeEditPartTN(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - installEditPolicy(ShowHideRelatedContentsEditPolicy.SHOW_HIDE_RELATED_CONTENTS_POLICY, new ShowHideRelatedContentsEditPolicy()); - installEditPolicy(AffixedNodeAlignmentEditPolicy.AFFIXED_CHILD_ALIGNMENT_ROLE, new AffixedNodeAlignmentEditPolicy()); - super.createDefaultEditPolicies(); - } - - @Override - protected IFigure createNodeShape() { - return this.primaryShape = new ParametricDiagramFrameFigure(); - } - - @Override - public ParametricDiagramFrameFigure getPrimaryShape() { - return (ParametricDiagramFrameFigure) primaryShape; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof BlockLabelNameEditPart) { - ((BlockLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - if (childEditPart instanceof StructureCompartmentEditPart) { - IFigure pane = getPrimaryShape(); - setupContentPane(pane); - pane.add(((StructureCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof ConstraintParameterAffixedNodeEditPart) { - IBorderItemLocator locator = new FullInsidePortPositionLocator(getMainFigure(), PositionConstants.NONE); - getBorderedFigure().getBorderItemContainer().add(((ConstraintParameterAffixedNodeEditPart) childEditPart).getFigure(), locator); - return true; - } - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof BlockLabelNameEditPart) { - return true; - } - if (childEditPart instanceof StructureCompartmentEditPart) { - IFigure pane = getPrimaryShape(); - setupContentPane(pane); - pane.remove(((StructureCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof ConstraintParameterAffixedNodeEditPart) { - getBorderedFigure().getBorderItemContainer().remove(((ConstraintParameterAffixedNodeEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - return getContentPane(); - } - - @Override - public EditPart getPrimaryChildEditPart() { - return null; - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - return null; - } - - - @Override - protected void refreshVisuals() { - refreshStereotypes(); - super.refreshVisuals(); - } - - protected void refreshStereotypes() { - Element resolveSemanticElement = (Element) this.resolveSemanticElement(); - EList<EObject> stereotypeApplications = resolveSemanticElement.getStereotypeApplications(); - List<EObject> additionnalStereotypeApplications = new ArrayList<EObject>(); - for (EObject currentStereotypeApplication : stereotypeApplications) { - if (!(currentStereotypeApplication instanceof Block) && !(currentStereotypeApplication instanceof ConstraintBlock)) { - additionnalStereotypeApplications.add(currentStereotypeApplication); - } - } - StringBuilder stereotypeLabel = new StringBuilder(); - String separator = ", "; - for (EObject eObject : additionnalStereotypeApplications) { - if (eObject != additionnalStereotypeApplications.get(0)) { - stereotypeLabel.append(separator); - } - stereotypeLabel.append(firstLetterToLowerCase(UMLUtil.getStereotype(eObject).getName())); - } - getPrimaryShape().setStereotypeLabel(stereotypeLabel.toString()); - } - - private String firstLetterToLowerCase(String string) { - String result = ""; - if (string != null && string.length() != 0) { - String lowerCaseFirstLetter = string.substring(0, 1).toLowerCase(); - result = lowerCaseFirstLetter + string.substring(1); - } - return result; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockLabelNameEditPart.java deleted file mode 100644 index f53b3b6be81..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockLabelNameEditPart.java +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - * 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: - * R�gis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.edit.part; - -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockLabelNameEditPart; - -public class CustomBlockLabelNameEditPart extends BlockLabelNameEditPart { - - public CustomBlockLabelNameEditPart(View view) { - super(view); - } - - /** - * Respect the SysML diagram frame "par [Block] Block1 [DiagramName]" - */ - @Override - protected String getLabelText() { - String diagramName = LabelInternationalization.getInstance().getDiagramLabel(getDiagramView()); - return super.getLabelText() + " [" + diagramName + "]"; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockPropertyCompositeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockPropertyCompositeEditPart.java deleted file mode 100644 index fcb15dc092d..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomBlockPropertyCompositeEditPart.java +++ /dev/null @@ -1,33 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.edit.part; - -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyCompositeEditPart; -import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomParametricSemanticPolicy; - -public class CustomBlockPropertyCompositeEditPart extends - BlockPropertyCompositeEditPart { - - public CustomBlockPropertyCompositeEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintBlockPropertyCompositeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintBlockPropertyCompositeEditPart.java deleted file mode 100644 index e3da15a19a4..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintBlockPropertyCompositeEditPart.java +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.edit.part; - -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintBlockPropertyCompositeEditPart; -import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomParametricSemanticPolicy; - -public class CustomConstraintBlockPropertyCompositeEditPart extends - ConstraintBlockPropertyCompositeEditPart { - - public CustomConstraintBlockPropertyCompositeEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintParameterAffixedNodeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintParameterAffixedNodeEditPart.java deleted file mode 100644 index 51b0360b413..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomConstraintParameterAffixedNodeEditPart.java +++ /dev/null @@ -1,32 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.edit.part; - -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomParametricSemanticPolicy; -import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintParameterAffixedNodeEditPart; - -public class CustomConstraintParameterAffixedNodeEditPart extends ConstraintParameterAffixedNodeEditPart { - - public CustomConstraintParameterAffixedNodeEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomPortAffixedNodeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomPortAffixedNodeEditPart.java deleted file mode 100644 index 76155592691..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/edit/part/CustomPortAffixedNodeEditPart.java +++ /dev/null @@ -1,33 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.edit.part; - -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomParametricSemanticPolicy; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedNodeEditPart; - -public class CustomPortAffixedNodeEditPart extends PortAffixedNodeEditPart { - - public CustomPortAffixedNodeEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/CustomBlockPropertyCompositeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/CustomBlockPropertyCompositeFigure.java deleted file mode 100644 index 40d68f20e0b..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/CustomBlockPropertyCompositeFigure.java +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************** - * 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: - * R�gis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.figures; - -import org.eclipse.draw2d.Label; -import org.eclipse.papyrus.sysml.diagram.common.figure.BlockPropertyCompositeFigure; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; - -public class CustomBlockPropertyCompositeFigure extends - BlockPropertyCompositeFigure { - - @Override - protected void initTagLabel(String value) { - // do nothing: we don't want a two lines element (tag + name) - } - - @Override - public PapyrusWrappingLabel getTaggedLabel() { - // return a mock Label - return new PapyrusWrappingLabel(); - } - - @Override - public void setNameLabelIcon(boolean displayNameLabelIcon) { - getNameLabel().setIcon(null); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/ParametricDiagramFrameFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/ParametricDiagramFrameFigure.java deleted file mode 100644 index b3ac246b4b3..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/figures/ParametricDiagramFrameFigure.java +++ /dev/null @@ -1,20 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.figures; - -import org.eclipse.papyrus.sysml.diagram.common.figure.SysMLDiagramFrameFigure; - -public class ParametricDiagramFrameFigure extends SysMLDiagramFrameFigure { - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/handler/ShowHideRelatedContentsAction.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/handler/ShowHideRelatedContentsAction.java deleted file mode 100644 index 605e687ac70..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/handler/ShowHideRelatedContentsAction.java +++ /dev/null @@ -1,120 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.handler; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.sysml.diagram.common.utils.ConstraintBlockHelper; - -/** - * This class allow to take into account the ConstraintParameter which are AffixedNode, not a "classical" property (Part/Reference/ConstraintProperty in structure). - * Also filter non allowed elements from AffixedNode (Port). - */ -public class ShowHideRelatedContentsAction extends org.eclipse.papyrus.sysml.diagram.internalblock.handler.ShowHideRelatedContentsAction { - - /** Constructor. */ - public ShowHideRelatedContentsAction() { - super(); - } - - /** - * @see org.eclipse.papyrus.diagram.common.actions.AbstractShowHideAction#initAction() - */ - @Override - protected void initAction() { - super.initAction(); - - // Only ConstraintParameter are allowed => remove Ports (and subclasses) from AffixedNode selection - List<EditPartRepresentation> editPartRepresentationsToRemove = new ArrayList<EditPartRepresentation>(); - Set<EObject> representedAffixedElements = new HashSet<EObject>(); - AffixedChildrenEditPartRepresentation affixedNodeRepresentations = getAffixedNodeRepresentation(this.representations); - - // Select only affixedNode which semantic element could be a ConstraintParameter - for (EditPartRepresentation currentRepresentation : affixedNodeRepresentations.getPossibleElement()) { - EObject semanticElement = currentRepresentation.getSemanticElement(); - if (!(semanticElement == null || ConstraintBlockHelper.couldBeConstraintParameter(semanticElement, getOwnerSemanticElement()))) { - editPartRepresentationsToRemove.add(currentRepresentation); - } - else { - representedAffixedElements.add(semanticElement); - } - } - for (EditPartRepresentation editPartRepresentationToRemove : editPartRepresentationsToRemove) { - affixedNodeRepresentations.getPossibleElement().remove(editPartRepresentationToRemove); - } - - // Remove from structure category elements which match as AffixedNode - editPartRepresentationsToRemove = new ArrayList<EditPartRepresentation>(); - CompartmentEditPartRepresentation compartmentEditPartRepresentation = getCompartmentEditPartRepresentation(this.representations); - if (compartmentEditPartRepresentation != null) { - for (EditPartRepresentation currentRepresentation : compartmentEditPartRepresentation.getPossibleElement()) { - EObject semanticElement = currentRepresentation.getSemanticElement(); - if (representedAffixedElements.contains(semanticElement)) { - editPartRepresentationsToRemove.add(currentRepresentation); - } - } - for (EditPartRepresentation editPartRepresentationToRemove : editPartRepresentationsToRemove) { - compartmentEditPartRepresentation.getPossibleElement().remove(editPartRepresentationToRemove); - } - } - } - - private EObject getOwnerSemanticElement() { - return this.representations.size() >= 1 ? this.representations.get(0).getSemanticElement() : null; - } - - /** - * - * @param editPartRepresentations - * @return - */ - private AffixedChildrenEditPartRepresentation getAffixedNodeRepresentation(List<EditPartRepresentation> editPartRepresentations) { - - for (EditPartRepresentation representation : editPartRepresentations) { - if (representation instanceof AffixedChildrenEditPartRepresentation) { - return (AffixedChildrenEditPartRepresentation) representation; - } - // recursive search - AffixedChildrenEditPartRepresentation affixedNodeRepresentation = getAffixedNodeRepresentation(representation.getPossibleElement()); - if (affixedNodeRepresentation != null) { - return affixedNodeRepresentation; - } - } - return null; - } - - /** - * - * @param editPartRepresentations - * @return - */ - private CompartmentEditPartRepresentation getCompartmentEditPartRepresentation(List<EditPartRepresentation> editPartRepresentations) { - - for (EditPartRepresentation representation : editPartRepresentations) { - if (representation instanceof CompartmentEditPartRepresentation && !(representation instanceof AffixedChildrenEditPartRepresentation)) { - return (CompartmentEditPartRepresentation) representation; - } - // recursive search - CompartmentEditPartRepresentation compartmentEditPartRepresentation = getCompartmentEditPartRepresentation(representation.getPossibleElement()); - if (compartmentEditPartRepresentation != null) { - return compartmentEditPartRepresentation; - } - } - return null; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/handler/ShowHideRelatedContentsHandler.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/handler/ShowHideRelatedContentsHandler.java deleted file mode 100644 index 5a37e5ff666..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/handler/ShowHideRelatedContentsHandler.java +++ /dev/null @@ -1,28 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.handler; - -import org.eclipse.papyrus.uml.diagram.common.actions.handlers.AbstractShowHideHandler; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideRelatedContentsEditPolicy; - -/** - * Handler for the {@link ShowHideRelatedContentsAction} - */ -public class ShowHideRelatedContentsHandler extends AbstractShowHideHandler { - - /** Constructor. */ - public ShowHideRelatedContentsHandler() { - super(new ShowHideRelatedContentsAction(), ShowHideRelatedContentsEditPolicy.SHOW_HIDE_RELATED_CONTENTS_POLICY); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/migration/ParametricReconciler_1_2_0.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/migration/ParametricReconciler_1_2_0.java deleted file mode 100644 index bcfbb443efe..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/migration/ParametricReconciler_1_2_0.java +++ /dev/null @@ -1,96 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2010, 2015 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:
- * Florian Noyrit (CEA) florian.noyrit@cea.fr - Initial API and Implementation
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - reconciler to add floating label
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.migration;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.AbstractCommand;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler;
-
-/**
- * Parametric Diagram Reconciler from 1.1.0 to 1.2.0
- */
-public class ParametricReconciler_1_2_0 extends DiagramReconciler {
-
- @Override
- public ICommand getReconcileCommand(Diagram diagram) {
- CompositeCommand cc = new CompositeCommand("Migrate diagram from 1.1.0 to 1.2.0");
- cc.add(new ChangeVisualIDsCommand(diagram));
- return cc;
- }
-
- protected class ChangeVisualIDsCommand extends AbstractCommand {
-
- protected final Diagram diagram;
-
- public ChangeVisualIDsCommand(Diagram diagram) {
- super("Change the diagram's visual ids from 1.1.0 to 1.2.0");
- this.diagram = diagram;
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- TreeIterator<EObject> allContentIterator = diagram.eAllContents();
-
- while (allContentIterator.hasNext()) {
- EObject eObject = allContentIterator.next();
- if (eObject instanceof View) {
- View view = (View) eObject;
- view.setType(getNewVisualID(view.getType()));
- }
- }
-
- return CommandResult.newOKCommandResult();
- }
-
- @Override
- public boolean canUndo() {
- return false;
- }
-
- @Override
- public boolean canRedo() {
- return false;
- }
-
- @Override
- protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- throw new ExecutionException("Should not be called, canRedo false");
- }
-
- @Override
- protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
- throw new ExecutionException("Should not be called, canUndo false");
- }
- }
-
- public static String getNewVisualID(String oldVisualID) {
- switch (oldVisualID) {
- case "8500":
- return "Constraint_ContextEdge";
- case "8501":
- return "Constraint_KeywordLabel";
- default:
- return oldVisualID;
- }
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parser/ParametricFrameParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parser/ParametricFrameParser.java deleted file mode 100644 index 6cbbdb9ca27..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/parser/ParametricFrameParser.java +++ /dev/null @@ -1,47 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * Trung-Truc Nguyen Bug 439935 - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.parser; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.infra.gmfdiag.common.commands.SemanticAdapter; -import org.eclipse.papyrus.sysml.constraints.ConstraintBlock; -import org.eclipse.papyrus.uml.diagram.common.parser.NamedElementLabelParser; -import org.eclipse.uml2.uml.util.UMLUtil; - -public class ParametricFrameParser extends NamedElementLabelParser { - - /** - * /** - * Respect the SysML diagram frame "diagramKind [modelElementType] modelElementName [diagramName]" - * For the parametric diagram, the modelElementName might be a Block or a ConstraintBlock element - * - * A parametric diagram frame, therefore, may be: - * - * par [Block] blockName [diagramName] OR - * par [ConstraintBlock] constraintBlockName [diagramName] - * - */ - @Override - public String getPrintString(IAdaptable element, int flags) { - String elementType = null; - if(element instanceof SemanticAdapter){ - Object realObject = ((SemanticAdapter) element).getAdapter(EObject.class); - if (realObject instanceof org.eclipse.uml2.uml.Class) { - elementType = UMLUtil.getStereotypeApplication(((org.eclipse.uml2.uml.Class) realObject), ConstraintBlock.class) != null ? "ConstraintBlock" : "Block"; - } - } - return "par [" + elementType + "] " + super.getPrintString(element, flags); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockCompositeDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockCompositeDropEditPolicy.java deleted file mode 100644 index 8e553b2e2fc..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockCompositeDropEditPolicy.java +++ /dev/null @@ -1,129 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013, 2016 CEA LIST, Esterel Technologies SAS 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * Alain Le Guennec (Esterel Technologies SAS) - bug 497400 - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.policies; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest; -import org.eclipse.papyrus.infra.gmfdiag.common.commands.SelectAndExecuteCommand; -import org.eclipse.papyrus.sysml.diagram.internalblock.utils.TypeDropHelper; -import org.eclipse.papyrus.sysml.diagram.parametric.provider.CustomGraphicalTypeRegistry; -import org.eclipse.papyrus.sysml.diagram.parametric.utils.ConstraintParameterDropHelper; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; -import org.eclipse.uml2.uml.Property; - -/** - * <pre> - * Customization of the DND edit policy for BlockPropertyComposite that enables - * type modification, or creation of new Port and FlowPort by a drop on target. - * </pre> - */ -public class CustomBlockCompositeDropEditPolicy extends CustomDragDropEditPolicy { - - /** Default constructor */ - public CustomBlockCompositeDropEditPolicy() { - super(); - registry = new CustomGraphicalTypeRegistry(); - } - - /** - * {@inheritDoc} - */ - @Override - protected Set<String> getSpecificDropBehaviorTypes() { - Set<String> specificDropBehaviorTypes = super.getSpecificDropBehaviorTypes(); - - specificDropBehaviorTypes.add(UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID); - - return specificDropBehaviorTypes; - } - - /** - * {@inheritDoc} - */ - @Override - protected ICommand getSpecificDropCommand(DropObjectsRequest dropRequest, EObject droppedEObject, String nodeType, String edgeType) { - if (UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID.equals(nodeType)) { - ConstraintParameterDropHelper constraintParameterDropHelper = new ConstraintParameterDropHelper(getEditingDomain()); - Command commandParameterDropCommand = constraintParameterDropHelper.getDropConstraintParameter((Property) droppedEObject, dropRequest.getLocation().getCopy(), (GraphicalEditPart) getHost()); - return new CommandProxy(commandParameterDropCommand); - } - - return super.getSpecificDropCommand(dropRequest, droppedEObject, nodeType, edgeType); - } - - /** - * {@inheritedDoc}. - */ - @Override - public Command getDropObjectsCommand(DropObjectsRequest dropRequest) { - TypeDropHelper helper = new TypeDropHelper(getEditingDomain()); - - // Single drop management possible drop action list can be proposed - if (dropRequest.getObjects().size() == 1) { - - // List of available drop commands - final List<Command> commandChoice = new ArrayList<Command>(); - - // 1. Try to set the target element type with dropped object - Command dropAsSetType = helper.getDropAsTypedElementType(dropRequest, (GraphicalEditPart) getHost()); - if ((dropAsSetType != null) && (dropAsSetType.canExecute())) { - commandChoice.add(dropAsSetType); - } - - // 2. Build default drop command (show view of the dropped object) - Command defaultDropCommand = super.getDropObjectsCommand(dropRequest); - if ((defaultDropCommand != null) && (defaultDropCommand.canExecute())) { - defaultDropCommand.setLabel("Default drop (Show dropped object in diagram)"); - commandChoice.add(defaultDropCommand); - } - - // Prepare the selection command (if several command are available) or return the drop command - if (commandChoice.size() > 1) { - RunnableWithResult<ICommand> runnable; - Display.getDefault().syncExec(runnable = new RunnableWithResult.Impl<ICommand>() { - - public void run() { - setResult(new SelectAndExecuteCommand("Select drop action for ", PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), commandChoice)); - } - }); - - ICommand selectCommand = runnable.getResult(); - - return new ICommandProxy(selectCommand); - } else if (commandChoice.size() == 1) { - return commandChoice.get(0); - } - - // else (command choice is empty) - return UnexecutableCommand.INSTANCE; - - } - - return super.getDropObjectsCommand(dropRequest); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyCompositeDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyCompositeDropEditPolicy.java deleted file mode 100644 index ea8909b4942..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyCompositeDropEditPolicy.java +++ /dev/null @@ -1,129 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013, 2016 CEA LIST, Esterel Technologies SAS 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * Alain Le Guennec (Esterel Technologies SAS) - bug 497400 - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.policies; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest; -import org.eclipse.papyrus.infra.gmfdiag.common.commands.SelectAndExecuteCommand; -import org.eclipse.papyrus.sysml.diagram.internalblock.utils.TypeDropHelper; -import org.eclipse.papyrus.sysml.diagram.parametric.provider.CustomGraphicalTypeRegistry; -import org.eclipse.papyrus.sysml.diagram.parametric.utils.ConstraintParameterDropHelper; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; -import org.eclipse.uml2.uml.Property; - -/** - * <pre> - * Customization of the DND edit policy for BlockPropertyComposite that enables - * type modification, or creation of new Port and FlowPort by a drop on target. - * </pre> - */ -public class CustomBlockPropertyCompositeDropEditPolicy extends CustomDragDropEditPolicy { - - /** Default constructor */ - public CustomBlockPropertyCompositeDropEditPolicy() { - super(); - registry = new CustomGraphicalTypeRegistry(); - } - - /** - * {@inheritDoc} - */ - @Override - protected Set<String> getSpecificDropBehaviorTypes() { - Set<String> specificDropBehaviorTypes = super.getSpecificDropBehaviorTypes(); - - specificDropBehaviorTypes.add(UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID); - - return specificDropBehaviorTypes; - } - - /** - * {@inheritDoc} - */ - @Override - protected ICommand getSpecificDropCommand(DropObjectsRequest dropRequest, EObject droppedEObject, String nodeType, String edgeType) { - if (UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID.equals(nodeType)) { - ConstraintParameterDropHelper constraintParameterDropHelper = new ConstraintParameterDropHelper(getEditingDomain()); - Command commandParameterDropCommand = constraintParameterDropHelper.getDropConstraintParameterOnPart((Property) droppedEObject, dropRequest.getLocation().getCopy(), (GraphicalEditPart) getHost()); - return new CommandProxy(commandParameterDropCommand); - } - - return super.getSpecificDropCommand(dropRequest, droppedEObject, nodeType, edgeType); - } - - /** - * {@inheritedDoc}. - */ - @Override - public Command getDropObjectsCommand(DropObjectsRequest dropRequest) { - TypeDropHelper helper = new TypeDropHelper(getEditingDomain()); - - // Single drop management possible drop action list can be proposed - if (dropRequest.getObjects().size() == 1) { - - // List of available drop commands - final List<Command> commandChoice = new ArrayList<Command>(); - - // 1. Try to set the target element type with dropped object - Command dropAsSetType = helper.getDropAsTypedElementType(dropRequest, (GraphicalEditPart) getHost()); - if ((dropAsSetType != null) && (dropAsSetType.canExecute())) { - commandChoice.add(dropAsSetType); - } - - // 2. Build default drop command (show view of the dropped object) - Command defaultDropCommand = super.getDropObjectsCommand(dropRequest); - if ((defaultDropCommand != null) && (defaultDropCommand.canExecute())) { - defaultDropCommand.setLabel("Default drop (Show dropped object in diagram)"); - commandChoice.add(defaultDropCommand); - } - - // Prepare the selection command (if several command are available) or return the drop command - if (commandChoice.size() > 1) { - RunnableWithResult<ICommand> runnable; - Display.getDefault().syncExec(runnable = new RunnableWithResult.Impl<ICommand>() { - - public void run() { - setResult(new SelectAndExecuteCommand("Select drop action for ", PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), commandChoice)); - } - }); - - ICommand selectCommand = runnable.getResult(); - - return new ICommandProxy(selectCommand); - } else if (commandChoice.size() == 1) { - return commandChoice.get(0); - } - - // else (command choice is empty) - return UnexecutableCommand.INSTANCE; - - } - - return super.getDropObjectsCommand(dropRequest); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy.java deleted file mode 100644 index 9692542fc86..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy.java +++ /dev/null @@ -1,146 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013, 2016 CEA LIST, Esterel Technologies SAS 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * Alain Le Guennec (Esterel Technologies SAS) - bug 497400 - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.policies; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.commands.SelectAndExecuteCommand; -import org.eclipse.papyrus.sysml.diagram.internalblock.utils.PartDropHelper; -import org.eclipse.papyrus.sysml.diagram.parametric.utils.BlockDropHelper; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; - -/** - * <pre> - * Customization of the DND edit policy for BlockPropertyComposite that enables - * type modification, or creation of new Port and FlowPort by a drop on target. - * </pre> - */ -public class CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy extends CustomDragDropEditPolicy { - - /** Default constructor */ - public CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy() { - super(); - } - - /** - * {@inheritedDoc}. - */ - @Override - public Command getDropObjectsCommand(DropObjectsRequest dropRequest) { - - BlockDropHelper helper = new BlockDropHelper(getEditingDomain()); - - // Single drop management possible drop action list can be proposed - if (dropRequest.getObjects().size() == 1) { - - // List of available drop commands - final List<Command> commandChoice = new ArrayList<Command>(); - - // 1. Build command to drop BlockProperty - PartDropHelper partDropHelper = new PartDropHelper(getEditingDomain()); - Command dropPartOnPart = partDropHelper.getDropPartOnPart(dropRequest, (GraphicalEditPart) getHost()); - if ((dropPartOnPart != null) && (dropPartOnPart.canExecute())) { - commandChoice.add(dropPartOnPart); - } - - // 2. Try to create a Part typed by the dropped object - Command dropAsTypedPart = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.PART_PROPERTY); - if ((dropAsTypedPart != null) && (dropAsTypedPart.canExecute())) { - commandChoice.add(dropAsTypedPart); - } - - // 3. Try to create a Reference typed by the dropped object - Command dropAsTypedReference = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.REFERENCE_PROPERTY); - if ((dropAsTypedReference != null) && (dropAsTypedReference.canExecute())) { - commandChoice.add(dropAsTypedReference); - } - - // 4. Try to create an ActorPart typed by the dropped object - Command dropAsTypedActorPart = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.ACTOR_PART_PROPERTY); - if ((dropAsTypedActorPart != null) && (dropAsTypedActorPart.canExecute())) { - commandChoice.add(dropAsTypedActorPart); - } - - // 5. Try to create a Value typed by the dropped object - Command dropAsTypedValue = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.VALUE_PROPERTY); - if ((dropAsTypedValue != null) && (dropAsTypedValue.canExecute())) { - commandChoice.add(dropAsTypedValue); - } - - // 6. Try to create a Property typed by the dropped object - Command dropAsTypedProperty = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart) getHost(), UMLElementTypes.PROPERTY); - if ((dropAsTypedProperty != null) && (dropAsTypedProperty.canExecute())) { - commandChoice.add(dropAsTypedProperty); - } - - // 7. Try to create a Property typed by the dropped object - Command dropAsTypedConstraintProperty = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.CONSTRAINT_PROPERTY); - if ((dropAsTypedConstraintProperty != null) && (dropAsTypedConstraintProperty.canExecute())) { - commandChoice.add(dropAsTypedConstraintProperty); - } - - // 8. Build default drop command (show view of the dropped object) - Command defaultDropCommand = super.getDropObjectsCommand(dropRequest); - if ((defaultDropCommand != null) && (defaultDropCommand.canExecute())) { - defaultDropCommand.setLabel("Default drop (Show dropped object in diagram)"); - commandChoice.add(defaultDropCommand); - } - - // Prepare the selection command (if several command are available) or return the drop command - if (commandChoice.size() > 1) { - RunnableWithResult<ICommand> runnable; - Display.getDefault().syncExec(runnable = new RunnableWithResult.Impl<ICommand>() { - - public void run() { - setResult(new SelectAndExecuteCommand("Select drop action for ", PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), commandChoice)); - } - }); - - ICommand selectCommand = runnable.getResult(); - - return new ICommandProxy(selectCommand); - } else if (commandChoice.size() == 1) { - return commandChoice.get(0); - } - - // else (command choice is empty) - return UnexecutableCommand.INSTANCE; - - } - - return super.getDropObjectsCommand(dropRequest); - } - - /** - * {@inheritDoc} - */ - @Override - protected View getReferenceViewForConnectorEnd() { - return ViewUtil.getContainerView(super.getReferenceViewForConnectorEnd()); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyStructureCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyStructureCompartmentSemanticEditPolicy.java deleted file mode 100644 index a5481a1015c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomBlockPropertyStructureCompartmentSemanticEditPolicy.java +++ /dev/null @@ -1,65 +0,0 @@ -/*****************************************************************************
- * 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:
- * Régis CHEVREL: chevrel.regis <at> gmail.com
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.sysml.constraints.ConstraintBlock;
-import org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockPropertyStructureCompartmentSemanticEditPolicy;
-import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
-import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-public class CustomBlockPropertyStructureCompartmentSemanticEditPolicy extends
- BlockPropertyStructureCompartmentSemanticEditPolicy {
-
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
-
- View dropTargetView = ((IGraphicalEditPart) getHost()).getNotationView();
- EObject eContainer = dropTargetView.eContainer();
- Element parent = null;
- if (eContainer != null && eContainer instanceof View) {
- parent = (Element) ((View) eContainer).getElement();
- }
- if (parent instanceof Property) {
- parent = ((Property) parent).getType();
- }
-
- if (parent != null) {
- if (UMLUtil.getStereotypeApplication(parent, ConstraintBlock.class) != null) {
- IElementType elementType = req.getElementType();
- if (elementType != UMLElementTypes.CONSTRAINT
- && elementType != UMLElementTypes.COMMENT) {
- // ConstraintBlock
- if (elementType != SysMLElementTypes.CONSTRAINT_PROPERTY) {
- // only ConstraintProperty can be dropped in structure
- // compartment of a diagram owned by a ConstraintBlock
- // (except common Comment and Constraint)
- return UnexecutableCommand.INSTANCE;
- }
- }
- }
- }
-
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDefaultSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDefaultSemanticEditPolicy.java deleted file mode 100644 index f3e58bef495..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDefaultSemanticEditPolicy.java +++ /dev/null @@ -1,103 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.policies; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.provider.IGraphicalTypeRegistry; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.infra.services.edit.utils.RequestParameterConstants; -import org.eclipse.papyrus.sysml.diagram.parametric.commands.CustomBindingConnectorReorientCommand; -import org.eclipse.papyrus.sysml.diagram.parametric.commands.CustomParametricContextLinkCreateCommand; -import org.eclipse.papyrus.sysml.diagram.parametric.commands.ReorientReferenceRelationshipRequestWithGraphical; -import org.eclipse.papyrus.sysml.diagram.parametric.provider.CustomGraphicalTypeRegistry; -import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes; -import org.eclipse.papyrus.sysml.diagram.parametric.provider.GraphicalTypeRegistry; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; -import org.eclipse.papyrus.uml.service.types.command.CommentAnnotatedElementsCreateCommand; -import org.eclipse.papyrus.uml.service.types.command.CommentAnnotatedElementsReorientCommand; -import org.eclipse.papyrus.uml.service.types.command.ConnectorReorientCommand; - -/** - * <pre> - * Custom semantic edit policy that replace DefaultSemanticEditPolicy - * in order to manage Class Diagram specific elements (reference - * relationships COMMENT_ANNOTATED_ELEMENT and CONSTRAINT_CONSTRAINED_ELEMENT). - * </pre> - */ -public class CustomDefaultSemanticEditPolicy extends DefaultSemanticEditPolicy { - - /** Local graphical type registry for graphical elements */ - private IGraphicalTypeRegistry registry = new CustomGraphicalTypeRegistry(); - - /** Local graphical type registry for inherited graphical elements */ - private IGraphicalTypeRegistry inheritedRegistry = new GraphicalTypeRegistry(); - - /** - * {@inheritDoc} - */ - @Override - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - - if (ElementTypes.COMMENT_ANNOTATED_ELEMENT == req.getElementType()) { - return getGEFWrapper(new CommentAnnotatedElementsCreateCommand(req)); - } - - if (ElementTypes.CONTEXT_LINK == req.getElementType()) { - return getGEFWrapper(new CustomParametricContextLinkCreateCommand(req)); - } - - String newEdgeGraphicalType = registry.getEdgeGraphicalType(req.getElementType()); - - if (inheritedRegistry.isKnownEdgeType(newEdgeGraphicalType)) { - return UnexecutableCommand.INSTANCE; - } - - if (!registry.isKnownEdgeType(newEdgeGraphicalType)) { - return UnexecutableCommand.INSTANCE; - } - - return super.getCreateRelationshipCommand(req); - } - - /** - * {@inheritDoc} - */ - @Override - protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { - - View reconnectedView = (View) req.getParameter(RequestParameterConstants.GRAPHICAL_RECONNECTED_EDGE); - String reconnectedViewType = (reconnectedView != null) ? reconnectedView.getType() : org.eclipse.papyrus.infra.gmfdiag.common.providers.IGraphicalTypeRegistry.UNDEFINED_TYPE; - - if (ElementTypes.COMMENT_ANNOTATED_ELEMENT.getSemanticHint().equals(reconnectedViewType)) { - return getGEFWrapper(new CommentAnnotatedElementsReorientCommand(req)); - } - - if (UMLGraphicalTypes.LINK_UML_CONNECTOR_ID.equals(reconnectedViewType)) { - if (req instanceof ReorientReferenceRelationshipRequestWithGraphical) { - return getGEFWrapper(new CustomBindingConnectorReorientCommand((ReorientReferenceRelationshipRequestWithGraphical) req)); - } - else { - return getGEFWrapper(new ConnectorReorientCommand(req)); - } - } - - - return super.getReorientReferenceRelationshipCommand(req); - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDragDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDragDropEditPolicy.java deleted file mode 100644 index 7ce99306223..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomDragDropEditPolicy.java +++ /dev/null @@ -1,278 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.policies; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest; -import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil; -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.gmf.diagram.common.edit.policy.CommonDiagramDragDropEditPolicy; -import org.eclipse.papyrus.sysml.blocks.NestedConnectorEnd; -import org.eclipse.papyrus.sysml.diagram.internalblock.dnd.helper.CustomLinkMappingHelper; -import org.eclipse.papyrus.sysml.diagram.parametric.provider.CustomGraphicalTypeRegistry; -import org.eclipse.papyrus.sysml.service.types.utils.ConnectorUtils; -import org.eclipse.papyrus.uml.diagram.common.commands.CommonDeferredCreateConnectionViewCommand; -import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; -import org.eclipse.uml2.uml.Connector; -import org.eclipse.uml2.uml.ConnectorEnd; -import org.eclipse.uml2.uml.EncapsulatedClassifier; -import org.eclipse.uml2.uml.Port; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Customization of the DND edit policy for the Internal Block Diagram */ -public class CustomDragDropEditPolicy extends CommonDiagramDragDropEditPolicy { - - private ConnectorUtils utils = new ConnectorUtils(); - - /** Default constructor. */ - public CustomDragDropEditPolicy() { - super(new CustomLinkMappingHelper()); - registry = new CustomGraphicalTypeRegistry(); - } - - /** - * {@inheritDoc} - */ - @Override - protected Set<String> getSpecificDropBehaviorTypes() { - Set<String> specificDropBehaviorTypes = new HashSet<String>(); - - specificDropBehaviorTypes.add(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID); - - return specificDropBehaviorTypes; - } - - /** - * {@inheritDoc} - */ - @Override - protected ICommand getSpecificDropCommand(DropObjectsRequest dropRequest, EObject droppedEObject, String nodeType, String edgeType) { - if ((UMLGraphicalTypes.LINK_UML_CONNECTOR_ID.equals(edgeType)) && (droppedEObject instanceof Connector)) { - return getConnectorDropCommand(dropRequest, (Connector) droppedEObject, edgeType); - } - - return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; - } - - protected ICommand getConnectorDropCommand(DropObjectsRequest dropRequest, Connector droppedEObject, String edgeType) { - - // Only manage binary link during drop - if (droppedEObject.getEnds().size() != 2) { - return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; - } - - ConnectorEnd source = droppedEObject.getEnds().get(0); - ConnectorEnd target = droppedEObject.getEnds().get(1); - - // Find views in current diagram representing source and target - Collection<View> sourceViews = getViewsForConnectorEnd(source); - Collection<View> targetViews = getViewsForConnectorEnd(target); - - IAdaptable sourceViewAdapter = null; - IAdaptable targetViewAdapter = null; - - // If either a source or target lacks create view for these elements, abort... - if (sourceViews.isEmpty() || targetViews.isEmpty()) { - return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; - } - - View selectedSourceView = null; - View selectedTargetView = null; - // until a correct one is found, check that source and target views selected are correct given the current path for the connector... - for (View sourceView : sourceViews) { - View targetView = getFirstValidTargetViewForSource(sourceView, targetViews, droppedEObject); - if (targetView != null) { - selectedSourceView = sourceView; - selectedTargetView = targetView; - break; - } - } - - - // Create source adapter - if (selectedSourceView != null) { // sourceViewAdapter should still be null in this case - sourceViewAdapter = new SemanticAdapter(null, selectedSourceView); - } else { - return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; - } - - // Create target adapter - if (selectedTargetView != null) { // targetViewAdapter should still be null in this case - targetViewAdapter = new SemanticAdapter(null, selectedTargetView); - } else { - return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; - } - - // Create a view for the dropped link between the source and target view adapters - IAdaptable droppedObjectAdapter = new SemanticAdapter(droppedEObject, null); - - CreateConnectionViewRequest.ConnectionViewDescriptor linkdescriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(droppedObjectAdapter, edgeType, getDiagramPreferencesHint()); - - CommonDeferredCreateConnectionViewCommand createConnectionViewCommand = new CommonDeferredCreateConnectionViewCommand(getEditingDomain(), edgeType, sourceViewAdapter, targetViewAdapter, getViewer(), getDiagramPreferencesHint(), linkdescriptor, null); - createConnectionViewCommand.setElement(droppedEObject); - - return createConnectionViewCommand; - } - - /** - * get the first valid target view for the given source. the couple source/target is valid if the path to them from the future container is valid - * - * @param sourceView - * @param targetViews - * @return - */ - private View getFirstValidTargetViewForSource(View sourceView, Collection<View> targetViews, Connector droppedConnector) { - for (View targetView : targetViews) { - if (isValidTargetViewForSource(sourceView, targetView, droppedConnector)) { - return targetView; - } - } - - return null; - } - - private boolean isValidTargetViewForSource(View sourceView, View targetView, Connector droppedConnector) { - if (!(utils.isCrossingEncapsulation(sourceView, targetView))) { - // no encapsulation. Computes the end paths - List<Property> sourceNestedPaths = utils.getNestedPropertyPath(sourceView, targetView); - List<Property> targetNestedPaths = utils.getNestedPropertyPath(targetView, sourceView); - - // check this is compatible with current connector - ConnectorEnd sourceConnectorEnd = utils.getSourceConnectorEnd(droppedConnector); - NestedConnectorEnd nestedSourceConnectorEnd = UMLUtil.getStereotypeApplication(sourceConnectorEnd, NestedConnectorEnd.class); - if (nestedSourceConnectorEnd != null) { - List<Property> currentSourceConnectorPropertyPath = nestedSourceConnectorEnd.getPropertyPath(); - // compare the 2 list - if (!sourceNestedPaths.equals(currentSourceConnectorPropertyPath)) { - return false; - } - - } else { // no end for the current connector, so the sourceNestedPath should be empty - if (!sourceNestedPaths.isEmpty()) { - return false; - } - } - - - ConnectorEnd targetConnectorEnd = utils.getTargetConnectorEnd(droppedConnector); - NestedConnectorEnd nestedTargetConnectorEnd = UMLUtil.getStereotypeApplication(targetConnectorEnd, NestedConnectorEnd.class); - if (nestedTargetConnectorEnd != null) { - List<Property> currentTargetConnectorPropertyPath = nestedTargetConnectorEnd.getPropertyPath(); - // compare the 2 list - if (!targetNestedPaths.equals(currentTargetConnectorPropertyPath)) { - return false; - } - - } else { // no end for the current connector, so the targetNestedPaths should be empty - if (!targetNestedPaths.isEmpty()) { - return false; - } - } - } - return true; - } - - /** - * This methods looks for views representing a given {@link ConnectorEnd} in the host diagram. - * - * @param end - * the {@link ConnectorEnd} to look for. - * @return the list of {@link View} representing the eObject. - */ - protected Set<View> getViewsForConnectorEnd(ConnectorEnd end) { - Set<View> views = new HashSet<View>(); - - // Retrieve host diagram - View hostView = ((IGraphicalEditPart) getHost()).getNotationView(); - View hostDiagram = (hostView instanceof Diagram) ? hostView : hostView.getDiagram(); - - // Retrieve all views for the ConnectorEnd role - EReference[] refs = { NotationPackage.eINSTANCE.getView_Element() }; - @SuppressWarnings("unchecked") - Collection<View> relatedViews = EMFCoreUtil.getReferencers(end.getRole(), refs); - - // TODO: We should filter views not only for the current diagram, - // but also consider only views nested within the owner of the connector that are closest to the host view - // (in case there are several instances of a Part within which the connector could appear). - // Connector connector = (Connector)end.getOwner(); - // StructuredClassifier connectorOwner = (StructuredClassifier)connector.getOwner(); - // Parse and select views from host diagram only - Iterator<View> it = relatedViews.iterator(); - while (it.hasNext()) { - View currentView = it.next(); - if (currentView.getDiagram() == hostDiagram) { // FIXME: Cf TODO above. - - boolean isInView = false; - View containerView = currentView; - while (containerView != null && !(containerView instanceof Diagram)) { - if (containerView == getReferenceViewForConnectorEnd()) { - isInView = true; - } - containerView = ViewUtil.getContainerView(containerView); - } - - if (isInView) { - - EObject containerElement = ViewUtil.getContainerView(currentView).getElement(); - - // If the ConnectorEnd partWithPort is not null, only select Views for which - // the graphical parent reference partWithPort. - if (end.getPartWithPort() != null) { - if (containerElement == end.getPartWithPort()) { - views.add(currentView); - } - } else { - // If the role is a Port, its graphical parent is a EncapsulatedClassifier - if (end.getRole() instanceof Port) { - if (containerElement instanceof EncapsulatedClassifier) { - views.add(currentView); - } else if (containerElement instanceof Property) { - Property property = (Property) containerElement; - if (property.getType() == end.getRole().getOwner()) { - views.add(currentView); - } - } - } else { // No further test needed - views.add(currentView); - } - - } - } - } - } - - return views; - } - - protected View getReferenceViewForConnectorEnd() { - return ((IGraphicalEditPart) getHost()).getNotationView(); - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomParametricSemanticPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomParametricSemanticPolicy.java deleted file mode 100644 index 32c432e2eb7..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomParametricSemanticPolicy.java +++ /dev/null @@ -1,270 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.policies; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gef.requests.ReconnectRequest; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.emf.type.core.IElementMatcher; -import org.eclipse.gmf.runtime.emf.type.core.SpecializationType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.sysml.constraints.ConstraintBlock; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyCompositeEditPart; -import org.eclipse.papyrus.sysml.diagram.parametric.commands.CustomBindingConnectorCreateCommand; -import org.eclipse.papyrus.sysml.diagram.parametric.commands.CustomParametricContextLinkReorientCommand; -import org.eclipse.papyrus.sysml.diagram.parametric.commands.ReorientReferenceRelationshipRequestWithGraphical; -import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomBlockCompositeEditPartTN; -import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomConstraintBlockPropertyCompositeEditPart; -import org.eclipse.papyrus.sysml.diagram.parametric.edit.policy.DiagramSemanticEditPolicy; -import org.eclipse.papyrus.sysml.service.types.matcher.PartPropertyMatcher; -import org.eclipse.papyrus.sysml.service.types.matcher.ReferencePropertyMatcher; -import org.eclipse.papyrus.sysml.service.types.matcher.ValuePropertyMatcher; -import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ContextLinkEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintParameterAffixedNodeEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedNodeEditPart; -import org.eclipse.papyrus.uml.tools.utils.UMLUtil; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.UMLPackage; - -public class CustomParametricSemanticPolicy extends DiagramSemanticEditPolicy { - - @Override - protected Command getSemanticCommand(IEditCommandRequest request) { - if (request instanceof CreateElementRequest) { - if (((CreateElementRequest) request).getElementType().getEClass() == UMLPackage.eINSTANCE.getProperty()) { - // Could create a ConstraintParameter on the diagram frame only if host element is a ConstraintBlock - Element semanticOwner = UMLUtil.resolveUMLElement(this.getHost()); - if (semanticOwner instanceof Class && org.eclipse.uml2.uml.util.UMLUtil.getStereotypeApplication(semanticOwner, ConstraintBlock.class) == null) { - return UnexecutableCommand.INSTANCE; - } - // Could not create Part/Reference/Value - if (request instanceof CreateElementRequest && ((CreateElementRequest) request).getElementType() instanceof SpecializationType) { - IElementMatcher matcher = ((SpecializationType) ((CreateElementRequest) request).getElementType()).getMatcher(); - if (matcher instanceof PartPropertyMatcher) { - return UnexecutableCommand.INSTANCE; - } - if (matcher instanceof ReferencePropertyMatcher) { - return UnexecutableCommand.INSTANCE; - } - if (matcher instanceof ValuePropertyMatcher) { - return UnexecutableCommand.INSTANCE; - } - } - } - } - return super.getSemanticCommand(request); - } - - @Override - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - if (req.getElementType().getEClass() == UMLPackage.eINSTANCE.getConnector()) { - if (getHost() instanceof CustomBlockCompositeEditPartTN) { - return UnexecutableCommand.INSTANCE; - } - if (getHost() instanceof CustomConstraintBlockPropertyCompositeEditPart) { - return UnexecutableCommand.INSTANCE; - } - if (getHost() instanceof ConstraintParameterAffixedNodeEditPart) { - return getGEFWrapper(new CustomBindingConnectorCreateCommand(req)); - } - if (getHost() instanceof PortAffixedNodeEditPart) { - return getGEFWrapper(new CustomBindingConnectorCreateCommand(req)); - } - if (getHost() instanceof BlockPropertyCompositeEditPart) { - return getGEFWrapper(new CustomBindingConnectorCreateCommand(req)); - } - } - return super.getCreateRelationshipCommand(req); - } - - /** - * Method getReorientRefRelationshipTargetCommand. Removes the reference the - * ConnectionEditPart current has an add the new TargetEditPart - * - * @param request - * @return Command - */ - @Override - protected Command getReorientRelationshipSourceCommand( - ReconnectRequest request) { - - EditPart target = request.getTarget(); - if (target instanceof CustomBlockCompositeEditPartTN) { - return UnexecutableCommand.INSTANCE; - } - if (target instanceof CustomConstraintBlockPropertyCompositeEditPart) { - return UnexecutableCommand.INSTANCE; - } - - org.eclipse.gef.ConnectionEditPart connectionEP = (request).getConnectionEditPart(); - - if (connectionEP instanceof ConnectionEditPart) { - if (!((ConnectionEditPart) connectionEP).isSemanticConnection()) { - return null; - } - } - - EditPart sourceEditPart = connectionEP.getSource(); - EditPart targetEditPart = connectionEP.getTarget(); - EObject referenceOwner = ViewUtil - .resolveSemanticElement((View) targetEditPart.getModel()); - EObject oldTarget = ViewUtil - .resolveSemanticElement((View) sourceEditPart.getModel()); - EObject newTarget = ViewUtil - .resolveSemanticElement((View) request.getTarget().getModel()); - - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) - .getEditingDomain(); - - ReorientReferenceRelationshipRequest semRequest = new ReorientReferenceRelationshipRequestWithGraphical( - editingDomain, referenceOwner, newTarget, oldTarget, - ReorientRequest.REORIENT_SOURCE, - request.getTarget(), targetEditPart); - - semRequest.addParameters(request.getExtendedData()); - return getSemanticCommand(semRequest); - } - - - - /** - * Method getReorientRefRelationshipTargetCommand. Removes the reference the - * ConnectionEditPart current has an add the new TargetEditPart - * - * @param request - * @return Command - */ - @Override - protected Command getReorientRelationshipTargetCommand( - ReconnectRequest request) { - - EditPart target = request.getTarget(); - if (target instanceof CustomBlockCompositeEditPartTN) { - return UnexecutableCommand.INSTANCE; - } - if (target instanceof CustomConstraintBlockPropertyCompositeEditPart) { - return UnexecutableCommand.INSTANCE; - } - - org.eclipse.gef.ConnectionEditPart connectionEP = (request).getConnectionEditPart(); - - if (connectionEP instanceof ConnectionEditPart) { - if (!((ConnectionEditPart) connectionEP).isSemanticConnection()) { - return null; - } - } - - EditPart sourceEditPart = connectionEP.getSource(); - EditPart targetEditPart = connectionEP.getTarget(); - EObject referenceOwner = ViewUtil - .resolveSemanticElement((View) sourceEditPart.getModel()); - EObject oldTarget = ViewUtil - .resolveSemanticElement((View) targetEditPart.getModel()); - EObject newTarget = ViewUtil - .resolveSemanticElement((View) request.getTarget().getModel()); - - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) - .getEditingDomain(); - - ReorientReferenceRelationshipRequest semRequest = new ReorientReferenceRelationshipRequestWithGraphical( - editingDomain, referenceOwner, newTarget, oldTarget, - ReorientRequest.REORIENT_TARGET, - sourceEditPart, request.getTarget()); - - semRequest.addParameters(request.getExtendedData()); - - return getSemanticCommand(semRequest); - } - - @Override - protected Command getReorientRefRelationshipSourceCommand( - ReconnectRequest request) { - - if (request.getConnectionEditPart() instanceof ContextLinkEditPart) { - org.eclipse.gef.ConnectionEditPart connectionEP = request.getConnectionEditPart(); - - if (connectionEP instanceof ConnectionEditPart) { - if (!((ConnectionEditPart) connectionEP).isSemanticConnection()) { - return null; - } - } - - EditPart sourceEditPart = connectionEP.getSource(); - EditPart targetEditPart = connectionEP.getTarget(); - EObject referenceOwner = ViewUtil - .resolveSemanticElement((View) targetEditPart.getModel()); - EObject oldTarget = ViewUtil - .resolveSemanticElement((View) sourceEditPart.getModel()); - EObject newTarget = ViewUtil - .resolveSemanticElement((View) request.getTarget().getModel()); - - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) - .getEditingDomain(); - - ReorientReferenceRelationshipRequestWithGraphical semRequest = new ReorientReferenceRelationshipRequestWithGraphical( - editingDomain, referenceOwner, newTarget, oldTarget, - ReorientRequest.REORIENT_SOURCE, - sourceEditPart, targetEditPart); - return getGEFWrapper(new CustomParametricContextLinkReorientCommand(semRequest)); - } - return super.getReorientRefRelationshipTargetCommand(request); - } - - @Override - protected Command getReorientRefRelationshipTargetCommand( - ReconnectRequest request) { - if (request.getConnectionEditPart() instanceof ContextLinkEditPart) { - org.eclipse.gef.ConnectionEditPart connectionEP = request.getConnectionEditPart(); - - if (connectionEP instanceof ConnectionEditPart) { - if (!((ConnectionEditPart) connectionEP).isSemanticConnection()) { - return null; - } - } - - EditPart sourceEditPart = connectionEP.getSource(); - EditPart targetEditPart = connectionEP.getTarget(); - EObject referenceOwner = ViewUtil - .resolveSemanticElement((View) sourceEditPart.getModel()); - EObject oldTarget = ViewUtil - .resolveSemanticElement((View) targetEditPart.getModel()); - EObject newTarget = ViewUtil - .resolveSemanticElement((View) request.getTarget().getModel()); - - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) - .getEditingDomain(); - - ReorientReferenceRelationshipRequestWithGraphical semRequest = new ReorientReferenceRelationshipRequestWithGraphical( - editingDomain, referenceOwner, newTarget, oldTarget, - ReorientRequest.REORIENT_TARGET, - sourceEditPart, targetEditPart); - return getGEFWrapper(new CustomParametricContextLinkReorientCommand(semRequest)); - } - return super.getReorientRefRelationshipTargetCommand(request); - } - - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomStructureClassifierDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomStructureClassifierDropEditPolicy.java deleted file mode 100644 index 2b1881ab51c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomStructureClassifierDropEditPolicy.java +++ /dev/null @@ -1,167 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.policies; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.commands.SelectAndExecuteCommand; -import org.eclipse.papyrus.sysml.constraints.ConstraintBlock; -import org.eclipse.papyrus.sysml.constraints.ConstraintProperty; -import org.eclipse.papyrus.sysml.diagram.parametric.utils.BlockDropHelper; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * <pre> - * Customization of the DND edit policy for the StructureClassifier compartments, that enables the direct - * creation of typed Part, Reference, ConstraintProperty, Value, ActorPart or Property by dragging types in a Block structure compartment. - * </pre> - */ -public class CustomStructureClassifierDropEditPolicy extends CustomDragDropEditPolicy { - - /** Default constructor */ - public CustomStructureClassifierDropEditPolicy() { - super(); - } - - /** - * {@inheritedDoc}. - */ - @Override - public Command getDropObjectsCommand(DropObjectsRequest dropRequest) { - - BlockDropHelper helper = new BlockDropHelper(getEditingDomain()); - - // Single drop management possible drop action list can be proposed - if (dropRequest.getObjects().size() == 1) { - - // List of available drop commands - final List<Command> commandChoice = new ArrayList<Command>(); - - // 1. Try to create a Part typed by the dropped object - Command dropAsTypedPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.PART_PROPERTY); - if ((dropAsTypedPart != null) && (dropAsTypedPart.canExecute())) { - commandChoice.add(dropAsTypedPart); - } - - // 2. Try to create a Reference typed by the dropped object - Command dropAsTypedReference = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.REFERENCE_PROPERTY); - if ((dropAsTypedReference != null) && (dropAsTypedReference.canExecute())) { - commandChoice.add(dropAsTypedReference); - } - - // 3. Try to create an ActorPart typed by the dropped object - Command dropAsTypedActorPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.ACTOR_PART_PROPERTY); - if ((dropAsTypedActorPart != null) && (dropAsTypedActorPart.canExecute())) { - commandChoice.add(dropAsTypedActorPart); - } - - // 4. Try to create a Value typed by the dropped object - Command dropAsTypedValue = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.VALUE_PROPERTY); - if ((dropAsTypedValue != null) && (dropAsTypedValue.canExecute())) { - commandChoice.add(dropAsTypedValue); - } - - // 5. Try to create a Property typed by the dropped object - Command dropAsTypedProperty = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), UMLElementTypes.PROPERTY); - if ((dropAsTypedProperty != null) && (dropAsTypedProperty.canExecute())) { - commandChoice.add(dropAsTypedProperty); - } - - // 6. Try to create a ConstraintProperty typed by the dropped object - Command dropAsTypedConstraintProperty = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.CONSTRAINT_PROPERTY); - if ((dropAsTypedConstraintProperty != null) && (dropAsTypedConstraintProperty.canExecute())) { - commandChoice.add(dropAsTypedConstraintProperty); - } - - // 7. Build default drop command (show view of the dropped object) - Command defaultDropCommand = super.getDropObjectsCommand(dropRequest); - if ((defaultDropCommand != null) && (defaultDropCommand.canExecute())) { - defaultDropCommand.setLabel("Default drop (Show dropped object in diagram)"); - commandChoice.add(defaultDropCommand); - } - - // Prepare the selection command (if several command are available) or return the drop command - if (commandChoice.size() > 1) { - RunnableWithResult<ICommand> runnable; - Display.getDefault().syncExec(runnable = new RunnableWithResult.Impl<ICommand>() { - - public void run() { - setResult(new SelectAndExecuteCommand("Select drop action for ", PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), commandChoice)); - } - }); - - ICommand selectCommand = runnable.getResult(); - - return new ICommandProxy(selectCommand); - - } else if (commandChoice.size() == 1) { - return commandChoice.get(0); - } - - // else (command choice is empty) - return UnexecutableCommand.INSTANCE; - - } - - return super.getDropObjectsCommand(dropRequest); - } - - /** - * {@inheritDoc} - */ - @Override - protected View getReferenceViewForConnectorEnd() { - return ViewUtil.getContainerView(super.getReferenceViewForConnectorEnd()); - } - - @Override - protected ICommand getDropObjectCommand(DropObjectsRequest dropRequest, EObject droppedObject) { - View dropTargetView = ((IGraphicalEditPart) getHost()).getNotationView(); - EObject dropTargetElement = dropTargetView.getElement(); - - EObject diagramOwner = getDiagramOwner(dropTargetView); - if (UMLUtil.getStereotypeApplication((Element) diagramOwner, ConstraintBlock.class) != null) { - // ConstraintBlock - if (UMLUtil.getStereotypeApplication((Element) dropTargetElement, ConstraintProperty.class) == null) { - // only ConstraintProperty can be dropped in structure compartment of a diagram owned by a ConstraintBlock - return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; - } - } - return super.getDropObjectCommand(dropRequest, droppedObject); - } - - private EObject getDiagramOwner(View dropTargetView) { - Diagram diagram = dropTargetView.getDiagram(); - EObject diagramOwer = diagram.getElement(); - return diagramOwer; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomStructureCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomStructureCompartmentSemanticEditPolicy.java deleted file mode 100644 index 1b6fddafcef..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/CustomStructureCompartmentSemanticEditPolicy.java +++ /dev/null @@ -1,65 +0,0 @@ -/*****************************************************************************
- * 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:
- * Régis CHEVREL: chevrel.regis <at> gmail.com
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.diagram.parametric.policies;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.sysml.constraints.ConstraintBlock;
-import org.eclipse.papyrus.sysml.diagram.common.edit.policy.StructureCompartmentSemanticEditPolicy;
-import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
-import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-public class CustomStructureCompartmentSemanticEditPolicy extends
- StructureCompartmentSemanticEditPolicy {
-
- @Override
- protected Command getCreateCommand(CreateElementRequest req) {
-
- View dropTargetView = ((IGraphicalEditPart) getHost()).getNotationView();
- EObject eContainer = dropTargetView.eContainer();
- Element parent = null;
- if (eContainer != null && eContainer instanceof View) {
- parent = (Element) ((View) eContainer).getElement();
- }
- if (parent instanceof Property) {
- parent = ((Property) parent).getType();
- }
-
- if (parent != null) {
- if (UMLUtil.getStereotypeApplication(parent, ConstraintBlock.class) != null) {
- IElementType elementType = req.getElementType();
- if (elementType != UMLElementTypes.CONSTRAINT
- && elementType != UMLElementTypes.COMMENT) {
- // ConstraintBlock
- if (elementType != SysMLElementTypes.CONSTRAINT_PROPERTY) {
- // only ConstraintProperty can be dropped in structure
- // compartment of a diagram owned by a ConstraintBlock
- // (except common Comment and Constraint)
- return UnexecutableCommand.INSTANCE;
- }
- }
- }
- }
-
- return super.getCreateCommand(req);
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/StructureClassifierDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/StructureClassifierDropEditPolicy.java deleted file mode 100644 index 2fda6946d81..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/policies/StructureClassifierDropEditPolicy.java +++ /dev/null @@ -1,139 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2013, 2016 CEA LIST, Esterel Technologies SAS 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * Alain Le Guennec (Esterel Technologies SAS) - bug 497400 - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.policies; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.commands.SelectAndExecuteCommand; -import org.eclipse.papyrus.sysml.diagram.parametric.utils.BlockDropHelper; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; - -/** - * <pre> - * Customization of the DND edit policy for the StructureClassifier compartments, that enables the direct - * creation of typed Part, Reference, Value, ActorPart or Property by dragging types in a Block structure compartment. - * </pre> - */ -public class StructureClassifierDropEditPolicy extends CustomDragDropEditPolicy { - - /** Default constructor */ - public StructureClassifierDropEditPolicy() { - super(); - } - - /** - * {@inheritedDoc}. - */ - @Override - public Command getDropObjectsCommand(DropObjectsRequest dropRequest) { - - BlockDropHelper helper = new BlockDropHelper(getEditingDomain()); - - // Single drop management possible drop action list can be proposed - if (dropRequest.getObjects().size() == 1) { - - // List of available drop commands - final List<Command> commandChoice = new ArrayList<Command>(); - - // 1. Try to create a Part typed by the dropped object - Command dropAsTypedPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.PART_PROPERTY); - if ((dropAsTypedPart != null) && (dropAsTypedPart.canExecute())) { - commandChoice.add(dropAsTypedPart); - } - - // 2. Try to create a Reference typed by the dropped object - Command dropAsTypedReference = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.REFERENCE_PROPERTY); - if ((dropAsTypedReference != null) && (dropAsTypedReference.canExecute())) { - commandChoice.add(dropAsTypedReference); - } - - // 3. Try to create an ActorPart typed by the dropped object - Command dropAsTypedActorPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.ACTOR_PART_PROPERTY); - if ((dropAsTypedActorPart != null) && (dropAsTypedActorPart.canExecute())) { - commandChoice.add(dropAsTypedActorPart); - } - - // 4. Try to create a Value typed by the dropped object - Command dropAsTypedValue = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.VALUE_PROPERTY); - if ((dropAsTypedValue != null) && (dropAsTypedValue.canExecute())) { - commandChoice.add(dropAsTypedValue); - } - - // 5. Try to create a Property typed by the dropped object - Command dropAsTypedProperty = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), UMLElementTypes.PROPERTY); - if ((dropAsTypedProperty != null) && (dropAsTypedProperty.canExecute())) { - commandChoice.add(dropAsTypedProperty); - } - - // 6. Try to create a ConstraintProperty typed by the dropped object - Command dropAsTypedConstraintProperty = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart) getHost(), SysMLElementTypes.CONSTRAINT_PROPERTY); - if ((dropAsTypedConstraintProperty != null) && (dropAsTypedConstraintProperty.canExecute())) { - commandChoice.add(dropAsTypedConstraintProperty); - } - - // 7. Build default drop command (show view of the dropped object) - Command defaultDropCommand = super.getDropObjectsCommand(dropRequest); - if ((defaultDropCommand != null) && (defaultDropCommand.canExecute())) { - defaultDropCommand.setLabel("Default drop (Show dropped object in diagram)"); - commandChoice.add(defaultDropCommand); - } - - // Prepare the selection command (if several command are available) or return the drop command - if (commandChoice.size() > 1) { - RunnableWithResult<ICommand> runnable; - Display.getDefault().syncExec(runnable = new RunnableWithResult.Impl<ICommand>() { - - public void run() { - setResult(new SelectAndExecuteCommand("Select drop action for ", PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), commandChoice)); - } - }); - - ICommand selectCommand = runnable.getResult(); - - return new ICommandProxy(selectCommand); - - } else if (commandChoice.size() == 1) { - return commandChoice.get(0); - } - - // else (command choice is empty) - return UnexecutableCommand.INSTANCE; - - } - - return super.getDropObjectsCommand(dropRequest); - } - - /** - * {@inheritDoc} - */ - @Override - protected View getReferenceViewForConnectorEnd() { - return ViewUtil.getContainerView(super.getReferenceViewForConnectorEnd()); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockPropertyCompositePreferencePage.java deleted file mode 100644 index bbdd7af189a..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/BlockPropertyCompositePreferencePage.java +++ /dev/null @@ -1,42 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.preferences; - -import org.eclipse.gmf.runtime.common.ui.preferences.AbstractPreferencePage; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.swt.widgets.Composite; - -public class BlockPropertyCompositePreferencePage extends AbstractPreferencePage { - - /** Constructor */ - public BlockPropertyCompositePreferencePage() { - super(); - } - - /** Default preferences initializer */ - public static void initDefaults(IPreferenceStore store) { - CustomBlockPropertyCompositePreferencePage.initDefaults(store); - /* CustomNestedBlockPropertyCompositePreferencePage.initDefaults(store); */ - } - - @Override - protected void addFields(Composite parent) { - - } - - @Override - protected void initHelp() { - - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintParameterAsBorderItemPreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintParameterAsBorderItemPreferencePage.java deleted file mode 100644 index f47329a8d25..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/ConstraintParameterAsBorderItemPreferencePage.java +++ /dev/null @@ -1,44 +0,0 @@ -/***************************************************************************** - * 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: - * R�gis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.preferences; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; -import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -/** - * {@link Port} preference page. - */ -public class ConstraintParameterAsBorderItemPreferencePage extends ParametricDiagramNodePreferencePage { - - /** Constant key to access preferences */ - public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID; //$NON-NLS-1$ - - public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID; //$NON-NLS-1$ - - /** Constructor */ - public ConstraintParameterAsBorderItemPreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID); //$NON-NLS-1$ - } - - /** Default preferences initializer */ - public static void initDefaults(IPreferenceStore store) { - store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 20); - store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 20); - store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.ELEMENTICON), 0); - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomBlockPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomBlockPropertyCompositePreferencePage.java deleted file mode 100644 index 2ffc26dbd2c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomBlockPropertyCompositePreferencePage.java +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * 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: - * R�gis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.preferences; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -/** - * Preference page for Part and References. - */ -public class CustomBlockPropertyCompositePreferencePage extends ParametricDiagramNodePreferencePage { - - /** Constant key to access preferences */ - public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID; //$NON-NLS-1$ - - public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID; //$NON-NLS-1$ - - /** The compartments default visibility for preferences */ - public static final Map<String, Boolean> compartmentDefaultVisibilityMap; - - /** The compartment titles default visibility for preferences */ - public static final Map<String, Boolean> compartmentTitleDefaultVisibilityMap; - - /** Static attribute initialization */ - static { - compartmentDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); - compartmentDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$ - - compartmentTitleDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); - compartmentTitleDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$ - - // Start of user code custom static initializations - compartmentTitleDefaultVisibilityMap.remove("structure"); //$NON-NLS-1$ - compartmentTitleDefaultVisibilityMap.put("structure", Boolean.FALSE); //$NON-NLS-1$ - // End of user code - - Collections.unmodifiableMap(compartmentDefaultVisibilityMap); - Collections.unmodifiableMap(compartmentTitleDefaultVisibilityMap); - } - - /** Constructor */ - public CustomBlockPropertyCompositePreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID); //$NON-NLS-1$ - } - - /** Default preferences initializer */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.WIDTH), 200); - store.setDefault(PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.HEIGHT), 100); - // End of user code - - // Initialize default visibility for compartments in preference page. - for (String compartmentName : compartmentDefaultVisibilityMap.keySet()) { - String showCompartmentKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY); - store.setDefault(showCompartmentKey, compartmentDefaultVisibilityMap.get(compartmentName)); - } - - // Initialize default title visibility for compartments in preference page. - for (String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) { - String showCompartmentTitleKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY); - store.setDefault(showCompartmentTitleKey, compartmentTitleDefaultVisibilityMap.get(compartmentName)); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeCompartmentNamesList() { - for (String name : compartmentDefaultVisibilityMap.keySet()) { - this.compartmentNamesList.add(name); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeCompartmentTitlesList() { - for (String name : compartmentTitleDefaultVisibilityMap.keySet()) { - this.compartmentTitlesList.add(name); - } - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConstraintPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConstraintPropertyCompositePreferencePage.java deleted file mode 100644 index 7634ef678be..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomConstraintPropertyCompositePreferencePage.java +++ /dev/null @@ -1,103 +0,0 @@ -/***************************************************************************** - * 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: - * R�gis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.preferences; - -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -/** - * Preference page for Part and References. - */ -public class CustomConstraintPropertyCompositePreferencePage extends ParametricDiagramNodePreferencePage { - - /** Constant key to access preferences */ - public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID; //$NON-NLS-1$ - - public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID; //$NON-NLS-1$ - - /** The compartments default visibility for preferences */ - public static final Map<String, Boolean> compartmentDefaultVisibilityMap; - - /** The compartment titles default visibility for preferences */ - public static final Map<String, Boolean> compartmentTitleDefaultVisibilityMap; - - /** Static attribute initialization */ - static { - compartmentDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); - compartmentDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$ - - compartmentTitleDefaultVisibilityMap = new LinkedHashMap<String, Boolean>(); - compartmentTitleDefaultVisibilityMap.put("structure", Boolean.TRUE); //$NON-NLS-1$ - - // Start of user code custom static initializations - compartmentTitleDefaultVisibilityMap.remove("structure"); //$NON-NLS-1$ - compartmentTitleDefaultVisibilityMap.put("structure", Boolean.FALSE); //$NON-NLS-1$ - // End of user code - - Collections.unmodifiableMap(compartmentDefaultVisibilityMap); - Collections.unmodifiableMap(compartmentTitleDefaultVisibilityMap); - } - - /** Constructor */ - public CustomConstraintPropertyCompositePreferencePage() { - super(); - setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID); //$NON-NLS-1$ - } - - /** Default preferences initializer */ - public static void initDefaults(IPreferenceStore store) { - // Start of user code custom default initializations - // End of user code - - // Initialize default visibility for compartments in preference page. - for (String compartmentName : compartmentDefaultVisibilityMap.keySet()) { - String showCompartmentKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY); - store.setDefault(showCompartmentKey, compartmentDefaultVisibilityMap.get(compartmentName)); - } - - // Initialize default title visibility for compartments in preference page. - for (String compartmentName : compartmentTitleDefaultVisibilityMap.keySet()) { - String showCompartmentTitleKey = PreferencesConstantsHelper.getCompartmentElementConstant(prefKey, compartmentName, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY); - store.setDefault(showCompartmentTitleKey, compartmentTitleDefaultVisibilityMap.get(compartmentName)); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeCompartmentNamesList() { - for (String name : compartmentDefaultVisibilityMap.keySet()) { - this.compartmentNamesList.add(name); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeCompartmentTitlesList() { - for (String name : compartmentTitleDefaultVisibilityMap.keySet()) { - this.compartmentTitlesList.add(name); - } - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java deleted file mode 100644 index 7987ab758c1..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/preferences/CustomPreferenceInitializer.java +++ /dev/null @@ -1,75 +0,0 @@ -/***************************************************************************** - * 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: - * R�gis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.preferences; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; -import org.eclipse.papyrus.sysml.diagram.parametric.Activator; -import org.eclipse.papyrus.sysml.diagram.parametric.provider.ElementTypes; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -/** - * Custom preferences initializer. - */ -public class CustomPreferenceInitializer extends ParametricDiagramPreferenceInitializer { - - @Override - protected IPreferenceStore getPreferenceStore() { - return Activator.getInstance().getPreferenceStore(); - } - - @Override - public void initializeDefaultPreferences() { - super.initializeDefaultPreferences(); - - IPreferenceStore store = getPreferenceStore(); - - ConstraintParameterAsBorderItemPreferencePage.initDefaults(store); - BlockPropertyCompositePreferencePage.initDefaults(store); - CustomConstraintPropertyCompositePreferencePage.initDefaults(store); - - // Initialize default positions for labels. - initDefaultPosition(UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID, UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID, 0, -10); - initDefaultPosition(UMLGraphicalTypes.LINK_UML_DEPENDENCY_ID, UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID, 0, -30); - - initDefaultPosition(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID, UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_LABEL_ID, 0, -10); - initDefaultPosition(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID, UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID, 0, -30); - initDefaultPosition(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID, UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_SOURCE_MULTIPLICITY_ID, 0, 10); - initDefaultPosition(UMLGraphicalTypes.LINK_UML_CONNECTOR_ID, UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_TARGET_MULTIPLICITY_ID, 0, 10); - - initDefaultPosition(UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID, UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID, -40, -15); - initDefaultPosition(UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_AFFIXED_ID, UMLGraphicalTypes.AFFIXEDLABEL_UML_APPLIEDSTEREOTYPE_ID, 30, -20); - - } - - /** - * Initialize default position of a link label in preferences. - * - * @param parentGraphicalType - * the graphical type of the view owning the label - * @param graphicalType - * the graphical type of the label - * @param x - * @param y - */ - protected void initDefaultPosition(String parentGraphicalType, String graphicalType, int x, int y) { - IPreferenceStore store = getPreferenceStore(); - - String xKey = PreferencesConstantsHelper.getElementConstant(ElementTypes.DIAGRAM_ID + "_" + parentGraphicalType + "-" + graphicalType, PreferencesConstantsHelper.LOCATION_X); - String yKey = PreferencesConstantsHelper.getElementConstant(ElementTypes.DIAGRAM_ID + "_" + parentGraphicalType + "-" + graphicalType, PreferencesConstantsHelper.LOCATION_Y); - - store.setDefault(xKey, x); - store.setDefault(yKey, y); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPolicyProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPolicyProvider.java deleted file mode 100644 index 62f6b2a58b4..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/CustomEditPolicyProvider.java +++ /dev/null @@ -1,187 +0,0 @@ -/***************************************************************************** - * 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: - * R�gis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.provider; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gmf.runtime.common.core.service.IOperation; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ResizableCompartmentEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation; -import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultXYLayoutEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyCompositeEditPart; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyStructureCompartmentEditPart; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.StructureCompartmentEditPart; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.CustomDuplicatePasteEditPolicy; -import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomBlockCompositeSemanticEditPolicy; -import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomDefaultSemanticEditPolicy; -import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomDiagramDropEditPolicy; -import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomDragDropEditPolicy; -import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.TypedElementDropEditPolicy; -import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomBlockCompositeEditPartTN; -import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.CustomConstraintBlockPropertyCompositeEditPart; -import org.eclipse.papyrus.sysml.diagram.parametric.edit.part.ParametricDiagramEditPart; -import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomBlockCompositeDropEditPolicy; -import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomBlockPropertyCompositeDropEditPolicy; -import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy; -import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomBlockPropertyStructureCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomParametricSemanticPolicy; -import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomStructureClassifierDropEditPolicy; -import org.eclipse.papyrus.sysml.diagram.parametric.policies.CustomStructureCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementBorderEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementLinkEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintParameterAffixedNodeEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.DependencyEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; -import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CommentEditPart; -import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CommentEditPartCN; -import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConstraintEditPart; -import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConstraintEditPartCN; -import org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConstraintSpecificationEditPartCN; - -/** - * Custom edit policy provider. - */ -public class CustomEditPolicyProvider extends ParametricDiagramEditPolicyProvider { - - @Override - public boolean provides(IOperation operation) { - - CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation) operation; - if (!(epOperation.getEditPart() instanceof IGraphicalEditPart)) { - return false; - } - - // Make sure this concern Parametric Diagram only - IGraphicalEditPart gep = (IGraphicalEditPart) epOperation.getEditPart(); - String diagramType = gep.getNotationView().getDiagram().getType(); - if (!ElementTypes.DIAGRAM_ID.equals(diagramType)) { - return false; - } - - // provides for the main diagram edit part - if (gep instanceof ParametricDiagramEditPart) { - return true; - } - - // Provides for edit parts that represent nodes in Internal Block diagram - if (gep instanceof AbstractElementEditPart) { - return true; - } - if (gep instanceof AbstractElementBorderEditPart) { - return true; - } - - // Provides for edit parts that represent edges in Internal Block diagram - if (gep instanceof AbstractElementLinkEditPart) { - return true; - } - - if (gep instanceof ResizableCompartmentEditPart) { - return true; - } - - if (gep instanceof ConstraintSpecificationEditPartCN) { - return true; - } - - if (gep instanceof ConstraintEditPartCN) { - return true; - } - - return super.provides(operation); - } - - @Override - public void createEditPolicies(EditPart editPart) { - super.createEditPolicies(editPart); - if(editPart instanceof ParametricDiagramEditPart) { - editPart.installEditPolicy(PasteEditPolicy.PASTE_ROLE, new CustomDuplicatePasteEditPolicy()); - editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDropEditPolicy()); - // no installation of other policies. - return; - } - - editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDragDropEditPolicy()); - - if ((editPart instanceof ConstraintEditPart) || (editPart instanceof ConstraintEditPartCN)) { - editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); - editPart.installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - editPart.installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); - } - - if ((editPart instanceof CommentEditPart) || (editPart instanceof CommentEditPartCN)) { - editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomDefaultSemanticEditPolicy()); - editPart.installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - editPart.installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); - } - - if (editPart instanceof BlockPropertyCompositeEditPart) { - editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomBlockPropertyCompositeDropEditPolicy()); - editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); - } - - if (editPart instanceof BlockPropertyStructureCompartmentEditPart) { - editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomBlockPropertyStructureCompartmentSemanticEditPolicy()); - editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy()); - editPart.installEditPolicy(EditPolicy.LAYOUT_ROLE, new DefaultXYLayoutEditPolicy()); - } - - if (editPart instanceof CustomBlockCompositeEditPartTN) { - editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomBlockCompositeDropEditPolicy()); - editPart.installEditPolicy(EditPolicyRoles.CREATION_ROLE, new StructuredClassifierCreationEditPolicy()); - - editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomBlockCompositeSemanticEditPolicy()); - } - - if (editPart instanceof StructureCompartmentEditPart) { - editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomStructureCompartmentSemanticEditPolicy()); - editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomStructureClassifierDropEditPolicy()); - editPart.installEditPolicy(EditPolicy.LAYOUT_ROLE, new DefaultXYLayoutEditPolicy()); - } - - if (editPart instanceof DependencyEditPart) { - editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomDefaultSemanticEditPolicy()); - } - - if (editPart instanceof ConnectorEditPart) { - editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomDefaultSemanticEditPolicy()); - } - - if (editPart instanceof CustomConstraintBlockPropertyCompositeEditPart) { - editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomBlockPropertyCompositeDropEditPolicy()); - editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); - } - if (editPart instanceof ConstraintParameterAffixedNodeEditPart) { - editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new TypedElementDropEditPolicy()); - editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); - } - if (editPart instanceof CustomBlockCompositeEditPartTN) { - editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); - } - if (editPart instanceof ConstraintSpecificationEditPartCN) { - editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); - } - if (editPart instanceof ConstraintEditPartCN) { - editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomParametricSemanticPolicy()); - } - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricVisualTypeProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricVisualTypeProvider.java deleted file mode 100644 index 4a48162d265..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParametricVisualTypeProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package org.eclipse.papyrus.sysml.diagram.parametric.provider; - -import org.eclipse.papyrus.gmf.diagram.common.provider.SysMLVisualTypeProvider; -import org.eclipse.papyrus.uml.diagram.composite.providers.UMLVisualTypeProvider; - -/** - * Visual type provider for the SysML Parametric Diagram. - */ -public class ParametricVisualTypeProvider extends SysMLVisualTypeProvider { - - public ParametricVisualTypeProvider() { - super(new CustomGraphicalTypeRegistry(), new UMLVisualTypeProvider()); - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParserProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParserProvider.java deleted file mode 100644 index da517cf5297..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/provider/ParserProvider.java +++ /dev/null @@ -1,107 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.provider; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.common.core.service.AbstractProvider; -import org.eclipse.gmf.runtime.common.core.service.IOperation; -import org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.sysml.diagram.common.parser.FlowPortLabelParser; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.sysml.diagram.parametric.parser.ParametricFrameParser; -import org.eclipse.papyrus.uml.diagram.common.parser.ConnectorLabelParser; -import org.eclipse.papyrus.uml.diagram.common.parser.ConstraintLabelParser; -import org.eclipse.papyrus.uml.diagram.common.parser.MultiplicityElementLabelParser; -import org.eclipse.papyrus.uml.diagram.common.parser.NamedElementLabelParser; -import org.eclipse.papyrus.uml.diagram.common.parser.PropertyLabelParser; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -/** - * Parser provider for labels used by this diagram. - */ -public class ParserProvider extends AbstractProvider implements IParserProvider { - - /** map from graphical hint to parsers */ - private static final Map<String, IParser> graphicalHintToParser = new HashMap<String, IParser>(); - - static { - graphicalHintToParser.put(SysMLGraphicalTypes.LABEL_SYSML_BLOCK_NAME_ID, new ParametricFrameParser()); - graphicalHintToParser.put(UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID, new PropertyLabelParser()); - graphicalHintToParser.put(UMLGraphicalTypes.SHAPE_UML_CONSTRAINT_AS_LABEL_ID, new ConstraintLabelParser()); - - graphicalHintToParser.put(UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID, new PropertyLabelParser()); - graphicalHintToParser.put(SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID, new FlowPortLabelParser()); - - graphicalHintToParser.put(UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID, new NamedElementLabelParser()); - graphicalHintToParser.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_LABEL_ID, new ConnectorLabelParser()); - graphicalHintToParser.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_SOURCE_MULTIPLICITY_ID, new MultiplicityElementLabelParser()); - graphicalHintToParser.put(UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_TARGET_MULTIPLICITY_ID, new MultiplicityElementLabelParser()); - } - - /** - * {@inheritDoc} - */ - public boolean provides(IOperation operation) { - if (operation instanceof GetParserOperation) { - IAdaptable hint = ((GetParserOperation) operation).getHint(); - - if (!ElementTypes.DIAGRAM_ID.equals(getDiagramType(hint))) { - return false; - } - - return getParser(hint) != null; - } - return false; - } - - /** - * {@inheritDoc} - */ - public IParser getParser(IAdaptable hint) { - String parserHint = (String) hint.getAdapter(String.class); - if (parserHint != null) { - IParser parser = graphicalHintToParser.get(parserHint); - if (parser != null) { - return parser; - } - } - - View view = (View) hint.getAdapter(View.class); - if (view != null) { - IParser parser = graphicalHintToParser.get(view.getType()); - if (parser != null) { - return parser; - } - } - - return null; - } - - private String getDiagramType(IAdaptable hint) { - Diagram diagram = (Diagram) hint.getAdapter(Diagram.class); - if (diagram != null) { - return diagram.getType(); - } - - return "undefined"; - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/BlockDropHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/BlockDropHelper.java deleted file mode 100644 index 6f7d5d57c10..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/BlockDropHelper.java +++ /dev/null @@ -1,301 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.utils; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor; -import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.utils.ViewDescriptorUtil; -import org.eclipse.papyrus.infra.services.edit.commands.ConfigureFeatureCommandFactory; -import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.papyrus.uml.diagram.common.helper.ElementHelper; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.uml2.uml.Actor; -import org.eclipse.uml2.uml.Association; -import org.eclipse.uml2.uml.DataType; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Type; -import org.eclipse.uml2.uml.TypedElement; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * This class provides convenience methods to create Block specific drop action (Part, Reference or ConstraintProperty creation). - */ -public class BlockDropHelper extends ElementHelper { - - public BlockDropHelper(TransactionalEditingDomain editDomain) { - this.editDomain = editDomain; - } - - public Command getDropAsStructureItemOnPart(DropObjectsRequest request, GraphicalEditPart host, IElementType elementType) { - Object droppedEObject = request.getObjects().get(0); - String label = ""; - if (elementType == SysMLElementTypes.PART_PROPERTY) { - label = "Create a new Part"; - // Exclude ConstraintProperty - if (droppedEObject instanceof Type) { - if (((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type) droppedEObject)) { - return UnexecutableCommand.INSTANCE; - } - } - // Exclude reference drop in diagram owned by a ConstraintBlock - Element editPartOwner = (Element) host.resolveSemanticElement(); - if (editPartOwner instanceof Property) { - editPartOwner = ((Property) editPartOwner).getType(); - } - if (editPartOwner != null && ((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches(editPartOwner)) { - return UnexecutableCommand.INSTANCE; - } - } - if (elementType == SysMLElementTypes.REFERENCE_PROPERTY) { - label = "Create a new Reference"; - // Exclude ConstraintProperty - if (droppedEObject instanceof Type) { - if (((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type) droppedEObject)) { - return UnexecutableCommand.INSTANCE; - } - } - // Exclude reference drop in diagram owned by a ConstraintBlock - Element editPartOwner = (Element) host.resolveSemanticElement(); - if (editPartOwner instanceof Property) { - editPartOwner = ((Property) editPartOwner).getType(); - } - if (editPartOwner != null && ((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches(editPartOwner)) { - return UnexecutableCommand.INSTANCE; - } - } - if (elementType == SysMLElementTypes.ACTOR_PART_PROPERTY) { - label = "Create a new ActorPart"; - } - if (elementType == SysMLElementTypes.VALUE_PROPERTY) { - label = "Create a new Value"; - } - if (elementType == UMLElementTypes.PROPERTY) { - label = "Create a new Property"; - } - // New kind of element - if (elementType == SysMLElementTypes.CONSTRAINT_PROPERTY) { - label = "Create a new ConstraintProperty"; - // Constraint Property on ConstraintBlock strictly - if (droppedEObject instanceof Type) { - if (!((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type) droppedEObject)) { - return UnexecutableCommand.INSTANCE; - } - } - } - - CompoundCommand cc = new CompoundCommand(label); - - if (!isValidStructureItemType(droppedEObject, elementType)) { - return UnexecutableCommand.INSTANCE; - } - - // Verify target nature - EObject target = getHostEObject(host); - if ((!(target instanceof TypedElement)) || (((TypedElement) target).getType() == null)) { - return UnexecutableCommand.INSTANCE; - } - - // The target type has to be a Block (will hold the created Port) - Type targetType = ((TypedElement) target).getType(); - if (!((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches(targetType)) { - return UnexecutableCommand.INSTANCE; - } - - // Prepare a command for the element creation and the drop in diagram - - // 1. Prepare creation command - ICommand createElementCommand = null; - CreateElementRequest createElementRequest = new CreateElementRequest(getEditingDomain(), targetType, elementType); - createElementRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getTypedElement_Type(), request.getObjects().get(0))); - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetType); - if (provider != null) { - createElementCommand = provider.getEditCommand(createElementRequest); - } - IAdaptable createElementRequestAdapter = new CreateElementRequestAdapter(createElementRequest); - - // 2. Prepare the drop command - ViewDescriptor descriptor = new ViewDescriptor(createElementRequestAdapter, Node.class, /* explicit semantic hint is mandatory */null, ViewDescriptorUtil.PERSISTED, host.getDiagramPreferencesHint()); - CreateViewRequest createViewRequest = new CreateViewRequest(descriptor); - createViewRequest.setLocation(request.getLocation().getCopy()); - Command viewCreateCommand = host.getCommand(createViewRequest); - - // 3. Create the compound command - cc.add(new ICommandProxy(createElementCommand)); - cc.add(viewCreateCommand); - - return cc; - } - - public Command getDropAsStructureItem(DropObjectsRequest request, GraphicalEditPart host, IElementType elementType) { - Object droppedEObject = request.getObjects().get(0); - String label = ""; - - // Filter part/reference : a property type by a ConstraintBlock MUST be a ConstraintProperty - if (elementType == SysMLElementTypes.PART_PROPERTY) { - label = "Create a new Part"; - // Exclude ConstraintProperty - if (droppedEObject instanceof Type) { - if (((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type) droppedEObject)) { - return UnexecutableCommand.INSTANCE; - } - } - // Exclude reference drop in diagram owned by a ConstraintBlock - Element diagramOwner = getDiagramOwner(host); - if (diagramOwner != null && ((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches(diagramOwner)) { - return UnexecutableCommand.INSTANCE; - } - } - if (elementType == SysMLElementTypes.REFERENCE_PROPERTY) { - label = "Create a new Reference"; - // Exclude ConstraintProperty - if (droppedEObject instanceof Type) { - if (((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type) droppedEObject)) { - return UnexecutableCommand.INSTANCE; - } - } - // Exclude reference drop in diagram owned by a ConstraintBlock - Element diagramOwner = getDiagramOwner(host); - if (diagramOwner != null && ((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches(diagramOwner)) { - return UnexecutableCommand.INSTANCE; - } - } - if (elementType == SysMLElementTypes.ACTOR_PART_PROPERTY) { - label = "Create a new ActorPart"; - } - if (elementType == SysMLElementTypes.VALUE_PROPERTY) { - label = "Create a new Value"; - } - if (elementType == UMLElementTypes.PROPERTY) { - label = "Create a new Property"; - } - - // New kind of element - if (elementType == SysMLElementTypes.CONSTRAINT_PROPERTY) { - label = "Create a new ConstraintProperty"; - // Constraint Property on ConstraintBlock strictly - if (droppedEObject instanceof Type) { - if (!((ISpecializationType) SysMLElementTypes.CONSTRAINT_BLOCK).getMatcher().matches((Type) droppedEObject)) { - return UnexecutableCommand.INSTANCE; - } - } - } - CompoundCommand cc = new CompoundCommand(label); - - if (!isValidStructureItemType(droppedEObject, elementType)) { - return UnexecutableCommand.INSTANCE; - } - - // Prepare a command for the element creation and the drop in diagram - - // 1. Prepare creation command - ICommand createElementCommand = null; - CreateElementRequest createElementRequest = new CreateElementRequest(getEditingDomain(), getHostEObject(host), elementType); - createElementRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getTypedElement_Type(), request.getObjects().get(0))); - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getHostEObject(host)); - if (provider != null) { - createElementCommand = provider.getEditCommand(createElementRequest); - } - IAdaptable createElementRequestAdapter = new CreateElementRequestAdapter(createElementRequest); - - // 2. Prepare the drop command - ViewDescriptor descriptor = new ViewDescriptor(createElementRequestAdapter, Node.class, /* explicit semantic hint is mandatory */null, ViewDescriptorUtil.PERSISTED, host.getDiagramPreferencesHint()); - CreateViewRequest createViewRequest = new CreateViewRequest(descriptor); - createViewRequest.setLocation(request.getLocation().getCopy()); - Command viewCreateCommand = host.getCommand(createViewRequest); - - // 3. Create the compound command - cc.add(new ICommandProxy(createElementCommand)); - cc.add(viewCreateCommand); - - return cc; - } - - private Element getDiagramOwner(GraphicalEditPart host) { - Object model = host.getRoot().getContents().getModel(); - if (model instanceof View) { - return (Element) ((View) model).getElement(); - } - return null; - } - - private boolean isValidStructureItemType(Object object, IElementType elementType) { - boolean isValid = false; - - if ((object != null) && (object instanceof Type) && !(object instanceof Association)) { - - Type type = (Type) object; - if ((elementType == SysMLElementTypes.PART_PROPERTY) || (elementType == SysMLElementTypes.REFERENCE_PROPERTY)) { - if (((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches(type)) { - isValid = true; - } - } - if (elementType == SysMLElementTypes.ACTOR_PART_PROPERTY) { - if (type instanceof Actor) { - isValid = true; - } - } - if (elementType == SysMLElementTypes.VALUE_PROPERTY) { - if (((ISpecializationType) SysMLElementTypes.VALUE_TYPE).getMatcher().matches(type) || (type instanceof DataType)) { - isValid = true; - } - } - if ((elementType == SysMLElementTypes.CONSTRAINT_PROPERTY)) { - if (((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches(type)) { - isValid = true; - } - } - if (elementType == UMLElementTypes.PROPERTY) { - if (!((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches(type) - && !(type instanceof Actor) - && !(type instanceof DataType) - && !((ISpecializationType) SysMLElementTypes.VALUE_TYPE).getMatcher().matches(type)) { - isValid = true; - } - } - } - - return isValid; - } - - /** - * return the host Edit Part's semantic element, if the semantic element - * is <code>null</code> or unresolvable it will return <code>null</code> - * - * @return EObject - */ - protected EObject getHostEObject(GraphicalEditPart host) { - return ViewUtil.resolveSemanticElement((View) host.getModel()); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/ConstraintParameterDropHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/ConstraintParameterDropHelper.java deleted file mode 100644 index 957993c457e..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.parametric/src/org/eclipse/papyrus/sysml/diagram/parametric/utils/ConstraintParameterDropHelper.java +++ /dev/null @@ -1,94 +0,0 @@ -/***************************************************************************** - * 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: - * Régis CHEVREL: chevrel.regis <at> gmail.com - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.parametric.utils; - -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.utils.ViewDescriptorUtil; -import org.eclipse.papyrus.sysml.constraints.ConstraintBlock; -import org.eclipse.papyrus.sysml.constraints.ConstraintProperty; -import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter; -import org.eclipse.papyrus.uml.diagram.common.helper.ElementHelper; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Port; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Type; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * This class provides convenience methods to create Type specific drop action (Show Port on BlockPropertyComposite). - */ -public class ConstraintParameterDropHelper extends ElementHelper { - - public ConstraintParameterDropHelper(TransactionalEditingDomain editDomain) { - this.editDomain = editDomain; - } - - public Command getDropConstraintParameter(Property droppedConstraintParameter, Point location, GraphicalEditPart host) { - return getDropConstraintParameterOnPart(droppedConstraintParameter, location, host); - } - - public Command getDropConstraintParameterOnPart(Property droppedConstraintParameter, Point location, GraphicalEditPart host) { - - if (!isValidConstraintParameter(droppedConstraintParameter, getHostEObject(host))) { - return UnexecutableCommand.INSTANCE; - } - - // Prepare the view creation command - ViewDescriptor descriptor = new ViewDescriptor(new SemanticAdapter(droppedConstraintParameter, null), Node.class, /* explicit semantic hint is mandatory */null, ViewDescriptorUtil.PERSISTED, host.getDiagramPreferencesHint()); - CreateViewRequest createViewRequest = new CreateViewRequest(descriptor); - createViewRequest.setLocation(location); - Command viewCreateCommand = host.getCommand(createViewRequest); - - return viewCreateCommand; - } - - private boolean isValidConstraintParameter(Object object, EObject dropTarget) { - // check if not a Port/FlowPort ... - if (object instanceof Port) { - return false; - } - // drop on a Block/ConstraintBlock - if (dropTarget instanceof Class && UMLUtil.getStereotypeApplication((Class) dropTarget, ConstraintBlock.class) != null) { - return ((Class) dropTarget).getOwnedAttributes().contains(object); - } - // drop on a part - if (dropTarget instanceof Property && UMLUtil.getStereotypeApplication((Property) dropTarget, ConstraintProperty.class) != null) { - Type type = ((Property) dropTarget).getType(); - if (type instanceof Class && UMLUtil.getStereotypeApplication(type, ConstraintBlock.class) != null) { - return ((Class) type).getOwnedAttributes().contains(object); - } - } - return false; - } - - /** - * return the host Edit Part's semantic element, if the semantic element - * is <code>null</code> or unresolvable it will return <code>null</code> - * - * @return EObject - */ - protected EObject getHostEObject(GraphicalEditPart host) { - return ViewUtil.resolveSemanticElement((View) host.getModel()); - } -} |