From ae82dd4c8ee95776a81bf1a94cfcd4540ee638b6 Mon Sep 17 00:00:00 2001 From: Benoit Maggi Date: Thu, 13 Feb 2014 16:41:22 +0100 Subject: Bug 290261 - [Usability] Papyrus shall provide a copy/paste/cut feature Remove org.eclipse.papyrus.uml.pastmanager plugin Change keybinding for Diagram only paste from M1+V to M1+M2+V Change keybinding for DiagramWithModel paste from M1+M2+V to M1+V Change-Id: I439fb20e62a15cd27f77818343574a19790d4731 Signed-off-by: Benoit Maggi --- .../org.eclipse.papyrus.uml.feature/feature.xml | 192 +- .../plugin.xml | 363 +- .../schema/pasteCommandProvider.exsd | 150 + .../common/commands/requests/PasteRequest.java | 74 + .../plugin.xml | 296 +- .../META-INF/MANIFEST.MF | 147 +- .../META-INF/MANIFEST.MF | 211 +- .../plugin.xml | 4 +- .../common/commands/CommentDropCreation.java | 98 + .../commands/PapyrusDuplicateWrapperCommand.java | 228 + .../editpolicies/DuplicatePasteEditPolicy.java | 4 +- .../common/handlers/PasteWithModelHandler.java | 2 +- .../providers/DefaultPasteCommandProvider.java | 191 + .../common/providers/IPasteCommandProvider.java | 54 + .../PapyrusDiagramGlobalActionHandler.java | 2 +- .../common/service/PasteCommandService.java | 155 + .../META-INF/MANIFEST.MF | 83 +- .../plugin.xml | 8770 ++++++++++---------- .../menu/handlers/PasteWithModelHandler.java | 192 +- .../.classpath | 7 - .../org.eclipse.papyrus.uml.pastemanager/.project | 28 - .../.settings/org.eclipse.jdt.core.prefs | 8 - .../META-INF/MANIFEST.MF | 26 - .../about.html | 28 - .../build.properties | 12 - .../plugin.properties | 17 - .../plugin.xml | 7 - .../schema/pasteCommandProvider.exsd | 150 - .../papyrus/uml/pastemanager/Activator.java | 74 - .../pastemanager/command/CommentDropCreation.java | 98 - .../command/GEFtoEMFCommandWrapper.java | 34 - .../command/PapyrusDuplicateWrapperCommand.java | 219 - .../uml/pastemanager/request/PasteRequest.java | 59 - .../service/DefaultPasteCommandProvider.java | 188 - .../service/IPasteCommandProvider.java | 54 - .../pastemanager/service/PasteCommandService.java | 154 - 36 files changed, 6134 insertions(+), 6245 deletions(-) create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/pasteCommandProvider.exsd create mode 100644 plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/commands/requests/PasteRequest.java create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/CommentDropCreation.java create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/PapyrusDuplicateWrapperCommand.java create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/DefaultPasteCommandProvider.java create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/IPasteCommandProvider.java create mode 100644 plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PasteCommandService.java delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/.classpath delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/.project delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/.settings/org.eclipse.jdt.core.prefs delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/META-INF/MANIFEST.MF delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/about.html delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/build.properties delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/plugin.properties delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/plugin.xml delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/schema/pasteCommandProvider.exsd delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/Activator.java delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/command/CommentDropCreation.java delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/command/GEFtoEMFCommandWrapper.java delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/command/PapyrusDuplicateWrapperCommand.java delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/request/PasteRequest.java delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/service/DefaultPasteCommandProvider.java delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/service/IPasteCommandProvider.java delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/service/PasteCommandService.java diff --git a/features/papyrus-main-features/org.eclipse.papyrus.uml.feature/feature.xml b/features/papyrus-main-features/org.eclipse.papyrus.uml.feature/feature.xml index d4fc616082c..d5a812e9c16 100644 --- a/features/papyrus-main-features/org.eclipse.papyrus.uml.feature/feature.xml +++ b/features/papyrus-main-features/org.eclipse.papyrus.uml.feature/feature.xml @@ -1,52 +1,140 @@ - - - - Copyright (c) 2012 CEA LIST. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Eclipse Public License -v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/epl-v10.html - - - - %license - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + Copyright (c) 2012 CEA LIST. +All rights reserved. This program and the accompanying materials +are made available under the terms of the Eclipse Public License +v1.0 +which accompanies this distribution, and is available at +http://www.eclipse.org/legal/epl-v10.html + + + + %license + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml index 412b9fe2c4f..b675129ed49 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/plugin.xml @@ -1,183 +1,184 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/pasteCommandProvider.exsd b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/pasteCommandProvider.exsd new file mode 100644 index 00000000000..828559605ee --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/schema/pasteCommandProvider.exsd @@ -0,0 +1,150 @@ + + + + + + + + + this extension point is used to declare a class that can provide command in charge of the paste + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a paste provider has to provide an operation in order to paste by taking account system clipboard or papyrus clipboard + + + + + + + this is the class that will provide the command in charge of the paste + + + + + + + + + + this the priority of the associated pasteCommandProvider +The priority of the provider. It can be one of the following values: +[Lowest, Low, Medium, High, Highest]. + + + + + + + + + + + + + + + + + + + + + + + + + + 0.7.0 + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + + + + + /***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ + + + + diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/commands/requests/PasteRequest.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/commands/requests/PasteRequest.java new file mode 100644 index 00000000000..3fd7cc87295 --- /dev/null +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/commands/requests/PasteRequest.java @@ -0,0 +1,74 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.common.commands.requests; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; + +import org.eclipse.gef.Request; +import org.eclipse.gmf.runtime.diagram.ui.requests.DuplicateRequest; + +/** + * This is a specific paste request in the framework of papyrus. + */ +public class PasteRequest extends Request { + + /** The Constant REQ_PAPYRUS_PASTE. */ + public final static String REQ_PAPYRUS_PASTE="Papyrus_PASTE"; //$NON-NLS-1$ + + /** The element to paste. */ + protected Collection elementToPaste; + + /** + * Instantiates a new paste request. + * + * @param elementToPaste the element to paste + */ + public PasteRequest(Collection elementToPaste){ + this.elementToPaste=elementToPaste; + this.setType(REQ_PAPYRUS_PASTE); + } + + /** + * Sets the element to paste. + * + * @param elementToPaste the elementToPaste to set + */ + public void setElementToPaste(Collection elementToPaste) { + this.elementToPaste = elementToPaste; + } + + /** + * Gets the element to paste. + * + * @return the elementToPaste + */ + public Collection getElementToPaste() { + return elementToPaste; + } + + /** + * Gets the duplicate. + * + * @return the duplicate + */ + public DuplicateRequest getDuplicate(){ + DuplicateRequest duplicateRequest= new DuplicateRequest(); + duplicateRequest.setEditParts(new ArrayList()); + duplicateRequest.setExtendedData(new HashMap()); + return duplicateRequest; + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.xml b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.xml index 76f118827e0..60cae741b48 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.xml +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.menu/plugin.xml @@ -1,139 +1,157 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF index 8e5e8926f68..a11480ac410 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF @@ -1,74 +1,73 @@ -Manifest-Version: 1.0 -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - org.eclipse.papyrus.infra.core;bundle-version="1.0.0", - org.eclipse.emf;bundle-version="2.6.0", - org.eclipse.uml2.uml;bundle-version="3.1.0", - org.eclipse.papyrus.sysml;bundle-version="1.0.0", - org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0", - org.eclipse.core.expressions, - org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.0", - org.eclipse.papyrus.editor;bundle-version="1.0.0", - org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.0.0", - org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.0.0", - org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0", - org.eclipse.papyrus.uml.service.types;bundle-version="1.0.0", - org.eclipse.papyrus.sysml.service.types;bundle-version="1.0.0", - org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.0.0", - org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0", - org.eclipse.papyrus.uml.modelexplorer.widgets;bundle-version="1.0.0", - org.eclipse.draw2d;bundle-version="3.7.1", - org.eclipse.gmf.runtime.diagram.core;bundle-version="1.4.1", - org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0", - org.eclipse.papyrus.uml.tools;bundle-version="1.0.0", - org.eclipse.papyrus.infra.emf;bundle-version="1.0.0", - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0", - org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.0.0", - org.eclipse.papyrus.uml.pastemanager;bundle-version="1.0.0", - org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0", - org.eclipse.uml2.common.edit;bundle-version="1.6.0", - org.eclipse.uml2.uml.edit;bundle-version="4.0.0", - org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0", - org.eclipse.emf.edit.ui;bundle-version="2.8.0", - org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0", - org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.0.0", - org.eclipse.gmf.tooling.runtime;bundle-version="3.1.0", - org.eclipse.papyrus.uml.diagram.composite;bundle-version="1.0.0" -Export-Package: org.eclipse.papyrus.gmf.diagram.common.commands, - org.eclipse.papyrus.gmf.diagram.common.compatibility, - org.eclipse.papyrus.gmf.diagram.common.edit.part, - org.eclipse.papyrus.gmf.diagram.common.edit.policy, - org.eclipse.papyrus.gmf.diagram.common.factory, - org.eclipse.papyrus.gmf.diagram.common.figure, - org.eclipse.papyrus.gmf.diagram.common.locator, - org.eclipse.papyrus.gmf.diagram.common.parser, - org.eclipse.papyrus.gmf.diagram.common.provider, - org.eclipse.papyrus.sysml.diagram.common, - org.eclipse.papyrus.sysml.diagram.common.commands, - org.eclipse.papyrus.sysml.diagram.common.dialogs, - org.eclipse.papyrus.sysml.diagram.common.edit.part, - org.eclipse.papyrus.sysml.diagram.common.edit.policy, - org.eclipse.papyrus.sysml.diagram.common.factory, - org.eclipse.papyrus.sysml.diagram.common.figure, - org.eclipse.papyrus.sysml.diagram.common.messages, - org.eclipse.papyrus.sysml.diagram.common.parser, - org.eclipse.papyrus.sysml.diagram.common.preferences, - org.eclipse.papyrus.sysml.diagram.common.utils, - org.eclipse.papyrus.uml.diagram.common.dnd.helper, - org.eclipse.papyrus.uml.diagram.common.edit.part, - org.eclipse.papyrus.uml.diagram.common.edit.policy, - org.eclipse.papyrus.uml.diagram.common.factory, - org.eclipse.papyrus.uml.diagram.common.figure, - org.eclipse.papyrus.uml.diagram.common.parser, - org.eclipse.papyrus.uml.diagram.common.utils -Bundle-Vendor: %providerName -Bundle-ActivationPolicy: lazy -Bundle-Version: 1.0.0.qualifier -Bundle-Name: %pluginName -Bundle-Localization: plugin -Bundle-ManifestVersion: 2 -Bundle-Activator: org.eclipse.papyrus.sysml.diagram.common.Activator -Bundle-SymbolicName: org.eclipse.papyrus.sysml.diagram.common;singleto - n:=true -Bundle-RequiredExecutionEnvironment: J2SE-1.5 - +Manifest-Version: 1.0 +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.papyrus.infra.core;bundle-version="1.0.0", + org.eclipse.emf;bundle-version="2.6.0", + org.eclipse.uml2.uml;bundle-version="3.1.0", + org.eclipse.papyrus.sysml;bundle-version="1.0.0", + org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0", + org.eclipse.core.expressions, + org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.0", + org.eclipse.papyrus.editor;bundle-version="1.0.0", + org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.0.0", + org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.0.0", + org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0", + org.eclipse.papyrus.uml.service.types;bundle-version="1.0.0", + org.eclipse.papyrus.sysml.service.types;bundle-version="1.0.0", + org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.0.0", + org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0", + org.eclipse.papyrus.uml.modelexplorer.widgets;bundle-version="1.0.0", + org.eclipse.draw2d;bundle-version="3.7.1", + org.eclipse.gmf.runtime.diagram.core;bundle-version="1.4.1", + org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0", + org.eclipse.papyrus.uml.tools;bundle-version="1.0.0", + org.eclipse.papyrus.infra.emf;bundle-version="1.0.0", + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0", + org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.0.0", + org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0", + org.eclipse.uml2.common.edit;bundle-version="1.6.0", + org.eclipse.uml2.uml.edit;bundle-version="4.0.0", + org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0", + org.eclipse.emf.edit.ui;bundle-version="2.8.0", + org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0", + org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.0.0", + org.eclipse.gmf.tooling.runtime;bundle-version="3.1.0", + org.eclipse.papyrus.uml.diagram.composite;bundle-version="1.0.0" +Export-Package: org.eclipse.papyrus.gmf.diagram.common.commands, + org.eclipse.papyrus.gmf.diagram.common.compatibility, + org.eclipse.papyrus.gmf.diagram.common.edit.part, + org.eclipse.papyrus.gmf.diagram.common.edit.policy, + org.eclipse.papyrus.gmf.diagram.common.factory, + org.eclipse.papyrus.gmf.diagram.common.figure, + org.eclipse.papyrus.gmf.diagram.common.locator, + org.eclipse.papyrus.gmf.diagram.common.parser, + org.eclipse.papyrus.gmf.diagram.common.provider, + org.eclipse.papyrus.sysml.diagram.common, + org.eclipse.papyrus.sysml.diagram.common.commands, + org.eclipse.papyrus.sysml.diagram.common.dialogs, + org.eclipse.papyrus.sysml.diagram.common.edit.part, + org.eclipse.papyrus.sysml.diagram.common.edit.policy, + org.eclipse.papyrus.sysml.diagram.common.factory, + org.eclipse.papyrus.sysml.diagram.common.figure, + org.eclipse.papyrus.sysml.diagram.common.messages, + org.eclipse.papyrus.sysml.diagram.common.parser, + org.eclipse.papyrus.sysml.diagram.common.preferences, + org.eclipse.papyrus.sysml.diagram.common.utils, + org.eclipse.papyrus.uml.diagram.common.dnd.helper, + org.eclipse.papyrus.uml.diagram.common.edit.part, + org.eclipse.papyrus.uml.diagram.common.edit.policy, + org.eclipse.papyrus.uml.diagram.common.factory, + org.eclipse.papyrus.uml.diagram.common.figure, + org.eclipse.papyrus.uml.diagram.common.parser, + org.eclipse.papyrus.uml.diagram.common.utils +Bundle-Vendor: %providerName +Bundle-ActivationPolicy: lazy +Bundle-Version: 1.0.0.qualifier +Bundle-Name: %pluginName +Bundle-Localization: plugin +Bundle-ManifestVersion: 2 +Bundle-Activator: org.eclipse.papyrus.sysml.diagram.common.Activator +Bundle-SymbolicName: org.eclipse.papyrus.sysml.diagram.common;singleto + n:=true +Bundle-RequiredExecutionEnvironment: J2SE-1.5 + diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF index eee85525f54..854361bc126 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF @@ -1,106 +1,105 @@ -Manifest-Version: 1.0 -Export-Package: org.eclipse.papyrus.uml.diagram.common, - org.eclipse.papyrus.uml.diagram.common.actions, - org.eclipse.papyrus.uml.diagram.common.actions.handlers, - org.eclipse.papyrus.uml.diagram.common.command.wrappers, - org.eclipse.papyrus.uml.diagram.common.commands, - org.eclipse.papyrus.uml.diagram.common.dialogs, - org.eclipse.papyrus.uml.diagram.common.directedit, - org.eclipse.papyrus.uml.diagram.common.dragtracker, - org.eclipse.papyrus.uml.diagram.common.draw2d, - org.eclipse.papyrus.uml.diagram.common.draw2d.anchors, - org.eclipse.papyrus.uml.diagram.common.editparts, - org.eclipse.papyrus.uml.diagram.common.editpolicies, - org.eclipse.papyrus.uml.diagram.common.figure.edge, - org.eclipse.papyrus.uml.diagram.common.figure.layout, - org.eclipse.papyrus.uml.diagram.common.figure.node, - org.eclipse.papyrus.uml.diagram.common.handlers, - org.eclipse.papyrus.uml.diagram.common.helper, - org.eclipse.papyrus.uml.diagram.common.ids, - org.eclipse.papyrus.uml.diagram.common.layout, - org.eclipse.papyrus.uml.diagram.common.listeners, - org.eclipse.papyrus.uml.diagram.common.locator, - org.eclipse.papyrus.uml.diagram.common.parser, - org.eclipse.papyrus.uml.diagram.common.parser.assist, - org.eclipse.papyrus.uml.diagram.common.parser.custom, - org.eclipse.papyrus.uml.diagram.common.parser.lookup, - org.eclipse.papyrus.uml.diagram.common.parser.packageimport, - org.eclipse.papyrus.uml.diagram.common.parser.stereotype, - org.eclipse.papyrus.uml.diagram.common.parser.structural, - org.eclipse.papyrus.uml.diagram.common.part, - org.eclipse.papyrus.uml.diagram.common.preferences, - org.eclipse.papyrus.uml.diagram.common.providers, - org.eclipse.papyrus.uml.diagram.common.providers.assistant, - org.eclipse.papyrus.uml.diagram.common.resourceupdate, - org.eclipse.papyrus.uml.diagram.common.service, - org.eclipse.papyrus.uml.diagram.common.service.palette, - org.eclipse.papyrus.uml.diagram.common.sheet, - org.eclipse.papyrus.uml.diagram.common.ui.dialogs, - org.eclipse.papyrus.uml.diagram.common.ui.helper, - org.eclipse.papyrus.uml.diagram.common.util, - org.eclipse.papyrus.uml.diagram.common.util.functions, - org.eclipse.papyrus.uml.diagram.common.util.predicates -Bundle-ActivationPolicy: lazy -Bundle-ClassPath: . -Bundle-Name: %pluginName -Bundle-Localization: plugin -Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.) -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.0.0", - org.eclipse.gmf.runtime.diagram.ui.resources.editor, - org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.1.0", - org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.0.0", - org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0", - org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="1.2.0", - org.eclipse.papyrus.uml.diagram.wizards;bundle-version="1.0.0", - org.eclipse.papyrus.editor;bundle-version="1.0.0", - org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="1.3.0", - org.eclipse.papyrus.uml.pastemanager;bundle-version="1.0.0", - org.eclipse.ui, - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0", - org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.0.0", - org.eclipse.gmf.runtime.diagram.ui.actions, - org.eclipse.gmf.runtime.draw2d.ui.render;bundle-version="1.4.0", - org.eclipse.core.expressions, - org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.0.0", - org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0", - org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.0.0", - org.eclipse.papyrus.uml.diagram.navigation;bundle-version="1.0.0", - org.eclipse.gmf.runtime.diagram.ui.printing, - org.eclipse.gmf.runtime.diagram.ui.providers.ide, - org.eclipse.papyrus.infra.services.decoration;bundle-version="1.0.0", - org.eclipse.papyrus.infra.services.resourceloading;bundle-version="1.0.0", - org.eclipse.papyrus.uml.tools;bundle-version="1.0.0", - com.google.guava;bundle-version="11.0.0", - org.eclipse.papyrus.uml.profile;bundle-version="1.0.0", - org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.0.0", - org.eclipse.papyrus.uml.appearance;bundle-version="1.0.0", - org.eclipse.uml2.uml.edit;bundle-version="4.0.0", - org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0", - org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.0", - org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0", - org.eclipse.ui.ide;bundle-version="3.8.0", - org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.0.0", - org.eclipse.papyrus.infra.emf;bundle-version="1.0.0", - org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0", - org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.0.0", - org.eclipse.jface, - org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.0.0", - org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.4.0", - org.eclipse.papyrus.infra.services.localizer;bundle-version="1.0.0", - org.apache.batik.dom.svg;bundle-version="[1.6.0,1.7.0)", - org.w3c.dom.svg, - org.apache.batik.css;bundle-version="[1.6.0,1.7.0)", - org.apache.batik.util;bundle-version="[1.6.0,1.7.0)", - org.apache.batik.dom;bundle-version="[1.6.0,1.7.0)", - org.eclipse.core.databinding;bundle-version="1.4.1", - org.eclipse.gmf.tooling.runtime -Bundle-Vendor: %providerName -Ant-Version: Apache Ant 1.7.0 -Bundle-Version: 1.0.0.qualifier -Eclipse-BuddyPolicy: dependent -Bundle-ManifestVersion: 2 -Bundle-Activator: org.eclipse.papyrus.uml.diagram.common.Activator -Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.common;singleton: - =true - +Manifest-Version: 1.0 +Export-Package: org.eclipse.papyrus.uml.diagram.common, + org.eclipse.papyrus.uml.diagram.common.actions, + org.eclipse.papyrus.uml.diagram.common.actions.handlers, + org.eclipse.papyrus.uml.diagram.common.command.wrappers, + org.eclipse.papyrus.uml.diagram.common.commands, + org.eclipse.papyrus.uml.diagram.common.dialogs, + org.eclipse.papyrus.uml.diagram.common.directedit, + org.eclipse.papyrus.uml.diagram.common.dragtracker, + org.eclipse.papyrus.uml.diagram.common.draw2d, + org.eclipse.papyrus.uml.diagram.common.draw2d.anchors, + org.eclipse.papyrus.uml.diagram.common.editparts, + org.eclipse.papyrus.uml.diagram.common.editpolicies, + org.eclipse.papyrus.uml.diagram.common.figure.edge, + org.eclipse.papyrus.uml.diagram.common.figure.layout, + org.eclipse.papyrus.uml.diagram.common.figure.node, + org.eclipse.papyrus.uml.diagram.common.handlers, + org.eclipse.papyrus.uml.diagram.common.helper, + org.eclipse.papyrus.uml.diagram.common.ids, + org.eclipse.papyrus.uml.diagram.common.layout, + org.eclipse.papyrus.uml.diagram.common.listeners, + org.eclipse.papyrus.uml.diagram.common.locator, + org.eclipse.papyrus.uml.diagram.common.parser, + org.eclipse.papyrus.uml.diagram.common.parser.assist, + org.eclipse.papyrus.uml.diagram.common.parser.custom, + org.eclipse.papyrus.uml.diagram.common.parser.lookup, + org.eclipse.papyrus.uml.diagram.common.parser.packageimport, + org.eclipse.papyrus.uml.diagram.common.parser.stereotype, + org.eclipse.papyrus.uml.diagram.common.parser.structural, + org.eclipse.papyrus.uml.diagram.common.part, + org.eclipse.papyrus.uml.diagram.common.preferences, + org.eclipse.papyrus.uml.diagram.common.providers, + org.eclipse.papyrus.uml.diagram.common.providers.assistant, + org.eclipse.papyrus.uml.diagram.common.resourceupdate, + org.eclipse.papyrus.uml.diagram.common.service, + org.eclipse.papyrus.uml.diagram.common.service.palette, + org.eclipse.papyrus.uml.diagram.common.sheet, + org.eclipse.papyrus.uml.diagram.common.ui.dialogs, + org.eclipse.papyrus.uml.diagram.common.ui.helper, + org.eclipse.papyrus.uml.diagram.common.util, + org.eclipse.papyrus.uml.diagram.common.util.functions, + org.eclipse.papyrus.uml.diagram.common.util.predicates +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: . +Bundle-Name: %pluginName +Bundle-Localization: plugin +Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.) +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="1.0.0", + org.eclipse.gmf.runtime.diagram.ui.resources.editor, + org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.1.0", + org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.0.0", + org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0", + org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="1.2.0", + org.eclipse.papyrus.uml.diagram.wizards;bundle-version="1.0.0", + org.eclipse.papyrus.editor;bundle-version="1.0.0", + org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="1.3.0", + org.eclipse.ui, + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0", + org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.0.0", + org.eclipse.gmf.runtime.diagram.ui.actions, + org.eclipse.gmf.runtime.draw2d.ui.render;bundle-version="1.4.0", + org.eclipse.core.expressions, + org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.0.0", + org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0", + org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.0.0", + org.eclipse.papyrus.uml.diagram.navigation;bundle-version="1.0.0", + org.eclipse.gmf.runtime.diagram.ui.printing, + org.eclipse.gmf.runtime.diagram.ui.providers.ide, + org.eclipse.papyrus.infra.services.decoration;bundle-version="1.0.0", + org.eclipse.papyrus.infra.services.resourceloading;bundle-version="1.0.0", + org.eclipse.papyrus.uml.tools;bundle-version="1.0.0", + com.google.guava;bundle-version="11.0.0", + org.eclipse.papyrus.uml.profile;bundle-version="1.0.0", + org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.0.0", + org.eclipse.papyrus.uml.appearance;bundle-version="1.0.0", + org.eclipse.uml2.uml.edit;bundle-version="4.0.0", + org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.0", + org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0", + org.eclipse.ui.ide;bundle-version="3.8.0", + org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="1.0.0", + org.eclipse.papyrus.infra.emf;bundle-version="1.0.0", + org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0", + org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.0.0", + org.eclipse.jface, + org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.0.0", + org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.4.0", + org.eclipse.papyrus.infra.services.localizer;bundle-version="1.0.0", + org.apache.batik.dom.svg;bundle-version="[1.6.0,1.7.0)", + org.w3c.dom.svg, + org.apache.batik.css;bundle-version="[1.6.0,1.7.0)", + org.apache.batik.util;bundle-version="[1.6.0,1.7.0)", + org.apache.batik.dom;bundle-version="[1.6.0,1.7.0)", + org.eclipse.core.databinding;bundle-version="1.4.1", + org.eclipse.gmf.tooling.runtime +Bundle-Vendor: %providerName +Ant-Version: Apache Ant 1.7.0 +Bundle-Version: 1.0.0.qualifier +Eclipse-BuddyPolicy: dependent +Bundle-ManifestVersion: 2 +Bundle-Activator: org.eclipse.papyrus.uml.diagram.common.Activator +Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.common;singleton: + =true + diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml index ada1123b5b3..47b507acf97 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml @@ -212,10 +212,10 @@ + point="org.eclipse.papyrus.infra.gmfdiag.common.pasteCommandProvider"> + realization="org.eclipse.papyrus.uml.diagram.common.providers.DefaultPasteCommandProvider"> eObjectsToBeDuplicated = null; + + /** Constant used as a key for the parameters map of the duplication request */ + public static final String ADDITIONAL_DUPLICATED_ELEMENTS = "Additional_Duplicated_Elements"; //$NON-NLS-1$ + + /** + * Constructor. + * + * @param editingDomain + * @param label + * @param eObjectsToBeDuplicated + * @param subCommand + * @param container + */ + public PapyrusDuplicateWrapperCommand(TransactionalEditingDomain editingDomain, String label, List eObjectsToBeDuplicated, ICommandProxy subCommand, View container) { + super(editingDomain, label, null); + this.container = container; + this.eObjectsToBeDuplicated = eObjectsToBeDuplicated; + this.duplicateEObjectsCommandOwner = lookForDuplicateCommandOwner(subCommand); + } + + /** + * Verifies that the container of all the original objects can contain + * multiple objects. + */ + @Override + @SuppressWarnings("rawtypes") + public boolean canExecute() { + for(Iterator iter = eObjectsToBeDuplicated.iterator(); iter.hasNext();) { + EObject original = (EObject)iter.next(); + //In the case of cut the owner does not exist + if(original.eContainer() == null) { + return true; + + } else { + EReference reference = original.eContainmentFeature(); + if(reference == null || !FeatureMapUtil.isMany(original.eContainer(), reference)) { + return false; + } + } + } + return true; + } + + /** + * {@inheritDoc} + */ + @Override + @SuppressWarnings("rawtypes") + protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { + duplicateEObjectsCommandOwner.execute(progressMonitor, info); + CommandResult result = duplicateEObjectsCommandOwner.getCommandResult(); + //reassociation to the new container + if(result.getReturnValue() instanceof List) { + Iterator resultIterator = ((List)result.getReturnValue()).iterator(); + while(resultIterator.hasNext()) { + Object currentResult = resultIterator.next(); + + // the result of a copy is a map + if(currentResult instanceof Map) { + Map duplicatedObject = (Map)currentResult; + Iterator iterator = duplicatedObject.values().iterator(); + // for each view, a container is set if it is null + // if this is a shape a new position is set in order to avoid superposition + while(iterator.hasNext()) { + Object object = iterator.next(); + if(object instanceof View) { + View duplicatedView = (View)object; + if(object instanceof Shape) { + LayoutConstraint layoutConstraint = ((Shape)object).getLayoutConstraint(); + if(layoutConstraint instanceof Bounds) { + ((Bounds)layoutConstraint).setX(((Bounds)layoutConstraint).getX() + DEFAULT_AVOID_SUPERPOSITION_X); + ((Bounds)layoutConstraint).setY(((Bounds)layoutConstraint).getY() + DEFAULT_AVOID_SUPERPOSITION_Y); + } + } + if(duplicatedView.eContainer() == null && container != null) { + ViewUtil.insertChildView(container, duplicatedView, -1, true); + } + } + } + } + } + } else if(result.getReturnValue() instanceof Map) { // perhaps not a list in case of simple ICommand, result value should be a map + Map duplicatedObject = (Map)result.getReturnValue(); + Iterator iterator = duplicatedObject.values().iterator(); + // for each view, a container is set if it is null + // if this is a shape a new position is set in order to avoid superposition + while(iterator.hasNext()) { + Object object = iterator.next(); + if(object instanceof Diagram) { + Diagram diagramView = (Diagram)object; + if(container != null && container.eResource() != null) { + container.eResource().getContents().add(diagramView); + } + + } else if(object instanceof View) { + View duplicatedView = (View)object; + if(object instanceof Shape) { + LayoutConstraint layoutConstraint = ((Shape)object).getLayoutConstraint(); + if(layoutConstraint instanceof Bounds) { + ((Bounds)layoutConstraint).setX(((Bounds)layoutConstraint).getX() + DEFAULT_AVOID_SUPERPOSITION_X); + ((Bounds)layoutConstraint).setY(((Bounds)layoutConstraint).getY() + DEFAULT_AVOID_SUPERPOSITION_Y); + } + } + if(duplicatedView.eContainer() == null && container != null) { + ViewUtil.insertChildView(container, duplicatedView, -1, true); + } + } + } + + ICommand externalObjectsDuplicateCommand = getExternalObjectsDuplicateCommand((Map)result.getReturnValue()); + if(externalObjectsDuplicateCommand != null && externalObjectsDuplicateCommand.canExecute()) { + IStatus status = externalObjectsDuplicateCommand.execute(progressMonitor, info); + if(!status.isOK()) { + return CommandResult.newErrorCommandResult(status.getException()); + } + } + } + + return result; + } + + /** + * this class is used to look for the basic eobject duplicate command + * + * @param command + * that contains normally the duplicated command + * @return the duplicate command + */ + protected ICommand lookForDuplicateCommandOwner(ICommandProxy command) { + return command.getICommand(); + } + + /** + * Returns the list of external objects to duplicate + * + * @return the list of external objects to duplicate or an empty list if not elements are found to add. + */ + protected ICommand getExternalObjectsDuplicateCommand(Map duplicatedElementsMap) { + CompositeCommand result = new CompositeCommand("Duplicate External Objects"); //$NON-NLS-1$ + Set duplicatedExternalElements = new HashSet(); + + for(Object o : duplicatedElementsMap.keySet()) { + if(o instanceof EObject) { + EObject object = (EObject)o; + DuplicateElementsRequest request = new DuplicateElementsRequest(Collections.singletonList(object)); + request.setAllDuplicatedElementsMap(duplicatedElementsMap); + request.setParameter(PapyrusDuplicateWrapperCommand.ADDITIONAL_DUPLICATED_ELEMENTS, duplicatedExternalElements); + request.setParameter(TARGET_OWNER, BusinessModelResolver.getInstance().getBusinessModel(container)); + IElementEditService service = ElementEditServiceUtils.getCommandProvider(object); + ICommand command = service.getEditCommand(request); + if(command != null) { + result.add(command); + } + } + } + + return (result.isEmpty()) ? null : result.reduce(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/DuplicatePasteEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/DuplicatePasteEditPolicy.java index 29b4f62a6a5..e66fa51b257 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/DuplicatePasteEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/DuplicatePasteEditPolicy.java @@ -46,8 +46,8 @@ import org.eclipse.gmf.runtime.emf.clipboard.core.ClipboardSupportUtil; import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil; import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.commands.requests.PasteRequest; import org.eclipse.papyrus.uml.diagram.common.commands.PapyrusDuplicateViewsCommand; -import org.eclipse.papyrus.uml.pastemanager.request.PasteRequest; import org.eclipse.uml2.uml.Element; /** @@ -58,7 +58,7 @@ import org.eclipse.uml2.uml.Element; @SuppressWarnings({ "rawtypes", "restriction" }) public class DuplicatePasteEditPolicy extends ContainerEditPolicy { - public final static String PASTE_ROLE = "PASTE_ROLE"; + public final static String PASTE_ROLE = "PASTE_ROLE"; //$NON-NLS-1$ /** * @see org.eclipse.gef.EditPolicy#getCommand(Request) diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/PasteWithModelHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/PasteWithModelHandler.java index 20d7dfa4bef..dc73f950d09 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/PasteWithModelHandler.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/PasteWithModelHandler.java @@ -26,7 +26,7 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.uml.diagram.common.helper.CleanDiagramHelper; -import org.eclipse.papyrus.uml.pastemanager.service.PasteCommandService; +import org.eclipse.papyrus.uml.diagram.common.service.PasteCommandService; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.handlers.HandlerUtil; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/DefaultPasteCommandProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/DefaultPasteCommandProvider.java new file mode 100644 index 00000000000..7e2d67e29b5 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/DefaultPasteCommandProvider.java @@ -0,0 +1,191 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.common.providers; + +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.DataFlavor; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.RootEditPart; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +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.DiagramEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper; +import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.commands.requests.PasteRequest; +import org.eclipse.papyrus.uml.diagram.common.commands.CommentDropCreation; +import org.eclipse.papyrus.uml.diagram.common.commands.PapyrusDuplicateWrapperCommand; +import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.eclipse.uml2.uml.Element; +import org.eclipse.gef.commands.Command; + +/** + * this provider has the following behavior + * when the System clipboard contains a string the papyrus clipboard has no information + * (a copy has be done on the system). In this case, a comment is created and displayed in the diagram + * the body contains the string from the clipboard. + * In other case, a paste request {@link org.eclipse.papyrus.infra.gmfdiag.common.commands.requests.PasteRequest} in send to the target editpart in order to obtain + * the paste command ( graphically or the paste with model command + * + */ + +public class DefaultPasteCommandProvider implements IPasteCommandProvider { + + private static final String LINUX = "Linux"; //$NON-NLS-1$ + private static final String OS_NAME = "os.name"; //$NON-NLS-1$ + + /** + * this method provides a command to paste by taking information from the clipboard of the system or gmf clipbaord + * + * @param targetEditPart + * the target editpart where we want to paste + * @param systemClipboard + * the system clipboard see {@link DataFlavor} to see how to extract information + * @param papyrusCliboard + * contains the list of views to paste + * @return + */ + + public ICommand getPasteViewCommand(GraphicalEditPart targetEditPart, Clipboard systemClipboard, Collection papyrusClipboard) { + + if(!System.getProperty(OS_NAME).equals(LINUX)) { + // examine system clipboard + String bufferSystem = null; + // long millisBefore = System.currentTimeMillis (); + DataFlavor[] dataFlavors = Toolkit.getDefaultToolkit().getSystemClipboard().getAvailableDataFlavors(); + // System.out.println (">>> TEST: time spend in getAvailableDataFlavorsCall: " + (System.currentTimeMillis () - millisBefore)); + for(int i = 0; i < dataFlavors.length; i++) { + try { + if(dataFlavors[i].isFlavorTextType() && dataFlavors[i].isMimeTypeEqual(DataFlavor.stringFlavor)) { + bufferSystem = Toolkit.getDefaultToolkit().getSystemClipboard().getData(dataFlavors[i]).toString(); + } + } catch (Exception e) { + // TODO: Add logger + } + } + // detection of a paste command from the system + if(bufferSystem != null) { + // here, the choice is to create a comment from a string + // if the you want to modify it overload the method paste from System + return pasteFromSystem(targetEditPart, bufferSystem); + } + //else + } + + /* Send the request to the target edit part of the paste command for the currently selected part */ + PasteRequest pasteRequest = new PasteRequest(targetEditPart.getEditingDomain().getClipboard()); + Command pasteCommand = targetEditPart.getCommand(pasteRequest); + if(pasteCommand != null) { + return new CommandProxy(pasteCommand); + } + return UnexecutableCommand.INSTANCE; + } + + /** + * This method is in charge of pasting a string from the system. + * If you want to add a new behavior, overload this method + * + * @param targetEditPart + * @param comment + * the string that comes from the system + * @return the command in charge to do the modification in the system + */ + public ICommand pasteFromSystem(GraphicalEditPart targetEditPart, String comment) { + return new CommentDropCreation("Paste from system", comment, targetEditPart.getNotationView().getElement(), targetEditPart); //$NON-NLS-1$ + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + /** + * @inheritedDoc + */ + public ICommand getPasteWithModelCommand(GraphicalEditPart targetEditPart, Clipboard systemClipboard, Collection papyrusCliboard) { + //look in the clipboard of the system + String bufferSystem = null; + if(!System.getProperty(OS_NAME).equals(LINUX)) { + DataFlavor[] dataFlavors = Toolkit.getDefaultToolkit().getSystemClipboard().getAvailableDataFlavors(); + for(int i = 0; i < dataFlavors.length; i++) { + try { + if(dataFlavors[i].isFlavorTextType() && dataFlavors[i].isMimeTypeEqual(DataFlavor.stringFlavor)) { + + bufferSystem = Toolkit.getDefaultToolkit().getSystemClipboard().getData(dataFlavors[i]).toString(); + } + } catch (Exception e) { + Activator.log.error(e); + } + } + //detection of a paste command from the system + if(bufferSystem != null) { + // here, the choice is to create a comment from a string + // if the you want to modify it overload the method paste from System + return pasteFromSystem(targetEditPart, bufferSystem); + } + //else + } + /* Send the request to the target edit part of the paste command for the currently selected part */ + ArrayList objectToPaste = new ArrayList(); + if(papyrusCliboard != null && papyrusCliboard.size() >= 1) { + objectToPaste.addAll(papyrusCliboard); + + + Iterator iterator = papyrusCliboard.iterator(); + //in order to paste with model, semantic element has to be put in the list + while(iterator.hasNext()) { + Object object = (Object)iterator.next(); + if(object instanceof View) { + objectToPaste.add(((View)object).getElement()); + + ArrayList stereotypedSelection = new ArrayList(); + EObject semantic =((View)object).getElement(); + if( semantic instanceof Element){ + stereotypedSelection.addAll(((Element)semantic).getStereotypeApplications()); + } + //copy stereotype contained into + Iterator iter=semantic.eAllContents(); + while (iter.hasNext()) { + EObject subeObject = (EObject) iter.next(); + if( subeObject instanceof Element){ + stereotypedSelection.addAll(((Element)subeObject).getStereotypeApplications()); + } + + } + objectToPaste.addAll(stereotypedSelection); + } + + } + //creation of duplicate request to obtain the functionnality of GMF + DuplicateElementsRequest duplicateElementRequest = new DuplicateElementsRequest(targetEditPart.getEditingDomain(), objectToPaste); + + //add the wrapper + RootEditPart topEditPart = targetEditPart.getRoot(); + if(topEditPart.getChildren().get(0) instanceof DiagramEditPart) { + + org.eclipse.gef.commands.Command gefCommand = ((DiagramEditPart)topEditPart.getChildren().get(0)).getCommand(new EditCommandRequestWrapper(duplicateElementRequest)); + ICommand command = new PapyrusDuplicateWrapperCommand(targetEditPart.getEditingDomain(), "Papyrus duplicate wrapper command", objectToPaste, (ICommandProxy)gefCommand, (View)targetEditPart.getModel()); //$NON-NLS-1$ + return command; + } + } + + return UnexecutableCommand.INSTANCE; + } + + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/IPasteCommandProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/IPasteCommandProvider.java new file mode 100644 index 00000000000..111c52ea9ea --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/IPasteCommandProvider.java @@ -0,0 +1,54 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.common.providers; + +import java.awt.datatransfer.Clipboard; +import java.util.Collection; + +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; + +/** + * + * a paste provider has provide operation in order to paste by taking account system clipboard or papyrus clipboard + * + */ +public interface IPasteCommandProvider { + + /** + * return the paste command to execute by taking account parameter + * + * @param targetEditPart + * the target where object will be paste + * @param systemClipboard + * contains info form the system copy paste + * @param papyrusCliboard + * the list of views to paste + * @return a command + */ + public ICommand getPasteViewCommand(GraphicalEditPart targetEditPart, java.awt.datatransfer.Clipboard systemClipboard, Collection papyrusCliboard); + + /** + * return the paste command to execute by taking account parameter. It copy also element of the semantic model + * + * @param targetEditPart + * the target where object will be paste + * @param systemClipboard + * contains info form the system copy paste + * @param papyrusCliboard + * the list of views to paste + * @return a command + */ + public ICommand getPasteWithModelCommand(GraphicalEditPart targetEditPart, Clipboard systemClipboard, Collection papyrusCliboard); +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/PapyrusDiagramGlobalActionHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/PapyrusDiagramGlobalActionHandler.java index f7544436747..ba2dc8d61f7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/PapyrusDiagramGlobalActionHandler.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/PapyrusDiagramGlobalActionHandler.java @@ -45,7 +45,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper; import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.uml.diagram.common.helper.CleanDiagramHelper; -import org.eclipse.papyrus.uml.pastemanager.service.PasteCommandService; +import org.eclipse.papyrus.uml.diagram.common.service.PasteCommandService; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPart; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PasteCommandService.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PasteCommandService.java new file mode 100644 index 00000000000..b161456f8c7 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PasteCommandService.java @@ -0,0 +1,155 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.common.service; + +import java.awt.datatransfer.Clipboard; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.Platform; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; +import org.eclipse.papyrus.uml.diagram.common.providers.IPasteCommandProvider; +import org.eclipse.papyrus.uml.diagram.common.Activator; +import org.osgi.framework.Bundle; + +/** + * this singleton looks for in extension point to find a pasteCommandProvider + * and can provide a paste command + */ + + +public class PasteCommandService { + + protected static final String PASTECOMMANDPROVIDER_EXTENSION_ID = "org.eclipse.papyrus.infra.gmfdiag.common.pasteCommandProvider"; //$NON-NLS-1$ + + protected static final String REALIZATION = "realization"; //$NON-NLS-1$ + + protected static final String PRIORITY = "priority"; //$NON-NLS-1$ + + protected static PasteCommandService instance = null; + + public static PasteCommandService getInstance() { + if(instance == null) { + instance = new PasteCommandService(); + } + return instance; + } + + + /** + * Load an instance of a class + * + * @param element + * the extension point + * @param classAttribute + * the name of the class to load + * @return the loaded Class + * @throws Exception + * if the class is not loaded + */ + protected static Object createExtension(final IConfigurationElement element, final String classAttribute) throws Exception { + try { + Bundle extensionBundle = Platform.getBundle(element.getDeclaringExtension().getNamespaceIdentifier()); + Class clazz = extensionBundle.loadClass(classAttribute); + Object obj = clazz.newInstance(); + return obj; + } catch (Exception e) { + throw new Exception("Unable to create Extension" + e); //$NON-NLS-1$ + } + } + + protected Map pasteCommandProviderMap; + + + private PasteCommandService() { + // Reading data from plugins + IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(PASTECOMMANDPROVIDER_EXTENSION_ID); + pasteCommandProviderMap = new HashMap(); + for(int i = 0; i < configElements.length; i++) { + getPasteCommandProvider(configElements[i]); + } + + } + + /** + * Load one rule + * + * @param element + * the extension point + */ + protected void getPasteCommandProvider(IConfigurationElement element) { + IPasteCommandProvider pasteCommandProvider = null; + try { + pasteCommandProvider = (IPasteCommandProvider)createExtension(element, element.getAttribute(REALIZATION)); + String priority = (String)element.getAttribute(PRIORITY); + pasteCommandProviderMap.put(priority, pasteCommandProvider); + + } catch (Exception e) { + Activator.log.error("- " + pasteCommandProvider + " can not be loaded: " + e.getLocalizedMessage(), e); //$NON-NLS-1$ + } + } + + protected IPasteCommandProvider lookForProvider() { + String[] priority = { "Highest", "High", "Medium", "Low", "Lowest" }; + IPasteCommandProvider selectedProvider = null; + int i = 0; + while(selectedProvider == null && i < priority.length) { + selectedProvider = pasteCommandProviderMap.get(priority[i]); + i++; + } + return selectedProvider; + } + + /** + * return the paste command to execute by taking account parameter + * + * @param targetEditPart + * the target where object will be paste + * @param systemClipboard + * contains info form the system copy paste + * @param papyrusCliboard + * the list of views to paste + * @return a command + */ + public ICommand getPasteViewCommand(GraphicalEditPart targetEditPart, Clipboard systemClipboard, Collection papyrusCliboard) { + IPasteCommandProvider selectedProvider = lookForProvider(); + if(selectedProvider == null) { + return UnexecutableCommand.INSTANCE; + } + return selectedProvider.getPasteViewCommand(targetEditPart, systemClipboard, papyrusCliboard); + } + + /** + * return the paste command to execute by taking account parameter. It copy also element of the semantic model + * + * @param targetEditPart + * the target where object will be paste + * @param systemClipboard + * contains info form the system copy paste + * @param papyrusCliboard + * the list of views to paste + * @return a command + */ + public ICommand getPasteWithModelCommand(GraphicalEditPart targetEditPart, Clipboard systemClipboard, Collection papyrusCliboard) { + IPasteCommandProvider selectedProvider = lookForProvider(); + if(selectedProvider == null) { + return UnexecutableCommand.INSTANCE; + } + return selectedProvider.getPasteWithModelCommand(targetEditPart, systemClipboard, papyrusCliboard); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/META-INF/MANIFEST.MF index ed1a5483cb7..cf2c1934346 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/META-INF/MANIFEST.MF @@ -1,42 +1,41 @@ -Manifest-Version: 1.0 -Require-Bundle: org.eclipse.ui, - org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0", - org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.0.0", - org.eclipse.gmf.runtime.diagram.ui.actions, - org.eclipse.gmf.runtime.draw2d.ui.render;bundle-version="1.4.0", - org.eclipse.core.expressions, - org.eclipse.gmf.runtime.diagram.ui.resources.editor, - org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.1.0", - org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="1.2.0", - org.eclipse.gmf.runtime.diagram.ui.actions, - org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="1.2.0", - org.eclipse.papyrus.uml.diagram.wizards;bundle-version="1.0.0", - org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.0", - org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0", - org.eclipse.papyrus.uml.tools;bundle-version="1.0.0", - org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0", - org.eclipse.uml2.uml;bundle-version="4.0.0", - org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.0", - org.eclipse.papyrus.infra.core;bundle-version="1.0.0", - org.eclipse.ui.ide;bundle-version="3.8.0", - org.eclipse.papyrus.infra.emf;bundle-version="1.0.0", - org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0", - org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.0.0", - org.eclipse.papyrus.uml.pastemanager;bundle-version="1.0.0", - org.eclipse.papyrus.infra.tools;bundle-version="1.0.0", - org.eclipse.emf.facet.infra.browser.custom.ui;bundle-version="0.4.0", - org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.4.0" -Export-Package: org.eclipse.papyrus.uml.diagram.menu, - org.eclipse.papyrus.uml.diagram.menu.actions, - org.eclipse.papyrus.uml.diagram.menu.actions.handlers -Bundle-Vendor: %providerName -Bundle-ActivationPolicy: lazy -Bundle-Version: 1.0.0.qualifier -Bundle-Name: %pluginName -Bundle-Localization: plugin -Bundle-ManifestVersion: 2 -Bundle-Activator: org.eclipse.papyrus.uml.diagram.menu.Activator -Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.menu;singleton:=t - rue -Bundle-RequiredExecutionEnvironment: J2SE-1.5 - +Manifest-Version: 1.0 +Require-Bundle: org.eclipse.ui, + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0", + org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.0.0", + org.eclipse.gmf.runtime.diagram.ui.actions, + org.eclipse.gmf.runtime.draw2d.ui.render;bundle-version="1.4.0", + org.eclipse.core.expressions, + org.eclipse.gmf.runtime.diagram.ui.resources.editor, + org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.1.0", + org.eclipse.gmf.runtime.diagram.ui.properties;bundle-version="1.2.0", + org.eclipse.gmf.runtime.diagram.ui.actions, + org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="1.2.0", + org.eclipse.papyrus.uml.diagram.wizards;bundle-version="1.0.0", + org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.0", + org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0", + org.eclipse.papyrus.uml.tools;bundle-version="1.0.0", + org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0", + org.eclipse.uml2.uml;bundle-version="4.0.0", + org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.0", + org.eclipse.papyrus.infra.core;bundle-version="1.0.0", + org.eclipse.ui.ide;bundle-version="3.8.0", + org.eclipse.papyrus.infra.emf;bundle-version="1.0.0", + org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0", + org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.0.0", + org.eclipse.papyrus.infra.tools;bundle-version="1.0.0", + org.eclipse.emf.facet.infra.browser.custom.ui;bundle-version="0.4.0", + org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.4.0" +Export-Package: org.eclipse.papyrus.uml.diagram.menu, + org.eclipse.papyrus.uml.diagram.menu.actions, + org.eclipse.papyrus.uml.diagram.menu.actions.handlers +Bundle-Vendor: %providerName +Bundle-ActivationPolicy: lazy +Bundle-Version: 1.0.0.qualifier +Bundle-Name: %pluginName +Bundle-Localization: plugin +Bundle-ManifestVersion: 2 +Bundle-Activator: org.eclipse.papyrus.uml.diagram.menu.Activator +Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.menu;singleton:=t + rue +Bundle-RequiredExecutionEnvironment: J2SE-1.5 + diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml index 631bc54de33..35cbe4a3aae 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml @@ -1,4387 +1,4387 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - mmand> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mmand> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/handlers/PasteWithModelHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/handlers/PasteWithModelHandler.java index bd6beb91445..e6891595d15 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/handlers/PasteWithModelHandler.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/handlers/PasteWithModelHandler.java @@ -1,97 +1,95 @@ -/***************************************************************************** - * 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.menu.handlers; - -import java.awt.Toolkit; -import java.util.Collection; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.expressions.IEvaluationContext; -import org.eclipse.gef.RootEditPart; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.uml.diagram.common.helper.CleanDiagramHelper; -import org.eclipse.papyrus.uml.pastemanager.service.PasteCommandService; - -/** - * The handler for the paste with model action - * - * @author vl222926 - * - */ -public class PasteWithModelHandler extends AbstractHandler { - - /** - * the paste command - */ - private ICommand pasteCommand = null; - - /** - * the target edit part - */ - private GraphicalEditPart targetEditPart = null; - - /** - * - * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) - * - * @param event - * @return - * @throws ExecutionException - */ - public Object execute(ExecutionEvent event) throws ExecutionException { - if(pasteCommand != null && pasteCommand.canExecute()) { - targetEditPart.getEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(pasteCommand)); - RootEditPart topEditPart = targetEditPart.getRoot(); - if(topEditPart.getChildren().get(0) instanceof DiagramEditPart) { - CleanDiagramHelper.getInstance().run((DiagramEditPart)topEditPart.getChildren().get(0)); - } - } - return null; - } - - /** - * - * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object) - * - * @param evaluationContext - */ - @Override - public void setEnabled(Object evaluationContext) { - boolean enabled = false; - pasteCommand = null; - targetEditPart = null; - if(evaluationContext instanceof IEvaluationContext) { - Object defaultVariable = ((IEvaluationContext)evaluationContext).getDefaultVariable(); - if(defaultVariable instanceof Collection) { - int size = ((Collection)defaultVariable).size(); - if(size == 1) { - final Object current = ((Collection)defaultVariable).iterator().next(); - if(current instanceof GraphicalEditPart) { - targetEditPart = (GraphicalEditPart)current; - pasteCommand = PasteCommandService.getInstance().getPasteWithModelCommand(targetEditPart, Toolkit.getDefaultToolkit().getSystemClipboard(), targetEditPart.getEditingDomain().getClipboard()); - enabled = pasteCommand != null && pasteCommand.canExecute(); - } - } - } - } - setBaseEnabled(enabled); - } - - -} +/***************************************************************************** + * 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.menu.handlers; + +import java.awt.Toolkit; +import java.util.Collection; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.expressions.IEvaluationContext; +import org.eclipse.gef.RootEditPart; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; +import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.uml.diagram.common.helper.CleanDiagramHelper; +import org.eclipse.papyrus.uml.diagram.common.service.PasteCommandService; + +/** + * The handler for the paste with model action + * + */ +public class PasteWithModelHandler extends AbstractHandler { + + /** + * the paste command + */ + private ICommand pasteCommand = null; + + /** + * the target edit part + */ + private GraphicalEditPart targetEditPart = null; + + /** + * + * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) + * + * @param event + * @return + * @throws ExecutionException + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + if(pasteCommand != null && pasteCommand.canExecute()) { + targetEditPart.getEditingDomain().getCommandStack().execute(new GMFtoEMFCommandWrapper(pasteCommand)); + RootEditPart topEditPart = targetEditPart.getRoot(); + if(topEditPart.getChildren().get(0) instanceof DiagramEditPart) { + CleanDiagramHelper.getInstance().run((DiagramEditPart)topEditPart.getChildren().get(0)); + } + } + return null; + } + + /** + * + * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object) + * + * @param evaluationContext + */ + @Override + public void setEnabled(Object evaluationContext) { + boolean enabled = false; + pasteCommand = null; + targetEditPart = null; + if(evaluationContext instanceof IEvaluationContext) { + Object defaultVariable = ((IEvaluationContext)evaluationContext).getDefaultVariable(); + if(defaultVariable instanceof Collection) { + int size = ((Collection)defaultVariable).size(); + if(size == 1) { + final Object current = ((Collection)defaultVariable).iterator().next(); + if(current instanceof GraphicalEditPart) { + targetEditPart = (GraphicalEditPart)current; + pasteCommand = PasteCommandService.getInstance().getPasteWithModelCommand(targetEditPart, Toolkit.getDefaultToolkit().getSystemClipboard(), targetEditPart.getEditingDomain().getClipboard()); + enabled = pasteCommand != null && pasteCommand.canExecute(); + } + } + } + } + setBaseEnabled(enabled); + } + + +} diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/.classpath b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/.classpath deleted file mode 100644 index 2d1a4302f04..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/.project b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/.project deleted file mode 100644 index 73cc7c1b4cf..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.papyrus.uml.pastemanager - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/.settings/org.eclipse.jdt.core.prefs b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 2858285d317..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Tue Mar 16 14:27:37 CET 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/META-INF/MANIFEST.MF deleted file mode 100644 index 01e5da98314..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/META-INF/MANIFEST.MF +++ /dev/null @@ -1,26 +0,0 @@ -Manifest-Version: 1.0 -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - org.eclipse.uml2.uml, - org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0", - org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0", - org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0", - org.eclipse.papyrus.infra.core;bundle-version="1.0.0", - org.eclipse.gmf.runtime.common.core;bundle-version="1.4.1", - org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.6.0", - org.eclipse.papyrus.infra.emf;bundle-version="1.0.0" -Export-Package: org.eclipse.papyrus.uml.pastemanager, - org.eclipse.papyrus.uml.pastemanager.command, - org.eclipse.papyrus.uml.pastemanager.request, - org.eclipse.papyrus.uml.pastemanager.service -Bundle-Vendor: %providerName -Bundle-ActivationPolicy: lazy -Bundle-Version: 1.0.0.qualifier -Bundle-Name: %pluginName -Bundle-Localization: plugin -Bundle-ManifestVersion: 2 -Bundle-Activator: org.eclipse.papyrus.uml.pastemanager.Activator -Bundle-SymbolicName: org.eclipse.papyrus.uml.pastemanager;singleton:=t - rue -Bundle-RequiredExecutionEnvironment: J2SE-1.5 - diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/about.html b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/about.html deleted file mode 100644 index 82d49bf5f81..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/about.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - -About - - -

About This Content

- -

June 5, 2007

-

License

- -

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at http://www.eclipse.org.

- - - diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/build.properties b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/build.properties deleted file mode 100644 index 74da397f78f..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/build.properties +++ /dev/null @@ -1,12 +0,0 @@ -# -#Mon Sep 12 09:30:02 CEST 2011 -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - schema/,\ - plugin.properties,\ - about.html -output..=bin/ -src.includes = about.html -source..=src/ -bin..=bin/ diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/plugin.properties b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/plugin.properties deleted file mode 100644 index 0ac10f3fe17..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/plugin.properties +++ /dev/null @@ -1,17 +0,0 @@ -########################################################################################## -# Copyright (c) 2010 CEA LIST. -# -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation -# -######################################################################################## -pluginName=Papyrus Paste Management(Incubation) -providerName=Eclipse Modeling Project - - diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/plugin.xml b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/plugin.xml deleted file mode 100644 index eaeeb1d03a6..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/plugin.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/schema/pasteCommandProvider.exsd b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/schema/pasteCommandProvider.exsd deleted file mode 100644 index 3a26f742600..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/schema/pasteCommandProvider.exsd +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - this extension point is used to declare a class that can provide command in charge of the paste - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - a paste provider has to provide an operation in order to paste by taking account system clipboard or papyrus clipboard - - - - - - - this is the class that will provide the command in charge of the paste - - - - - - - - - - this the priority of the associated pasteCommandProvider -The priority of the provider. It can be one of the following values: -[Lowest, Low, Medium, High, Highest]. - - - - - - - - - - - - - - - - - - - - - - - - - - 0.7.0 - - - - - - - - - [Enter extension point usage example here.] - - - - - - - - - [Enter API information here.] - - - - - - - - - [Enter information about supplied implementation of this extension point.] - - - - - - - - - /***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ - - - - diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/Activator.java b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/Activator.java deleted file mode 100644 index eca50d5fe8e..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/Activator.java +++ /dev/null @@ -1,74 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.pastemanager; - -import org.eclipse.papyrus.infra.core.log.LogHelper; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.pastemanager"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** Logging helper */ - public static LogHelper log; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - // register the login helper - log = new LogHelper(plugin); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - log = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - -} diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/command/CommentDropCreation.java b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/command/CommentDropCreation.java deleted file mode 100644 index d9162083a94..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/command/CommentDropCreation.java +++ /dev/null @@ -1,98 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.pastemanager.command; - -import java.util.ArrayList; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.gmf.runtime.common.core.command.AbstractCommand; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest; -import org.eclipse.uml2.uml.Comment; -import org.eclipse.uml2.uml.Element; - - -/** - * this command is used to create a comment and to drop into a diagram. - * This command is independent from diagrams - * - */ -public class CommentDropCreation extends AbstractCommand { - - protected String content = null; - - protected Object owner = null; - - protected GraphicalEditPart targetEditPart; - - /** - * - * Constructor. - * - * @param label - * label of the command - * @param content - * content to put in the comment - * @param owner - * the owner of the comment - * @param targetEditPart - * the target editpart in which will be display the comment - */ - public CommentDropCreation(String label, String content, Object owner, GraphicalEditPart targetEditPart) { - super(label); - this.content = content; - this.owner = owner; - this.targetEditPart = targetEditPart; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { - if(owner instanceof Element) { - //creation of the command - Comment comment = ((Element)owner).createOwnedComment(); - comment.setBody(content); - CommandResult result = CommandResult.newOKCommandResult(comment); - setResult(result); - - //drop the comment into the target editPart - DropObjectsRequest dropObjectsRequest = new DropObjectsRequest(); - dropObjectsRequest.setLocation(new Point(10, 10)); - ArrayList objectList = new ArrayList(); - objectList.add(comment); - dropObjectsRequest.setObjects(objectList); - org.eclipse.gef.commands.Command cmd = targetEditPart.getCommand(dropObjectsRequest); - if(cmd != null) { - targetEditPart.getEditingDomain().getCommandStack().execute(new org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper(cmd)); - } - return result; - } - return CommandResult.newOKCommandResult(); - } - - @Override - protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { - return null; - } - - @Override - protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { - return null; - } - -} diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/command/GEFtoEMFCommandWrapper.java b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/command/GEFtoEMFCommandWrapper.java deleted file mode 100644 index db7f5d82ded..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/command/GEFtoEMFCommandWrapper.java +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation - * Vinent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Add undo - *****************************************************************************/ -package org.eclipse.papyrus.uml.pastemanager.command; - -import org.eclipse.gef.commands.Command; - -/** - * A EMF Command that wraps a GEF command. Each method is redirected to the GEF one. - * - * @deprecated use {@link org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper} instead - */ -public class GEFtoEMFCommandWrapper extends org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper { - - /** - * Constructor. - * - * @param gefCommand - * the gef command - */ - public GEFtoEMFCommandWrapper(Command gefCommand) { - super(gefCommand); - } -} diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/command/PapyrusDuplicateWrapperCommand.java b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/command/PapyrusDuplicateWrapperCommand.java deleted file mode 100644 index c8a4a03a641..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/command/PapyrusDuplicateWrapperCommand.java +++ /dev/null @@ -1,219 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2009 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: - * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.pastemanager.command; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -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.core.runtime.IStatus; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.util.FeatureMapUtil; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -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.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; -import org.eclipse.gmf.runtime.notation.Bounds; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.LayoutConstraint; -import org.eclipse.gmf.runtime.notation.Shape; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.emf.utils.BusinessModelResolver; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; - - -/** - * this command is used to wrap a copy command. it allows set a new owner for views. - */ -public class PapyrusDuplicateWrapperCommand extends AbstractTransactionalCommand { - - /** the new container for the shape */ - protected View container = null; - - /** Command that owns this duplicate command */ - protected ICommand duplicateEObjectsCommandOwner = null; - - /** list of object to duplicate */ - protected List eObjectsToBeDuplicated = null; - - /** Constant used as a key for the parameters map of the duplication request */ - public static final String ADDITIONAL_DUPLICATED_ELEMENTS = "Additional_Duplicated_Elements"; - - /** - * Constructor. - * - * @param editingDomain - * @param label - * @param eObjectsToBeDuplicated - * @param subCommand - * @param container - */ - public PapyrusDuplicateWrapperCommand(TransactionalEditingDomain editingDomain, String label, List eObjectsToBeDuplicated, ICommandProxy subCommand, View container) { - super(editingDomain, label, null); - this.container = container; - this.eObjectsToBeDuplicated = eObjectsToBeDuplicated; - this.duplicateEObjectsCommandOwner = lookForDuplicateCommandOwner(subCommand); - } - - /** - * Verifies that the container of all the original objects can contain - * multiple objects. - */ - @Override - @SuppressWarnings("rawtypes") - public boolean canExecute() { - for(Iterator iter = eObjectsToBeDuplicated.iterator(); iter.hasNext();) { - EObject original = (EObject)iter.next(); - //In the case of cut the owner does not exist - if(original.eContainer() == null) { - return true; - - } else { - EReference reference = original.eContainmentFeature(); - if(reference == null || !FeatureMapUtil.isMany(original.eContainer(), reference)) { - return false; - } - } - } - return true; - } - - /** - * {@inheritDoc} - */ - @Override - @SuppressWarnings("rawtypes") - protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { - duplicateEObjectsCommandOwner.execute(progressMonitor, info); - CommandResult result = duplicateEObjectsCommandOwner.getCommandResult(); - //reassociation to the new container - if(result.getReturnValue() instanceof List) { - Iterator resultIterator = ((List)result.getReturnValue()).iterator(); - while(resultIterator.hasNext()) { - Object currentResult = resultIterator.next(); - - // the result of a copy is a map - if(currentResult instanceof Map) { - Map duplicatedObject = (Map)currentResult; - Iterator iterator = duplicatedObject.values().iterator(); - // for each view, a container is set if it is null - // if this is a shape a new position is set in order to avoid superposition - while(iterator.hasNext()) { - Object object = iterator.next(); - if(object instanceof View) { - View duplicatedView = (View)object; - if(object instanceof Shape) { - LayoutConstraint layoutConstraint = ((Shape)object).getLayoutConstraint(); - if(layoutConstraint instanceof Bounds) { - ((Bounds)layoutConstraint).setX(((Bounds)layoutConstraint).getX() + 10); - ((Bounds)layoutConstraint).setY(((Bounds)layoutConstraint).getY() + 10); - } - } - if(duplicatedView.eContainer() == null && container != null) { - ViewUtil.insertChildView(container, duplicatedView, -1, true); - } - } - } - } - } - } else if(result.getReturnValue() instanceof Map) { // perhaps not a list in case of simple ICommand, result value should be a map - Map duplicatedObject = (Map)result.getReturnValue(); - Iterator iterator = duplicatedObject.values().iterator(); - // for each view, a container is set if it is null - // if this is a shape a new position is set in order to avoid superposition - while(iterator.hasNext()) { - Object object = iterator.next(); - if(object instanceof Diagram) { - Diagram diagramView = (Diagram)object; - if(container != null && container.eResource() != null) { - container.eResource().getContents().add(diagramView); - } - - } else if(object instanceof View) { - View duplicatedView = (View)object; - if(object instanceof Shape) { - LayoutConstraint layoutConstraint = ((Shape)object).getLayoutConstraint(); - if(layoutConstraint instanceof Bounds) { - ((Bounds)layoutConstraint).setX(((Bounds)layoutConstraint).getX() + 10); - ((Bounds)layoutConstraint).setY(((Bounds)layoutConstraint).getY() + 10); - } - } - if(duplicatedView.eContainer() == null && container != null) { - ViewUtil.insertChildView(container, duplicatedView, -1, true); - } - } - } - - ICommand externalObjectsDuplicateCommand = getExternalObjectsDuplicateCommand((Map)result.getReturnValue()); - if(externalObjectsDuplicateCommand != null && externalObjectsDuplicateCommand.canExecute()) { - IStatus status = externalObjectsDuplicateCommand.execute(progressMonitor, info); - if(!status.isOK()) { - return CommandResult.newErrorCommandResult(status.getException()); - } - } - } - - return result; - } - - /** - * this class is used to look for the basic eobject duplicate command - * - * @param command - * that contains normally the duplicated command - * @return the duplicate command - */ - protected ICommand lookForDuplicateCommandOwner(ICommandProxy command) { - return command.getICommand(); - } - - /** - * Returns the list of external objects to duplicate - * - * @return the list of external objects to duplicate or an empty list if not elements are found to add. - */ - protected ICommand getExternalObjectsDuplicateCommand(Map duplicatedElementsMap) { - CompositeCommand result = new CompositeCommand("Duplicate External Objects"); - Set duplicatedExternalElements = new HashSet(); - - for(Object o : duplicatedElementsMap.keySet()) { - if(o instanceof EObject) { - EObject object = (EObject)o; - DuplicateElementsRequest request = new DuplicateElementsRequest(Collections.singletonList(object)); - request.setAllDuplicatedElementsMap(duplicatedElementsMap); - request.setParameter(PapyrusDuplicateWrapperCommand.ADDITIONAL_DUPLICATED_ELEMENTS, duplicatedExternalElements); - request.setParameter("Target_Owner", BusinessModelResolver.getInstance().getBusinessModel(container)); - IElementEditService service = ElementEditServiceUtils.getCommandProvider(object); - ICommand command = service.getEditCommand(request); - if(command != null) { - result.add(command); - } - } - } - - return (result.isEmpty()) ? null : result.reduce(); - } -} diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/request/PasteRequest.java b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/request/PasteRequest.java deleted file mode 100644 index 524acab672e..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/request/PasteRequest.java +++ /dev/null @@ -1,59 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.pastemanager.request; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; - -import org.eclipse.gef.Request; -import org.eclipse.gmf.runtime.diagram.ui.requests.DuplicateRequest; - -/** - * this a specific paste request in the framework of papyrus - * - */ -public class PasteRequest extends Request { - - public final static String REQ_PAPYRUS_PASTE="Papyrus_PASTE"; - - /** - * @param elementToPaste the elementToPaste to set - */ - public void setElementToPaste(Collection elementToPaste) { - this.elementToPaste = elementToPaste; - } - - /** - * @return the elementToPaste - */ - public Collection getElementToPaste() { - return elementToPaste; - } - - protected Collection elementToPaste; - - public PasteRequest(Collection elementToPaste){ - this.elementToPaste=elementToPaste; - this.setType(REQ_PAPYRUS_PASTE); - - } - public DuplicateRequest getDuplicate(){ - DuplicateRequest duplicateRequest= new DuplicateRequest(); - duplicateRequest.setEditParts(new ArrayList()); - duplicateRequest.setExtendedData(new HashMap()); - return duplicateRequest; - } - -} diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/service/DefaultPasteCommandProvider.java b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/service/DefaultPasteCommandProvider.java deleted file mode 100644 index 5b8036d1498..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/service/DefaultPasteCommandProvider.java +++ /dev/null @@ -1,188 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.pastemanager.service; - -import java.awt.Toolkit; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.DataFlavor; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.RootEditPart; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; -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.DiagramEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper; -import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.pastemanager.Activator; -import org.eclipse.papyrus.uml.pastemanager.command.CommentDropCreation; -import org.eclipse.papyrus.uml.pastemanager.command.PapyrusDuplicateWrapperCommand; -import org.eclipse.papyrus.uml.pastemanager.request.PasteRequest; -import org.eclipse.uml2.uml.Element; -import org.eclipse.gef.commands.Command; - -/** - * this provider has the following behavior - * when the System clipboard contains a string the papyrus clipboard has no information - * (a copy has be done on the system). In this case, a comment is created and displayed in the diagram - * the body contains the string from the clipboard. - * In other case, a paste request {@link org.eclipse.papyrus.uml.pastemanager.request.PasteRequest} in send to the target editpart in order to obtain - * the paste command ( graphically or the paste with model command - * - */ - -public class DefaultPasteCommandProvider implements IPasteCommandProvider { - - /** - * this method provides a command to paste by taking information from the clipboard of the system or gmf clipbaord - * - * @param targetEditPart - * the target editpart where we want to paste - * @param systemClipboard - * the system clipboard see {@link DataFlavor} to see how to extract information - * @param papyrusCliboard - * contains the list of views to paste - * @return - */ - - public ICommand getPasteViewCommand(GraphicalEditPart targetEditPart, Clipboard systemClipboard, Collection papyrusClipboard) { - - if(!System.getProperty("os.name").equals("Linux")) { - // examine system clipboard - String bufferSystem = null; - // long millisBefore = System.currentTimeMillis (); - DataFlavor[] dataFlavors = Toolkit.getDefaultToolkit().getSystemClipboard().getAvailableDataFlavors(); - // System.out.println (">>> TEST: time spend in getAvailableDataFlavorsCall: " + (System.currentTimeMillis () - millisBefore)); - for(int i = 0; i < dataFlavors.length; i++) { - try { - if(dataFlavors[i].isFlavorTextType() && dataFlavors[i].isMimeTypeEqual(DataFlavor.stringFlavor)) { - bufferSystem = Toolkit.getDefaultToolkit().getSystemClipboard().getData(dataFlavors[i]).toString(); - } - } catch (Exception e) { - //System.err.println(e); - } - } - // detection of a paste command from the system - if(bufferSystem != null) { - // here, the choice is to create a comment from a string - // if the you want to modify it overload the method paste from System - return pasteFromSystem(targetEditPart, bufferSystem); - } - //else - } - - /* Send the request to the target edit part of the paste command for the currently selected part */ - PasteRequest pasteRequest = new PasteRequest(targetEditPart.getEditingDomain().getClipboard()); - Command pasteCommand = targetEditPart.getCommand(pasteRequest); - if(pasteCommand != null) { - return new CommandProxy(pasteCommand); - } - return UnexecutableCommand.INSTANCE; - } - - /** - * This method is in charge of pasting a string from the system. - * If you want to add a new behavior, overload this method - * - * @param targetEditPart - * @param comment - * the string that comes from the system - * @return the command in charge to do the modification in the system - */ - public ICommand pasteFromSystem(GraphicalEditPart targetEditPart, String comment) { - return new CommentDropCreation("paste", comment, targetEditPart.getNotationView().getElement(), targetEditPart); - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - /** - * @inheritedDoc - */ - public ICommand getPasteWithModelCommand(GraphicalEditPart targetEditPart, Clipboard systemClipboard, Collection papyrusCliboard) { - //look in the clipboard of the system - String bufferSystem = null; - if(!System.getProperty("os.name").equals("Linux")) { - DataFlavor[] dataFlavors = Toolkit.getDefaultToolkit().getSystemClipboard().getAvailableDataFlavors(); - for(int i = 0; i < dataFlavors.length; i++) { - try { - if(dataFlavors[i].isFlavorTextType() && dataFlavors[i].isMimeTypeEqual(DataFlavor.stringFlavor)) { - - bufferSystem = Toolkit.getDefaultToolkit().getSystemClipboard().getData(dataFlavors[i]).toString(); - } - } catch (Exception e) { - Activator.log.error(e); - } - } - //detection of a paste command from the system - if(bufferSystem != null) { - // here, the choice is to create a comment from a string - // if the you want to modify it overload the method paste from System - return pasteFromSystem(targetEditPart, bufferSystem); - } - //else - } - /* Send the request to the target edit part of the paste command for the currently selected part */ - ArrayList objectToPaste = new ArrayList(); - if(papyrusCliboard != null && papyrusCliboard.size() >= 1) { - objectToPaste.addAll(papyrusCliboard); - - - Iterator iterator = papyrusCliboard.iterator(); - //in order to paste with model, semantic element has to be put in the list - while(iterator.hasNext()) { - Object object = (Object)iterator.next(); - if(object instanceof View) { - objectToPaste.add(((View)object).getElement()); - - ArrayList stereotypedSelection = new ArrayList(); - EObject semantic =((View)object).getElement(); - if( semantic instanceof Element){ - stereotypedSelection.addAll(((Element)semantic).getStereotypeApplications()); - } - //copy stereotype contained into - Iterator iter=semantic.eAllContents(); - while (iter.hasNext()) { - EObject subeObject = (EObject) iter.next(); - if( subeObject instanceof Element){ - stereotypedSelection.addAll(((Element)subeObject).getStereotypeApplications()); - } - - } - objectToPaste.addAll(stereotypedSelection); - } - - } - //creation of duplicate request to obtain the functionnality of GMF - DuplicateElementsRequest duplicateElementRequest = new DuplicateElementsRequest(targetEditPart.getEditingDomain(), objectToPaste); - - //add the wrapper - RootEditPart topEditPart = targetEditPart.getRoot(); - if(topEditPart.getChildren().get(0) instanceof DiagramEditPart) { - - org.eclipse.gef.commands.Command gefCommand = ((DiagramEditPart)topEditPart.getChildren().get(0)).getCommand(new EditCommandRequestWrapper(duplicateElementRequest)); - ICommand command = new PapyrusDuplicateWrapperCommand(targetEditPart.getEditingDomain(), "", objectToPaste, (ICommandProxy)gefCommand, (View)targetEditPart.getModel()); - return command; - } - } - - return UnexecutableCommand.INSTANCE; - } - - -} diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/service/IPasteCommandProvider.java b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/service/IPasteCommandProvider.java deleted file mode 100644 index bf99ab7c372..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/service/IPasteCommandProvider.java +++ /dev/null @@ -1,54 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.pastemanager.service; - -import java.awt.datatransfer.Clipboard; -import java.util.Collection; - -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; - -/** - * - * a paste provider has provide operation in order to paste by taking account system clipboard or papyrus clipboard - * - */ -public interface IPasteCommandProvider { - - /** - * return the paste command to execute by taking account parameter - * - * @param targetEditPart - * the target where object will be paste - * @param systemClipboard - * contains info form the system copy paste - * @param papyrusCliboard - * the list of views to paste - * @return a command - */ - public ICommand getPasteViewCommand(GraphicalEditPart targetEditPart, java.awt.datatransfer.Clipboard systemClipboard, Collection papyrusCliboard); - - /** - * return the paste command to execute by taking account parameter. It copy also element of the semantic model - * - * @param targetEditPart - * the target where object will be paste - * @param systemClipboard - * contains info form the system copy paste - * @param papyrusCliboard - * the list of views to paste - * @return a command - */ - public ICommand getPasteWithModelCommand(GraphicalEditPart targetEditPart, Clipboard systemClipboard, Collection papyrusCliboard); -} diff --git a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/service/PasteCommandService.java b/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/service/PasteCommandService.java deleted file mode 100644 index 4edcb1ae0b7..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.pastemanager/src/org/eclipse/papyrus/uml/pastemanager/service/PasteCommandService.java +++ /dev/null @@ -1,154 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.pastemanager.service; - -import java.awt.datatransfer.Clipboard; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.papyrus.uml.pastemanager.Activator; -import org.osgi.framework.Bundle; - -/** - * this singleton looks for in extension point to find a pasteCommandProvider - * and can provide a paste command - */ - - -public class PasteCommandService { - - protected static final String PASTECOMMANDPROVIDER_EXTENSION_ID = "org.eclipse.papyrus.uml.pastemanager.pasteCommandProvider"; - - protected static final String REALIZATION = "realization"; - - protected static final String PRIORITY = "priority"; - - protected static PasteCommandService instance = null; - - public static PasteCommandService getInstance() { - if(instance == null) { - instance = new PasteCommandService(); - } - return instance; - } - - - /** - * Load an instance of a class - * - * @param element - * the extension point - * @param classAttribute - * the name of the class to load - * @return the loaded Class - * @throws Exception - * if the class is not loaded - */ - protected static Object createExtension(final IConfigurationElement element, final String classAttribute) throws Exception { - try { - Bundle extensionBundle = Platform.getBundle(element.getDeclaringExtension().getNamespaceIdentifier()); - Class clazz = extensionBundle.loadClass(classAttribute); - Object obj = clazz.newInstance(); - return obj; - } catch (Exception e) { - throw new Exception("unable to create Extension" + e); - } - } - - protected Map pasteCommandProviderMap; - - - private PasteCommandService() { - // Reading data from plugins - IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(PASTECOMMANDPROVIDER_EXTENSION_ID); - pasteCommandProviderMap = new HashMap(); - for(int i = 0; i < configElements.length; i++) { - getPasteCommandProvider(configElements[i]); - } - - } - - /** - * Load one rule - * - * @param element - * the extension point - */ - protected void getPasteCommandProvider(IConfigurationElement element) { - IPasteCommandProvider pasteCommandProvider = null; - try { - pasteCommandProvider = (IPasteCommandProvider)createExtension(element, element.getAttribute(REALIZATION)); - String priority = (String)element.getAttribute(PRIORITY); - pasteCommandProviderMap.put(priority, pasteCommandProvider); - - } catch (Exception e) { - Activator.log.error("- " + pasteCommandProvider + " can not be loaded: " + e.getLocalizedMessage(), e); - } - } - - protected IPasteCommandProvider lookForProvider() { - String[] priority = { "Highest", "High", "Medium", "Low", "Lowest" }; - IPasteCommandProvider selectedProvider = null; - int i = 0; - while(selectedProvider == null && i < priority.length) { - selectedProvider = pasteCommandProviderMap.get(priority[i]); - i++; - } - return selectedProvider; - } - - /** - * return the paste command to execute by taking account parameter - * - * @param targetEditPart - * the target where object will be paste - * @param systemClipboard - * contains info form the system copy paste - * @param papyrusCliboard - * the list of views to paste - * @return a command - */ - public ICommand getPasteViewCommand(GraphicalEditPart targetEditPart, Clipboard systemClipboard, Collection papyrusCliboard) { - IPasteCommandProvider selectedProvider = lookForProvider(); - if(selectedProvider == null) { - return UnexecutableCommand.INSTANCE; - } - return selectedProvider.getPasteViewCommand(targetEditPart, systemClipboard, papyrusCliboard); - } - - /** - * return the paste command to execute by taking account parameter. It copy also element of the semantic model - * - * @param targetEditPart - * the target where object will be paste - * @param systemClipboard - * contains info form the system copy paste - * @param papyrusCliboard - * the list of views to paste - * @return a command - */ - public ICommand getPasteWithModelCommand(GraphicalEditPart targetEditPart, Clipboard systemClipboard, Collection papyrusCliboard) { - IPasteCommandProvider selectedProvider = lookForProvider(); - if(selectedProvider == null) { - return UnexecutableCommand.INSTANCE; - } - return selectedProvider.getPasteWithModelCommand(targetEditPart, systemClipboard, papyrusCliboard); - } -} -- cgit v1.2.3 From 05f65a0e59300446fc4fba57f3866e6bb634666c Mon Sep 17 00:00:00 2001 From: Benoit Maggi Date: Fri, 14 Feb 2014 16:03:41 +0100 Subject: Add contextid to solve keybing problems Change-Id: I5ac9472dd1ad816c61b71a3198cf55e2ed60e90d Signed-off-by: Benoit Maggi --- plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml index 35cbe4a3aae..fe5cb637888 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/plugin.xml @@ -4378,10 +4378,10 @@ point="org.eclipse.ui.bindings"> - - - + + -- cgit v1.2.3 From 4d31222b2d0d4ed20b3e7499221503919f9b8dc4 Mon Sep 17 00:00:00 2001 From: Benoit Maggi Date: Fri, 14 Feb 2014 17:51:24 +0100 Subject: #290261: Merge naming convention for graphical and emf copy [Usability] Papyrus shall provide a copy/paste/cut feature Change-Id: Id62b94d8206957a84b2aa0f2fd3ae971d42ac6ee Signed-off-by: Benoit Maggi --- .../commands/DuplicateNamedElementCommand.java | 48 +- .../commands/command/GMFtoEMFCommandWrapper.java | 34 -- .../uml/commands/command/PasteElementCommand.java | 631 +++++++++++---------- .../papyrus/uml/tools/utils/NamedElementUtil.java | 380 +++++++------ 4 files changed, 524 insertions(+), 569 deletions(-) delete mode 100644 plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/command/GMFtoEMFCommandWrapper.java diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/DuplicateNamedElementCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/DuplicateNamedElementCommand.java index 86e22244864..997cd07d597 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/DuplicateNamedElementCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/DuplicateNamedElementCommand.java @@ -13,20 +13,17 @@ *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.commands; -import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.Map; 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.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.common.core.command.CommandResult; import org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand; import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; import org.eclipse.uml2.uml.NamedElement; /** @@ -35,9 +32,7 @@ import org.eclipse.uml2.uml.NamedElement; */ public class DuplicateNamedElementCommand extends DuplicateEObjectsCommand { - protected static final String COPY_OF = "Copy_Of_"; - - protected Object diagram; + protected Diagram diagram; @SuppressWarnings("rawtypes") public DuplicateNamedElementCommand(TransactionalEditingDomain editingDomain, String label, List eObjectsToBeDuplicated, Map allDuplicatedObjectsMap, Diagram currentDiagram) { @@ -53,40 +48,15 @@ public class DuplicateNamedElementCommand extends DuplicateEObjectsCommand { */ protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { super.doExecuteWithResult(progressMonitor, info); - ArrayList processedData= new ArrayList(); - Iterator iterator = getAllDuplicatedObjectsMap().values().iterator(); - NamedElement namedElement=null; - while(iterator.hasNext()) { - Object currentObject = iterator.next(); - if(currentObject instanceof View) { - if(((View)currentObject).getElement() != null && ((View)currentObject).getElement() instanceof NamedElement) { - namedElement = ((NamedElement)((View)currentObject).getElement()); - if(namedElement.getName() != null && !namedElement.getName().startsWith(COPY_OF)) { - namedElement.setName(COPY_OF + namedElement.getName()); - } - } - - } - - if(currentObject instanceof NamedElement) { - namedElement = ((NamedElement)currentObject); - // some literal has not name - if(namedElement.getName() != null && !namedElement.getName().startsWith(COPY_OF)) { - namedElement.setName(COPY_OF + namedElement.getName()); - } - } - - } - - iterator = getAllDuplicatedObjectsMap().values().iterator(); - while(iterator.hasNext()) { - Object currentObject = iterator.next(); - if((currentObject instanceof EObject) &&(((EObject) currentObject).eContainer()== null)&&(((EObject) currentObject).eResource()== null)) { - namedElement.eResource().getContents().add((EObject)currentObject); + List objectsToBeDuplicated = getObjectsToBeDuplicated(); + for (Object object : objectsToBeDuplicated) { + if(object instanceof NamedElement) { + Object duplicatedObject = getAllDuplicatedObjectsMap().get(object); + NamedElement namedDuplicatedObject = (NamedElement)duplicatedObject; + String incrementedName = NamedElementUtil.getDefaultCopyNameWithIncrement(namedDuplicatedObject,diagram.getElement().eContents()); + namedDuplicatedObject.setName(incrementedName); } } - return CommandResult.newOKCommandResult(getAllDuplicatedObjectsMap()); } - } diff --git a/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/command/GMFtoEMFCommandWrapper.java b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/command/GMFtoEMFCommandWrapper.java deleted file mode 100644 index 5885e0b414d..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/command/GMFtoEMFCommandWrapper.java +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.commands.command; - -import org.eclipse.gmf.runtime.common.core.command.ICommand; - -/** - * A EMF Command that wraps a GMF command. Each method is redirected to the GMF one. - * - * @deprecated use {@link org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper} instead - */ -public class GMFtoEMFCommandWrapper extends org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper { - - /** - * Constructor. - * - * @param gmfCommand - * the gmf command - */ - public GMFtoEMFCommandWrapper(ICommand gmfCommand) { - super(gmfCommand); - } -} diff --git a/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/command/PasteElementCommand.java b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/command/PasteElementCommand.java index f6e8fa9a96e..6a1c419f4fa 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/command/PasteElementCommand.java +++ b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/command/PasteElementCommand.java @@ -1,310 +1,321 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.commands.command; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.emf.common.command.AbstractCommand; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; -import org.eclipse.osgi.util.NLS; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.uml.commands.Activator; -import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.Stereotype; -import org.eclipse.uml2.uml.UMLFactory; -import org.eclipse.uml2.uml.util.UMLUtil; - -; - -/** - * this handler has in charge to exexute the paste of UML element with their applied stereotypes - * - */ -public class PasteElementCommand extends AbstractCommand { - - protected ArrayList eobjectTopaste = null; - - protected ArrayList stereotypeApplicationTopaste = null; - - protected EObject targetOwner; - - protected CompositeCommand command; - - //the prefix for the duplicated object - protected String COPY_OF = "CopyOf"; - - /** - * get the command do the paste on the target owner - * - * @param domain - * the editing owner - * @param targetOwner - * the element where the paste will be done - */ - public PasteElementCommand(EditingDomain domain, EObject targetOwner) { - super(); - - if(domain.getClipboard() != null) { - //1. get Data from the clipboard - Collection rawData = domain.getClipboard(); - - //2. filter only EObject - ArrayList eobjectsTopaste = new ArrayList(); - Iterator iterData = rawData.iterator(); - while(iterData.hasNext()) { - Object object = iterData.next(); - if(object instanceof EObject) { - eobjectsTopaste.add((EObject)object); - } - } - - // 2b retrieve now the original stereotype application - List originalStereotypeApplications = new ArrayList(); - Iterator selecIterator = eobjectsTopaste.iterator(); - while(selecIterator.hasNext()) { - EObject eObject = selecIterator.next(); - - if(eObject instanceof Element) { - originalStereotypeApplications.addAll(((Element)eObject).getStereotypeApplications()); - } - //copy stereotype contained into - Iterator iter = eObject.eAllContents(); - while(iter.hasNext()) { - EObject subeObject = iter.next(); - if(subeObject instanceof Element) { - originalStereotypeApplications.addAll(((Element)subeObject).getStereotypeApplications()); - } - - } - } - eobjectsTopaste.addAll(originalStereotypeApplications); - - //3. Copy all eObjects (inspired from PasteFromClipboardCommand) - // Collection duplicatedObject = EcoreUtil.copyAll(eobjectsTopaste); - EcoreUtil.Copier copier = new EcoreUtil.Copier(); - copier.copyAll(eobjectsTopaste); - copier.copyReferences(); - Map duplicatedObjects = new HashMap(); - duplicatedObjects.putAll(copier); - - //4. filter eobject that are UML elements and application of stereotypes - Iterator iter = duplicatedObjects.values().iterator(); - eobjectTopaste = new ArrayList(); - stereotypeApplicationTopaste = new ArrayList(); - while(iter.hasNext()) { - EObject eObject = iter.next(); - boolean isaUMLElement = false; - if(eObject instanceof Element) { - isaUMLElement = true; - } - //functionality that comes from UML2 plugins - Stereotype st = UMLUtil.getStereotype(eObject); - if(isaUMLElement && !originalStereotypeApplications.contains(eObject)) { - eobjectTopaste.add(eObject); - } - } - - // 4b retrieve stereotypeapplications to paste - Iterator stereotypeIterator = originalStereotypeApplications.listIterator(); - while(stereotypeIterator.hasNext()) { - EObject originalStereotypeApp = stereotypeIterator.next(); - EObject duplicateStereotype = duplicatedObjects.get(originalStereotypeApp); - if(duplicateStereotype == null) { - Activator.log.debug("warning a stereotype could not be copied/paste : " + originalStereotypeApp); - } else { - stereotypeApplicationTopaste.add(duplicateStereotype); - } - } - - this.targetOwner = targetOwner; - - //5. prepare the move command to move UML element to their new owner - //Nota: move only the "root" semantic elements to be paste - List objectsToMove = new ArrayList(); - Iterator it = eobjectsTopaste.iterator(); - while(it.hasNext()) { - EObject eObject = it.next(); - boolean isaUMLElement = false; - if(eObject instanceof Element) { - isaUMLElement = true; - } - //functionality that comes from UML2 plugins - if((isaUMLElement && !originalStereotypeApplications.contains(eObject))) {// UML element, but not a stereotype => should be moved - // this is one of the original elements to paste, not a stereotype. - // the copy of this one should be moved - EObject copyObject = duplicatedObjects.get(eObject); - if(copyObject != null) { - objectsToMove.add(copyObject); - } - } - } - - - MoveRequest moveRequest = new MoveRequest(targetOwner, objectsToMove); - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetOwner); - if(provider != null) { - command = new CompositeCommand("Copy Object"); - command.compose(provider.getEditCommand(moveRequest)); - } - - //5 bis. Rename the duplicated objects (only the root elements that are copied, no need to rename *all* nested elements) - for(int i = 0; i < objectsToMove.size(); i++) { - EObject element = objectsToMove.get(i); - if(element instanceof NamedElement && domain instanceof TransactionalEditingDomain) { - String newName = NLS.bind(COPY_OF + "_{0}_", ((NamedElement)element).getName()); - String incrementedName = NamedElementUtil.getDefaultNameWithIncrementFromBase(newName, targetOwner.eContents()); - SetRequest renameRequest = new SetRequest((TransactionalEditingDomain)domain, element, UMLFactory.eINSTANCE.getUMLPackage().getNamedElement_Name(), incrementedName); - if(provider != null && command != null) { - command.compose(provider.getEditCommand(renameRequest)); - } - } - } - - ICommand externalObjectsDuplicateCommand = getExternalObjectsDuplicateCommand(duplicatedObjects, targetOwner); - if(externalObjectsDuplicateCommand != null && command != null) { - command.compose(externalObjectsDuplicateCommand); - } - - } - } - - /** - * {@inheritDoc} - */ - public void execute() { - // for steps 1. 2. 3. 4. 5. see constructor - //6. execute the move command for UML element - if(command != null) { - try { - command.execute(new NullProgressMonitor(), null); - } catch (ExecutionException e) { - Activator.log.error(e); - } - } - //7. move stereotypes applications into the resource - Iterator stereoApplIter = stereotypeApplicationTopaste.iterator(); - while(stereoApplIter.hasNext()) { - EObject eObject = stereoApplIter.next(); - targetOwner.eResource().getContents().add(eObject); - - - } - - } - - /** - * {@inheritDoc} - */ - @Override - public boolean canExecute() { - if(command == null) { - return false; - } - return command.canExecute(); - } - - /** - * {@inheritDoc} - */ - public void redo() { - // for steps 1. 2. 3. 4. 5. see constructor - //6. execute the move command for UML element - if(command != null) { - try { - command.redo(new NullProgressMonitor(), null); - } catch (ExecutionException e) { - Activator.log.error(e); - } - } - //7. move stereotype application into the resource - Iterator stereoApplIter = stereotypeApplicationTopaste.iterator(); - while(stereoApplIter.hasNext()) { - EObject eObject = stereoApplIter.next(); - targetOwner.eResource().getContents().add(eObject); - - - } - - } - - /** - * {@inheritDoc} - */ - @Override - public void undo() { - // for steps 1. 2. 3. 4. 5. see constructor - //6. Undo the move command for UML element - try { - IProgressMonitor monitor = new NullProgressMonitor(); - command.undo(monitor, null); - } catch (ExecutionException e) { - Activator.log.error(e); - } - //7. remove stereotype application from the resource - Iterator stereoApplIter = stereotypeApplicationTopaste.iterator(); - while(stereoApplIter.hasNext()) { - EObject eObject = stereoApplIter.next(); - targetOwner.eResource().getContents().remove(eObject); - } - } - - /** - * Returns the list of external objects to duplicate - * - * @return the list of external objects to duplicate or an empty list if not elements are found to add. - */ - protected ICommand getExternalObjectsDuplicateCommand(Map duplicatedElementsMap, EObject targetOwner) { - CompositeCommand result = new CompositeCommand("Additional Duplications"); - Set duplicatedExternalElements = new HashSet(); - - for(Object o : duplicatedElementsMap.keySet()) { - if(o instanceof EObject) { - EObject object = (EObject)o; - DuplicateElementsRequest request = new DuplicateElementsRequest(Collections.singletonList(object)); - request.setAllDuplicatedElementsMap(duplicatedElementsMap); - request.setParameter("Additional_Duplicated_Elements", duplicatedExternalElements); - request.setParameter("Target_Owner", targetOwner); - IElementEditService service = ElementEditServiceUtils.getCommandProvider(object); - ICommand command = service.getEditCommand(request); - if(command != null) { - result.add(command); - } - } - } - - return result.isEmpty() ? null : result.reduce(); - } -} +/***************************************************************************** + * Copyright (c) 2011 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.commands.command; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.emf.common.command.AbstractCommand; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.commands.Activator; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Stereotype; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.util.UMLUtil; + + +/** + * this handler has in charge to exexute the paste of UML element with their applied stereotypes + * + */ +public class PasteElementCommand extends AbstractCommand { + + private static final String TARGET_OWNER = "Target_Owner"; //$NON-NLS-1$ + + private static final String ADDITIONAL_DUPLICATED_ELEMENTS = "Additional_Duplicated_Elements"; //$NON-NLS-1$ + + protected List eobjectTopaste = null; + + protected List stereotypeApplicationTopaste = null; + + protected EObject targetOwner; + + protected CompositeCommand command; + + + /** + * get the command do the paste on the target owner + * + * @param domain + * the editing owner + * @param targetOwner + * the element where the paste will be done + */ + public PasteElementCommand(EditingDomain domain, EObject targetOwner) { + super(); + + if(domain.getClipboard() != null) { + //1. get Data from the clipboard + Collection rawData = domain.getClipboard(); + + //2. filter only EObject + List eobjectsTopaste = new ArrayList(); + Iterator iterData = rawData.iterator(); + while(iterData.hasNext()) { + Object object = iterData.next(); + if(object instanceof EObject) { + eobjectsTopaste.add((EObject)object); + } + } + + // 2b retrieve now the original stereotype application + List originalStereotypeApplications = new ArrayList(); + Iterator selecIterator = eobjectsTopaste.iterator(); + while(selecIterator.hasNext()) { + EObject eObject = selecIterator.next(); + + if(eObject instanceof Element) { + originalStereotypeApplications.addAll(((Element)eObject).getStereotypeApplications()); + } + //copy stereotype contained into + Iterator iter = eObject.eAllContents(); + while(iter.hasNext()) { + EObject subeObject = iter.next(); + if(subeObject instanceof Element) { + originalStereotypeApplications.addAll(((Element)subeObject).getStereotypeApplications()); + } + + } + } + eobjectsTopaste.addAll(originalStereotypeApplications); + + //3. Copy all eObjects (inspired from PasteFromClipboardCommand) + // Collection duplicatedObject = EcoreUtil.copyAll(eobjectsTopaste); + EcoreUtil.Copier copier = new EcoreUtil.Copier(); + copier.copyAll(eobjectsTopaste); + copier.copyReferences(); + Map duplicatedObjects = new HashMap(); + duplicatedObjects.putAll(copier); + + //4. filter eobject that are UML elements and application of stereotypes + Iterator iter = duplicatedObjects.values().iterator(); + eobjectTopaste = new ArrayList(); + stereotypeApplicationTopaste = new ArrayList(); + while(iter.hasNext()) { + EObject eObject = iter.next(); + boolean isaUMLElement = false; + if(eObject instanceof Element) { + isaUMLElement = true; + } + //functionality that comes from UML2 plugins + Stereotype st = UMLUtil.getStereotype(eObject); + if(isaUMLElement && !originalStereotypeApplications.contains(eObject)) { + eobjectTopaste.add(eObject); + } + } + + // 4b retrieve stereotypeapplications to paste + Iterator stereotypeIterator = originalStereotypeApplications.listIterator(); + while(stereotypeIterator.hasNext()) { + EObject originalStereotypeApp = stereotypeIterator.next(); + EObject duplicateStereotype = duplicatedObjects.get(originalStereotypeApp); + if(duplicateStereotype == null) { + Activator.log.debug("warning a stereotype could not be copied/paste : " + originalStereotypeApp); + } else { + stereotypeApplicationTopaste.add(duplicateStereotype); + } + } + + this.targetOwner = targetOwner; + + //5. prepare the move command to move UML element to their new owner + //Nota: move only the "root" semantic elements to be paste + List objectsToMove = new ArrayList(); + Iterator it = eobjectsTopaste.iterator(); + while(it.hasNext()) { + EObject eObject = it.next(); + boolean isaUMLElement = false; + if(eObject instanceof Element) { + isaUMLElement = true; + } + //functionality that comes from UML2 plugins + if((isaUMLElement && !originalStereotypeApplications.contains(eObject))) {// UML element, but not a stereotype => should be moved + // this is one of the original elements to paste, not a stereotype. + // the copy of this one should be moved + EObject copyObject = duplicatedObjects.get(eObject); + if(copyObject != null) { + objectsToMove.add(copyObject); + } + } + } + + + MoveRequest moveRequest = new MoveRequest(targetOwner, objectsToMove); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetOwner); + if(provider != null) { + command = new CompositeCommand("Copy Object"); + command.compose(provider.getEditCommand(moveRequest)); + } + + renameDuplicatedObject(domain, targetOwner, objectsToMove, provider); + + ICommand externalObjectsDuplicateCommand = getExternalObjectsDuplicateCommand(duplicatedObjects, targetOwner); + if(externalObjectsDuplicateCommand != null && command != null) { + command.compose(externalObjectsDuplicateCommand); + } + + } + } + + + /** + * Rename duplicated objects + * @param domain + * @param targetOwner + * @param objectsToMove + * @param provider + */ + private void renameDuplicatedObject(EditingDomain domain, + EObject targetOwner, List objectsToMove, + IElementEditService provider) { + //5 bis. Rename the duplicated objects (only the root elements that are copied, no need to rename *all* nested elements) + for(int i = 0; i < objectsToMove.size(); i++) { + EObject element = objectsToMove.get(i); + if(element instanceof NamedElement && domain instanceof TransactionalEditingDomain) { + String incrementedName = NamedElementUtil.getDefaultCopyNameWithIncrement((NamedElement)element,targetOwner.eContents()); + SetRequest renameRequest = new SetRequest((TransactionalEditingDomain)domain, element, UMLFactory.eINSTANCE.getUMLPackage().getNamedElement_Name(), incrementedName); + if(provider != null && command != null) { + command.compose(provider.getEditCommand(renameRequest)); + } + } + } + } + + /** + * {@inheritDoc} + */ + public void execute() { + // for steps 1. 2. 3. 4. 5. see constructor + //6. execute the move command for UML element + if(command != null) { + try { + command.execute(new NullProgressMonitor(), null); + } catch (ExecutionException e) { + Activator.log.error(e); + } + } + //7. move stereotypes applications into the resource + Iterator stereoApplIter = stereotypeApplicationTopaste.iterator(); + while(stereoApplIter.hasNext()) { + EObject eObject = stereoApplIter.next(); + targetOwner.eResource().getContents().add(eObject); + } + + } + + /** + * {@inheritDoc} + */ + @Override + public boolean canExecute() { + if(command == null) { + return false; + } + return command.canExecute(); + } + + /** + * {@inheritDoc} + */ + public void redo() { + // for steps 1. 2. 3. 4. 5. see constructor + //6. execute the move command for UML element + if(command != null) { + try { + command.redo(new NullProgressMonitor(), null); + } catch (ExecutionException e) { + Activator.log.error(e); + } + } + //7. move stereotype application into the resource + Iterator stereoApplIter = stereotypeApplicationTopaste.iterator(); + while(stereoApplIter.hasNext()) { + EObject eObject = stereoApplIter.next(); + targetOwner.eResource().getContents().add(eObject); + + + } + + } + + /** + * {@inheritDoc} + */ + @Override + public void undo() { + // for steps 1. 2. 3. 4. 5. see constructor + //6. Undo the move command for UML element + try { + IProgressMonitor monitor = new NullProgressMonitor(); + command.undo(monitor, null); + } catch (ExecutionException e) { + Activator.log.error(e); + } + //7. remove stereotype application from the resource + Iterator stereoApplIter = stereotypeApplicationTopaste.iterator(); + while(stereoApplIter.hasNext()) { + EObject eObject = stereoApplIter.next(); + targetOwner.eResource().getContents().remove(eObject); + } + } + + /** + * Returns the list of external objects to duplicate + * + * @return the list of external objects to duplicate or an empty list if not elements are found to add. + */ + protected ICommand getExternalObjectsDuplicateCommand(Map duplicatedElementsMap, EObject targetOwner) { + CompositeCommand result = new CompositeCommand("Additional Duplications"); + Set duplicatedExternalElements = new HashSet(); + + for(Object o : duplicatedElementsMap.keySet()) { + if(o instanceof EObject) { + EObject object = (EObject)o; + DuplicateElementsRequest request = new DuplicateElementsRequest(Collections.singletonList(object)); + request.setAllDuplicatedElementsMap(duplicatedElementsMap); + request.setParameter(ADDITIONAL_DUPLICATED_ELEMENTS, duplicatedExternalElements); + request.setParameter(TARGET_OWNER, targetOwner); + IElementEditService service = ElementEditServiceUtils.getCommandProvider(object); + ICommand command = service.getEditCommand(request); + if(command != null) { + result.add(command); + } + } + } + + return result.isEmpty() ? null : result.reduce(); + } +} diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NamedElementUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NamedElementUtil.java index 13da0b0c704..9223c881e91 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NamedElementUtil.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NamedElementUtil.java @@ -1,186 +1,194 @@ -/***************************************************************************** - * Copyright (c) 2009 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: - * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.tools.utils; - -import java.util.Collection; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil; -import org.eclipse.uml2.uml.NamedElement; - -/** - * Utility class for org.eclipse.uml2.uml.NamedElement
- */ -public class NamedElementUtil { - - public static final String QUALIFIED_NAME_SEPARATOR = "::"; - - private final static String PUBLIC_STRING = "+"; - - private final static String PROTECTED_STRING = "#"; - - private final static String PRIVATE_STRING = "-"; - - private final static String PACKAGE_STRING = "~"; - - /** - * A helper method to calculate the max depth of an element - * - * @param the - * named element - * @return the maximum depth found in qualified name - */ - public static int getQualifiedNameMaxDepth(NamedElement namedElement) { - int d = 0; - String s = namedElement.getQualifiedName(); - if(s == null) { - return 0; - } - int n = 0; - while((n = s.indexOf(QUALIFIED_NAME_SEPARATOR, n)) != -1) { - n += 2; - d++; - } - return d; - } - - /** - * generate a default name for the eobject in parameter the format is : - * "eclassName"+"max(elementOfTheSameName in the container)" + 1 - * - * @param newElement - * @return - */ - public static String getDefaultNameWithIncrement(EObject newElement) { - if(newElement.eContainer() != null) { - return getDefaultNameWithIncrement(newElement, newElement.eContainer().eContents()); - } - return null; - } - - /** - * generate a default name for the eobject in parameter the format is : - * "eclassName"+"max(elementOfTheSameName in the container)" + 1 the method checks already - * existing element in contents parameter - * - * @param newElement - */ - @SuppressWarnings("rawtypes") - public static String getDefaultNameWithIncrement(EObject newElement, Collection contents) { - return getDefaultNameWithIncrement("", newElement, contents); - } - - @SuppressWarnings("rawtypes") - public static String getDefaultNameWithIncrement(String prefix, EObject newElement, Collection contents) { - if(prefix == null) { - prefix = ""; - } - - return getDefaultNameWithIncrementFromBase(prefix + newElement.eClass().getName(), contents); - } - - @SuppressWarnings("rawtypes") - public static String getDefaultNameWithIncrementFromBase(String base, Collection contents) { - if(base.equalsIgnoreCase("property")) { - base = "Attribute"; - } - int nextNumber = 1; - - for(Object o : contents) { - if(o instanceof EObject) { - String name = EMFCoreUtil.getName((EObject)o); - if(name != null && name.startsWith(base)) { - String end = name.substring(base.length()); - int nextNumberTmp = 1; - - try { - nextNumberTmp = Integer.parseInt(end) + 1; - } catch (NumberFormatException ex) { - } - - if(nextNumberTmp > nextNumber) { - nextNumber = nextNumberTmp; - } - } - } - } - - return base + nextNumber; - } - - /** - * Give the visibility of the {@link NamedElement} as a string, as defined in the UML2 standard. - * - * @return A String representing the visibility of the {@link NamedElement}. Possible values: - *
    - *
  • public: "+" - *
  • private: "-" - *
  • protected: "#" - *
  • package: "~" - *
- */ - public static String getVisibilityAsSign(NamedElement element) { - String vKindValue = ""; - - switch(element.getVisibility().getValue()) { - case org.eclipse.uml2.uml.VisibilityKind.PUBLIC: - vKindValue = PUBLIC_STRING; - break; - case org.eclipse.uml2.uml.VisibilityKind.PRIVATE: - vKindValue = PRIVATE_STRING; - break; - case org.eclipse.uml2.uml.VisibilityKind.PACKAGE: - vKindValue = PACKAGE_STRING; - break; - case org.eclipse.uml2.uml.VisibilityKind.PROTECTED: - vKindValue = PROTECTED_STRING; - break; - } - return vKindValue; - } - - /** - * Returns the name of an element, given its qualified name - * - * @param qualifiedName - * the qualified name of the element - * @return the name of the element. It shall never be null. - */ - public static String getNameFromQualifiedName(String qualifiedName) { - String name = qualifiedName.substring(qualifiedName.lastIndexOf(NamedElement.SEPARATOR) + NamedElement.SEPARATOR.length()); - return (name != null) ? name : ""; - } - - /** - * - * @param childQualifiedName - * the qualifiedName of an element - * @return - * the qualified name of its parent - */ - public static String getParentQualifiedName(final String childQualifiedName) { - final String childName = getNameFromQualifiedName(childQualifiedName); - final String parentQualifiedName = childQualifiedName.substring(0, childQualifiedName.length() - (NamedElement.SEPARATOR.length() + childName.length())); - return (parentQualifiedName != null) ? parentQualifiedName : ""; - } - - - public static String getName(NamedElement element) { - if(element.getName() != null) { - return element.getName(); - } else { - return (NamedElementUtil.getDefaultNameWithIncrement(element)); - } - } -} +/***************************************************************************** + * Copyright (c) 2009 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: + * Yann TANGUY (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.tools.utils; + +import java.util.Collection; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil; +import org.eclipse.osgi.util.NLS; +import org.eclipse.uml2.uml.NamedElement; + +/** + * Utility class for org.eclipse.uml2.uml.NamedElement
+ */ +public class NamedElementUtil { + + public static final String COPY_OF = "CopyOf"; + + public static final String QUALIFIED_NAME_SEPARATOR = "::"; + + private final static String PUBLIC_STRING = "+"; + + private final static String PROTECTED_STRING = "#"; + + private final static String PRIVATE_STRING = "-"; + + private final static String PACKAGE_STRING = "~"; + + /** + * A helper method to calculate the max depth of an element + * + * @param the + * named element + * @return the maximum depth found in qualified name + */ + public static int getQualifiedNameMaxDepth(NamedElement namedElement) { + int d = 0; + String s = namedElement.getQualifiedName(); + if(s == null) { + return 0; + } + int n = 0; + while((n = s.indexOf(QUALIFIED_NAME_SEPARATOR, n)) != -1) { + n += 2; + d++; + } + return d; + } + + /** + * generate a default name for the eobject in parameter the format is : + * "eclassName"+"max(elementOfTheSameName in the container)" + 1 + * + * @param newElement + * @return + */ + public static String getDefaultNameWithIncrement(EObject newElement) { + if(newElement.eContainer() != null) { + return getDefaultNameWithIncrement(newElement, newElement.eContainer().eContents()); + } + return null; + } + + /** + * generate a default name for the eobject in parameter the format is : + * "eclassName"+"max(elementOfTheSameName in the container)" + 1 the method checks already + * existing element in contents parameter + * + * @param newElement + */ + @SuppressWarnings("rawtypes") + public static String getDefaultNameWithIncrement(EObject newElement, Collection contents) { + return getDefaultNameWithIncrement("", newElement, contents); + } + + @SuppressWarnings("rawtypes") + public static String getDefaultCopyNameWithIncrement(NamedElement namedElement, Collection contents) { + String newName = NLS.bind(COPY_OF + "_{0}_", namedElement.getName()); + return NamedElementUtil.getDefaultNameWithIncrementFromBase(newName, contents); + } + + @SuppressWarnings("rawtypes") + public static String getDefaultNameWithIncrement(String prefix, EObject newElement, Collection contents) { + if(prefix == null) { + prefix = ""; + } + return getDefaultNameWithIncrementFromBase(prefix + newElement.eClass().getName(), contents); + } + + @SuppressWarnings("rawtypes") + public static String getDefaultNameWithIncrementFromBase(String base, Collection contents) { + if(base.equalsIgnoreCase("property")) { + base = "Attribute"; + } + int nextNumber = 1; + + for(Object o : contents) { + if(o instanceof EObject) { + String name = EMFCoreUtil.getName((EObject)o); + if(name != null && name.startsWith(base)) { + String end = name.substring(base.length()); + int nextNumberTmp = 1; + + try { + nextNumberTmp = Integer.parseInt(end) + 1; + } catch (NumberFormatException ex) { + } + + if(nextNumberTmp > nextNumber) { + nextNumber = nextNumberTmp; + } + } + } + } + + return base + nextNumber; + } + + /** + * Give the visibility of the {@link NamedElement} as a string, as defined in the UML2 standard. + * + * @return A String representing the visibility of the {@link NamedElement}. Possible values: + *
    + *
  • public: "+" + *
  • private: "-" + *
  • protected: "#" + *
  • package: "~" + *
+ */ + public static String getVisibilityAsSign(NamedElement element) { + String vKindValue = ""; + + switch(element.getVisibility().getValue()) { + case org.eclipse.uml2.uml.VisibilityKind.PUBLIC: + vKindValue = PUBLIC_STRING; + break; + case org.eclipse.uml2.uml.VisibilityKind.PRIVATE: + vKindValue = PRIVATE_STRING; + break; + case org.eclipse.uml2.uml.VisibilityKind.PACKAGE: + vKindValue = PACKAGE_STRING; + break; + case org.eclipse.uml2.uml.VisibilityKind.PROTECTED: + vKindValue = PROTECTED_STRING; + break; + } + return vKindValue; + } + + /** + * Returns the name of an element, given its qualified name + * + * @param qualifiedName + * the qualified name of the element + * @return the name of the element. It shall never be null. + */ + public static String getNameFromQualifiedName(String qualifiedName) { + String name = qualifiedName.substring(qualifiedName.lastIndexOf(NamedElement.SEPARATOR) + NamedElement.SEPARATOR.length()); + return (name != null) ? name : ""; + } + + /** + * + * @param childQualifiedName + * the qualifiedName of an element + * @return + * the qualified name of its parent + */ + public static String getParentQualifiedName(final String childQualifiedName) { + final String childName = getNameFromQualifiedName(childQualifiedName); + final String parentQualifiedName = childQualifiedName.substring(0, childQualifiedName.length() - (NamedElement.SEPARATOR.length() + childName.length())); + return (parentQualifiedName != null) ? parentQualifiedName : ""; + } + + + public static String getName(NamedElement element) { + if(element.getName() != null) { + return element.getName(); + } else { + return (NamedElementUtil.getDefaultNameWithIncrement(element)); + } + } +} -- cgit v1.2.3 From a47ae195d5ab1463216f4bdef0da7d3d64e29388 Mon Sep 17 00:00:00 2001 From: Camille Letavernier Date: Mon, 17 Feb 2014 15:57:21 +0100 Subject: [Tests] Fix various regressions based on test results (SashEditor, CSS, ExtendedTypes) --- .../simple/SimpleSashWindowsContentProvider.java | 79 ++++---- .../singlefolder/SingleFolderContentProvider.java | 34 ++-- .../preferences/EnumerationPreferencePage.java | 7 +- .../org.eclipse.papyrus.uml.diagram.pkg/plugin.xml | 204 +++++++++++++++++++++ .../pkg/preferences/ModelPreferencePage.java | 4 +- .../pkg/preferences/PackagePreferencePage.java | 4 +- .../uml/diagram/pkg/CustomModelPreferencePage.java | 2 +- .../diagram/pkg/CustomPackagePreferencePage.java | 2 +- .../infra/core/sasheditor/tests/AllTests.java | 2 +- .../org.eclipse.papyrus.tests/META-INF/MANIFEST.MF | 5 +- .../test/org/eclipse/papyrus/tests/AllTests.java | 6 +- 11 files changed, 273 insertions(+), 76 deletions(-) diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowsContentProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowsContentProvider.java index 48690ff6ae3..f3482d4a5ed 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowsContentProvider.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowsContentProvider.java @@ -23,6 +23,7 @@ import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IContentChanged import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel; import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider; import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ITabFolderModel; +import org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer; import org.eclipse.swt.SWT; /** @@ -95,42 +96,26 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv * Add the page which should be an IPageModel instance. {@inheritDoc} */ public void addPage(Object newModel, int index) { - addPage((IPageModel)newModel, index); + addPage(index, (IPageModel)newModel); } - /** - * - * {@inheritDoc} - */ public void addPage(IPageModel newModel) { currentTabFolder.doAddItem(newModel); firePropertyChanged(new ContentEvent(ContentEvent.ADDED, this, newModel)); } - /** - * - * {@inheritDoc} - */ public void addPage(ITabFolderModel toFolderModel, IPageModel newModel) { TabFolderModel srcFolder = (TabFolderModel)toFolderModel; srcFolder.doAddItem(newModel); firePropertyChanged(new ContentEvent(ContentEvent.ADDED, this, newModel)); } - /** - * - * {@inheritDoc} - */ - public void addPage(IPageModel newModel, int index) { + public void addPage(int index, IPageModel newModel) { currentTabFolder.doAddItem(index, newModel); firePropertyChanged(new ContentEvent(ContentEvent.ADDED, this, newModel)); } - /** - * - * {@inheritDoc} - */ - public void addPage(ITabFolderModel toFolderModel, IPageModel newModel, int index) { + public void addPage(ITabFolderModel toFolderModel, int index, IPageModel newModel) { TabFolderModel srcFolder = (TabFolderModel)toFolderModel; srcFolder.doAddItem(index, newModel); firePropertyChanged(new ContentEvent(ContentEvent.ADDED, this, newModel)); @@ -184,7 +169,7 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv * @param targetFolderModel */ private void doSetCurrentFolder(TabFolderModel newCurrentFolder) { - currentTabFolder = (TabFolderModel)newCurrentFolder; + currentTabFolder = newCurrentFolder; } /** @@ -192,25 +177,29 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv * * The change event is sent only once after the complete operation is performed. {@inheritDoc} * - * @param referenceFolder The folder used as reference to insert the newly created Folder. - * @param side The side to which the created folder is inserted. Can be SWT.TOP, DOWN, LEFT, RIGHT. + * @param referenceFolder + * The folder used as reference to insert the newly created Folder. + * @param side + * The side to which the created folder is inserted. Can be SWT.TOP, DOWN, LEFT, RIGHT. */ public void createFolder(ITabFolderModel sourceFolder, int tabIndex, ITabFolderModel referenceFolder, int side) { org.eclipse.papyrus.infra.core.sasheditor.Activator.log.debug("createFolder()"); - ITabFolderModel newFolder = doCreateFolder((TabFolderModel)sourceFolder, tabIndex, (TabFolderModel)referenceFolder, side); + doCreateFolder((TabFolderModel)sourceFolder, tabIndex, (TabFolderModel)referenceFolder, side); contentChangedListenerManager.fireContentChanged(new ContentEvent(ContentEvent.CHANGED, this, sourceFolder)); // return newFolder; } /** * Create a new folder and insert it at the specified side of the reference folder. - * The change event is sent only once after the complete operation is performed. + * The change event is sent only once after the complete operation is performed. * * This method is not part of the {@link SashWindowsContainer} API. It is here to help writing junit tests. * - * @param referenceFolder The folder used as reference to insert the newly created Folder. - * @param side The side to which the created folder is inserted. Can be SWT.TOP, DOWN, LEFT, RIGHT. + * @param referenceFolder + * The folder used as reference to insert the newly created Folder. + * @param side + * The side to which the created folder is inserted. Can be SWT.TOP, DOWN, LEFT, RIGHT. */ public ITabFolderModel createFolder(ITabFolderModel referenceFolder, int side) { org.eclipse.papyrus.infra.core.sasheditor.Activator.log.debug("createFolder()"); @@ -236,17 +225,17 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv /** * Move a tab from folder to folder. * The tab is added at the end of the target folder. - * The change event is sent only once after the complete operation is performed. {@inheritDoc} + * The change event is sent only once after the complete operation is performed. */ private void doMoveTab(TabFolderModel srcFolderModel, int sourceIndex, TabFolderModel targetFolderModel) { // Move all - if( sourceIndex < 0) { + if(sourceIndex < 0) { targetFolderModel.getChildren().addAll(srcFolderModel.getChildren()); srcFolderModel.getChildren().clear(); return; } - + IPageModel tab = srcFolderModel.doRemoveTab(sourceIndex); targetFolderModel.doAddItem(tab); } @@ -292,13 +281,15 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv */ private void removeEmptyFolder(TabFolderModel tabFolder) { // Check if empty - if(tabFolder.getChildren().size() > 0) + if(tabFolder.getChildren().size() > 0) { return; + } AbstractModel parent = tabFolder.getParent(); // Forbid removing of the last folder - if(parent == rootModel) + if(parent == rootModel) { return; + } // Parent is a sash. Ask it to remove the child and itself ((SashPanelModel)parent).delete(tabFolder); @@ -319,10 +310,11 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv int direction; // Compute sash direction - if(side == SWT.LEFT || side == SWT.RIGHT) + if(side == SWT.LEFT || side == SWT.RIGHT) { direction = SWT.HORIZONTAL; - else + } else { direction = SWT.VERTICAL; + } // Create sash if(side == SWT.LEFT || side == SWT.UP) { newSash = new SashPanelModel(refParent, folderToInsert, refFolder, direction); @@ -371,13 +363,13 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv } /** - * Remove the specified tab from its parent. {@inheritDoc} + * Remove the specified tab from its parent. */ public void removePage(IPageModel tabItem) { TabFolderModel folder = lookupPageFolder(tabItem); -// if(folder != null) -// folder.removeTab(tabItem); + // if(folder != null) + // folder.removeTab(tabItem); if(folder != null) { folder.doRemoveTab(tabItem); removeEmptyFolder(folder); @@ -469,12 +461,14 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv * @param listener */ public void addContentChangedListener(IContentChangedListener listener) { - if(listeners == null) + if(listeners == null) { createListeners(); + } // Check if already exists. - if(listeners.contains(listener)) + if(listeners.contains(listener)) { return; + } listeners.add(listener); } @@ -486,8 +480,9 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv * @param listener */ public void removeContentChangedListener(IContentChangedListener listener) { - if(listeners == null) + if(listeners == null) { return; + } listeners.remove(listener); } @@ -496,8 +491,9 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv * Create the list of listeners. */ private void createListeners() { - if(listeners == null) + if(listeners == null) { listeners = new ArrayList(); + } } @@ -507,8 +503,9 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv * @param event */ public void fireContentChanged(ContentEvent event) { - if(listeners == null) + if(listeners == null) { return; + } for(IContentChangedListener listener : listeners) { listener.contentChanged(event); diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/singlefolder/SingleFolderContentProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/singlefolder/SingleFolderContentProvider.java index 9fab42698f2..4fba90e6770 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/singlefolder/SingleFolderContentProvider.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/singlefolder/SingleFolderContentProvider.java @@ -86,23 +86,15 @@ public class SingleFolderContentProvider implements ISashWindowsContentProvider, * Add the page which should be an IPageModel instance. {@inheritDoc} */ public void addPage(Object newModel, int index) { - addPage((IPageModel)newModel, index); + addPage(index, (IPageModel)newModel); } - /** - * - * {@inheritDoc} - */ public void addPage(IPageModel newModel) { currentTabFolder.addItem(newModel); } - /** - * - * {@inheritDoc} - */ - public void addPage(IPageModel newModel, int index) { + public void addPage(int index, IPageModel newModel) { currentTabFolder.addItem(index, newModel); } @@ -110,7 +102,7 @@ public class SingleFolderContentProvider implements ISashWindowsContentProvider, * Do nothing because this implementation doesn't allows folders. {@inheritDoc} */ public void createFolder(ITabFolderModel tabFolder, int tabIndex, ITabFolderModel targetFolder, int side) { - + //Nothing } /** @@ -145,10 +137,6 @@ public class SingleFolderContentProvider implements ISashWindowsContentProvider, currentTabFolder.removeTab(index); } - /** - * - * {@inheritDoc} - */ public void removePage(IPageModel tabItem) { currentTabFolder.removeTab(tabItem); } @@ -177,6 +165,7 @@ public class SingleFolderContentProvider implements ISashWindowsContentProvider, * @param rawModel */ public void setCurrentFolder(Object rawModel) { + //Nothing } /** @@ -195,12 +184,14 @@ public class SingleFolderContentProvider implements ISashWindowsContentProvider, * @param listener */ public void addContentChangedListener(IContentChangedListener listener) { - if(listeners == null) + if(listeners == null) { createListeners(); + } // Check if already exists. - if(listeners.contains(listener)) + if(listeners.contains(listener)) { return; + } listeners.add(listener); } @@ -212,8 +203,9 @@ public class SingleFolderContentProvider implements ISashWindowsContentProvider, * @param listener */ public void removeContentChangedListener(IContentChangedListener listener) { - if(listeners == null) + if(listeners == null) { return; + } listeners.remove(listener); } @@ -222,8 +214,9 @@ public class SingleFolderContentProvider implements ISashWindowsContentProvider, * Create the list of listeners. */ private void createListeners() { - if(listeners == null) + if(listeners == null) { listeners = new ArrayList(); + } } @@ -233,8 +226,9 @@ public class SingleFolderContentProvider implements ISashWindowsContentProvider, * @param event */ public void fireContentChanged(ContentEvent event) { - if(listeners == null) + if(listeners == null) { return; + } for(IContentChangedListener listener : listeners) { listener.contentChanged(event); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/preferences/EnumerationPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/preferences/EnumerationPreferencePage.java index 79e281d4684..2b615ec78fb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/preferences/EnumerationPreferencePage.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/preferences/EnumerationPreferencePage.java @@ -29,7 +29,7 @@ public class EnumerationPreferencePage extends AbstractPapyrusNodePreferencePage /** * @generated */ - public static final String compartments[] = { "EnumerationLiteralCompartment" }; + public static final String compartments[] = { "literals" }; /** * @generated @@ -89,7 +89,7 @@ public class EnumerationPreferencePage extends AbstractPapyrusNodePreferencePage */ private static TreeMap getStaticCompartmentVisibilityPreferences() { TreeMap map = new TreeMap(); - map.put("EnumerationLiteralCompartment", Boolean.TRUE); + map.put("literals", Boolean.TRUE); return map; } @@ -98,13 +98,14 @@ public class EnumerationPreferencePage extends AbstractPapyrusNodePreferencePage */ private static TreeMap getStaticCompartmentTitleVisibilityPreferences() { TreeMap map = new TreeMap(); - map.put("EnumerationLiteralCompartment", Boolean.FALSE); + map.put("literals", Boolean.FALSE); return map; } /** * @generated */ + @Override protected TreeMap getCompartmentTitleVisibilityPreferences() { return getStaticCompartmentTitleVisibilityPreferences(); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/plugin.xml index 9b056b8a84a..c7d6758a721 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/plugin.xml @@ -478,6 +478,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/ModelPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/ModelPreferencePage.java index b65cdb493dd..e5684450c39 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/ModelPreferencePage.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/ModelPreferencePage.java @@ -35,10 +35,10 @@ public class ModelPreferencePage extends PackageDiagramNodePreferencePage { /** Static attribute initialization */ static { compartmentDefaultVisibilityMap = new LinkedHashMap(); - compartmentDefaultVisibilityMap.put("PackageableElementCompartment", Boolean.TRUE); //$NON-NLS-1$ + compartmentDefaultVisibilityMap.put("packaged elements", Boolean.TRUE); //$NON-NLS-1$ compartmentTitleDefaultVisibilityMap = new LinkedHashMap(); - compartmentTitleDefaultVisibilityMap.put("PackageableElementCompartment", Boolean.TRUE); //$NON-NLS-1$ + compartmentTitleDefaultVisibilityMap.put("packaged elements", Boolean.TRUE); //$NON-NLS-1$ // Start of user code custom static initializations // End of user code diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackagePreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackagePreferencePage.java index 981e2158c01..b765504af9f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackagePreferencePage.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src-gen/org/eclipse/papyrus/uml/diagram/pkg/preferences/PackagePreferencePage.java @@ -35,10 +35,10 @@ public class PackagePreferencePage extends PackageDiagramNodePreferencePage { /** Static attribute initialization */ static { compartmentDefaultVisibilityMap = new LinkedHashMap(); - compartmentDefaultVisibilityMap.put("PackageableElementCompartment", Boolean.TRUE); //$NON-NLS-1$ + compartmentDefaultVisibilityMap.put("packaged elements", Boolean.TRUE); //$NON-NLS-1$ compartmentTitleDefaultVisibilityMap = new LinkedHashMap(); - compartmentTitleDefaultVisibilityMap.put("PackageableElementCompartment", Boolean.TRUE); //$NON-NLS-1$ + compartmentTitleDefaultVisibilityMap.put("packaged elements", Boolean.TRUE); //$NON-NLS-1$ // Start of user code custom static initializations // End of user code diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CustomModelPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CustomModelPreferencePage.java index d51b074bd9d..9f2c29565fd 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CustomModelPreferencePage.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CustomModelPreferencePage.java @@ -20,7 +20,7 @@ import org.eclipse.papyrus.uml.diagram.pkg.preferences.ModelPreferencePage; public class CustomModelPreferencePage extends ModelPreferencePage { static { - compartmentTitleDefaultVisibilityMap.put("PackageableElementCompartment", Boolean.FALSE); //$NON-NLS-1$ + compartmentTitleDefaultVisibilityMap.put("packaged elements", Boolean.FALSE); //$NON-NLS-1$ } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CustomPackagePreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CustomPackagePreferencePage.java index 1e2c4baac7f..7332b08f5b9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CustomPackagePreferencePage.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.pkg/src/org/eclipse/papyrus/uml/diagram/pkg/CustomPackagePreferencePage.java @@ -20,7 +20,7 @@ import org.eclipse.papyrus.uml.diagram.pkg.preferences.PackagePreferencePage; public class CustomPackagePreferencePage extends PackagePreferencePage { static { - compartmentTitleDefaultVisibilityMap.put("PackageableElementCompartment", Boolean.FALSE); //$NON-NLS-1$ + compartmentTitleDefaultVisibilityMap.put("packaged elements", Boolean.FALSE); //$NON-NLS-1$ } /** diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/tests/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/tests/AllTests.java index 153a1a60b01..b8e961a87e7 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/tests/AllTests.java +++ b/tests/junit/plugins/core/org.eclipse.papyrus.sasheditor.tests/test/org/eclipse/papyrus/infra/core/sasheditor/tests/AllTests.java @@ -28,5 +28,5 @@ org.eclipse.papyrus.infra.core.sasheditor.internal.AllTests.class, org.eclipse.papyrus.infra.core.sasheditor.tests.texteditor.AllTests.class }) public class AllTests { - + //Testsuite } diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF index 9906a3b4c21..6aeaa83921f 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/META-INF/MANIFEST.MF @@ -42,8 +42,9 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.nattable.model.editor.tests;bundle-version="1.0.0", org.eclipse.papyrus.uml.diagram.sequence.tests;bundle-version="1.0.0", org.eclipse.papyrus.uml.diagram.interactionoverview.tests;bundle-version="1.0.0", - org.eclipse.papyrus.uml.diagram.composite.tests;bundle-version="1.0.0", - org.eclipse.papyrus.infra.gmfdiag.css.tests;bundle-version="1.0.0" + org.eclipse.papyrus.uml.diagram.composite.tests;bundle-version="1.0.0", + org.eclipse.papyrus.infra.gmfdiag.css.tests;bundle-version="1.0.0", + org.eclipse.papyrus.infra.extendedtypes.tests;bundle-version="1.0.0" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 1.0.0.qualifier diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java index f9dc589e01e..510de5a6616 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java +++ b/tests/junit/plugins/core/org.eclipse.papyrus.tests/test/org/eclipse/papyrus/tests/AllTests.java @@ -48,7 +48,7 @@ public class AllTests { suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.services.edit.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.services.edit.tests.suites.AllTests")); suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.labelprovider.tests.AllTests.class)); suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.emf.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceTest")); - suiteClasses.add(new FragmentTestSuiteClass(org.eclipse.papyrus.infra.extendedtypes.Activator.PLUGIN_ID, "org.eclipse.papyrus.infra.extendedtypes.AllTests")); + suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.extendedtypes.tests.AllTests.class)); // suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.services.openelement.tests.AllTests.class)); /* views */ @@ -106,7 +106,7 @@ public class AllTests { /** * Constructor. - * + * * @param clazz * the suite class � AllTests2 * @throws InitializationError @@ -120,7 +120,7 @@ public class AllTests { /** * Returns the list of test classes - * + * * @return the list of test classes */ private static Class[] getSuites() { -- cgit v1.2.3 From d678c26eea16eea70b7b65cf9aff41e7f8512aa4 Mon Sep 17 00:00:00 2001 From: Camille Letavernier Date: Mon, 17 Feb 2014 18:05:16 +0100 Subject: [Releng] Move the test plug-in extendedtypes.tests to the right location --- .../.classpath | 7 - .../.project | 28 -- .../.settings/org.eclipse.jdt.core.prefs | 8 - .../META-INF/MANIFEST.MF | 27 -- .../about.html | 28 -- .../build.properties | 9 - .../icons/M.gif | Bin 912 -> 0 bytes .../icons/O.gif | Bin 912 -> 0 bytes .../icons/Values.gif | Bin 361 -> 0 bytes .../icons/debug.gif | Bin 348 -> 0 bytes .../model/ExtendedTypesTestsProfile.ctx | 38 --- .../model/ExtendedTypesTestsProfile.profile.di | 17 - .../ExtendedTypesTestsProfile.profile.notation | 120 ------- .../model/ExtendedTypesTestsProfile.profile.uml | 370 --------------------- .../model/MyPalette.palette | 1 - .../model/Test.extendedtypes | 122 ------- .../model/Test1.extendedtypes | 15 - .../model/TestMenu.xmi | 33 -- .../model/model.di | 17 - .../model/model.notation | 105 ------ .../model/model.uml | 116 ------- .../model/ui/SingleStereotypeWithFeaturesToSet.xwt | 2 - ...clipse.papyrus.infra.extendedtypes.tests.launch | 41 --- .../plugin.properties | 12 - .../plugin.xml | 38 --- .../infra/extendedtypes/tests/Activator.java | 50 --- .../infra/extendedtypes/tests/AllTests.java | 26 -- .../tests/ExtendedEditHelperAdviceTests.java | 200 ----------- .../tests/ExtendedTypesRegistryTests.java | 225 ------------- .../infra/extendedtypes/tests/ITestConstants.java | 25 -- .../.classpath | 7 + .../.project | 28 ++ .../.settings/org.eclipse.jdt.core.prefs | 8 + .../META-INF/MANIFEST.MF | 27 ++ .../about.html | 28 ++ .../build.properties | 9 + .../icons/M.gif | Bin 0 -> 912 bytes .../icons/O.gif | Bin 0 -> 912 bytes .../icons/Values.gif | Bin 0 -> 361 bytes .../icons/debug.gif | Bin 0 -> 348 bytes .../model/ExtendedTypesTestsProfile.ctx | 38 +++ .../model/ExtendedTypesTestsProfile.profile.di | 17 + .../ExtendedTypesTestsProfile.profile.notation | 120 +++++++ .../model/ExtendedTypesTestsProfile.profile.uml | 370 +++++++++++++++++++++ .../model/MyPalette.palette | 1 + .../model/Test.extendedtypes | 122 +++++++ .../model/Test1.extendedtypes | 15 + .../model/TestMenu.xmi | 33 ++ .../model/model.di | 17 + .../model/model.notation | 105 ++++++ .../model/model.uml | 116 +++++++ .../model/ui/SingleStereotypeWithFeaturesToSet.xwt | 2 + ...clipse.papyrus.infra.extendedtypes.tests.launch | 41 +++ .../plugin.properties | 12 + .../plugin.xml | 38 +++ .../infra/extendedtypes/tests/Activator.java | 50 +++ .../infra/extendedtypes/tests/AllTests.java | 26 ++ .../tests/ExtendedEditHelperAdviceTests.java | 200 +++++++++++ .../tests/ExtendedTypesRegistryTests.java | 225 +++++++++++++ .../infra/extendedtypes/tests/ITestConstants.java | 25 ++ 60 files changed, 1680 insertions(+), 1680 deletions(-) delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.classpath delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.project delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.settings/org.eclipse.jdt.core.prefs delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/META-INF/MANIFEST.MF delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/about.html delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/build.properties delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/M.gif delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/O.gif delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/Values.gif delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/debug.gif delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.ctx delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.di delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.notation delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.uml delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/MyPalette.palette delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/Test.extendedtypes delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/Test1.extendedtypes delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/TestMenu.xmi delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.di delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.notation delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.uml delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ui/SingleStereotypeWithFeaturesToSet.xwt delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/org.eclipse.papyrus.infra.extendedtypes.tests.launch delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/plugin.properties delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/plugin.xml delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/Activator.java delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/AllTests.java delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedEditHelperAdviceTests.java delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedTypesRegistryTests.java delete mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ITestConstants.java create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/.classpath create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/.project create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/.settings/org.eclipse.jdt.core.prefs create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/META-INF/MANIFEST.MF create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/about.html create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/build.properties create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/M.gif create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/O.gif create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/Values.gif create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/debug.gif create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.ctx create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.di create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.notation create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.uml create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/MyPalette.palette create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/Test.extendedtypes create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/Test1.extendedtypes create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/TestMenu.xmi create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/model.di create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/model.notation create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/model.uml create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ui/SingleStereotypeWithFeaturesToSet.xwt create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/org.eclipse.papyrus.infra.extendedtypes.tests.launch create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/plugin.properties create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/plugin.xml create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/Activator.java create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/AllTests.java create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedEditHelperAdviceTests.java create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedTypesRegistryTests.java create mode 100644 tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ITestConstants.java diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.classpath b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.classpath deleted file mode 100644 index 2d1a4302f04..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.project b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.project deleted file mode 100644 index 4887ac9519b..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.papyrus.infra.extendedtypes.tests - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 25668b8f4f0..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Fri Oct 29 11:46:50 CEST 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/META-INF/MANIFEST.MF deleted file mode 100644 index e56fafcb15a..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/META-INF/MANIFEST.MF +++ /dev/null @@ -1,27 +0,0 @@ -Manifest-Version: 1.0 -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - org.eclipse.papyrus.uml.service.types;bundle-version="1.0.0", - org.junit;bundle-version="4.10.0", - org.eclipse.papyrus.junit.utils;bundle-version="1.0.0", - org.eclipse.papyrus.uml.tools;bundle-version="1.0.0", - org.eclipse.papyrus.infra.newchild;bundle-version="1.0.0", - org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.0", - org.eclipse.papyrus.infra.core;bundle-version="1.0.0", - org.eclipse.emf.transaction;bundle-version="1.4.0", - org.eclipse.gmf.runtime.emf.core;bundle-version="1.7.0", - org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.7.0", - org.eclipse.gmf.runtime.diagram.ui -Export-Package: org.eclipse.papyrus.infra.extendedtypes.tests -Bundle-Vendor: %providerName -Bundle-ActivationPolicy: lazy -Bundle-Version: 1.0.0.qualifier -Bundle-Name: %pluginName -Bundle-Localization: plugin -Bundle-ManifestVersion: 2 -Bundle-Activator: org.eclipse.papyrus.infra.extendedtypes.tests.Activa - tor -Bundle-SymbolicName: org.eclipse.papyrus.infra.extendedtypes.tests;sin - gleton:=true -Bundle-RequiredExecutionEnvironment: J2SE-1.5 - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/about.html b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/about.html deleted file mode 100644 index 82d49bf5f81..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/about.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - -About - - -

About This Content

- -

June 5, 2007

-

License

- -

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at http://www.eclipse.org.

- - - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/build.properties b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/build.properties deleted file mode 100644 index 89abf6ef7cc..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/build.properties +++ /dev/null @@ -1,9 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - icons/,\ - model/,\ - plugin.properties,\ - about.html diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/M.gif b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/M.gif deleted file mode 100644 index f9a5b239d6c..00000000000 Binary files a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/M.gif and /dev/null differ diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/O.gif b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/O.gif deleted file mode 100644 index e6ce0916227..00000000000 Binary files a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/O.gif and /dev/null differ diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/Values.gif b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/Values.gif deleted file mode 100644 index f1f019535ea..00000000000 Binary files a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/Values.gif and /dev/null differ diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/debug.gif b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/debug.gif deleted file mode 100644 index ac5431fa311..00000000000 Binary files a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/icons/debug.gif and /dev/null differ diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.ctx b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.ctx deleted file mode 100644 index 09175a9012a..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.ctx +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.di b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.di deleted file mode 100644 index d2eb61d4a99..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.di +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.notation b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.notation deleted file mode 100644 index add35f587e1..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.notation +++ /dev/null @@ -1,120 +0,0 @@ - - - - -
-
-
-
-
- - - - - - - - - -
- - - - - - - - -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.uml b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.uml deleted file mode 100644 index 4e4f00f3fe5..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.uml +++ /dev/null @@ -1,370 +0,0 @@ - - - - - -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
- - - - - - - - - - -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/MyPalette.palette b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/MyPalette.palette deleted file mode 100644 index 16715342f71..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/MyPalette.palette +++ /dev/null @@ -1 +0,0 @@ -Electrical \ No newline at end of file diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/Test.extendedtypes b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/Test.extendedtypes deleted file mode 100644 index bee034e62cf..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/Test.extendedtypes +++ /dev/null @@ -1,122 +0,0 @@ - - - - - org.eclipse.papyrus.uml.Component - - - - - - - org.eclipse.papyrus.uml.Package - - - - org.eclipse.papyrus.uml.Class - - - - - - - - - - org.eclipse.papyrus.uml.Class - - - ExtendedTypesTestsProfile - - - - - org.eclipse.papyrus.uml.Class - - - ExtendedTypesTestsProfile - - - - - org.eclipse.papyrus.uml.Class - - - ExtendedTypesTestsProfile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.eclipse.papyrus.infra.extendedtypes.tests.aspectabstractclass - - - ExtendedTypesTestsProfile - - - - - - - - - - - - - - - - - - - - - - - - - - - org.eclipse.papyrus.infra.extendedtypes.tests.classSimpleStereotypeRename - - - - - - - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/Test1.extendedtypes b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/Test1.extendedtypes deleted file mode 100644 index 9eca2d787d3..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/Test1.extendedtypes +++ /dev/null @@ -1,15 +0,0 @@ - - - - - org.eclipse.papyrus.uml.Class - - - - org.eclipse.papyrus.uml.Class - - - - org.eclipse.papyrus.uml.Class - - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/TestMenu.xmi b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/TestMenu.xmi deleted file mode 100644 index e48d7c47063..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/TestMenu.xmi +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.di b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.di deleted file mode 100644 index 6392b22281d..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.di +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.notation b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.notation deleted file mode 100644 index 3c226f86ef6..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.notation +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -
- - - - - -
- - - - - - - - -
- - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - -
- - - - - - - - -
- - - - - - - - -
- - - - - - - - - - - - - - - - - - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.uml b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.uml deleted file mode 100644 index 254c4db1865..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/model.uml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - demo - - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ui/SingleStereotypeWithFeaturesToSet.xwt b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ui/SingleStereotypeWithFeaturesToSet.xwt deleted file mode 100644 index 207c40fbd34..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/model/ui/SingleStereotypeWithFeaturesToSet.xwt +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/org.eclipse.papyrus.infra.extendedtypes.tests.launch b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/org.eclipse.papyrus.infra.extendedtypes.tests.launch deleted file mode 100644 index 869cd7daab0..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/org.eclipse.papyrus.infra.extendedtypes.tests.launch +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/plugin.properties b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/plugin.properties deleted file mode 100644 index 374016923b4..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/plugin.properties +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################### -# Copyright (c) 2010 CEA LIST. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# CEA LIST - initial API and implementation -############################################################################### -fragmentName=Papyrus enhanced types metamodel plugin tests (Incubation) -providerName=Eclipse Modeling Project diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/plugin.xml b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/plugin.xml deleted file mode 100644 index d818bfb1c3a..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/plugin.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/Activator.java b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/Activator.java deleted file mode 100644 index 6c7df711a20..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/Activator.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.eclipse.papyrus.infra.extendedtypes.tests; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.extendedtypes.tests"; //$NON-NLS-1$ - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - -} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/AllTests.java deleted file mode 100644 index d29666206a8..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/AllTests.java +++ /dev/null @@ -1,26 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.extendedtypes.tests; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - - -/** - * All tests for this fragment - */ -@RunWith(Suite.class) -@SuiteClasses({ ExtendedTypesRegistryTests.class, }) -public class AllTests { - -} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedEditHelperAdviceTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedEditHelperAdviceTests.java deleted file mode 100644 index 382c670411e..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedEditHelperAdviceTests.java +++ /dev/null @@ -1,200 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.extendedtypes.tests; - - - -/** - * Test class for extended edit helper advice - */ -public class ExtendedEditHelperAdviceTests implements ITestConstants { - -// /** test class1 element type */ -// private static IElementType class1ElementType; -// -// /** test class in package element type */ -// private static IElementType classInPackageElementType; -// -// /** test class in model element type */ -// private static IElementType classInModelElementType; -// -// /** class1 configuration element type */ -// private static ExtendedElementTypeConfiguration class1ElementTypeConfiguration; -// -// /** class in package configuration element type */ -// private static ExtendedElementTypeConfiguration classInPackageElementTypeConfiguration; -// -// /** class in model configuration element type */ -// private static ExtendedElementTypeConfiguration classInModelElementTypeConfiguration; -// -// /** extended edit helper advice for class1 */ -// private static ExtendedEditHelperAdvice extendedClass1EditHelperAdvice; -// -// /** extended edit helper advice for class in package */ -// private static ExtendedEditHelperAdvice extendedClassInPackageEditHelperAdvice; -// -// /** extended edit helper advice for class in model */ -// private static ExtendedEditHelperAdvice extendedClassInModelEditHelperAdvice; -// -// /** package with short name */ -// private static org.eclipse.uml2.uml.Package shortNamePackage; -// -// /** package with long name */ -// private static org.eclipse.uml2.uml.Package longNamePackage; -// -// /** model with short Name */ -// private static Package shortNameModel; -// -// /** model with long name */ -// private static Package longNameModel; -// -// /** -// * @throws java.lang.Exception -// */ -// @BeforeClass -// public static void setUpBeforeClass() throws Exception { -// // create the configuration passes as argument -// class1ElementType = ExtendedTypesRegistry.getInstance().getType(CLASS1_TEST_TYPE_ID); -// assertNotNull("Class1 element type should not be null", class1ElementType); -// classInPackageElementType = ExtendedTypesRegistry.getInstance().getType(CLASS_IN_PACKAGE_TEST_TYPE_ID); -// assertNotNull("Class in package element type should not be null", classInPackageElementType); -// classInModelElementType = ExtendedTypesRegistry.getInstance().getType(CLASS_IN_MODEL_TEST_TYPE_ID); -// assertNotNull("Class in model element type should not be null", classInModelElementType); -// -// ExtendedElementTypeSet set = ExtendedTypesRegistry.getInstance().getExtendedElementTypeSet(TEST1_CONFIGURATION_SET_ID, TEST1_MODEL_PATH, org.eclipse.papyrus.infra.extendedtypes.tests.Activator.PLUGIN_ID); -// assertNotNull("extended type set should not be null", set); -// for(ExtendedElementTypeConfiguration configuration : set.getElementType()) { -// if(CLASS1_TEST_TYPE_CONFIGURATION_ID.equals(configuration.getId())) { -// class1ElementTypeConfiguration = configuration; -// } else if(CLASS_IN_PACKAGE_TEST_TYPE_CONFIGURATION_ID.equals(configuration.getId())) { -// classInPackageElementTypeConfiguration = configuration; -// } else if(CLASS_IN_MODEL_TEST_TYPE_CONFIGURATION_ID.equals(configuration.getId())) { -// classInModelElementTypeConfiguration = configuration; -// } -// } -// assertNotNull("extended type configuration should not be null", class1ElementTypeConfiguration); -// assertNotNull("extended type configuration should not be null", classInPackageElementTypeConfiguration); -// assertNotNull("extended type configuration should not be null", classInModelElementTypeConfiguration); -// extendedClass1EditHelperAdvice = new ExtendedEditHelperAdvice(); -// extendedClassInPackageEditHelperAdvice = new ExtendedEditHelperAdvice(); -// extendedClassInModelEditHelperAdvice = new ExtendedEditHelperAdvice(); -// -// // create Test Model -// Model model1 = UMLFactory.eINSTANCE.createModel(); -// model1.setName("Model1"); -// shortNamePackage = model1.createNestedPackage("P"); -// longNamePackage = model1.createNestedPackage("veryLongPackage"); -// shortNameModel = model1.createNestedPackage("tinyM", UMLPackage.eINSTANCE.getModel()); -// longNameModel = model1.createNestedPackage("veryLongModel", UMLPackage.eINSTANCE.getModel()); -// -// } -// -// /** -// * @throws java.lang.Exception -// */ -// @AfterClass -// public static void tearDownAfterClass() throws Exception { -// class1ElementType = null; -// class1ElementTypeConfiguration = null; -// extendedClass1EditHelperAdvice = null; -// shortNamePackage = null; -// longNamePackage = null; -// shortNameModel = null; -// longNameModel = null; -// } -// -// /** -// * @throws java.lang.Exception -// */ -// @Before -// public void setUp() throws Exception { -// } -// -// /** -// * @throws java.lang.Exception -// */ -// @After -// public void tearDown() throws Exception { -// } -// -// /** -// * Test method for -// * {@link org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedEditHelperAdvice#ExtendedEditHelperAdvice(org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedElementTypeConfiguration)} -// * . -// */ -// @Test -// public final void testExtendedEditHelperAdvice() { -// assertNotNull("edit helper advice should not be null", extendedClass1EditHelperAdvice); -// } -// -// /** -// * Test method for -// * {@link org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedEditHelperAdvice#approveRequest(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest)} -// * . -// */ -// @Test -// public final void testApproveRequestIEditCommandRequest() { -// // get the request: create a class on the test packages -// -// // simple test: test if it the name of the container is long or not enough -// CreateElementRequest inShortPackageCreateRequest = new CreateElementRequest(shortNamePackage, class1ElementType); -// boolean resultShort = extendedClass1EditHelperAdvice.approveRequest(inShortPackageCreateRequest); -// assertTrue("request should always be approved", resultShort); -// -// // simple test: test if it the name of the container is long or not enough -// CreateElementRequest inLongPackageCreateRequest = new CreateElementRequest(longNamePackage, class1ElementType); -// boolean resultLong = extendedClass1EditHelperAdvice.approveRequest(inLongPackageCreateRequest); -// assertTrue("request should always be approved", resultLong); -// -// // advanced tests: 2 queries at the same time (test true&false; false&false, false&true, true&true) -// // false & false -// CreateElementRequest requestShortPackageModel = new CreateElementRequest(shortNamePackage, classInModelElementType); -// boolean shortPackageModel = extendedClassInModelEditHelperAdvice.approveRequest(requestShortPackageModel); -// assertTrue("request should always be approved", shortPackageModel); -// -// // true & false -// CreateElementRequest requestLongPackageModel = new CreateElementRequest(longNamePackage, classInModelElementType); -// boolean longPackageModel = extendedClassInModelEditHelperAdvice.approveRequest(requestLongPackageModel); -// assertTrue("request should always be approved", longPackageModel); -// -// // false & true -// CreateElementRequest requestShortPackagePackage = new CreateElementRequest(shortNamePackage, classInPackageElementType); -// boolean shortPackagePackage = extendedClassInPackageEditHelperAdvice.approveRequest(requestShortPackagePackage); -// assertTrue("request should always be approved", shortPackagePackage); -// -// // true & true -// CreateElementRequest requestlongPackagePackage = new CreateElementRequest(longNamePackage, classInPackageElementType); -// boolean longPackagePackage = extendedClassInPackageEditHelperAdvice.approveRequest(requestlongPackagePackage); -// assertTrue("request should always be approved", longPackagePackage); -// } -// -// /** -// * Test method for -// * {@link org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedEditHelperAdvice#getBeforeCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest)} -// * . -// */ -// @Test -// public final void testGetBeforeCreateCommandCreateElementRequest() { -// // not test here for now... -// } -// -// /** -// * Test method for -// * {@link org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedEditHelperAdvice#getAfterCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest)} -// * . -// */ -// @Test -// public final void testGetAfterCreateCommandCreateElementRequest() { -// // test in {oep}.diagram.extendedtypes.uml.tests fragment -// } - -} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedTypesRegistryTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedTypesRegistryTests.java deleted file mode 100644 index 8e9d00df06c..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedTypesRegistryTests.java +++ /dev/null @@ -1,225 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.extendedtypes.tests; - -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.IOException; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; -import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.resource.ModelUtils; -import org.eclipse.papyrus.infra.core.resource.NotFoundException; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.extendedtypes.ExtendedElementTypeSetRegistry; -import org.eclipse.papyrus.infra.extendedtypes.ExtendedTypeRegistryService; -import org.eclipse.papyrus.junit.utils.EditorUtils; -import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils; -import org.eclipse.papyrus.junit.utils.ProjectUtils; -import org.eclipse.papyrus.uml.tools.model.UmlModel; -import org.eclipse.papyrus.uml.tools.model.UmlUtils; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PartInitException; -import org.eclipse.uml2.uml.Activity; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Model; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; - - -/** - * Tests for {@link ExtendedTypesRegistry} - */ -public class ExtendedTypesRegistryTests implements ITestConstants { - - private static IProject createProject; - - private static IFile copyPapyrusModel; - - private static IMultiDiagramEditor openPapyrusEditor; - - private static ModelSet modelset; - - private static UmlModel umlIModel; - - private static Model rootModel; - - private static Activity testActivity; - - private static TransactionalEditingDomain transactionalEditingDomain; - - private static Class testClass; - - private static Activity testActivityWithNode; - - /** - * Init test class - */ - @BeforeClass - public static void initCreateElementTest() { - - // create Project - try { - createProject = ProjectUtils.createProject("ExtendedTypes"); - } catch (CoreException e) { - fail(e.getMessage()); - } - - // import test model - try { - copyPapyrusModel = PapyrusProjectUtils.copyPapyrusModel(createProject, Platform.getBundle("org.eclipse.papyrus.infra.extendedtypes.tests"), "/model/", "model"); - } catch (CoreException e) { - fail(e.getMessage()); - } catch (IOException e) { - fail(e.getMessage()); - } - - // open project - Display.getDefault().syncExec(new Runnable() { - - public void run() { - try { - openPapyrusEditor = EditorUtils.openPapyrusEditor(copyPapyrusModel); - } catch (PartInitException e) { - fail(e.getMessage()); - } - } - }); - - transactionalEditingDomain = (TransactionalEditingDomain)openPapyrusEditor.getAdapter(TransactionalEditingDomain.class); - assertTrue("Impossible to init editing domain", transactionalEditingDomain instanceof TransactionalEditingDomain); - - // retrieve UML model from this editor - try { - modelset = ModelUtils.getModelSetChecked(openPapyrusEditor.getServicesRegistry()); - umlIModel = UmlUtils.getUmlModel(modelset); - rootModel = (Model)umlIModel.lookupRoot(); - - Assert.assertNotNull("root model should not be null", rootModel); - - } catch (ServiceException e) { - fail(e.getMessage()); - } catch (NotFoundException e) { - fail(e.getMessage()); - } catch (ClassCastException e) { - fail(e.getMessage()); - } - try { - initExistingElements(); - } catch (Exception e) { - fail(e.getMessage()); - } - - } - - /** - * Init fields corresponding to element in the test model - */ - private static void initExistingElements() throws Exception { - - - } - - /** - * @throws java.lang.Exception - */ - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - /** - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - } - - /** - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - } - - /** - * Test method for {@link ExtendedElementTypeSetRegistry#getInstance()} - */ - @Test - @Ignore - public final void testGetInstance() { - ExtendedTypeRegistryService service = null; - try { - service = openPapyrusEditor.getServicesRegistry().getService(ExtendedTypeRegistryService.class); - } catch (ServiceException e) { - fail(e.getMessage()); - } - Assert.assertNotNull("Extended type service should not be null", service); - - // retrieve registry from this service - Assert.assertNotNull("Extended type registry singleton should not be null", service.getExtendedElementTypeSetRegistry()); - } - - - /** - * Test method for {@link org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedTypesRegistry#createResourceSet()}. - */ - @Test - @Ignore - public final void testGetTypeRegisteredInplugin() { - // check standard class - IElementType classType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.Class"); - Assert.assertNotNull("Element type should be registered", classType); - - IElementType restrictedClassType = ElementTypeRegistry.getInstance().getType(CLASS_ONLY_IN_MODEL_ID); - Assert.assertNotNull("Element type should be registered", restrictedClassType); - } - -// /** -// * Test method for {@link org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedTypesRegistry#getExtendedElementTypeSet(java.lang.String, java.lang.String)}. -// */ -// @Test -// public final void testGetExtendedElementTypeSet() { -// ExtendedElementTypeSet set = ExtendedTypesRegistry.getInstance().getExtendedElementTypeSet(TEST1_CONFIGURATION_SET_ID, TEST1_MODEL_PATH, Activator.PLUGIN_ID); -// assertNotNull("Element type model file set should be found", set); -// -// ExtendedElementTypeSet set2 = ExtendedTypesRegistry.getInstance().getExtendedElementTypeSet("null", NO_FILE, Activator.PLUGIN_ID); -// assertNull("Element type model file set should not be found", set2); -// } -// -// /** -// * Test method for {@link org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedTypesRegistry#getType(java.lang.String)}. -// */ -// @Test -// public final void testGetType() { -// IElementType classType = ExtendedTypesRegistry.getInstance().getType(UMLElementTypes.CLASS.getId()); -// assertNotNull("element Type for class should be found", classType); -// -// IElementType extendedClassType = ExtendedTypesRegistry.getInstance().getType(CLASS1_TEST_TYPE_ID); -// assertNotNull("element Type for class should be found", extendedClassType); -// -// IElementType noType = ExtendedTypesRegistry.getInstance().getType(NO_TYPE); -// assertNull("element Type for class should not be found", noType); -// } -} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ITestConstants.java b/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ITestConstants.java deleted file mode 100644 index fbdc4c829ab..00000000000 --- a/tests/junit/plugins/core/org.eclipse.papyrus.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ITestConstants.java +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.infra.extendedtypes.tests; - - -/** - * Constants for test classes - */ -public interface ITestConstants { - - public final static String CLASS_ONLY_IN_MODEL_ID = "org.eclipse.papyrus.infra.extendedtypes.tests.classonlyinmodel"; //$NON-NLS-1$ - /** name of the extended type set in Test1 */ - public final static String ExtendedTypeSetName_Test1 = "org.eclipse.papyrus.infra.extendedtypes.tests.tests.test1"; - - -} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/.classpath b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/.classpath new file mode 100644 index 00000000000..2d1a4302f04 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/.project b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/.project new file mode 100644 index 00000000000..4887ac9519b --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/.project @@ -0,0 +1,28 @@ + + + org.eclipse.papyrus.infra.extendedtypes.tests + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..25668b8f4f0 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Oct 29 11:46:50 CEST 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..e56fafcb15a --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/META-INF/MANIFEST.MF @@ -0,0 +1,27 @@ +Manifest-Version: 1.0 +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.papyrus.uml.service.types;bundle-version="1.0.0", + org.junit;bundle-version="4.10.0", + org.eclipse.papyrus.junit.utils;bundle-version="1.0.0", + org.eclipse.papyrus.uml.tools;bundle-version="1.0.0", + org.eclipse.papyrus.infra.newchild;bundle-version="1.0.0", + org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.0", + org.eclipse.papyrus.infra.core;bundle-version="1.0.0", + org.eclipse.emf.transaction;bundle-version="1.4.0", + org.eclipse.gmf.runtime.emf.core;bundle-version="1.7.0", + org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.7.0", + org.eclipse.gmf.runtime.diagram.ui +Export-Package: org.eclipse.papyrus.infra.extendedtypes.tests +Bundle-Vendor: %providerName +Bundle-ActivationPolicy: lazy +Bundle-Version: 1.0.0.qualifier +Bundle-Name: %pluginName +Bundle-Localization: plugin +Bundle-ManifestVersion: 2 +Bundle-Activator: org.eclipse.papyrus.infra.extendedtypes.tests.Activa + tor +Bundle-SymbolicName: org.eclipse.papyrus.infra.extendedtypes.tests;sin + gleton:=true +Bundle-RequiredExecutionEnvironment: J2SE-1.5 + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/about.html b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/about.html new file mode 100644 index 00000000000..82d49bf5f81 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

About This Content

+ +

June 5, 2007

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ + + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/build.properties b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/build.properties new file mode 100644 index 00000000000..89abf6ef7cc --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/build.properties @@ -0,0 +1,9 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + icons/,\ + model/,\ + plugin.properties,\ + about.html diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/M.gif b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/M.gif new file mode 100644 index 00000000000..f9a5b239d6c Binary files /dev/null and b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/M.gif differ diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/O.gif b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/O.gif new file mode 100644 index 00000000000..e6ce0916227 Binary files /dev/null and b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/O.gif differ diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/Values.gif b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/Values.gif new file mode 100644 index 00000000000..f1f019535ea Binary files /dev/null and b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/Values.gif differ diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/debug.gif b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/debug.gif new file mode 100644 index 00000000000..ac5431fa311 Binary files /dev/null and b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/icons/debug.gif differ diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.ctx b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.ctx new file mode 100644 index 00000000000..09175a9012a --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.ctx @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.di b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.di new file mode 100644 index 00000000000..d2eb61d4a99 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.di @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.notation b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.notation new file mode 100644 index 00000000000..add35f587e1 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.notation @@ -0,0 +1,120 @@ + + + + +
+
+
+
+
+ + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.uml b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.uml new file mode 100644 index 00000000000..4e4f00f3fe5 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ExtendedTypesTestsProfile.profile.uml @@ -0,0 +1,370 @@ + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/MyPalette.palette b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/MyPalette.palette new file mode 100644 index 00000000000..16715342f71 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/MyPalette.palette @@ -0,0 +1 @@ +Electrical \ No newline at end of file diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/Test.extendedtypes b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/Test.extendedtypes new file mode 100644 index 00000000000..bee034e62cf --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/Test.extendedtypes @@ -0,0 +1,122 @@ + + + + + org.eclipse.papyrus.uml.Component + + + + + + + org.eclipse.papyrus.uml.Package + + + + org.eclipse.papyrus.uml.Class + + + + + + + + + + org.eclipse.papyrus.uml.Class + + + ExtendedTypesTestsProfile + + + + + org.eclipse.papyrus.uml.Class + + + ExtendedTypesTestsProfile + + + + + org.eclipse.papyrus.uml.Class + + + ExtendedTypesTestsProfile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.eclipse.papyrus.infra.extendedtypes.tests.aspectabstractclass + + + ExtendedTypesTestsProfile + + + + + + + + + + + + + + + + + + + + + + + + + + + org.eclipse.papyrus.infra.extendedtypes.tests.classSimpleStereotypeRename + + + + + + + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/Test1.extendedtypes b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/Test1.extendedtypes new file mode 100644 index 00000000000..9eca2d787d3 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/Test1.extendedtypes @@ -0,0 +1,15 @@ + + + + + org.eclipse.papyrus.uml.Class + + + + org.eclipse.papyrus.uml.Class + + + + org.eclipse.papyrus.uml.Class + + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/TestMenu.xmi b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/TestMenu.xmi new file mode 100644 index 00000000000..e48d7c47063 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/TestMenu.xmi @@ -0,0 +1,33 @@ + + + + + + + + + + + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/model.di b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/model.di new file mode 100644 index 00000000000..6392b22281d --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/model.di @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/model.notation b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/model.notation new file mode 100644 index 00000000000..3c226f86ef6 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/model.notation @@ -0,0 +1,105 @@ + + + + + + +
+ + + + + +
+ + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + +
+ + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/model.uml b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/model.uml new file mode 100644 index 00000000000..254c4db1865 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/model.uml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + demo + + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ui/SingleStereotypeWithFeaturesToSet.xwt b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ui/SingleStereotypeWithFeaturesToSet.xwt new file mode 100644 index 00000000000..207c40fbd34 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/model/ui/SingleStereotypeWithFeaturesToSet.xwt @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/org.eclipse.papyrus.infra.extendedtypes.tests.launch b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/org.eclipse.papyrus.infra.extendedtypes.tests.launch new file mode 100644 index 00000000000..869cd7daab0 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/org.eclipse.papyrus.infra.extendedtypes.tests.launch @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/plugin.properties b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/plugin.properties new file mode 100644 index 00000000000..374016923b4 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/plugin.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2010 CEA LIST. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# CEA LIST - initial API and implementation +############################################################################### +fragmentName=Papyrus enhanced types metamodel plugin tests (Incubation) +providerName=Eclipse Modeling Project diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/plugin.xml b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/plugin.xml new file mode 100644 index 00000000000..d818bfb1c3a --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/plugin.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/Activator.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/Activator.java new file mode 100644 index 00000000000..6c7df711a20 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/Activator.java @@ -0,0 +1,50 @@ +package org.eclipse.papyrus.infra.extendedtypes.tests; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.extendedtypes.tests"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/AllTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/AllTests.java new file mode 100644 index 00000000000..d29666206a8 --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/AllTests.java @@ -0,0 +1,26 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.extendedtypes.tests; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + + +/** + * All tests for this fragment + */ +@RunWith(Suite.class) +@SuiteClasses({ ExtendedTypesRegistryTests.class, }) +public class AllTests { + +} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedEditHelperAdviceTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedEditHelperAdviceTests.java new file mode 100644 index 00000000000..382c670411e --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedEditHelperAdviceTests.java @@ -0,0 +1,200 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.extendedtypes.tests; + + + +/** + * Test class for extended edit helper advice + */ +public class ExtendedEditHelperAdviceTests implements ITestConstants { + +// /** test class1 element type */ +// private static IElementType class1ElementType; +// +// /** test class in package element type */ +// private static IElementType classInPackageElementType; +// +// /** test class in model element type */ +// private static IElementType classInModelElementType; +// +// /** class1 configuration element type */ +// private static ExtendedElementTypeConfiguration class1ElementTypeConfiguration; +// +// /** class in package configuration element type */ +// private static ExtendedElementTypeConfiguration classInPackageElementTypeConfiguration; +// +// /** class in model configuration element type */ +// private static ExtendedElementTypeConfiguration classInModelElementTypeConfiguration; +// +// /** extended edit helper advice for class1 */ +// private static ExtendedEditHelperAdvice extendedClass1EditHelperAdvice; +// +// /** extended edit helper advice for class in package */ +// private static ExtendedEditHelperAdvice extendedClassInPackageEditHelperAdvice; +// +// /** extended edit helper advice for class in model */ +// private static ExtendedEditHelperAdvice extendedClassInModelEditHelperAdvice; +// +// /** package with short name */ +// private static org.eclipse.uml2.uml.Package shortNamePackage; +// +// /** package with long name */ +// private static org.eclipse.uml2.uml.Package longNamePackage; +// +// /** model with short Name */ +// private static Package shortNameModel; +// +// /** model with long name */ +// private static Package longNameModel; +// +// /** +// * @throws java.lang.Exception +// */ +// @BeforeClass +// public static void setUpBeforeClass() throws Exception { +// // create the configuration passes as argument +// class1ElementType = ExtendedTypesRegistry.getInstance().getType(CLASS1_TEST_TYPE_ID); +// assertNotNull("Class1 element type should not be null", class1ElementType); +// classInPackageElementType = ExtendedTypesRegistry.getInstance().getType(CLASS_IN_PACKAGE_TEST_TYPE_ID); +// assertNotNull("Class in package element type should not be null", classInPackageElementType); +// classInModelElementType = ExtendedTypesRegistry.getInstance().getType(CLASS_IN_MODEL_TEST_TYPE_ID); +// assertNotNull("Class in model element type should not be null", classInModelElementType); +// +// ExtendedElementTypeSet set = ExtendedTypesRegistry.getInstance().getExtendedElementTypeSet(TEST1_CONFIGURATION_SET_ID, TEST1_MODEL_PATH, org.eclipse.papyrus.infra.extendedtypes.tests.Activator.PLUGIN_ID); +// assertNotNull("extended type set should not be null", set); +// for(ExtendedElementTypeConfiguration configuration : set.getElementType()) { +// if(CLASS1_TEST_TYPE_CONFIGURATION_ID.equals(configuration.getId())) { +// class1ElementTypeConfiguration = configuration; +// } else if(CLASS_IN_PACKAGE_TEST_TYPE_CONFIGURATION_ID.equals(configuration.getId())) { +// classInPackageElementTypeConfiguration = configuration; +// } else if(CLASS_IN_MODEL_TEST_TYPE_CONFIGURATION_ID.equals(configuration.getId())) { +// classInModelElementTypeConfiguration = configuration; +// } +// } +// assertNotNull("extended type configuration should not be null", class1ElementTypeConfiguration); +// assertNotNull("extended type configuration should not be null", classInPackageElementTypeConfiguration); +// assertNotNull("extended type configuration should not be null", classInModelElementTypeConfiguration); +// extendedClass1EditHelperAdvice = new ExtendedEditHelperAdvice(); +// extendedClassInPackageEditHelperAdvice = new ExtendedEditHelperAdvice(); +// extendedClassInModelEditHelperAdvice = new ExtendedEditHelperAdvice(); +// +// // create Test Model +// Model model1 = UMLFactory.eINSTANCE.createModel(); +// model1.setName("Model1"); +// shortNamePackage = model1.createNestedPackage("P"); +// longNamePackage = model1.createNestedPackage("veryLongPackage"); +// shortNameModel = model1.createNestedPackage("tinyM", UMLPackage.eINSTANCE.getModel()); +// longNameModel = model1.createNestedPackage("veryLongModel", UMLPackage.eINSTANCE.getModel()); +// +// } +// +// /** +// * @throws java.lang.Exception +// */ +// @AfterClass +// public static void tearDownAfterClass() throws Exception { +// class1ElementType = null; +// class1ElementTypeConfiguration = null; +// extendedClass1EditHelperAdvice = null; +// shortNamePackage = null; +// longNamePackage = null; +// shortNameModel = null; +// longNameModel = null; +// } +// +// /** +// * @throws java.lang.Exception +// */ +// @Before +// public void setUp() throws Exception { +// } +// +// /** +// * @throws java.lang.Exception +// */ +// @After +// public void tearDown() throws Exception { +// } +// +// /** +// * Test method for +// * {@link org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedEditHelperAdvice#ExtendedEditHelperAdvice(org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedElementTypeConfiguration)} +// * . +// */ +// @Test +// public final void testExtendedEditHelperAdvice() { +// assertNotNull("edit helper advice should not be null", extendedClass1EditHelperAdvice); +// } +// +// /** +// * Test method for +// * {@link org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedEditHelperAdvice#approveRequest(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest)} +// * . +// */ +// @Test +// public final void testApproveRequestIEditCommandRequest() { +// // get the request: create a class on the test packages +// +// // simple test: test if it the name of the container is long or not enough +// CreateElementRequest inShortPackageCreateRequest = new CreateElementRequest(shortNamePackage, class1ElementType); +// boolean resultShort = extendedClass1EditHelperAdvice.approveRequest(inShortPackageCreateRequest); +// assertTrue("request should always be approved", resultShort); +// +// // simple test: test if it the name of the container is long or not enough +// CreateElementRequest inLongPackageCreateRequest = new CreateElementRequest(longNamePackage, class1ElementType); +// boolean resultLong = extendedClass1EditHelperAdvice.approveRequest(inLongPackageCreateRequest); +// assertTrue("request should always be approved", resultLong); +// +// // advanced tests: 2 queries at the same time (test true&false; false&false, false&true, true&true) +// // false & false +// CreateElementRequest requestShortPackageModel = new CreateElementRequest(shortNamePackage, classInModelElementType); +// boolean shortPackageModel = extendedClassInModelEditHelperAdvice.approveRequest(requestShortPackageModel); +// assertTrue("request should always be approved", shortPackageModel); +// +// // true & false +// CreateElementRequest requestLongPackageModel = new CreateElementRequest(longNamePackage, classInModelElementType); +// boolean longPackageModel = extendedClassInModelEditHelperAdvice.approveRequest(requestLongPackageModel); +// assertTrue("request should always be approved", longPackageModel); +// +// // false & true +// CreateElementRequest requestShortPackagePackage = new CreateElementRequest(shortNamePackage, classInPackageElementType); +// boolean shortPackagePackage = extendedClassInPackageEditHelperAdvice.approveRequest(requestShortPackagePackage); +// assertTrue("request should always be approved", shortPackagePackage); +// +// // true & true +// CreateElementRequest requestlongPackagePackage = new CreateElementRequest(longNamePackage, classInPackageElementType); +// boolean longPackagePackage = extendedClassInPackageEditHelperAdvice.approveRequest(requestlongPackagePackage); +// assertTrue("request should always be approved", longPackagePackage); +// } +// +// /** +// * Test method for +// * {@link org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedEditHelperAdvice#getBeforeCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest)} +// * . +// */ +// @Test +// public final void testGetBeforeCreateCommandCreateElementRequest() { +// // not test here for now... +// } +// +// /** +// * Test method for +// * {@link org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedEditHelperAdvice#getAfterCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest)} +// * . +// */ +// @Test +// public final void testGetAfterCreateCommandCreateElementRequest() { +// // test in {oep}.diagram.extendedtypes.uml.tests fragment +// } + +} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedTypesRegistryTests.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedTypesRegistryTests.java new file mode 100644 index 00000000000..8e9d00df06c --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ExtendedTypesRegistryTests.java @@ -0,0 +1,225 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.extendedtypes.tests; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.IOException; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.resource.ModelUtils; +import org.eclipse.papyrus.infra.core.resource.NotFoundException; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.extendedtypes.ExtendedElementTypeSetRegistry; +import org.eclipse.papyrus.infra.extendedtypes.ExtendedTypeRegistryService; +import org.eclipse.papyrus.junit.utils.EditorUtils; +import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils; +import org.eclipse.papyrus.junit.utils.ProjectUtils; +import org.eclipse.papyrus.uml.tools.model.UmlModel; +import org.eclipse.papyrus.uml.tools.model.UmlUtils; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PartInitException; +import org.eclipse.uml2.uml.Activity; +import org.eclipse.uml2.uml.Class; +import org.eclipse.uml2.uml.Model; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Tests for {@link ExtendedTypesRegistry} + */ +public class ExtendedTypesRegistryTests implements ITestConstants { + + private static IProject createProject; + + private static IFile copyPapyrusModel; + + private static IMultiDiagramEditor openPapyrusEditor; + + private static ModelSet modelset; + + private static UmlModel umlIModel; + + private static Model rootModel; + + private static Activity testActivity; + + private static TransactionalEditingDomain transactionalEditingDomain; + + private static Class testClass; + + private static Activity testActivityWithNode; + + /** + * Init test class + */ + @BeforeClass + public static void initCreateElementTest() { + + // create Project + try { + createProject = ProjectUtils.createProject("ExtendedTypes"); + } catch (CoreException e) { + fail(e.getMessage()); + } + + // import test model + try { + copyPapyrusModel = PapyrusProjectUtils.copyPapyrusModel(createProject, Platform.getBundle("org.eclipse.papyrus.infra.extendedtypes.tests"), "/model/", "model"); + } catch (CoreException e) { + fail(e.getMessage()); + } catch (IOException e) { + fail(e.getMessage()); + } + + // open project + Display.getDefault().syncExec(new Runnable() { + + public void run() { + try { + openPapyrusEditor = EditorUtils.openPapyrusEditor(copyPapyrusModel); + } catch (PartInitException e) { + fail(e.getMessage()); + } + } + }); + + transactionalEditingDomain = (TransactionalEditingDomain)openPapyrusEditor.getAdapter(TransactionalEditingDomain.class); + assertTrue("Impossible to init editing domain", transactionalEditingDomain instanceof TransactionalEditingDomain); + + // retrieve UML model from this editor + try { + modelset = ModelUtils.getModelSetChecked(openPapyrusEditor.getServicesRegistry()); + umlIModel = UmlUtils.getUmlModel(modelset); + rootModel = (Model)umlIModel.lookupRoot(); + + Assert.assertNotNull("root model should not be null", rootModel); + + } catch (ServiceException e) { + fail(e.getMessage()); + } catch (NotFoundException e) { + fail(e.getMessage()); + } catch (ClassCastException e) { + fail(e.getMessage()); + } + try { + initExistingElements(); + } catch (Exception e) { + fail(e.getMessage()); + } + + } + + /** + * Init fields corresponding to element in the test model + */ + private static void initExistingElements() throws Exception { + + + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + } + + /** + * Test method for {@link ExtendedElementTypeSetRegistry#getInstance()} + */ + @Test + @Ignore + public final void testGetInstance() { + ExtendedTypeRegistryService service = null; + try { + service = openPapyrusEditor.getServicesRegistry().getService(ExtendedTypeRegistryService.class); + } catch (ServiceException e) { + fail(e.getMessage()); + } + Assert.assertNotNull("Extended type service should not be null", service); + + // retrieve registry from this service + Assert.assertNotNull("Extended type registry singleton should not be null", service.getExtendedElementTypeSetRegistry()); + } + + + /** + * Test method for {@link org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedTypesRegistry#createResourceSet()}. + */ + @Test + @Ignore + public final void testGetTypeRegisteredInplugin() { + // check standard class + IElementType classType = ElementTypeRegistry.getInstance().getType("org.eclipse.papyrus.uml.Class"); + Assert.assertNotNull("Element type should be registered", classType); + + IElementType restrictedClassType = ElementTypeRegistry.getInstance().getType(CLASS_ONLY_IN_MODEL_ID); + Assert.assertNotNull("Element type should be registered", restrictedClassType); + } + +// /** +// * Test method for {@link org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedTypesRegistry#getExtendedElementTypeSet(java.lang.String, java.lang.String)}. +// */ +// @Test +// public final void testGetExtendedElementTypeSet() { +// ExtendedElementTypeSet set = ExtendedTypesRegistry.getInstance().getExtendedElementTypeSet(TEST1_CONFIGURATION_SET_ID, TEST1_MODEL_PATH, Activator.PLUGIN_ID); +// assertNotNull("Element type model file set should be found", set); +// +// ExtendedElementTypeSet set2 = ExtendedTypesRegistry.getInstance().getExtendedElementTypeSet("null", NO_FILE, Activator.PLUGIN_ID); +// assertNull("Element type model file set should not be found", set2); +// } +// +// /** +// * Test method for {@link org.eclipse.papyrus.infra.extendedtypes.tests.ExtendedTypesRegistry#getType(java.lang.String)}. +// */ +// @Test +// public final void testGetType() { +// IElementType classType = ExtendedTypesRegistry.getInstance().getType(UMLElementTypes.CLASS.getId()); +// assertNotNull("element Type for class should be found", classType); +// +// IElementType extendedClassType = ExtendedTypesRegistry.getInstance().getType(CLASS1_TEST_TYPE_ID); +// assertNotNull("element Type for class should be found", extendedClassType); +// +// IElementType noType = ExtendedTypesRegistry.getInstance().getType(NO_TYPE); +// assertNull("element Type for class should not be found", noType); +// } +} diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ITestConstants.java b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ITestConstants.java new file mode 100644 index 00000000000..fbdc4c829ab --- /dev/null +++ b/tests/junit/plugins/core/org.eclipse.papyrus.infra.extendedtypes.tests/src/org/eclipse/papyrus/infra/extendedtypes/tests/ITestConstants.java @@ -0,0 +1,25 @@ +/***************************************************************************** + * Copyright (c) 2010 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.extendedtypes.tests; + + +/** + * Constants for test classes + */ +public interface ITestConstants { + + public final static String CLASS_ONLY_IN_MODEL_ID = "org.eclipse.papyrus.infra.extendedtypes.tests.classonlyinmodel"; //$NON-NLS-1$ + /** name of the extended type set in Test1 */ + public final static String ExtendedTypeSetName_Test1 = "org.eclipse.papyrus.infra.extendedtypes.tests.tests.test1"; + + +} -- cgit v1.2.3 From 8ba568efcf0e0e0d4bf0e2364268ca4d915dcab9 Mon Sep 17 00:00:00 2001 From: Camille Letavernier Date: Tue, 18 Feb 2014 14:24:23 +0100 Subject: Bug 425190 - [CSS] Loss of Notation information when CSS style is applied on Edges. https://bugs.eclipse.org/bugs/show_bug.cgi?id=425190 - Do not reset styles which are not supported by the CSS Engine (Including the EObjectValueStyle used for SysML association ends)--- .../infra/gmfdiag/css/command/ResetStyleCommand.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/command/ResetStyleCommand.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/command/ResetStyleCommand.java index 25cec4c4d63..726386e16b2 100644 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/command/ResetStyleCommand.java +++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/command/ResetStyleCommand.java @@ -102,8 +102,21 @@ public class ResetStyleCommand extends RecordingCommand { Object styleObject = styleIterator.next(); if(styleObject instanceof NamedStyle) { NamedStyle customStyle = (NamedStyle)styleObject; + if(!CSSStyles.RESERVED_KEYWORDS.contains(customStyle.getName())) { - styleIterator.remove(); + + //Remove only NamedStyle which are supported by the CSS Implementation + //See org.eclipse.papyrus.infra.gmfdiag.css.style.impl.CSSViewDelegate.getCSSNamedStyle(EClass, String) + //See Bug 425190 - [CSS] Loss of Notation information when CSS style is applied on Edges. + switch(customStyle.eClass().getClassifierID()) { + case NotationPackage.STRING_VALUE_STYLE: + case NotationPackage.BOOLEAN_VALUE_STYLE: + case NotationPackage.INT_VALUE_STYLE: + case NotationPackage.DOUBLE_VALUE_STYLE: + case NotationPackage.STRING_LIST_VALUE_STYLE: + styleIterator.remove(); + } + } } else if(styleObject instanceof Style) { resetStyle((Style)styleObject); -- cgit v1.2.3