Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/strategy/paste/PartPasteStrategy.java6
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java405
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/META-INF/MANIFEST.MF47
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/model/Bug435197.di47
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/model/Bug435197.notation5
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/model/Bug435197.uml75
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/Activator.java71
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/common/AbstractModelExplorerTest.java2
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/copypaste/CopyPasteInModelExplorer.java116
-rw-r--r--tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/suites/AllCopyPasteTests.java3
10 files changed, 553 insertions, 224 deletions
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/strategy/paste/PartPasteStrategy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/strategy/paste/PartPasteStrategy.java
index ccc8fbaa5ed..d58723a50da 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/strategy/paste/PartPasteStrategy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/strategy/paste/PartPasteStrategy.java
@@ -170,8 +170,10 @@ public class PartPasteStrategy implements IPasteStrategy {
PartBlockAdditionalData partBlockAdditionalData = (PartBlockAdditionalData)additionnalData;
for(Property property : allAttributes) {
Association duplicatedAssociation = partBlockAdditionalData.getDuplicatedAssociationByPropertyName(property.getName());
- restoreAssociationPartContext(classifier, property, duplicatedAssociation);
- listDuplicatedAssociation.add(duplicatedAssociation);
+ if (duplicatedAssociation != null){
+ restoreAssociationPartContext(classifier, property, duplicatedAssociation);
+ listDuplicatedAssociation.add(duplicatedAssociation);
+ }
}
associationContainer = targetOwner;
}
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java
index e3167a69834..9d2fd2a9f19 100644
--- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/tests/AbstractEditorTest.java
@@ -1,203 +1,202 @@
-/*****************************************************************************
- * 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.junit.utils.tests;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel;
-import org.eclipse.papyrus.infra.core.resource.IModel;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.junit.utils.Activator;
-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.views.modelexplorer.ModelExplorerPage;
-import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
-import org.eclipse.papyrus.views.modelexplorer.ModelExplorerView;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.IPage;
-import org.junit.After;
-import org.junit.Assert;
-import org.osgi.framework.Bundle;
-
-
-public abstract class AbstractEditorTest extends AbstractPapyrusTest {
- /** the id of the model explorer */
- public static final String MODELEXPLORER_VIEW_ID = "org.eclipse.papyrus.views.modelexplorer.modelexplorer"; //$NON-NLS-1$
-
-
- protected IMultiDiagramEditor editor;
-
- protected IProject project;
-
-
- protected ModelExplorerView modelExplorerView;
-
- /**
- *
- * @return
- * the current bundle
- */
- protected Bundle getBundle() {
- return Activator.getDefault().getBundle();
- }
-
- /**
- * Inits this.editor
- * Fails or throws an exception if an error occurs
- *
- * @param bundle the source bundle where the model is store
- * @param projectName the project that will created at runtime to execute test
- * @param modelName the model that will be copied and test executed on.
- */
- protected void initModel(String projectName, String modelName, Bundle bundle) throws Exception {
- project = ProjectUtils.createProject(projectName);
- final IFile diModelFile = PapyrusProjectUtils.copyPapyrusModel(project, bundle, getSourcePath(), modelName);
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- try {
- editor = EditorUtils.openPapyrusEditor(diModelFile);
- } catch (Exception ex) {
- Activator.log.error(ex);
- Assert.fail(ex.getMessage());
- }
- }
- });
-
- Assert.assertNotNull(editor);
- }
-
- @After
- public void dispose() throws Exception {
- if(editor != null) {
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- ((IEditorPart)editor).getSite().getPage().closeEditor(editor, false);
- }
- });
-
- editor = null;
- }
-
- if(project != null) {
- project.delete(true, new NullProgressMonitor());
- project = null;
- }
- }
-
-
- public ModelExplorerView getModelExplorerView(){
-
- Display.getDefault().syncExec( new Runnable() {
-
- public void run() {
- IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-
- // we look for the modelexplorer
- IViewPart modelexplorer;
- try {
- modelexplorer = activeWorkbenchWindow.getActivePage().showView(MODELEXPLORER_VIEW_ID);
- } catch (PartInitException ex) {
- ex.printStackTrace(System.out);
- return;
- }
- ModelExplorerPageBookView view = (ModelExplorerPageBookView)modelexplorer;
- IPage currentPage = view.getCurrentPage();
- ModelExplorerPage page = (ModelExplorerPage)currentPage;
- IViewPart viewer = page.getViewer();
- modelExplorerView = (ModelExplorerView)viewer;
-
- }
- });
- return modelExplorerView;
- }
-
- /**
- *
- * @return the current UML model
- */
- protected org.eclipse.uml2.uml.Package getRootUMLModel(){
-
- IModel umlIModel;
- try {
- umlIModel = getModelSet().getModel("org.eclipse.papyrus.infra.core.resource.uml.UmlModel");
-
- AbstractBaseModel umlModel = null;
- if(umlIModel instanceof AbstractBaseModel) {
- umlModel = (AbstractBaseModel)umlIModel;
- }
-
-
- Assert.assertFalse("umlRessource contains nothing", umlModel.getResource().getContents().size()>1);
- Object root =umlModel.getResource().getContents().get(0);
- Assert.assertFalse("the root of UML model is not a package", root instanceof Package);
-
- return (org.eclipse.uml2.uml.Package)root;
- } catch (ServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return null;
-
- }
- protected IPageManager getPageManager() throws ServiceException {
- return getServicesRegistry().getService(IPageManager.class);
- }
-
- protected ServicesRegistry getServicesRegistry() throws ServiceException {
- return editor.getServicesRegistry();
- }
-
- protected TransactionalEditingDomain getTransactionalEditingDomain() throws ServiceException {
- return getServicesRegistry().getService(TransactionalEditingDomain.class);
- }
-
- protected ModelSet getModelSet() throws ServiceException {
- return getServicesRegistry().getService(ModelSet.class);
- }
-
- /**
- * The path to the source model folder
- *
- * @return
- */
- protected abstract String getSourcePath();
-
- protected void flushDisplayEvents() {
- for(;;) {
- try {
- if(!Display.getCurrent().readAndDispatch()) {
- break;
- }
- } catch (Exception e) {
- Bundle testBundle = getBundle();
- Platform.getLog(testBundle).log(new Status(IStatus.ERROR, testBundle.getSymbolicName(), "Uncaught exception in display runnable.", e));
- }
- }
- }
-}
+/*****************************************************************************
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.junit.utils.tests;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel;
+import org.eclipse.papyrus.infra.core.resource.IModel;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.junit.utils.Activator;
+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.views.modelexplorer.ModelExplorerPage;
+import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
+import org.eclipse.papyrus.views.modelexplorer.ModelExplorerView;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.IPage;
+import org.junit.After;
+import org.junit.Assert;
+import org.osgi.framework.Bundle;
+
+
+public abstract class AbstractEditorTest extends AbstractPapyrusTest {
+ /** the id of the model explorer */
+ public static final String MODELEXPLORER_VIEW_ID = "org.eclipse.papyrus.views.modelexplorer.modelexplorer"; //$NON-NLS-1$
+
+
+ protected IMultiDiagramEditor editor;
+
+ protected IProject project;
+
+
+ protected ModelExplorerView modelExplorerView;
+
+ /**
+ *
+ * @return
+ * the current bundle
+ */
+ protected Bundle getBundle() {
+ return Activator.getDefault().getBundle();
+ }
+
+ /**
+ * Inits this.editor
+ * Fails or throws an exception if an error occurs
+ *
+ * @param bundle the source bundle where the model is store
+ * @param projectName the project that will created at runtime to execute test
+ * @param modelName the model that will be copied and test executed on.
+ */
+ protected void initModel(String projectName, String modelName, Bundle bundle) throws Exception {
+ project = ProjectUtils.createProject(projectName);
+ final IFile diModelFile = PapyrusProjectUtils.copyPapyrusModel(project, bundle, getSourcePath(), modelName);
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ try {
+ editor = EditorUtils.openPapyrusEditor(diModelFile);
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ Assert.fail(ex.getMessage());
+ }
+ }
+ });
+
+ Assert.assertNotNull(editor);
+ }
+
+ @After
+ public void dispose() throws Exception {
+ if(editor != null) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ ((IEditorPart)editor).getSite().getPage().closeEditor(editor, false);
+ }
+ });
+
+ editor = null;
+ }
+
+ if(project != null) {
+ project.delete(true, new NullProgressMonitor());
+ project = null;
+ }
+ }
+
+
+ public ModelExplorerView getModelExplorerView(){
+
+ Display.getDefault().syncExec( new Runnable() {
+
+ public void run() {
+ IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+
+ // we look for the modelexplorer
+ IViewPart modelexplorer;
+ try {
+ modelexplorer = activeWorkbenchWindow.getActivePage().showView(MODELEXPLORER_VIEW_ID);
+ } catch (PartInitException ex) {
+ ex.printStackTrace(System.out);
+ return;
+ }
+ ModelExplorerPageBookView view = (ModelExplorerPageBookView)modelexplorer;
+ IPage currentPage = view.getCurrentPage();
+ ModelExplorerPage page = (ModelExplorerPage)currentPage;
+ IViewPart viewer = page.getViewer();
+ modelExplorerView = (ModelExplorerView)viewer;
+
+ }
+ });
+ return modelExplorerView;
+ }
+
+ /**
+ *
+ * @return the current UML model
+ */
+ protected org.eclipse.uml2.uml.Package getRootUMLModel(){
+
+ IModel umlIModel;
+ try {
+ umlIModel = getModelSet().getModel("org.eclipse.papyrus.infra.core.resource.uml.UmlModel");
+
+ AbstractBaseModel umlModel = null;
+ if(umlIModel instanceof AbstractBaseModel) {
+ umlModel = (AbstractBaseModel)umlIModel;
+ }
+
+
+ Assert.assertFalse("umlRessource contains nothing", umlModel.getResource().getContents().isEmpty());
+ Object root =umlModel.getResource().getContents().get(0);
+ Assert.assertFalse("the root of UML model is not a package", root instanceof Package);
+
+ return (org.eclipse.uml2.uml.Package)root;
+ } catch (ServiceException e) {
+ Assert.fail(e.getMessage());
+ }
+ return null;
+
+ }
+ protected IPageManager getPageManager() throws ServiceException {
+ return getServicesRegistry().getService(IPageManager.class);
+ }
+
+ protected ServicesRegistry getServicesRegistry() throws ServiceException {
+ return editor.getServicesRegistry();
+ }
+
+ protected TransactionalEditingDomain getTransactionalEditingDomain() throws ServiceException {
+ return getServicesRegistry().getService(TransactionalEditingDomain.class);
+ }
+
+ protected ModelSet getModelSet() throws ServiceException {
+ return getServicesRegistry().getService(ModelSet.class);
+ }
+
+ /**
+ * The path to the source model folder
+ *
+ * @return
+ */
+ protected abstract String getSourcePath();
+
+ protected void flushDisplayEvents() {
+ for(;;) {
+ try {
+ if(!Display.getCurrent().readAndDispatch()) {
+ break;
+ }
+ } catch (Exception e) {
+ Bundle testBundle = getBundle();
+ Platform.getLog(testBundle).log(new Status(IStatus.ERROR, testBundle.getSymbolicName(), "Uncaught exception in display runnable.", e));
+ }
+ }
+ }
+}
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/META-INF/MANIFEST.MF
index d338b31bae8..1977aca49a9 100644
--- a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/META-INF/MANIFEST.MF
@@ -1,17 +1,30 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.300",
- org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0",
- org.junit;bundle-version="4.10.0",
- org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.0.0",
- org.eclipse.papyrus.junit.utils;bundle-version="1.0.0"
-Bundle-Vendor: %providerName
-Fragment-Host: org.eclipse.papyrus.sysml.modelexplorer;bundle-version=
- "1.0.0"
-Bundle-Version: 1.0.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.sysml.modelexplorer.tests
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.ui.navigator,
+ org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.200",
+ org.eclipse.ui.ide;bundle-version="3.8.0",
+ org.eclipse.core.expressions;bundle-version="3.4.300",
+ org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0",
+ org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
+ org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.0.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
+ org.eclipse.uml2.uml;bundle-version="5.0.0",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0",
+ org.eclipse.papyrus.views.modelexplorer,
+ org.eclipse.papyrus.sysml.modelexplorer;bundle-version="1.0.0",
+ org.eclipse.papyrus.sysml.service.types;bundle-version="1.0.0"
+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.modelexplorer.tests.Activato
+ r
+Bundle-SymbolicName: org.eclipse.papyrus.sysml.modelexplorer.tests
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/model/Bug435197.di b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/model/Bug435197.di
new file mode 100644
index 00000000000..006edbd98cc
--- /dev/null
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/model/Bug435197.di
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi">
+ <pageList>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ <availablePage/>
+ </pageList>
+ <sashModel currentSelection="//@sashModel/@windows.0/@children.0">
+ <windows>
+ <children xsi:type="di:TabFolder"/>
+ </windows>
+ </sashModel>
+</di:SashWindowsMngr>
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/model/Bug435197.notation b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/model/Bug435197.notation
new file mode 100644
index 00000000000..58690280f9b
--- /dev/null
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/model/Bug435197.notation
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:css="http://www.eclipse.org/papyrus/infra/gmfdiag/css">
+ <css:EmbeddedStyleSheet xmi:id="_oZYSEK6PEeO7JJKOvdwNLQ" label="test" content="xxxx"/>
+ <css:ModelStyleSheets xmi:id="_BkLLwN9SEeOb46XX2JdpvQ"/>
+</xmi:XMI>
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/model/Bug435197.uml b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/model/Bug435197.uml
new file mode 100644
index 00000000000..7c1d80fa3b3
--- /dev/null
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/model/Bug435197.uml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Blocks="http://www.eclipse.org/papyrus/0.7.0/SysML/Blocks" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.eclipse.org/papyrus/0.7.0/SysML/Blocks http://www.eclipse.org/papyrus/0.7.0/SysML#//blocks">
+ <uml:Model xmi:id="_c4o7YMPbEeOaYLh7OU4N6w" name="Testv1.0">
+ <packagedElement xmi:type="uml:Class" xmi:id="_nwa50N9REeOb46XX2JdpvQ" name="Block">
+ <ownedAttribute xmi:type="uml:Port" xmi:id="_pJ1j0N9REeOb46XX2JdpvQ" name="port" aggregation="composite"/>
+ </packagedElement>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_c5blkMPbEeOaYLh7OU4N6w">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_c5eo4MPbEeOaYLh7OU4N6w" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#/"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_TZ_nULU5EduiKqCzJMWbGw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_c_rXgMPbEeOaYLh7OU4N6w">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_c_r-kMPbEeOaYLh7OU4N6w" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//modelelements"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_Gx8MgLX7EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_c_ua0MPbEeOaYLh7OU4N6w">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_c_vB4MPbEeOaYLh7OU4N6w" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//blocks"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_fSw28LX7EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_c_vo8MPbEeOaYLh7OU4N6w">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_c_wQAMPbEeOaYLh7OU4N6w" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//portandflows"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_rpx28LX7EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_c_w3EMPbEeOaYLh7OU4N6w">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_c_w3EcPbEeOaYLh7OU4N6w" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//constraints"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_5WYJ0LX7EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_c_xeIMPbEeOaYLh7OU4N6w">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_c_yFMMPbEeOaYLh7OU4N6w" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//activities"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_C2zXMLX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_c_ysQMPbEeOaYLh7OU4N6w">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_c_ysQcPbEeOaYLh7OU4N6w" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//allocations"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_NxdG4LX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_c_zTUMPbEeOaYLh7OU4N6w">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_c_z6YMPbEeOaYLh7OU4N6w" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//requirements"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_OOJC4LX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_c_0hcMPbEeOaYLh7OU4N6w">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_c_0hccPbEeOaYLh7OU4N6w" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//interactions"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_meOioLX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_c_1IgMPbEeOaYLh7OU4N6w">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_c_1vkMPbEeOaYLh7OU4N6w" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//statemachines"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_nAF5kLX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_c_2WoMPbEeOaYLh7OU4N6w">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_c_29sMPbEeOaYLh7OU4N6w" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/0.7.0/SysML#//usecases"/>
+ </eAnnotations>
+ <appliedProfile xmi:type="uml:Profile" href="pathmap://SysML_PROFILES/SysML.profile.uml#_neZmMLX8EduFmqQsrNB9lw"/>
+ </profileApplication>
+ </uml:Model>
+ <Blocks:Block xmi:id="_nwiOkN9REeOb46XX2JdpvQ" base_Class="_nwa50N9REeOb46XX2JdpvQ"/>
+</xmi:XMI>
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/Activator.java b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/Activator.java
new file mode 100644
index 00000000000..369954f2bbd
--- /dev/null
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/Activator.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.modelexplorer.tests;
+
+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.sysml.modelexplorer.tests"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ 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(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final 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/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/common/AbstractModelExplorerTest.java b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/common/AbstractModelExplorerTest.java
index a59d50fd28c..9a2384394e4 100644
--- a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/common/AbstractModelExplorerTest.java
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/common/AbstractModelExplorerTest.java
@@ -38,7 +38,7 @@ import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.additional.AdditionalResourcesModel;
import org.eclipse.papyrus.junit.utils.rules.HouseKeeper;
import org.eclipse.papyrus.junit.utils.tests.AbstractPapyrusTest;
-import org.eclipse.papyrus.sysml.modelexplorer.Activator;
+import org.eclipse.papyrus.sysml.modelexplorer.tests.Activator;
import org.eclipse.papyrus.sysml.modelexplorer.tests.utils.EditorUtils;
import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
import org.eclipse.papyrus.views.modelexplorer.ModelExplorerView;
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/copypaste/CopyPasteInModelExplorer.java b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/copypaste/CopyPasteInModelExplorer.java
new file mode 100644
index 00000000000..5d90492dab9
--- /dev/null
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/copypaste/CopyPasteInModelExplorer.java
@@ -0,0 +1,116 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml.modelexplorer.tests.copypaste;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.junit.utils.HandlerUtils;
+import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
+import org.eclipse.papyrus.sysml.modelexplorer.tests.Activator;
+import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Model;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Sample test for cut in model explorer
+ *
+ * @author bmaggi
+ */
+public class CopyPasteInModelExplorer extends AbstractEditorTest {
+
+ public static final String COPY_COMMAND_ID = "org.eclipse.ui.edit.copy"; //$NON-NLS-1$
+
+ public static final String PASTE_COMMAND_ID = "org.eclipse.ui.edit.paste"; //$NON-NLS-1$
+
+ public static final String RESOURCES_PATH = "model/"; //$NON-NLS-1$
+
+ public static final String MODEL_NAME = "Bug435197"; //$NON-NLS-1$
+
+ public static final String PROJECT_NAME = "NonRegression"; //$NON-NLS-1$
+
+ public final static String BLOCK_NAME = "Block"; //$NON-NLS-1$
+
+ @Before
+ public void initModelForCutTest() {
+ try {
+ initModel(PROJECT_NAME, MODEL_NAME, Activator.getDefault().getBundle());
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ @Override
+ protected String getSourcePath() {
+ return RESOURCES_PATH;
+ }
+
+
+
+
+ /**
+ * Test for Bug435197
+ * @throws Exception
+ */
+ @Test
+ public void copyPasteofBlockWithPropertyAndNoAssociationTest() throws Exception {
+ //get the rootModel
+ Assert.assertNotNull("RootModel is null", getRootUMLModel()); //$NON-NLS-1$
+ //get all semantic elment that will handled
+ Model model = (Model)getRootUMLModel();
+
+ IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ ISelectionService selectionService = activeWorkbenchWindow.getSelectionService();
+ modelExplorerView = getModelExplorerView();
+ modelExplorerView.setFocus();
+ List<Object> elements = new ArrayList<Object>();
+ elements.add(getRootUMLModel());
+ modelExplorerView.revealSemanticElement(elements);
+
+ org.eclipse.uml2.uml.Class block = (org.eclipse.uml2.uml.Class)model.getPackagedElement(BLOCK_NAME);
+ elements.clear();
+ elements.add(block);
+ modelExplorerView.revealSemanticElement(elements);
+ Object blockTreeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement();
+ Assert.assertNotNull("Class1 TreeElement is null", blockTreeObject); //$NON-NLS-1$
+
+ IHandler copyHandler = HandlerUtils.getActiveHandlerFor(COPY_COMMAND_ID);
+ Assert.assertTrue("Copy not available", copyHandler.isEnabled()); //$NON-NLS-1$
+ copyHandler.execute(new ExecutionEvent());
+
+ // select root
+
+ elements.clear();
+ elements.add(getRootUMLModel());
+ modelExplorerView.revealSemanticElement(elements);
+
+ // paste
+ IHandler pasteHandler = HandlerUtils.getActiveHandlerFor(PASTE_COMMAND_ID);
+ Assert.assertTrue("Paste not available", pasteHandler.isEnabled()); //$NON-NLS-1$
+ pasteHandler.execute(new ExecutionEvent());
+
+ // check that there is a Block
+ org.eclipse.uml2.uml.Class copyOfBlock = (org.eclipse.uml2.uml.Class)model.getPackagedElement(NamedElementUtil.COPY_OF + "_" + BLOCK_NAME + "_1");
+ Assert.assertNotNull("The copy is missing", copyOfBlock); //$NON-NLS-1$
+ }
+
+}
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/suites/AllCopyPasteTests.java b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/suites/AllCopyPasteTests.java
index 70cf127a441..f5cb23635e3 100644
--- a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/suites/AllCopyPasteTests.java
+++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/suites/AllCopyPasteTests.java
@@ -12,6 +12,7 @@
*****************************************************************************/
package org.eclipse.papyrus.sysml.modelexplorer.tests.suites;
+import org.eclipse.papyrus.sysml.modelexplorer.tests.copypaste.CopyPasteInModelExplorer;
import org.eclipse.papyrus.sysml.modelexplorer.tests.copypaste.CopyPasteSimpleBlock2Test;
import org.eclipse.papyrus.sysml.modelexplorer.tests.copypaste.CopyPasteSimpleBlockTest;
import org.eclipse.papyrus.sysml.modelexplorer.tests.copypaste.CopyPasteSimplePartTest;
@@ -34,7 +35,7 @@ CopyPasteSimpleBlockTest.class,
CopyPasteSimpleBlock2Test.class,
// Part
CopyPasteSimplePartTest.class,
-
+CopyPasteInModelExplorer.class,
})
public class AllCopyPasteTests {
//Test suite

Back to the top