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 /plugins
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
Diffstat (limited to 'plugins')
-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
2 files changed, 15 insertions, 18 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);

Back to the top