Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-08-25 11:32:08 +0000
committerCamille Letavernier2014-08-25 11:32:08 +0000
commitbf1614fbbf746bc637c527348cba2e2967dc87fd (patch)
treef3d9aad50e870d8ab2f4c5e18fd1303bcba1d1e6 /tests/integration
parent446f8a7071d9d40ffb935cda21c28871c1ad28f2 (diff)
downloadorg.eclipse.papyrus-bf1614fbbf746bc637c527348cba2e2967dc87fd.tar.gz
org.eclipse.papyrus-bf1614fbbf746bc637c527348cba2e2967dc87fd.tar.xz
org.eclipse.papyrus-bf1614fbbf746bc637c527348cba2e2967dc87fd.zip
[Code style] Apply clean-up profile on Extra Plug-ins
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/.classpath2
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/META-INF/MANIFEST.MF22
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/build.properties14
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/Activator.java4
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/DiagramCreationException.java4
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/DiagramCreator.java33
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/EclipseProject.java96
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/EditorCreationException.java4
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ExecutionException.java6
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditor.java183
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/operationhistory/IOperationHistoryHandler.java12
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/operationhistory/OperationHistoryHandler.java25
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/package-info.java6
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/DiagramCreatorTest.java38
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/EclipseProjectTest.java53
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditorTest.java61
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/undoredo/UndoRedoAfterEditorCreationTest.java94
18 files changed, 347 insertions, 316 deletions
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/.classpath b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/.classpath
index b04b8be8f5d..e8be64492e4 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/.classpath
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/.settings/org.eclipse.jdt.core.prefs b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/.settings/org.eclipse.jdt.core.prefs
index 44217f8c068..f287d53cf45 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +1,7 @@
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.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/META-INF/MANIFEST.MF b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/META-INF/MANIFEST.MF
index d72fb33b06c..21b9c106fdb 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/META-INF/MANIFEST.MF
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/META-INF/MANIFEST.MF
@@ -2,27 +2,27 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.papyrus.integrationtests.editor
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 1.0.1.qualifier
Bundle-Activator: org.eclipse.papyrus.integrationtests.editor.Activator
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
- org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.1",
org.eclipse.ui.workbench,
org.eclipse.ui.ide,
org.eclipse.emf.ecore;bundle-version="2.9.1",
org.junit;bundle-version="4.10.0",
- org.eclipse.papyrus.uml.tools;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.diagram.clazz;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.diagram.activity;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.diagram.emftree;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.emf.diagram.common;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.tools;bundle-version="1.0.1",
+ org.eclipse.papyrus.uml.diagram.clazz;bundle-version="1.0.1",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.1",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.1",
+ org.eclipse.papyrus.uml.diagram.activity;bundle-version="1.0.1",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.1",
+ org.eclipse.papyrus.uml.diagram.emftree;bundle-version="1.0.1",
+ org.eclipse.papyrus.infra.emf.diagram.common;bundle-version="1.0.1",
org.eclipse.core.commands;bundle-version="3.6.100",
org.eclipse.emf.transaction;bundle-version="1.4.0"
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %providerName
Export-Package: org.eclipse.papyrus.integrationtests.editor
Bundle-Localization: plugin
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/build.properties b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/build.properties
index 4bd00011180..5011ec37623 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/build.properties
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/build.properties
@@ -1,16 +1,10 @@
-source.. = src/
+source.. = src/,\
+ test/
output.. = bin/
bin.includes = META-INF/,\
.,\
about.html,\
plugin.properties,\
- build.properties
-src.includes = about.html,\
build.properties,\
- models/,\
- plugin.properties,\
- src/,\
- test/,\
- .settings/,\
- .project,\
- META-INF/
+ models/
+src.includes = about.html
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/Activator.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/Activator.java
index 9ed5a9b5f54..404def75863 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/Activator.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/Activator.java
@@ -13,16 +13,20 @@ public class Activator implements BundleActivator {
/*
* (non-Javadoc)
+ *
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
+ @Override
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
/*
* (non-Javadoc)
+ *
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
+ @Override
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/DiagramCreationException.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/DiagramCreationException.java
index 96629afd563..ddeec2f1660 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/DiagramCreationException.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/DiagramCreationException.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2013 Cedric Dumoulin.
*
- *
+ *
* 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
@@ -22,7 +22,7 @@ package org.eclipse.papyrus.integrationtests.editor;
public class DiagramCreationException extends ExecutionException {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/DiagramCreator.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/DiagramCreator.java
index 9e2b1158151..e78a791591e 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/DiagramCreator.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/DiagramCreator.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2013 Cedric Dumoulin.
*
- *
+ *
* 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
@@ -26,17 +26,16 @@ import org.eclipse.papyrus.uml.diagram.emftree.CreateEMFTreeDiagramHandler;
/**
- * This class is used to create programmatically various diagram available in Papyrus.
- * <br>
+ * This class is used to create programmatically various diagram available in Papyrus. <br>
* This class is designed for tests purpose. It is not intended to be used in regular editor.
- *
+ *
* @author cedric dumoulin
*
*/
public class DiagramCreator {
public ProgramaticPapyrusEditor editorCreator;
-
+
/**
* Constructor.
*
@@ -47,15 +46,16 @@ public class DiagramCreator {
/**
* Create a diagram of the requested type. Return the {@link IPage} used in {@link ISashWindowsContainer}.
+ *
* @param name
* @return
- * @throws DiagramCreationException
+ * @throws DiagramCreationException
*/
public IPage createClassDiagram(String name) throws DiagramCreationException {
-
+
try {
ModelSet modelSet = editorCreator.getModelSet();
-
+
ICreationCommand command = new CreateClassDiagramCommand();
command.createDiagram(modelSet, null, name);
@@ -68,18 +68,19 @@ public class DiagramCreator {
throw new DiagramCreationException(e);
}
}
-
+
/**
* Create a diagram of the requested type. Return the {@link IPage} used in {@link ISashWindowsContainer}.
+ *
* @param name
* @return
- * @throws DiagramCreationException
+ * @throws DiagramCreationException
*/
public IPage createActivityDiagram(String name) throws DiagramCreationException {
-
+
try {
ModelSet modelSet = editorCreator.getModelSet();
-
+
ICreationCommand command = new CreateActivityDiagramCommand();
command.createDiagram(modelSet, null, name);
@@ -92,17 +93,19 @@ public class DiagramCreator {
throw new DiagramCreationException(e);
}
}
+
/**
* Create a diagram of the requested type. Return the {@link IPage} used in {@link ISashWindowsContainer}.
+ *
* @param name
* @return
- * @throws DiagramCreationException
+ * @throws DiagramCreationException
*/
public IPage createEmfTreeDiagram(String name) throws DiagramCreationException {
-
+
try {
ModelSet modelSet = editorCreator.getModelSet();
-
+
CreateEMFTreeDiagramHandler command = new CreateEMFTreeDiagramHandler();
command.execute(editorCreator.getServiceRegistry());
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/EclipseProject.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/EclipseProject.java
index 1dcf703c148..2ebd921d45e 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/EclipseProject.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/EclipseProject.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2014 Cedric Dumoulin.
*
- *
+ *
* 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
@@ -34,7 +34,7 @@ import org.eclipse.core.runtime.Platform;
* This class allows to create or load an Eclipse Project.
* This is the projects found in the project explorer.
* This class is mainly used in tests.
- *
+ *
* @author cedric dumoulin
*
*/
@@ -42,45 +42,46 @@ public class EclipseProject {
/**
* The underlying Eclipse project.
- *
+ *
*/
protected IProject project;
-
+
protected IProgressMonitor monitor = new NullProgressMonitor();
-
+
/**
* Constructor.
* Create or load the specified project.
- * @throws ExecutionException
+ *
+ * @throws ExecutionException
*/
- public EclipseProject( String projectName ) throws ExecutionException {
+ public EclipseProject(String projectName) throws ExecutionException {
// Create the project
initProject(projectName);
}
/**
* Create or load the project.
- *
+ *
* @param projectName
- * @throws ExecutionException
+ * @throws ExecutionException
*/
- protected void initProject(String projectName ) throws ExecutionException {
+ protected void initProject(String projectName) throws ExecutionException {
project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
-
- if( project == null) {
+
+ if (project == null) {
throw new ExecutionException("Can't get project '" + projectName + "' from workspace.");
}
-
- if(project != null && !project.exists()) {
-// IProgressMonitor monitor = new NullProgressMonitor();
+
+ if (project != null && !project.exists()) {
+ // IProgressMonitor monitor = new NullProgressMonitor();
try {
project.create(monitor);
} catch (CoreException e) {
throw new ExecutionException("Can't create project '" + projectName + "'.", e);
}
}
-
- if(!project.isOpen()) {
+
+ if (!project.isOpen()) {
try {
project.open(null);
} catch (CoreException e) {
@@ -92,31 +93,31 @@ public class EclipseProject {
}
-
+
/**
* @return the project
*/
public IProject getProject() {
return project;
}
-
+
/**
- *
+ *
* @param fromBundle
* @param fromResourceName
* @param toResourceName
* @return
* @throws ExecutionException
*/
- public IFile copyResource( String fromBundle, String fromResourceName, String toResourceName) throws ExecutionException {
-
+ public IFile copyResource(String fromBundle, String fromResourceName, String toResourceName) throws ExecutionException {
+
try {
Path toURL = new Path(toResourceName);
System.out.println(toURL);
-
+
IFile file = project.getFile(toResourceName);
// link all the models resources
- if(!file.exists()) {
+ if (!file.exists()) {
// Create intermediate folders
ensureFolders(file);
@@ -126,85 +127,86 @@ public class EclipseProject {
// encode the URI for spaces in the path
// And then create a link to the file
file.createLink(new URL(newFile.toString().replaceAll(" ", "%20")).toURI(), IResource.REPLACE, monitor);
- }
+ }
return file;
} catch (Exception e) {
throw new ExecutionException("Can't copy resource '" + toResourceName + "'.", e);
- }
+ }
}
-
+
/**
* Copy the specified resource from the specified bundle to this project.
* Use the same path in src and target.
- *
+ *
* @param fromBundle
* @param fromResourceName
* @return
* @throws ExecutionException
*/
- public IFile copyResource( String fromBundle, String fromResourceName) throws ExecutionException {
+ public IFile copyResource(String fromBundle, String fromResourceName) throws ExecutionException {
return copyResource(fromBundle, fromResourceName, fromResourceName);
}
-
+
/**
- *
+ *
* @param fromBundle
* @param fromResourceNames
* @throws ExecutionException
*/
- public void copyResources(String fromBundle, String ...fromResourceNames) throws ExecutionException {
-
- for(String fromResourceName : fromResourceNames) {
+ public void copyResources(String fromBundle, String... fromResourceNames) throws ExecutionException {
+
+ for (String fromResourceName : fromResourceNames) {
copyResource(fromBundle, fromResourceName);
}
}
-
+
/**
* Ensure that the intermediates folders exist in the project.
- *
+ *
* @param project
* @param name
* @throws CoreException
*/
protected void ensureFolders(IFile file) throws CoreException {
-
+
IPath path = file.getProjectRelativePath();
IPath folderPath = path.removeLastSegments(1);
-
+
String[] segments = folderPath.segments();
-
- for( int i = segments.length-1; i>=0; i--) {
+
+ for (int i = segments.length - 1; i >= 0; i--) {
IPath curFolderPath = folderPath.removeLastSegments(i);
createFolder(curFolderPath);
}
-
+
}
/**
- *
+ *
* @param folderPath
* @throws CoreException
*/
private void createFolder(IPath folderPath) throws CoreException {
IFolder parent = project.getFolder(folderPath);
- if(!parent.exists()) {
+ if (!parent.exists()) {
parent.create(true, true, monitor);
}
- assert (parent.exists()); }
+ assert (parent.exists());
+ }
/**
* Creates all the folders that are needed to contains the resource.
- *
+ *
* @param modelName
- * @throws ExecutionException
+ * @throws ExecutionException
*/
public void createFolders(String modelName) throws ExecutionException {
try {
IFile file = project.getFile(modelName);
// link all the models resources
- if(!file.exists()) {
+ if (!file.exists()) {
// Create intermediate folders
ensureFolders(file);
}
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/EditorCreationException.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/EditorCreationException.java
index 109a70f2676..0f4d8a98a5d 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/EditorCreationException.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/EditorCreationException.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2013 Cedric Dumoulin.
*
- *
+ *
* 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
@@ -22,7 +22,7 @@ package org.eclipse.papyrus.integrationtests.editor;
public class EditorCreationException extends ExecutionException {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ExecutionException.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ExecutionException.java
index 22d93992b82..47c45642f07 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ExecutionException.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ExecutionException.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2013 Cedric Dumoulin.
*
- *
+ *
* 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
@@ -17,14 +17,14 @@ package org.eclipse.papyrus.integrationtests.editor;
/**
* Root exception of the package.
- *
+ *
* @author cedric dumoulin
*
*/
public class ExecutionException extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditor.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditor.java
index fdb5e5ca498..f720df0b5b1 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditor.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditor.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2013 Cedric Dumoulin.
*
- *
+ *
* 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
@@ -40,7 +40,7 @@ import org.eclipse.ui.part.FileEditorInput;
* This class allows to create a Papyrus Editor programatically.
* The creation require the name of a project and the name of the model to create.
* This class is for use in tests.
- *
+ *
* @author cedric dumoulin
*
*/
@@ -48,22 +48,22 @@ public class ProgramaticPapyrusEditor {
protected static final String DEFAULT_PROJECT_NAME = "org.eclipse.papyrus.integrationtests.editor";
protected static final String DEFAULT_MODEL_NAME = "papyrusModelForIntegration";
-
- /**
+
+ /**
* Name of the project that will contains Model
*/
-// protected String projectName = DEFAULT_PROJECT_NAME;
-
+ // protected String projectName = DEFAULT_PROJECT_NAME;
+
/**
* Name of the model to create.
*/
protected String modelName = DEFAULT_MODEL_NAME;
/** The di resource set. */
-// protected ModelSet modelSet;
+ // protected ModelSet modelSet;
/** The file. */
-// protected IFile file;
+ // protected IFile file;
/** The page. */
protected IWorkbenchPage page;
@@ -72,8 +72,8 @@ public class ProgramaticPapyrusEditor {
protected IMultiDiagramEditor papyrusEditor;
/** The project. */
-// protected IProject project;
-
+ // protected IProject project;
+
/**
* An object representing an EclipseProject.
*/
@@ -81,19 +81,20 @@ public class ProgramaticPapyrusEditor {
/** The root. */
-// protected IWorkspaceRoot root;
-
-
+ // protected IWorkspaceRoot root;
+
+
/**
* Constructor.
*
* @param projectName
* @param modelName
- * @throws EditorCreationException If the creation fails.
+ * @throws EditorCreationException
+ * If the creation fails.
*/
public ProgramaticPapyrusEditor(String projectName, String modelName) throws ExecutionException {
this.modelName = modelName;
-
+
// Create an Eclipse project
eclipseProject = new EclipseProject(projectName);
// Create a suitable EclipseProject
@@ -108,12 +109,13 @@ public class ProgramaticPapyrusEditor {
*
* @param projectName
* @param modelName
- * @throws EditorCreationException If the creation fails.
+ * @throws EditorCreationException
+ * If the creation fails.
*/
public ProgramaticPapyrusEditor(EclipseProject eclipseProject, String modelName) throws ExecutionException {
this.modelName = modelName;
-
- if( eclipseProject == null ) {
+
+ if (eclipseProject == null) {
throw new ExecutionException("The argument 'EclipseProject' should be initialized.");
}
this.eclipseProject = eclipseProject;
@@ -126,13 +128,15 @@ public class ProgramaticPapyrusEditor {
/**
- *
+ *
* Constructor.
- * @throws EditorCreationException If the creation fails.
+ *
+ * @throws EditorCreationException
+ * If the creation fails.
*
*/
public ProgramaticPapyrusEditor() throws ExecutionException {
-
+
// Create an Eclipse project
eclipseProject = new EclipseProject(DEFAULT_PROJECT_NAME);
// Create a suitable EclipseProject
@@ -146,7 +150,7 @@ public class ProgramaticPapyrusEditor {
/**
* Init the resources.
* The {@link #eclipseProject} should be initialized.
- *
+ *
* @throws ExecutionException
* @throws CoreException
* @throws IOException
@@ -155,32 +159,33 @@ public class ProgramaticPapyrusEditor {
try {
// Ensure path to specified resource
eclipseProject.createFolders(modelName);
-
+
// delete existing files, and then create a new model
IFile file = eclipseProject.getProject().getFile(modelName + ".di");
- if(deleteFileIfExists && file.exists()) {
+ if (deleteFileIfExists && file.exists()) {
file.delete(true, new NullProgressMonitor());
}
- if(!file.exists()) {
+ if (!file.exists()) {
// Create the model
createModel(file);
}
} catch (Exception e) {
- throw new ExecutionException("Can't init Project and Resources" , e );
- }
+ throw new ExecutionException("Can't init Project and Resources", e);
+ }
}
/**
* Create a model suitable for Papyrus uml.
* Save it in the provided file.
+ *
* @param file
* @throws CoreException
- * @throws IOException
+ * @throws IOException
*/
protected void createModel(IFile file) throws CoreException, IOException {
-
+
// Create ModelSet and initialize it with models declared in eclipse extensions
ModelSet modelSet = new ModelSet();
ModelsReader reader = new ModelsReader();
@@ -191,72 +196,74 @@ public class ProgramaticPapyrusEditor {
// populate the model
UmlModel umlModel = UmlUtils.getUmlModel(modelSet);
umlModel.initializeEmptyModel();
-
- // ICreationCommand command = getDiagramCommandCreation();
- // command.createDiagram(modelSet, null, "DiagramToTest");
+
+ // ICreationCommand command = getDiagramCommandCreation();
+ // command.createDiagram(modelSet, null, "DiagramToTest");
modelSet.save(new NullProgressMonitor());
-
+
}
+
/**
* Create a papyrus editor.
- * @return
- * @throws EditorCreationException
+ *
+ * @return
+ * @throws EditorCreationException
*/
protected IMultiDiagramEditor createEditor() throws EditorCreationException {
-// IWorkspace workspace = ResourcesPlugin.getWorkspace();
-// root = workspace.getRoot();
-// project = root.getProject(projectName);
+ // IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ // root = workspace.getRoot();
+ // project = root.getProject(projectName);
IFile file = eclipseProject.getProject().getFile(modelName + ".di");
- try {
-// //at this point, no resources have been created
-// if(!project.exists()) {
-// project.create(null);
-// }
-// if(!project.isOpen()) {
-// project.open(null);
-// }
-//
-// if(file.exists()) {
-// file.delete(true, new NullProgressMonitor());
-// }
-//
-// if(!file.exists()) {
-// // Create the model
-// createModel(file);
-// }
-//
- // Create the editor
- page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName());
- papyrusEditor = (IMultiDiagramEditor)page.openEditor(new FileEditorInput(file), desc.getId());
- return papyrusEditor;
- } catch (PartInitException e) {
- e.printStackTrace();
- throw new EditorCreationException("Can't create editor", e);
- } catch (CoreException e) {
- throw new EditorCreationException("Can't create editor", e);
-// } catch (IOException e) {
-// throw new EditorCreationException("Can't create editor", e);
- }
+ try {
+ // //at this point, no resources have been created
+ // if(!project.exists()) {
+ // project.create(null);
+ // }
+ // if(!project.isOpen()) {
+ // project.open(null);
+ // }
+ //
+ // if(file.exists()) {
+ // file.delete(true, new NullProgressMonitor());
+ // }
+ //
+ // if(!file.exists()) {
+ // // Create the model
+ // createModel(file);
+ // }
+ //
+ // Create the editor
+ page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName());
+ papyrusEditor = (IMultiDiagramEditor) page.openEditor(new FileEditorInput(file), desc.getId());
+ return papyrusEditor;
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ throw new EditorCreationException("Can't create editor", e);
+ } catch (CoreException e) {
+ throw new EditorCreationException("Can't create editor", e);
+ // } catch (IOException e) {
+ // throw new EditorCreationException("Can't create editor", e);
+ }
}
-
+
/**
* Dispose the editor.
*/
public void dispose() {
-
- if(papyrusEditor == null) {
+
+ if (papyrusEditor == null) {
return;
}
-
+
// Save model, to avoid popup
papyrusEditor.doSave(new NullProgressMonitor());
papyrusEditor = null;
-
+
// Dispose done from closeAllEditors ?
-// papyrusEditor.dispose();
+ // papyrusEditor.dispose();
page.closeAllEditors(true);
try {
eclipseProject.getProject().delete(true, new NullProgressMonitor());
@@ -266,17 +273,18 @@ public class ProgramaticPapyrusEditor {
}
}
-
+
/**
- *
+ *
* @return
*/
public IMultiDiagramEditor getEditor() {
return papyrusEditor;
}
-
+
/**
* Get the {@link ServicesRegistry} associated to the editor.
+ *
* @return The service registry.
*/
public ServicesRegistry getServiceRegistry() {
@@ -288,30 +296,31 @@ public class ProgramaticPapyrusEditor {
* Cached value of modelSet.
*/
private ModelSet modelSet;
+
public ModelSet getModelSet() throws ServiceException {
- if(modelSet == null) {
+ if (modelSet == null) {
modelSet = papyrusEditor.getServicesRegistry().getService(ModelSet.class);
}
return modelSet;
}
-
+
public void undo() throws ServiceException {
TransactionalEditingDomain domain = getServiceRegistry().getService(TransactionalEditingDomain.class);
-
- if(domain.getCommandStack().canUndo()) {
+
+ if (domain.getCommandStack().canUndo()) {
domain.getCommandStack().undo();
}
}
-
+
public void redo() throws ServiceException {
TransactionalEditingDomain domain = getServiceRegistry().getService(TransactionalEditingDomain.class);
-
- if(domain.getCommandStack().canRedo()) {
+
+ if (domain.getCommandStack().canRedo()) {
domain.getCommandStack().redo();
}
-
+
}
-
+
public IOperationHistory getIOperationHistory() {
return papyrusEditor.getSite().getWorkbenchWindow().getWorkbench().getOperationSupport().getOperationHistory();
}
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/operationhistory/IOperationHistoryHandler.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/operationhistory/IOperationHistoryHandler.java
index 09a9b6aea32..a73f0c4c9ce 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/operationhistory/IOperationHistoryHandler.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/operationhistory/IOperationHistoryHandler.java
@@ -8,26 +8,28 @@ import org.eclipse.papyrus.integrationtests.editor.ExecutionException;
public interface IOperationHistoryHandler {
/**
- *
+ *
* @return
*/
public boolean canRedo();
/**
* Redo the last operation in the history.
- * @throws ExecutionException
+ *
+ * @throws ExecutionException
*/
public void redo() throws ExecutionException;
/**
- *
+ *
* @return
*/
public boolean canUndo();
-
+
/**
* Redo the last operation in the history.
- * @throws ExecutionException
+ *
+ * @throws ExecutionException
*/
public void undo() throws ExecutionException;
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/operationhistory/OperationHistoryHandler.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/operationhistory/OperationHistoryHandler.java
index 862329897fd..ca0274cb961 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/operationhistory/OperationHistoryHandler.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/operationhistory/OperationHistoryHandler.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2013 Cedric Dumoulin.
*
- *
+ *
* 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
@@ -24,8 +24,8 @@ import org.eclipse.papyrus.integrationtests.editor.ProgramaticPapyrusEditor;
/**
* A handler allowing to perform undo and redo through the {@link IOperationHistory}
- *
- *
+ *
+ *
* @author cedric dumoulin
*
*/
@@ -37,12 +37,12 @@ public class OperationHistoryHandler implements IOperationHistoryHandler {
protected IOperationHistory history;
private IUndoContext papyrusContext;
-
+
/**
* Constructor.
*
* @param papyrusEditor
- * @throws ServiceException
+ * @throws ServiceException
*/
public OperationHistoryHandler(ProgramaticPapyrusEditor handler) throws ServiceException {
this.papyrusEditor = handler.getEditor();
@@ -55,29 +55,33 @@ public class OperationHistoryHandler implements IOperationHistoryHandler {
}
/**
- *
+ *
* @return
*/
+ @Override
public boolean canRedo() {
return history.canRedo(papyrusContext);
}
+
/**
* @see org.eclipse.papyrus.integrationtests.editor.operationhistory.IOperationHistoryHandler#redo()
*
* @throws ExecutionException
*/
+ @Override
public void redo() throws ExecutionException {
try {
history.redo(papyrusContext, null, null);
} catch (org.eclipse.core.commands.ExecutionException e) {
throw new ExecutionException(e);
- }
+ }
}
/**
- *
+ *
* @return
*/
+ @Override
public boolean canUndo() {
return history.canUndo(papyrusContext);
}
@@ -87,12 +91,13 @@ public class OperationHistoryHandler implements IOperationHistoryHandler {
*
* @throws ExecutionException
*/
- public void undo() throws ExecutionException {
+ @Override
+ public void undo() throws ExecutionException {
try {
history.undo(papyrusContext, null, null);
} catch (org.eclipse.core.commands.ExecutionException e) {
throw new ExecutionException(e);
- }
+ }
}
}
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/package-info.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/package-info.java
index 70c1c304ef3..4a7ae087dfa 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/package-info.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/package-info.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2014 Cedric Dumoulin.
*
- *
+ *
* 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
@@ -16,8 +16,8 @@
* This package contains utility classes for integration tests.
* <br>
* Examples of usages can be found in tests: {@link org.eclipse.papyrus.integrationtests.editor.DiagramCreatorTest}, {@link org.eclipse.papyrus.integrationtests.editor.ProgramaticPapyrusEditorTest}.
- *
- *
+ *
+ *
* @author cedric dumoulin
*
*/
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/DiagramCreatorTest.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/DiagramCreatorTest.java
index 8d4721d62b7..6b532957855 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/DiagramCreatorTest.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/DiagramCreatorTest.java
@@ -1,6 +1,6 @@
package org.eclipse.papyrus.integrationtests.editor;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage;
import org.junit.After;
@@ -10,8 +10,8 @@ import org.junit.Test;
/**
* Test for {@link DiagramCreator}.
- *
- *
+ *
+ *
* @author cedric dumoulin
*
*/
@@ -26,56 +26,56 @@ public class DiagramCreatorTest {
}
/**
- *
+ *
* @throws Exception
*/
@Test
@Ignore
public void testCreateClassDiagram() throws Exception {
ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor();
-// DiagramCreator diagramCreator = new DiagramCreator(editorHandler);
-//
-// IPage createdPage = diagramCreator.createClassDiagram("newDiagram");
-//
-// assertNotNull("diagram created", createdPage);
-
+ // DiagramCreator diagramCreator = new DiagramCreator(editorHandler);
+ //
+ // IPage createdPage = diagramCreator.createClassDiagram("newDiagram");
+ //
+ // assertNotNull("diagram created", createdPage);
+
// exit
editorHandler.dispose();
}
/**
- *
+ *
* @throws Exception
*/
@Test
public void testCreateActivityDiagram() throws Exception {
ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor();
DiagramCreator diagramCreator = new DiagramCreator(editorHandler);
-
+
IPage createdPage = diagramCreator.createActivityDiagram("newDiagram");
-
+
assertNotNull("diagram created", createdPage);
-
+
// exit
editorHandler.dispose();
}
/**
- *
+ *
* @throws Exception
*/
@Test
public void testCreateEMFTreeDiagram() throws Exception {
ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor();
DiagramCreator diagramCreator = new DiagramCreator(editorHandler);
-
+
IPage createdPage = diagramCreator.createEmfTreeDiagram("newDiagram");
-
+
assertNotNull("diagram created", createdPage);
-
+
// exit
editorHandler.dispose();
}
-
+
}
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/EclipseProjectTest.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/EclipseProjectTest.java
index 39a4cd54e4c..6774b2f034a 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/EclipseProjectTest.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/EclipseProjectTest.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2014 Cedric Dumoulin.
*
- *
+ *
* 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
@@ -14,7 +14,8 @@
package org.eclipse.papyrus.integrationtests.editor;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import org.junit.After;
import org.junit.Before;
@@ -46,63 +47,67 @@ public class EclipseProjectTest {
/**
* Test method for {@link org.eclipse.papyrus.integrationtests.editor.EclipseProject#EclipseProject(java.lang.String)}.
- * @throws ExecutionException
+ *
+ * @throws ExecutionException
*/
@Test
public void testEclipseProject() throws ExecutionException {
EclipseProject project = new EclipseProject(PROJECT_NAME);
-
- assertNotNull( "object created", project);
+
+ assertNotNull("object created", project);
}
/**
* Test method for {@link org.eclipse.papyrus.integrationtests.editor.EclipseProject#getProject()}.
- * @throws ExecutionException
+ *
+ * @throws ExecutionException
*/
@Test
public void testGetProject() throws ExecutionException {
EclipseProject project = new EclipseProject(PROJECT_NAME);
-
- assertNotNull( "object created", project.getProject());
+
+ assertNotNull("object created", project.getProject());
}
/**
* Test method for {@link org.eclipse.papyrus.integrationtests.editor.EclipseProject#copyResource(java.lang.String, java.lang.String, java.lang.String)}.
- * @throws ExecutionException
+ *
+ * @throws ExecutionException
*/
@Test
public void testCopyResource() throws ExecutionException {
-
+
String fromFile = "META-INF/MANIFEST.MF";
String toFile = "a/b/META-INF/MANIFEST.MF";
-
+
EclipseProject project = new EclipseProject(PROJECT_NAME);
-
+
project.copyResource(FROM_BUNDLE_NAME, fromFile, toFile);
-
- assertNotNull( "file copied", project.getProject().findMember(toFile));
+
+ assertNotNull("file copied", project.getProject().findMember(toFile));
}
/**
* Test method for {@link org.eclipse.papyrus.integrationtests.editor.EclipseProject#copyResource(java.lang.String, java.lang.String, java.lang.String)}.
- * @throws ExecutionException
+ *
+ * @throws ExecutionException
*/
@Test
public void testCopyResources() throws ExecutionException {
-
+
String fromFile1 = "META-INF/MANIFEST.MF";
String fromFile2 = "about.html";
-
+
EclipseProject project = new EclipseProject(PROJECT_NAME);
-
- assertNull( "file copied", project.getProject().findMember(fromFile1));
- assertNull( "file copied", project.getProject().findMember(fromFile2));
-
+
+ assertNull("file copied", project.getProject().findMember(fromFile1));
+ assertNull("file copied", project.getProject().findMember(fromFile2));
+
project.copyResources(FROM_BUNDLE_NAME, fromFile1, fromFile2);
-
- assertNotNull( "file copied", project.getProject().findMember(fromFile1));
- assertNotNull( "file copied", project.getProject().findMember(fromFile2));
+
+ assertNotNull("file copied", project.getProject().findMember(fromFile1));
+ assertNotNull("file copied", project.getProject().findMember(fromFile2));
}
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditorTest.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditorTest.java
index 96702f3b28f..ebf63c3189f 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditorTest.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditorTest.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2013 Cedric Dumoulin.
*
- *
+ *
* 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
@@ -14,12 +14,12 @@
package org.eclipse.papyrus.integrationtests.editor;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.resource.BadArgumentExcetion;
-import org.eclipse.papyrus.infra.core.resource.IModel;
import org.eclipse.papyrus.infra.core.resource.NotFoundException;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
@@ -31,7 +31,7 @@ import org.junit.Test;
/**
* Test for the utility class {@link ProgramaticPapyrusEditor}
- *
+ *
* @author cedric dumoulin
*
*/
@@ -64,57 +64,61 @@ public class ProgramaticPapyrusEditorTest {
/**
* Test method for {@link org.eclipse.papyrus.integrationtests.editor.ProgramaticPapyrusEditor#createEditor()}.
- * @throws ExecutionException
+ *
+ * @throws ExecutionException
*/
@Test
public void testCreateEditor() throws ExecutionException {
ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor();
IMultiDiagramEditor editor = editorHandler.getEditor();
-
+
assertNotNull("editor created", editor);
editorHandler.dispose();
}
/**
* Test method for {@link org.eclipse.papyrus.integrationtests.editor.ProgramaticPapyrusEditor#dispose()}.
- * @throws ExecutionException
+ *
+ * @throws ExecutionException
*/
@Test
public void testDispose() throws ExecutionException {
ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor();
IMultiDiagramEditor editor = editorHandler.getEditor();
-
+
assertNotNull("editor created", editor);
// Try to dispose
editorHandler.dispose();
- assertNull("editor cleaned", editorHandler.getEditor());
+ assertNull("editor cleaned", editorHandler.getEditor());
}
/**
* Test method for {@link org.eclipse.papyrus.integrationtests.editor.ProgramaticPapyrusEditor#getEditor()}.
- * @throws ExecutionException
+ *
+ * @throws ExecutionException
*/
@Test
public void testGetEditor() throws ExecutionException {
ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor();
IMultiDiagramEditor editor = editorHandler.getEditor();
-
+
assertNotNull("editor created", editor);
-
+
editorHandler.dispose();
}
/**
* Test method for {@link org.eclipse.papyrus.integrationtests.editor.ProgramaticPapyrusEditor#getServiceRegistry()}.
- * @throws ExecutionException
+ *
+ * @throws ExecutionException
*/
@Test
public void testGetServiceRegistry() throws ExecutionException {
ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor();
IMultiDiagramEditor editor = editorHandler.getEditor();
-
+
assertNotNull("editor created", editor);
-
+
// Try to get the Registry
ServicesRegistry servicesRegistry = editorHandler.getServiceRegistry();
assertNotNull("registry initialized", servicesRegistry);
@@ -124,32 +128,33 @@ public class ProgramaticPapyrusEditorTest {
/**
* Test method for {@link org.eclipse.papyrus.integrationtests.editor.ProgramaticPapyrusEditor#getEditor()}.
- * @throws ServiceException
- * @throws BadArgumentExcetion
- * @throws NotFoundException
- * @throws ExecutionException
+ *
+ * @throws ServiceException
+ * @throws BadArgumentExcetion
+ * @throws NotFoundException
+ * @throws ExecutionException
*/
@Test
public void testGetEditorAndLoadModel() throws ServiceException, NotFoundException, BadArgumentExcetion, ExecutionException {
-
+
String modelName = "models/modelTestLoadModel";
-// String modelName = "modelTestLoadModel";
+ // String modelName = "modelTestLoadModel";
String diagramName = "diagram1";
EclipseProject eclipseProject = new EclipseProject(PLUGIN_PROJECT_NAME);
- eclipseProject.copyResources(BUNDLE_NAME, modelName+".di", modelName+".notation", modelName+".uml" );
-
+ eclipseProject.copyResources(BUNDLE_NAME, modelName + ".di", modelName + ".notation", modelName + ".uml");
+
ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor(eclipseProject, modelName);
IMultiDiagramEditor editor = editorHandler.getEditor();
-
+
assertNotNull("editor created", editor);
-
- NotationModel notationModel = (NotationModel)editorHandler.getModelSet().getModel(NotationModel.MODEL_ID);
+
+ NotationModel notationModel = (NotationModel) editorHandler.getModelSet().getModel(NotationModel.MODEL_ID);
assertNotNull("notation model loaded", notationModel);
-
+
// If the following assertion is false, this means that the model is not loaded from file (it has been created)
Diagram diagram = notationModel.getDiagram(diagramName);
assertNotNull("diagram loaded", diagram);
-
+
editorHandler.dispose();
}
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/undoredo/UndoRedoAfterEditorCreationTest.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/undoredo/UndoRedoAfterEditorCreationTest.java
index ab59265efa5..00da3a726d3 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/undoredo/UndoRedoAfterEditorCreationTest.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/undoredo/UndoRedoAfterEditorCreationTest.java
@@ -21,10 +21,10 @@ import org.junit.Before;
import org.junit.Test;
/**
- *
+ *
* Integration tests.
* Check the undo/redo after nested editor creation.
- *
+ *
* @author cedric dumoulin
*
*/
@@ -34,15 +34,16 @@ public class UndoRedoAfterEditorCreationTest {
* Handler on a newly created editor
*/
protected ProgramaticPapyrusEditor editorHandler;
-
+
/**
* A diagram creator associated to the editor.
* Used to create diagrams.
*/
protected DiagramCreator diagramCreator;
-
+
/**
* Create a new editor
+ *
* @throws Exception
*/
@Before
@@ -53,6 +54,7 @@ public class UndoRedoAfterEditorCreationTest {
/**
* Dispose the editor.
+ *
* @throws Exception
*/
@After
@@ -61,92 +63,92 @@ public class UndoRedoAfterEditorCreationTest {
}
/**
- * @throws DiagramCreationException
- * @throws EditorCreationException
- * @throws ServiceException
- *
+ * @throws DiagramCreationException
+ * @throws EditorCreationException
+ * @throws ServiceException
+ *
*/
@Test
public void testUndoRedoUndo() throws DiagramCreationException, EditorCreationException, ServiceException {
-
+
TransactionalEditingDomain domain = editorHandler.getServiceRegistry().getService(TransactionalEditingDomain.class);
CommandStack cstack = domain.getCommandStack();
-
+
// Create one diagram
IPage createdPage = diagramCreator.createEmfTreeDiagram("newDiagram");
assertNotNull("diagram created", createdPage);
// Try to undo
editorHandler.undo();
assertNull("diagram removed", editorHandler.getEditor().getActiveEditor());
-
+
// Try to redo
editorHandler.redo();
assertNotNull("diagram exist", editorHandler.getEditor().getActiveEditor());
-
+
// Try to undo
editorHandler.undo();
assertNull("diagram removed", editorHandler.getEditor().getActiveEditor());
-
+
// Try to redo
editorHandler.redo();
assertNotNull("diagram exist", editorHandler.getEditor().getActiveEditor());
// Check di now
-
+
}
/**
- * @throws ServiceException
- * @throws ExecutionException
- *
+ * @throws ServiceException
+ * @throws ExecutionException
+ *
*/
@Test
public void testUndoRedoUndoIOperationHistory() throws ServiceException, ExecutionException {
-
+
// Create one diagram
IPage createdPage = diagramCreator.createEmfTreeDiagram("newDiagram");
assertNotNull("diagram created", createdPage);
IOperationHistoryHandler history = new OperationHistoryHandler(editorHandler);
-
+
// Try to undo
assertTrue("Can undo", history.canUndo());
history.undo();
assertNull("diagram removed", editorHandler.getEditor().getActiveEditor());
-
-
+
+
// Try to redo
assertTrue("Can redo", history.canRedo());
history.redo();
assertNotNull("diagram exist", editorHandler.getEditor().getActiveEditor());
-
+
// Try to undo
assertTrue("Can undo", history.canUndo());
history.undo();
assertNull("diagram removed", editorHandler.getEditor().getActiveEditor());
-
+
// Try to redo
assertTrue("Can redo", history.canRedo());
history.redo();
assertNotNull("diagram exist", editorHandler.getEditor().getActiveEditor());
// Check di now
-
+
}
/**
- * @throws ServiceException
- * @throws ExecutionException
- *
+ * @throws ServiceException
+ * @throws ExecutionException
+ *
*/
@Test
public void testDoubleCreateUndoUndoRedoRedoIOperationHistory() throws ServiceException, ExecutionException {
-
+
IOperationHistoryHandler history = new OperationHistoryHandler(editorHandler);
ISashWindowsContainer container = editorHandler.getServiceRegistry().getService(ISashWindowsContainer.class);
// Create one diagram
IPage createdPage = diagramCreator.createEmfTreeDiagram("newDiagram");
Object page1RawModel = createdPage.getRawModel();
-
+
assertNotNull("diagram created", createdPage);
assertNotNull("diagram created", page1RawModel);
@@ -154,46 +156,46 @@ public class UndoRedoAfterEditorCreationTest {
Object page2RawModel = createdPage2.getRawModel();
assertNotNull("diagram created", createdPage);
assertNotNull("diagram created", page2RawModel);
-
+
// Try to undo
assertTrue("Can undo", history.canUndo());
history.undo();
- assertNull( "diagram removed", container.lookupModelPage(page2RawModel ));
- assertNotNull( "diagram preserved", container.lookupModelPage(page1RawModel ));
-
-
+ assertNull("diagram removed", container.lookupModelPage(page2RawModel));
+ assertNotNull("diagram preserved", container.lookupModelPage(page1RawModel));
+
+
// Try to undo
assertTrue("Can undo", history.canUndo());
history.undo();
- assertNull( "diagram removed", container.lookupModelPage(page2RawModel ));
- assertNull( "diagram removed", container.lookupModelPage(page1RawModel ));
+ assertNull("diagram removed", container.lookupModelPage(page2RawModel));
+ assertNull("diagram removed", container.lookupModelPage(page1RawModel));
assertNull("no active editor", editorHandler.getEditor().getActiveEditor());
-
+
// Try to redo
assertTrue("Can redo", history.canRedo());
history.redo();
- assertNotNull( "diagram restored", container.lookupModelPage(page1RawModel ));
+ assertNotNull("diagram restored", container.lookupModelPage(page1RawModel));
assertNotNull("active editor set", editorHandler.getEditor().getActiveEditor());
-
+
// Try to redo
assertTrue("Can redo", history.canRedo());
history.redo();
- assertNotNull( "diagram restored", container.lookupModelPage(page2RawModel ));
+ assertNotNull("diagram restored", container.lookupModelPage(page2RawModel));
assertNotNull("active editor set", editorHandler.getEditor().getActiveEditor());
-
+
// Try to undo
assertTrue("Can undo", history.canUndo());
history.undo();
- assertNull( "diagram removed", container.lookupModelPage(page2RawModel ));
- assertNotNull( "diagram preserved", container.lookupModelPage(page1RawModel ));
-
+ assertNull("diagram removed", container.lookupModelPage(page2RawModel));
+ assertNotNull("diagram preserved", container.lookupModelPage(page1RawModel));
+
// Try to redo
assertTrue("Can redo", history.canRedo());
history.redo();
- assertNotNull( "diagram restored", container.lookupModelPage(page2RawModel ));
+ assertNotNull("diagram restored", container.lookupModelPage(page2RawModel));
assertNotNull("active editor set", editorHandler.getEditor().getActiveEditor());
// Check di now
-
+
}

Back to the top