Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2013-02-21 18:36:53 +0000
committercletavernie2013-02-21 18:36:53 +0000
commitf5fc92d8c6c115f15f60007b1dcf4e4d5d61a51b (patch)
tree7fed1e98eb9d5413edd5b840236662a61a075228
parent4aa29f53785077e87828a22820fa07a8376f9302 (diff)
downloadorg.eclipse.papyrus-f5fc92d8c6c115f15f60007b1dcf4e4d5d61a51b.tar.gz
org.eclipse.papyrus-f5fc92d8c6c115f15f60007b1dcf4e4d5d61a51b.tar.xz
org.eclipse.papyrus-f5fc92d8c6c115f15f60007b1dcf4e4d5d61a51b.zip
398712: [Core] Multiple issues with the PageManager
https://bugs.eclipse.org/bugs/show_bug.cgi?id=398712 401434: [Core] The CoreEditor shall be covered with integration tests https://bugs.eclipse.org/bugs/show_bug.cgi?id=401434 Minor fixes on Papyrus Editor integration tests
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/editor/UnloadResourcesEditorModel.java6
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/handlers/AbstractCreateNattableEditorCommand.java27
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/RecoveryTest.java19
3 files changed, 26 insertions, 26 deletions
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/editor/UnloadResourcesEditorModel.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/editor/UnloadResourcesEditorModel.java
index c83b38fc413..24b58ca0c85 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/editor/UnloadResourcesEditorModel.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.resourceloading/src/org/eclipse/papyrus/infra/services/resourceloading/editor/UnloadResourcesEditorModel.java
@@ -15,7 +15,9 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.EditorActionBarContributor;
import org.eclipse.ui.part.EditorPart;
@@ -35,7 +37,7 @@ public class UnloadResourcesEditorModel implements IEditorModel {
public UnloadResourcesEditorModel(URI uri) {
this.uri = uri;
- name = "unresolved tab";
+ name = "Unresolved tab";
}
/**
@@ -53,7 +55,7 @@ public class UnloadResourcesEditorModel implements IEditorModel {
* @return
*/
public Image getTabIcon() {
- return null;
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK);
}
/**
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/handlers/AbstractCreateNattableEditorCommand.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/handlers/AbstractCreateNattableEditorCommand.java
index 3d695ebe89e..33c7822d58c 100644
--- a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/handlers/AbstractCreateNattableEditorCommand.java
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/handlers/AbstractCreateNattableEditorCommand.java
@@ -70,6 +70,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
import org.eclipse.papyrus.infra.table.common.Activator;
import org.eclipse.papyrus.infra.table.common.dialog.TwoInputDialog;
import org.eclipse.papyrus.infra.table.common.messages.Messages;
@@ -98,12 +99,6 @@ public abstract class AbstractCreateNattableEditorCommand extends AbstractHandle
/** the default description for the table */
private final String defaultDescription = "Table Description"; //$NON-NLS-1$
- /** the description for the table */
- private String description;
-
- /** the name for the table */
- private String name;
-
/** the editor type */
private final String editorType;
@@ -145,7 +140,7 @@ public abstract class AbstractCreateNattableEditorCommand extends AbstractHandle
public Object execute(final ExecutionEvent event) throws ExecutionException {
try {
- runAsTransaction();
+ runAsTransaction(event);
} catch (ServiceException e) {
throw new ExecutionException("Can't create TableEditor", e); //$NON-NLS-1$
}
@@ -159,17 +154,17 @@ public abstract class AbstractCreateNattableEditorCommand extends AbstractHandle
* @throws ServiceException
*
*/
- public void runAsTransaction() throws ServiceException {
+ public void runAsTransaction(ExecutionEvent event) throws ServiceException {
//default Value
- name = defaultName;
- description = defaultDescription;
+ final String name;
+ final String description;
TwoInputDialog dialog = new TwoInputDialog(Display.getCurrent().getActiveShell(), Messages.AbstractCreateNattableEditorCommand_CreateNewTableDialogTitle, Messages.AbstractCreateNattableEditorCommand_CreateNewTableDialog_TableNameMessage, Messages.AbstractCreateNattableEditorCommand_CreateNewTableDialog_TableDescriptionMessage, defaultName, defaultDescription, null);
if(dialog.open() == Dialog.OK) {
//get the name and the description for the table
name = dialog.getValue();
description = dialog.getValue_2();
- final ServicesRegistry serviceRegistry = ServiceUtilsForActionHandlers.getInstance().getServiceRegistry();
+ final ServicesRegistry serviceRegistry = ServiceUtilsForHandlers.getInstance().getServiceRegistry(event);
TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry);
//Create the transactional command
@@ -178,7 +173,7 @@ public abstract class AbstractCreateNattableEditorCommand extends AbstractHandle
@Override
protected IStatus doExecute(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
try {
- AbstractCreateNattableEditorCommand.this.doExecute(serviceRegistry);
+ AbstractCreateNattableEditorCommand.this.doExecute(serviceRegistry, name, description);
} catch (ServiceException e) {
e.printStackTrace();
return Status.CANCEL_STATUS;
@@ -194,7 +189,7 @@ public abstract class AbstractCreateNattableEditorCommand extends AbstractHandle
try {
CheckedOperationHistory.getInstance().execute(command, new NullProgressMonitor(), null);
} catch (ExecutionException e) {
- Activator.getDefault().log.error("Can't create Table Editor", e); //$NON-NLS-1$
+ Activator.log.error("Can't create Table Editor", e); //$NON-NLS-1$
}
}
@@ -207,9 +202,9 @@ public abstract class AbstractCreateNattableEditorCommand extends AbstractHandle
* @throws ServiceException
* @throws NotFoundException
*/
- public void doExecute(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
+ public void doExecute(final ServicesRegistry serviceRegistry, String name, String description) throws ServiceException, NotFoundException {
- Object editorModel = createEditorModel(serviceRegistry);
+ Object editorModel = createEditorModel(serviceRegistry, name, description);
// Get the mngr allowing to add/open new editor.
IPageManager pageMngr = ServiceUtils.getInstance().getIPageManager(serviceRegistry);
// add the new editor model to the sash.
@@ -225,7 +220,7 @@ public abstract class AbstractCreateNattableEditorCommand extends AbstractHandle
* @throws NotFoundException
* The model where to save the TableInstance is not found.
*/
- protected Object createEditorModel(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
+ protected Object createEditorModel(final ServicesRegistry serviceRegistry, String name, String description) throws ServiceException, NotFoundException {
PapyrusTableInstance papyrusTable = PapyrustableinstanceFactory.eINSTANCE.createPapyrusTableInstance();
papyrusTable.setName(name);
papyrusTable.setType(editorType);
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/RecoveryTest.java b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/RecoveryTest.java
index 31987fbeabe..d6b8423e391 100644
--- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/RecoveryTest.java
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/RecoveryTest.java
@@ -33,6 +33,11 @@ import org.junit.Test;
* The Editor should be able to load the valid parts and should not
* fail on the invalid ones
*
+ * In most cases, we're simply interested in opening the Papyrus Editor
+ * (i.e. the model is invalid, so we don't expect to be able to manipulate
+ * the diagrams; but we should still be able to manipulate the editor
+ * and the semantic model, create new digrams, etc).
+ *
* @author Camille Letavernier
*
*/
@@ -50,8 +55,8 @@ public class RecoveryTest extends AbstractEditorIntegrationTest {
//Assert.assertEquals(2, manager.allPages().size());
}
- //Not fixed yet. Bug 401109: [PageManager] Deleting an Activity leads to critical model corruption
- //FIXME Critical
+ //Should work
+ //Bug 401109: [PageManager] Deleting an element which contains an opened page leads to critical model corruption
@Test
public void testInvalidTab() throws Exception {
initModel("invalidTab", "invalid_child_tab");
@@ -107,15 +112,14 @@ public class RecoveryTest extends AbstractEditorIntegrationTest {
Assert.assertEquals(2, pageManager.allPages().size());
}
- @Ignore("Recovery not supported")
- //Not fixed yet. Fails when the <children> tag contains an unresolved local URI (i.e. an invalid uri within the same resource)
- //Works when only the availablePage is invalid
+ @Ignore("Disabled because the Papyrus Editor opens a user dialog. Won't run on Hudson.")
+ //Should work
/** @see {link #testInvalidTab()} */
@Test
public void testProxyTable() throws Exception {
initModel("proxyTable", "proxy_table_recovery");
- IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class);
- Assert.assertEquals(2, pageManager.allPages());
+ //IPageManager pageManager = editor.getServicesRegistry().getService(IPageManager.class);
+ //Assert.assertEquals(2, pageManager.allPages());
}
//This model contains a few different errors (Unresolved proxy, invalid tabs, invalid available pages, ...)
@@ -126,7 +130,6 @@ public class RecoveryTest extends AbstractEditorIntegrationTest {
// Assert.assertEquals(3, pageManager.allPages().size());
}
- //Not fixed yet
//We should be able to delete a diagram, even when there is an invalid page in the model
@Test
public void testDeleteDiagramWithInvalidAvailablePage() throws Exception {

Back to the top