Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org')
-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
10 files changed, 199 insertions, 174 deletions
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
*
*/

Back to the top