Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2012-09-10 14:41:47 +0000
committervlorenzo2012-09-10 14:41:47 +0000
commite98c6e561e6ffb67c29234ebad7941684b7f0694 (patch)
tree491a8793e10bed007d83dd51f8adddfdaee20bd1
parent22e6c8b6dc84d904f790d87621fc251c1f9d490a (diff)
downloadorg.eclipse.papyrus-e98c6e561e6ffb67c29234ebad7941684b7f0694.tar.gz
org.eclipse.papyrus-e98c6e561e6ffb67c29234ebad7941684b7f0694.tar.xz
org.eclipse.papyrus-e98c6e561e6ffb67c29234ebad7941684b7f0694.zip
389144: [Table] Control Mode : The new EFacet Table should be managed by the control mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=389144 A first steps of the development for the ControlMode
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet.controlmode/src/org/eclipse/papyrus/infra/table/efacet/controlmode/Activator.java3
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet.controlmode/src/org/eclipse/papyrus/infra/table/efacet/controlmode/handlers/PapyrusTableControlCommand.java7
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet.controlmode/src/org/eclipse/papyrus/infra/table/efacet/controlmode/helpers/PapyrusTableMoveHelper.java46
3 files changed, 46 insertions, 10 deletions
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet.controlmode/src/org/eclipse/papyrus/infra/table/efacet/controlmode/Activator.java b/incoming/org.eclipse.papyrus.infra.table.efacet.controlmode/src/org/eclipse/papyrus/infra/table/efacet/controlmode/Activator.java
index a03c6c6a680..6c72f36abaf 100644
--- a/incoming/org.eclipse.papyrus.infra.table.efacet.controlmode/src/org/eclipse/papyrus/infra/table/efacet/controlmode/Activator.java
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet.controlmode/src/org/eclipse/papyrus/infra/table/efacet/controlmode/Activator.java
@@ -1,5 +1,6 @@
package org.eclipse.papyrus.infra.table.efacet.controlmode;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -14,6 +15,7 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
+ public static LogHelper log;
/**
* The constructor
*/
@@ -27,6 +29,7 @@ public class Activator extends AbstractUIPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ log = new LogHelper(this);
}
/*
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet.controlmode/src/org/eclipse/papyrus/infra/table/efacet/controlmode/handlers/PapyrusTableControlCommand.java b/incoming/org.eclipse.papyrus.infra.table.efacet.controlmode/src/org/eclipse/papyrus/infra/table/efacet/controlmode/handlers/PapyrusTableControlCommand.java
index 4b34ad1dc11..738375abc9e 100644
--- a/incoming/org.eclipse.papyrus.infra.table.efacet.controlmode/src/org/eclipse/papyrus/infra/table/efacet/controlmode/handlers/PapyrusTableControlCommand.java
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet.controlmode/src/org/eclipse/papyrus/infra/table/efacet/controlmode/handlers/PapyrusTableControlCommand.java
@@ -18,6 +18,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.papyrus.infra.core.resource.notation.NotationModel;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel;
import org.eclipse.papyrus.infra.services.controlmode.commands.IControlCommand;
import org.eclipse.papyrus.infra.table.efacet.controlmode.helpers.PapyrusTableMoveHelper;
@@ -36,6 +37,10 @@ public class PapyrusTableControlCommand implements IControlCommand {
case POST_NOTATION:
PapyrusTableMoveHelper.addAllTableMoveCommands(domain, selection, target, commandToModify);
break;
+ case POST_DI:
+ //I think that we will need to the SashWindowsMngr to add the pages...
+ //PapyrusTableMoveHelper.addAllPageRefTableMoveCommands(domain, selection, source, target, commandToModify);
+ break;
default:
}
}
@@ -44,7 +49,7 @@ public class PapyrusTableControlCommand implements IControlCommand {
* {@inheritDoc}
*/
public boolean provides(final EObject selection, final STATE_CONTROL state, final Resource source, final Resource target) {
- return NotationModel.NOTATION_FILE_EXTENSION.equals(target.getURI().fileExtension());
+ return NotationModel.NOTATION_FILE_EXTENSION.equals(target.getURI().fileExtension()) || DiModel.DI_FILE_EXTENSION.equals(target.getURI().fileExtension());
}
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet.controlmode/src/org/eclipse/papyrus/infra/table/efacet/controlmode/helpers/PapyrusTableMoveHelper.java b/incoming/org.eclipse.papyrus.infra.table.efacet.controlmode/src/org/eclipse/papyrus/infra/table/efacet/controlmode/helpers/PapyrusTableMoveHelper.java
index c6f78ecbbc9..99b14158dd0 100644
--- a/incoming/org.eclipse.papyrus.infra.table.efacet.controlmode/src/org/eclipse/papyrus/infra/table/efacet/controlmode/helpers/PapyrusTableMoveHelper.java
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet.controlmode/src/org/eclipse/papyrus/infra/table/efacet/controlmode/helpers/PapyrusTableMoveHelper.java
@@ -24,11 +24,16 @@ import org.eclipse.emf.ecore.EStructuralFeature.Setting;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.TableInstance;
+import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.Table;
import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.TablePackage;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
+import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr;
+import org.eclipse.papyrus.infra.core.sashwindows.di.exception.SashEditorException;
+import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
import org.eclipse.papyrus.infra.core.utils.PapyrusEcoreUtils;
+import org.eclipse.papyrus.infra.table.efacet.controlmode.Activator;
import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrustablePackage;
import org.eclipse.papyrus.views.modelexplorer.commands.MoveOpenableCommand;
@@ -137,15 +142,15 @@ public class PapyrusTableMoveHelper {
boolean result = true;
if(setting != null) {
final EObject settingEObject = setting.getEObject();
- result &= settingEObject instanceof TableInstance;
+ result &= settingEObject instanceof Table;
result &= setting.getEStructuralFeature() == TablePackage.Literals.TABLE__CONTEXT;
-
- final Collection<Setting> references = PapyrusEcoreUtils.getUsages(settingEObject);
- final Iterable<Setting> papyrusTableInstances = Iterables.filter(references, keepPapyrusTableInstances);
- //Veryfing that there is at least one papyrusTableInstance
- result = result && !Iterables.isEmpty(papyrusTableInstances);
- System.out.println("result2 = " + result);
-
+ final EObject container = settingEObject;//.eContainer();
+ if(container instanceof Table) {
+ final Collection<Setting> references = PapyrusEcoreUtils.getUsages(container);
+ final Iterable<Setting> papyrusTableInstances = Iterables.filter(references, keepPapyrusTableInstances);
+ //Veryfing that there is at least one papyrusTableInstance
+ result = result && !Iterables.isEmpty(papyrusTableInstances);
+ }
} else {
result = false;
}
@@ -185,4 +190,27 @@ public class PapyrusTableMoveHelper {
return result;
}
+
+ public static void addAllPageRefTableMoveCommands(EditingDomain domain, EObject selection, Resource source, Resource target, CompoundCommand commandToModify) {
+
+ //TODO should be done in a command.
+ //we need to get the SashWindowsMngr
+ // SashWindowsMngr windowsMngr = null;
+ // // Resource diResource = SashModelUtils.getSashModel(target.).getResource();
+ // Resource diResource = source;
+ //
+ // for(final EObject current : createDescendantTablesIterable(selection)) {
+ // PageRef pageRef = DiUtils.getPageRef(diResource, current);
+ // if(pageRef != null) {
+ // windowsMngr.getPageList().addPage(pageRef.getPageIdentifier());
+ // try {
+ // DiUtils.addPageToTabFolder(windowsMngr, pageRef);
+ // } catch (SashEditorException e) {
+ // Activator.log.error(e);
+ // }
+ // }
+ //
+ // }
+
+ }
}

Back to the top