Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Roland2014-01-28 05:46:48 -0500
committerPhilippe Roland2014-01-28 05:46:48 -0500
commit0ca6d8ca5205bb9454fb5738a4eab65cc734f30a (patch)
treed843b4233655c32f2e9e8abe2afd5a191829ccab /plugins
parent683979844cf4e169dcb2521a0e2a779f89467f81 (diff)
parentfacae2cf6f3b21b5494899e38c690b24e3113352 (diff)
downloadorg.eclipse.papyrus-0ca6d8ca5205bb9454fb5738a4eab65cc734f30a.tar.gz
org.eclipse.papyrus-0ca6d8ca5205bb9454fb5738a4eab65cc734f30a.tar.xz
org.eclipse.papyrus-0ca6d8ca5205bb9454fb5738a4eab65cc734f30a.zip
Merge branch 'master' of ssh://git.eclipse.org/gitroot/papyrus/org.eclipse.papyrus
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java22
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/cell/EMFFeatureValueCellManager.java21
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/cell/ModelViewsCellManager.java21
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/AbstractCellManager.java5
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/ICellManager.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/dialogs/WarningAndCreateAttributeDialog.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/dialogs/WarningAndCreateParameterDialog.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/ActivityParameterAndParameterSynchronizer.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/PinAndParameterSynchronizer.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/helper/CommunicationUtil.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/command/ConnectorCreateCommand.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/itemsemantic/PropertyPartItemSemanticEditPolicyCN.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyItemSemanticEditPolicy.java24
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationMoveHelper.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java4
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java15
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/StereotypeApplierCellEditorWrapper.java426
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/StereotypeApplierDialogCellEditorWrapper.java104
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java8
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/utils/UMLTableUtils.java27
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/model/UmlModel.java2
21 files changed, 661 insertions, 51 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java
index dacfdea5e41..4c8b093f7a9 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
- *
+ *
* 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
@@ -41,20 +41,21 @@ public class RefreshHandler extends AbstractHandler {
* We use weak references so that we do not block the garbage collection of objects
*/
private static Collection<WeakReference<IRefreshHandlerPart>> PARTS = new LinkedList<WeakReference<IRefreshHandlerPart>>();
-
+
/**
* Register a refresher part that is not attached to any editor
*
* @param refresher
- * The refresher part
+ * The refresher part
*/
public static synchronized void register(IRefreshHandlerPart refresher) {
PARTS.add(new WeakReference<IRefreshHandlerPart>(refresher));
}
-
+
/**
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart activeEditor;
try {
@@ -64,21 +65,22 @@ public class RefreshHandler extends AbstractHandler {
return null;
}
- // Refresh the base GMF objects
- DiagramHelper.refresh(activeEditor);
-
+ //Hooks must be called before the actual refresh, because they typically reset cache
// Call the relevant hooks
callRefresherHooks(activeEditor);
+ // Refresh the base GMF objects
+ DiagramHelper.refresh(activeEditor);
+
return null;
}
-
+
private synchronized void callRefresherHooks(IEditorPart activeEditor) {
Iterator<WeakReference<IRefreshHandlerPart>> iterator = PARTS.iterator();
- while (iterator.hasNext()) {
+ while(iterator.hasNext()) {
WeakReference<IRefreshHandlerPart> wr = iterator.next();
IRefreshHandlerPart part = wr.get();
- if (part != null) {
+ if(part != null) {
part.refresh(activeEditor);
} else {
iterator.remove();
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/cell/EMFFeatureValueCellManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/cell/EMFFeatureValueCellManager.java
index 297e2a3a5cf..7b627dcf198 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/cell/EMFFeatureValueCellManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/manager/cell/EMFFeatureValueCellManager.java
@@ -22,13 +22,11 @@ import java.util.Map;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.UnexecutableCommand;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
@@ -41,8 +39,6 @@ import org.eclipse.papyrus.commands.wrappers.EMFtoGMFCommandWrapper;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.emf.utils.EMFStringValueConverter;
import org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager;
-import org.eclipse.papyrus.infra.nattable.manager.cell.CellManagerFactory;
-import org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.paste.IValueSetter;
import org.eclipse.papyrus.infra.nattable.paste.ReferenceValueSetter;
@@ -183,6 +179,17 @@ public class EMFFeatureValueCellManager extends AbstractCellManager {
* the command to set the value
*/
protected Command getSetValueCommand(final TransactionalEditingDomain domain, final EObject elementToEdit, final EStructuralFeature featureToEdit, final Object newValue) {
+ //426731: [Table 2] Opening then closing cells editors without modifiyng values execute a command in the stack
+ //https://bugs.eclipse.org/bugs/show_bug.cgi?id=426731
+ //1. we verify that the new valu eis not the same thjan the current value
+ final Object currentValue = elementToEdit.eGet(featureToEdit);
+ if(newValue == null && currentValue == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ if(newValue != null && newValue.equals(currentValue)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ //2. if not we do the job
final AbstractEditCommandRequest request = new SetRequest(domain, elementToEdit, featureToEdit, newValue);
final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(elementToEdit);
final ICommand cmd = provider.getEditCommand(request);
@@ -229,9 +236,9 @@ public class EMFFeatureValueCellManager extends AbstractCellManager {
}
return new GMFtoEMFCommandWrapper(returnedCommand);
}
-
-
- protected final ICommand getOpenConfirmChangeContainmentDialogCommand(final TransactionalEditingDomain domain, final ICommand defaultCommand, final boolean isMany){
+
+
+ protected final ICommand getOpenConfirmChangeContainmentDialogCommand(final TransactionalEditingDomain domain, final ICommand defaultCommand, final boolean isMany) {
final String messageDialog;
if(isMany) {
messageDialog = "Your are setting a value in a containment feature. This action will change the owner of the dropped element(s).\nContinue?";
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/cell/ModelViewsCellManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/cell/ModelViewsCellManager.java
index e2ffd90c082..8e44156f8dc 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/cell/ModelViewsCellManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/cell/ModelViewsCellManager.java
@@ -36,6 +36,7 @@ import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
/**
* The Cell manager for the ModelViews table
+ * TODO : should inherits from emf.nattable
*
* @author Vincent Lorenzo
*
@@ -160,9 +161,13 @@ public class ModelViewsCellManager extends AbstractCellManager {
final String featureName = ((String)objects.get(1)).replace(Utils.NATTABLE_EDITOR_PAGE_ID, ""); //$NON-NLS-1$
if(Utils.VIEW_NAME.equals(featureName)) {
final EStructuralFeature feature = editor.eClass().getEStructuralFeature(Utils.VIEW_NAME);
- final AbstractEditCommandRequest request = new SetRequest((TransactionalEditingDomain)domain, editor, feature, newValue);
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(editor);
- return new GMFtoEMFCommandWrapper(provider.getEditCommand(request));
+ if(!newValue.equals(editor.eClass().eGet(feature))) {
+ // 426731: [Table 2] Opening then closing cells editors without modifiyng values execute a command in the stack
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=426731
+ final AbstractEditCommandRequest request = new SetRequest((TransactionalEditingDomain)domain, editor, feature, newValue);
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(editor);
+ return new GMFtoEMFCommandWrapper(provider.getEditCommand(request));
+ }
}
return null;
}
@@ -218,12 +223,10 @@ public class ModelViewsCellManager extends AbstractCellManager {
*/
protected Object getEditorName(final Object editor) {
if(editor instanceof EObject) {
- if(editor instanceof EObject) {
- final EObject eobject = (EObject)editor;
- EStructuralFeature feature = eobject.eClass().getEStructuralFeature(Utils.VIEW_NAME);
- if(feature != null) {
- return eobject.eGet(feature);
- }
+ final EObject eobject = (EObject)editor;
+ EStructuralFeature feature = eobject.eClass().getEStructuralFeature(Utils.VIEW_NAME);
+ if(feature != null) {
+ return eobject.eGet(feature);
}
}
return NOT_AVALAIBLE;
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/AbstractCellManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/AbstractCellManager.java
index e24a9c648e4..a8c7c3fd4f1 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/AbstractCellManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/AbstractCellManager.java
@@ -98,8 +98,9 @@ public abstract class AbstractCellManager implements ICellManager {
@Override
public void setValue(final TransactionalEditingDomain domain, final Object columnElement, final Object rowElement, final Object newValue, final INattableModelManager tableManager) {
final Command cmd = getSetValueCommand(domain, columnElement, rowElement, newValue, tableManager);
- assert cmd != null;
- domain.getCommandStack().execute(cmd);
+ if(cmd != null) {
+ domain.getCommandStack().execute(cmd);
+ }
}
/**
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/ICellManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/ICellManager.java
index f239a73bd7c..b4a83c67385 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/ICellManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/cell/ICellManager.java
@@ -99,7 +99,7 @@ public interface ICellManager {
* the new value to set to the intersection of these 2 objects
* @param tableManager
* @return
- * the command to set the value
+ * the command to set the value or <code>null</code>
*/
public Command getSetValueCommand(final TransactionalEditingDomain domain, final Object columnElement, final Object rowElement, final Object newValue, final INattableModelManager tableManager);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/dialogs/WarningAndCreateAttributeDialog.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/dialogs/WarningAndCreateAttributeDialog.java
index dae3da95831..145ccfb81b6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/dialogs/WarningAndCreateAttributeDialog.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/dialogs/WarningAndCreateAttributeDialog.java
@@ -122,7 +122,7 @@ public class WarningAndCreateAttributeDialog extends MessageDialog {
completeText.append(START_FORM);
StringBuffer impactText = new StringBuffer();
// explore referencing elements
- Collection<Setting> references = CacheAdapter.INSTANCE.getNonNavigableInverseReferences(attributeOwner);
+ Collection<Setting> references = CacheAdapter.getInstance().getNonNavigableInverseReferences(attributeOwner);
HashSet<EObject> impactedElements = new HashSet<EObject>();
for(Setting ref : references) {
EObject referencing = ref.getEObject();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/dialogs/WarningAndCreateParameterDialog.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/dialogs/WarningAndCreateParameterDialog.java
index a752093c42b..b9f8dee4d45 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/dialogs/WarningAndCreateParameterDialog.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/dialogs/WarningAndCreateParameterDialog.java
@@ -129,7 +129,7 @@ public class WarningAndCreateParameterDialog extends MessageDialog {
completeText.append(START_FORM);
StringBuffer impactText = new StringBuffer();
// explore referencing elements
- Collection<Setting> references = CacheAdapter.INSTANCE.getNonNavigableInverseReferences(parameterOwner);
+ Collection<Setting> references = CacheAdapter.getInstance().getNonNavigableInverseReferences(parameterOwner);
HashSet<EObject> impactedElements = new HashSet<EObject>();
for(Setting ref : references) {
EObject referencing = ref.getEObject();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/ActivityParameterAndParameterSynchronizer.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/ActivityParameterAndParameterSynchronizer.java
index 25a20916800..1fd68f4598a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/ActivityParameterAndParameterSynchronizer.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/ActivityParameterAndParameterSynchronizer.java
@@ -220,7 +220,7 @@ public class ActivityParameterAndParameterSynchronizer extends AbstractModelCons
private Set<ActivityParameterNode> getActivityParameterNodesFromParameter(Parameter parameter) {
Set<ActivityParameterNode> references = new HashSet<ActivityParameterNode>();
if(parameter != null) {
- Collection<Setting> inverseReferences = CacheAdapter.INSTANCE.getNonNavigableInverseReferences(parameter);
+ Collection<Setting> inverseReferences = CacheAdapter.getInstance().getNonNavigableInverseReferences(parameter);
for(Setting ref : inverseReferences) {
if(UMLPackage.eINSTANCE.getActivityParameterNode_Parameter().equals(ref.getEStructuralFeature()) && ref.getEObject().eContainer() != null) {
references.add((ActivityParameterNode)ref.getEObject());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/PinAndParameterSynchronizer.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/PinAndParameterSynchronizer.java
index 75edee3fa65..367b37f218c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/PinAndParameterSynchronizer.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/helper/PinAndParameterSynchronizer.java
@@ -803,7 +803,7 @@ public class PinAndParameterSynchronizer extends AbstractModelConstraint {
// explore referencing actions
Set<InvocationAction> callingActions = new HashSet<InvocationAction>();
if(element instanceof Behavior || element instanceof Operation) {
- Collection<Setting> references = CacheAdapter.INSTANCE.getNonNavigableInverseReferences(element);
+ Collection<Setting> references = CacheAdapter.getInstance().getNonNavigableInverseReferences(element);
for(Setting ref : references) {
EObject action = ref.getEObject();
// parameter's owner is action's called Operation
@@ -815,7 +815,7 @@ public class PinAndParameterSynchronizer extends AbstractModelConstraint {
}
}
} else if(element instanceof Signal) {
- Collection<Setting> references = CacheAdapter.INSTANCE.getNonNavigableInverseReferences(element);
+ Collection<Setting> references = CacheAdapter.getInstance().getNonNavigableInverseReferences(element);
for(Setting ref : references) {
EObject action = ref.getEObject();
// parameter's owner is action's sent Signal
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/helper/CommunicationUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/helper/CommunicationUtil.java
index 0d9977fd437..9a60227da9a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/helper/CommunicationUtil.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/helper/CommunicationUtil.java
@@ -203,7 +203,7 @@ public class CommunicationUtil {
if(message == null) {
return null;
}
- Collection<Setting> settings = CacheAdapter.INSTANCE.getNonNavigableInverseReferences(message);
+ Collection<Setting> settings = CacheAdapter.getInstance().getNonNavigableInverseReferences(message);
for(Setting ref : settings) {
if(NotationPackage.eINSTANCE.getView_Element().equals(ref.getEStructuralFeature())) {
View view = (View)ref.getEObject();
@@ -229,7 +229,7 @@ public class CommunicationUtil {
if(execution == null) {
return null;
}
- Collection<Setting> settings = CacheAdapter.INSTANCE.getNonNavigableInverseReferences(execution);
+ Collection<Setting> settings = CacheAdapter.getInstance().getNonNavigableInverseReferences(execution);
for(Setting ref : settings) {
if(NotationPackage.eINSTANCE.getView_Element().equals(ref.getEStructuralFeature())) {
View view = (View)ref.getEObject();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/command/ConnectorCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/command/ConnectorCreateCommand.java
index 8b6d7dcc79c..425c09c1436 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/command/ConnectorCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/command/ConnectorCreateCommand.java
@@ -141,6 +141,7 @@ public class ConnectorCreateCommand extends org.eclipse.papyrus.uml.diagram.comp
if((target != null) && (getContainer() == null)) {
return false;
}
+
// return
// UMLBaseItemSemanticEditPolicy.LinkConstraints.canCreateConnector_4013(getContainer(),
// _getSource(),
@@ -243,7 +244,7 @@ public class ConnectorCreateCommand extends org.eclipse.papyrus.uml.diagram.comp
StructuredClassifier containerProposedBySource = proposedContainer(sourceGraphicalEditPart);
StructuredClassifier containerProposedByTarget = proposedContainer(targetGraphicalEditPart);
-
+
StructuredClassifier deducedContainer = null;
if((containerProposedBySource != null) && (containerProposedByTarget != null)) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/itemsemantic/PropertyPartItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/itemsemantic/PropertyPartItemSemanticEditPolicyCN.java
index 94dac2414e0..a911fec83c6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/itemsemantic/PropertyPartItemSemanticEditPolicyCN.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/edit/policies/itemsemantic/PropertyPartItemSemanticEditPolicyCN.java
@@ -25,7 +25,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipReques
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.component.edit.commands.ConnectorCreateCommand;
+import org.eclipse.papyrus.uml.diagram.component.custom.edit.command.ConnectorCreateCommand;
import org.eclipse.papyrus.uml.diagram.component.edit.parts.ConnectorEditPart;
import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
import org.eclipse.papyrus.uml.service.types.utils.RequestParameterConstants;
@@ -87,6 +87,8 @@ public class PropertyPartItemSemanticEditPolicyCN extends org.eclipse.papyrus.um
@Override
protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Connector_4019 == req.getElementType()) {
+ req.setParameter(org.eclipse.papyrus.uml.diagram.component.custom.edit.policies.GraphicalNodeEditPolicy.CONNECTOR_CREATE_REQUEST_SOURCE_GRAPHICAL, getHost());
+
return getGEFWrapper(new ConnectorCreateCommand(req, req.getSource(), req.getTarget()));
}
return super.getStartCreateRelationshipCommand(req);
@@ -103,6 +105,8 @@ public class PropertyPartItemSemanticEditPolicyCN extends org.eclipse.papyrus.um
@Override
protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
if(UMLElementTypes.Connector_4019 == req.getElementType()) {
+ req.setParameter(org.eclipse.papyrus.uml.diagram.component.custom.edit.policies.GraphicalNodeEditPolicy.CONNECTOR_CREATE_REQUEST_TARGET_GRAPHICAL, getHost());
+
return getGEFWrapper(new ConnectorCreateCommand(req, req.getSource(), req.getTarget()));
}
return super.getCompleteCreateRelationshipCommand(req);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyItemSemanticEditPolicy.java
index 172f026e434..904d15e34f1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyItemSemanticEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/policies/PropertyItemSemanticEditPolicy.java
@@ -67,6 +67,7 @@ import org.eclipse.papyrus.uml.diagram.component.edit.parts.SubstitutionEditPart
import org.eclipse.papyrus.uml.diagram.component.edit.parts.UsageEditPart;
import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
import org.eclipse.papyrus.uml.diagram.component.providers.UMLElementTypes;
+import org.eclipse.papyrus.uml.service.types.utils.RequestParameterConstants;
/**
* @generated
@@ -360,7 +361,25 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic
* @generated
*/
protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
+ ICommand reorientCommand =null;
switch(getVisualID(req)) {
+ case org.eclipse.papyrus.uml.diagram.component.edit.parts.ConnectorEditPart.VISUAL_ID:
+ if(provider == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ // Add graphical new end View in request parameters
+ View targetView = (View)getHost().getModel();
+ req.setParameter(RequestParameterConstants.EDGE_REORIENT_REQUEST_END_VIEW, targetView);
+
+ // Retrieve re-orient command from the Element Edit service
+ reorientCommand = provider.getEditCommand(req);
+ if(reorientCommand == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ return getGEFWrapper(reorientCommand.reduce());
+
case UsageEditPart.VISUAL_ID:
case InterfaceRealizationEditPart.VISUAL_ID:
case SubstitutionEditPart.VISUAL_ID:
@@ -369,12 +388,12 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic
case AbstractionEditPart.VISUAL_ID:
case DependencyEditPart.VISUAL_ID:
case DependencyBranchEditPart.VISUAL_ID:
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(req.getRelationship());
+
if(provider == null) {
return UnexecutableCommand.INSTANCE;
}
// Retrieve re-orient command from the Element Edit service
- ICommand reorientCommand = provider.getEditCommand(req);
+ reorientCommand = provider.getEditCommand(req);
if(reorientCommand == null) {
return UnexecutableCommand.INSTANCE;
}
@@ -398,4 +417,5 @@ public class PropertyItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolic
}
return super.getReorientReferenceRelationshipCommand(req);
}
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationMoveHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationMoveHelper.java
index 70065362963..95e2a773b41 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationMoveHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationMoveHelper.java
@@ -171,7 +171,7 @@ public class OccurrenceSpecificationMoveHelper {
}
// reconnect general ordering from the event
for(GeneralOrdering go : movedOccurrenceSpecification.getToAfters()) {
- Collection<Setting> settings = CacheAdapter.INSTANCE.getNonNavigableInverseReferences(go);
+ Collection<Setting> settings = CacheAdapter.getInstance().getNonNavigableInverseReferences(go);
for(Setting ref : settings) {
if(NotationPackage.eINSTANCE.getView_Element().equals(ref.getEStructuralFeature())) {
View view = (View)ref.getEObject();
@@ -189,7 +189,7 @@ public class OccurrenceSpecificationMoveHelper {
}
// reconnect general ordering to the event
for(GeneralOrdering go : movedOccurrenceSpecification.getToBefores()) {
- Collection<Setting> settings = CacheAdapter.INSTANCE.getNonNavigableInverseReferences(go);
+ Collection<Setting> settings = CacheAdapter.getInstance().getNonNavigableInverseReferences(go);
for(Setting ref : settings) {
if(NotationPackage.eINSTANCE.getView_Element().equals(ref.getEStructuralFeature())) {
View view = (View)ref.getEObject();
@@ -234,7 +234,7 @@ public class OccurrenceSpecificationMoveHelper {
// reconnect message from the event
Message message = ((MessageOccurrenceSpecification)movedOccurrenceSpecification).getMessage();
if(message != null && movedOccurrenceSpecification.equals(message.getSendEvent())) {
- Collection<Setting> settings = CacheAdapter.INSTANCE.getNonNavigableInverseReferences(message);
+ Collection<Setting> settings = CacheAdapter.getInstance().getNonNavigableInverseReferences(message);
for(Setting ref : settings) {
if(NotationPackage.eINSTANCE.getView_Element().equals(ref.getEStructuralFeature())) {
View view = (View)ref.getEObject();
@@ -255,7 +255,7 @@ public class OccurrenceSpecificationMoveHelper {
}
// reconnect message to the event
if(message != null && movedOccurrenceSpecification.equals(message.getReceiveEvent())) {
- Collection<Setting> settings = CacheAdapter.INSTANCE.getNonNavigableInverseReferences(message);
+ Collection<Setting> settings = CacheAdapter.getInstance().getNonNavigableInverseReferences(message);
for(Setting ref : settings) {
if(NotationPackage.eINSTANCE.getView_Element().equals(ref.getEStructuralFeature())) {
View view = (View)ref.getEObject();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java
index bd93c885fc6..de8d138f3bf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/SequenceUtil.java
@@ -832,7 +832,7 @@ public class SequenceUtil {
if(message == null) {
return null;
}
- Collection<Setting> settings = CacheAdapter.INSTANCE.getNonNavigableInverseReferences(message);
+ Collection<Setting> settings = CacheAdapter.getInstance().getNonNavigableInverseReferences(message);
for(Setting ref : settings) {
if(NotationPackage.eINSTANCE.getView_Element().equals(ref.getEStructuralFeature())) {
View view = (View)ref.getEObject();
@@ -858,7 +858,7 @@ public class SequenceUtil {
if(execution == null) {
return null;
}
- Collection<Setting> settings = CacheAdapter.INSTANCE.getNonNavigableInverseReferences(execution);
+ Collection<Setting> settings = CacheAdapter.getInstance().getNonNavigableInverseReferences(execution);
for(Setting ref : settings) {
if(NotationPackage.eINSTANCE.getView_Element().equals(ref.getEStructuralFeature())) {
View view = (View)ref.getEObject();
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java
index ec321760dad..a70adb0d6b9 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/config/UMLFeatureCellEditorConfig.java
@@ -15,12 +15,12 @@ import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider;
import org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor;
+import org.eclipse.nebula.widgets.nattable.edit.gui.AbstractDialogCellEditor;
import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
import org.eclipse.papyrus.infra.emf.nattable.celleditor.config.EStructuralFeatureEditorConfig;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
@@ -35,6 +35,8 @@ import org.eclipse.papyrus.uml.nattable.editor.MultiReferenceCellEditor;
import org.eclipse.papyrus.uml.nattable.editor.MultiStringCellEditor;
import org.eclipse.papyrus.uml.nattable.editor.MultiUnlimitedNaturalCellEditor;
import org.eclipse.papyrus.uml.nattable.editor.SingleReferenceValueCellEditor;
+import org.eclipse.papyrus.uml.nattable.editor.StereotypeApplierCellEditorWrapper;
+import org.eclipse.papyrus.uml.nattable.editor.StereotypeApplierDialogCellEditorWrapper;
import org.eclipse.papyrus.uml.nattable.utils.UMLTableUtils;
import org.eclipse.papyrus.uml.nattable.validator.RealDataValidator;
import org.eclipse.papyrus.uml.nattable.validator.UnlimitedNaturalDataValidator;
@@ -133,7 +135,6 @@ public class UMLFeatureCellEditorConfig extends EStructuralFeatureEditorConfig {
// conf.setAction(action);
// conf.setTooltipText("Open a dialog to select the value");
// editor = new ComboBoxWithButtonCellEditor(dataProvider, conf);
- INattableModelManager manager = (INattableModelManager)elementProvider;
editor = new SingleReferenceValueCellEditor(axisElement, elementProvider);
break;
case SINGLE_UML_ENUMERATION:
@@ -167,6 +168,14 @@ public class UMLFeatureCellEditorConfig extends EStructuralFeatureEditorConfig {
editor = super.getICellEditor(table, axisElement, elementProvider);
break;
}
+ // to apply required stereotype before edition
+ // see bug 426709: [Table 2][Stereotype] Papyrus Table must allows to edit stereotype properties even if the required stereotypes is not yet applied
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=426709
+ if(editor instanceof AbstractDialogCellEditor) {
+ editor = new StereotypeApplierDialogCellEditorWrapper((AbstractDialogCellEditor)editor, axisElement, elementProvider);
+ } else if(editor instanceof ICellEditor) {
+ editor = new StereotypeApplierCellEditorWrapper(editor, axisElement, elementProvider);
+ }
return editor;
}
@@ -499,4 +508,4 @@ public class UMLFeatureCellEditorConfig extends EStructuralFeatureEditorConfig {
public String getEditorConfigId() {
return EDITOR_CONFIG_ID;
}
-} \ No newline at end of file
+}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/StereotypeApplierCellEditorWrapper.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/StereotypeApplierCellEditorWrapper.java
new file mode 100644
index 00000000000..c7871b0a79a
--- /dev/null
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/StereotypeApplierCellEditorWrapper.java
@@ -0,0 +1,426 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.nattable.editor;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.edit.ICellEditHandler;
+import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
+import org.eclipse.nebula.widgets.nattable.edit.editor.IEditErrorHandler;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum;
+import org.eclipse.nebula.widgets.nattable.widget.EditModeEnum;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+import org.eclipse.papyrus.uml.nattable.utils.UMLTableUtils;
+import org.eclipse.papyrus.uml.tools.commands.ApplyStereotypeCommand;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ * Wrapper to apply stereotypes if required before to do the edition
+ * see bug 426709: [Table 2][Stereotype] Papyrus Table must allows to edit stereotype properties even if the required stereotypes is not yet applied
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=426709
+ *
+ * elementProvider
+ */
+public class StereotypeApplierCellEditorWrapper implements ICellEditor {
+
+ /** the wrapped celleditor. */
+ protected final ICellEditor wrappedCellEditor;
+
+ /**
+ * the edited axis
+ */
+ protected final Object axisElement;
+
+ /**
+ * the table element provider
+ */
+ protected final ITableAxisElementProvider elementProvider;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param wrappedCellEditor
+ * the wrapped cell editor
+ * @param axisElement
+ * the edited axis
+ * @param elementProvider
+ * the axis element provider
+ */
+ public StereotypeApplierCellEditorWrapper(final ICellEditor wrappedCellEditor, final Object axisElement, final ITableAxisElementProvider elementProvider) {
+ this.wrappedCellEditor = wrappedCellEditor;
+ this.axisElement = axisElement;
+ this.elementProvider = elementProvider;
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#activateCell(org.eclipse.swt.widgets.Composite, java.lang.Object,
+ * org.eclipse.nebula.widgets.nattable.widget.EditModeEnum, org.eclipse.nebula.widgets.nattable.edit.ICellEditHandler,
+ * org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell, org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param parent
+ * @param originalCanonicalValue
+ * @param editMode
+ * @param editHandler
+ * @param cell
+ * @param configRegistry
+ * @return
+ */
+
+ @Override
+ public Control activateCell(Composite parent, Object originalCanonicalValue, EditModeEnum editMode, ICellEditHandler editHandler, ILayerCell cell, IConfigRegistry configRegistry) {
+ int columnIndex = cell.getColumnIndex();
+ int rowIndex = cell.getRowIndex();
+ Object row = this.elementProvider.getRowElement(rowIndex);
+ Object column = this.elementProvider.getColumnElement(columnIndex);
+ row = AxisUtils.getRepresentedElement(row);
+ column = AxisUtils.getRepresentedElement(column);
+ Element editedElement = null;
+ Object feature = null;
+ if(row instanceof EObject && column == this.axisElement) {
+ editedElement = (Element)row;
+ feature = column;
+ } else {
+ editedElement = (Element)column;
+ feature = row;
+ }
+
+ if(!(feature instanceof EStructuralFeature)) {
+ final String id = AxisUtils.getPropertyId(this.axisElement);
+ applyRequiredStereotype(editedElement, id);
+ }
+ return this.wrappedCellEditor.activateCell(parent, originalCanonicalValue, editMode, editHandler, cell, configRegistry);
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#getColumnIndex()
+ *
+ * @return
+ */
+
+ @Override
+ public int getColumnIndex() {
+ return this.wrappedCellEditor.getColumnIndex();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#getRowIndex()
+ *
+ * @return
+ */
+
+ @Override
+ public int getRowIndex() {
+ return this.wrappedCellEditor.getRowIndex();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#getColumnPosition()
+ *
+ * @return
+ */
+
+ @Override
+ public int getColumnPosition() {
+ return this.wrappedCellEditor.getColumnPosition();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#getRowPosition()
+ *
+ * @return
+ */
+
+ @Override
+ public int getRowPosition() {
+ return this.wrappedCellEditor.getRowPosition();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#getEditorValue()
+ *
+ * @return
+ */
+
+ @Override
+ public Object getEditorValue() {
+ return this.wrappedCellEditor.getEditorValue();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#setEditorValue(java.lang.Object)
+ *
+ * @param value
+ */
+
+ @Override
+ public void setEditorValue(Object value) {
+ this.wrappedCellEditor.setEditorValue(value);
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#getCanonicalValue()
+ *
+ * @return
+ */
+
+ @Override
+ public Object getCanonicalValue() {
+ return this.wrappedCellEditor.getCanonicalValue();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#getCanonicalValue(org.eclipse.nebula.widgets.nattable.edit.editor.IEditErrorHandler)
+ *
+ * @param conversionErrorHandler
+ * @return
+ */
+
+ @Override
+ public Object getCanonicalValue(IEditErrorHandler conversionErrorHandler) {
+ return this.wrappedCellEditor.getCanonicalValue(conversionErrorHandler);
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#setCanonicalValue(java.lang.Object)
+ *
+ * @param canonicalValue
+ */
+
+ @Override
+ public void setCanonicalValue(Object canonicalValue) {
+ this.wrappedCellEditor.setCanonicalValue(canonicalValue);
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#validateCanonicalValue(java.lang.Object)
+ *
+ * @param canonicalValue
+ * @return
+ */
+
+ @Override
+ public boolean validateCanonicalValue(Object canonicalValue) {
+ return this.wrappedCellEditor.validateCanonicalValue(canonicalValue);
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#validateCanonicalValue(java.lang.Object,
+ * org.eclipse.nebula.widgets.nattable.edit.editor.IEditErrorHandler)
+ *
+ * @param canonicalValue
+ * @param validationErrorHandler
+ * @return
+ */
+
+ @Override
+ public boolean validateCanonicalValue(Object canonicalValue, IEditErrorHandler validationErrorHandler) {
+ return this.wrappedCellEditor.validateCanonicalValue(canonicalValue, validationErrorHandler);
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#commit(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum)
+ *
+ * @param direction
+ * @return
+ */
+
+ @Override
+ public boolean commit(MoveDirectionEnum direction) {
+ return this.wrappedCellEditor.commit(direction);
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#commit(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum,
+ * boolean)
+ *
+ * @param direction
+ * @param closeAfterCommit
+ * @return
+ */
+
+ @Override
+ public boolean commit(MoveDirectionEnum direction, boolean closeAfterCommit) {
+ return this.wrappedCellEditor.commit(direction, closeAfterCommit);
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#commit(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectionEnum,
+ * boolean, boolean)
+ *
+ * @param direction
+ * @param closeAfterCommit
+ * @param skipValidation
+ * @return
+ */
+
+ @Override
+ public boolean commit(MoveDirectionEnum direction, boolean closeAfterCommit, boolean skipValidation) {
+ return this.wrappedCellEditor.commit(direction, closeAfterCommit, skipValidation);
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#close()
+ *
+ */
+
+ @Override
+ public void close() {
+ this.wrappedCellEditor.close();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#isClosed()
+ *
+ * @return
+ */
+
+ @Override
+ public boolean isClosed() {
+ return this.wrappedCellEditor.isClosed();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#getEditorControl()
+ *
+ * @return
+ */
+
+ @Override
+ public Control getEditorControl() {
+ return this.wrappedCellEditor.getEditorControl();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#createEditorControl(org.eclipse.swt.widgets.Composite)
+ *
+ * @param parent
+ * @return
+ */
+
+ @Override
+ public Control createEditorControl(Composite parent) {
+ return this.wrappedCellEditor.createEditorControl(parent);
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#openInline(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry,
+ * java.util.List)
+ *
+ * @param configRegistry
+ * @param configLabels
+ * @return
+ */
+
+ @Override
+ public boolean openInline(IConfigRegistry configRegistry, List<String> configLabels) {
+ return this.wrappedCellEditor.openInline(configRegistry, configLabels);
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#supportMultiEdit(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry,
+ * java.util.List)
+ *
+ * @param configRegistry
+ * @param configLabels
+ * @return
+ */
+
+ @Override
+ public boolean supportMultiEdit(IConfigRegistry configRegistry, List<String> configLabels) {
+ return this.wrappedCellEditor.supportMultiEdit(configRegistry, configLabels);
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#openAdjacentEditor()
+ *
+ * @return
+ */
+
+ @Override
+ public boolean openAdjacentEditor() {
+ return this.wrappedCellEditor.openAdjacentEditor();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#activateAtAnyPosition()
+ *
+ * @return
+ */
+
+ @Override
+ public boolean activateAtAnyPosition() {
+ return this.wrappedCellEditor.activateAtAnyPosition();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#addEditorControlListeners()
+ *
+ */
+
+ @Override
+ public void addEditorControlListeners() {
+ this.wrappedCellEditor.addEditorControlListeners();
+ }
+
+ /**
+ * Removes the editor control listeners.
+ *
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor#removeEditorControlListeners()
+ */
+
+ @Override
+ public void removeEditorControlListeners() {
+ this.wrappedCellEditor.removeEditorControlListeners();
+ }
+
+ /**
+ *
+ * @param el
+ * an element of the model
+ * @param propertyId
+ * the id of the edited property
+ * @return <code>true</code> if a stereotype has been applied
+ */
+ private static final boolean applyRequiredStereotype(final Element el, final String propertyId) {
+ if(UMLTableUtils.getAppliedStereotypesWithThisProperty(el, propertyId).size() == 0) {
+ final List<Stereotype> stereotypesList = UMLTableUtils.getApplicableStereotypesWithThisProperty(el, propertyId);
+ if(stereotypesList.size() == 1) {
+ TransactionalEditingDomain domain = null;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(el);
+ final ApplyStereotypeCommand applyCommand = new ApplyStereotypeCommand(el, stereotypesList.get(0), domain);
+ domain.getCommandStack().execute(applyCommand);
+ return true;
+ } catch (ServiceException e) {
+ Activator.log.error("EditingDomain not found", e); //$NON-NLS-1$
+ }
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/StereotypeApplierDialogCellEditorWrapper.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/StereotypeApplierDialogCellEditorWrapper.java
new file mode 100644
index 00000000000..ae176b4a7c7
--- /dev/null
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/editor/StereotypeApplierDialogCellEditorWrapper.java
@@ -0,0 +1,104 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.nattable.editor;
+
+import java.util.Map;
+
+import org.eclipse.nebula.widgets.nattable.edit.EditTypeEnum;
+import org.eclipse.nebula.widgets.nattable.edit.gui.AbstractDialogCellEditor;
+import org.eclipse.nebula.widgets.nattable.edit.gui.ICellEditDialog;
+import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
+
+
+/**
+ * Wrapper for cell editor dialogs
+ * see bug 426709: [Table 2][Stereotype] Papyrus Table must allows to edit stereotype properties even if the required stereotypes is not yet applied
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=426709
+ */
+public class StereotypeApplierDialogCellEditorWrapper extends StereotypeApplierCellEditorWrapper implements ICellEditDialog {
+
+ /**
+ * Instantiates a new stereotyped element dialog cell editor wrapper.
+ *
+ * @param wrappedCellEditor
+ * the wrapped cell editor
+ * @param axisElement
+ * the edited axis
+ * @param elementProvider
+ * the axis element provider
+ */
+ public StereotypeApplierDialogCellEditorWrapper(final AbstractDialogCellEditor wrappedCellEditor, final Object axisElement, final ITableAxisElementProvider elementProvider) {
+ super(wrappedCellEditor, axisElement, elementProvider);
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.gui.ICellEditDialog#getCommittedValue()
+ *
+ * @return
+ */
+
+ @Override
+ public Object getCommittedValue() {
+ return ((AbstractDialogCellEditor)this.wrappedCellEditor).getCommittedValue();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.gui.ICellEditDialog#getEditType()
+ *
+ * @return
+ */
+
+ @Override
+ public EditTypeEnum getEditType() {
+ return ((AbstractDialogCellEditor)this.wrappedCellEditor).getEditType();
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.gui.ICellEditDialog#calculateValue(java.lang.Object, java.lang.Object)
+ *
+ * @param currentValue
+ * @param processValue
+ * @return
+ */
+
+ @Override
+ public Object calculateValue(Object currentValue, Object processValue) {
+ return ((AbstractDialogCellEditor)this.wrappedCellEditor).calculateValue(currentValue, processValue);
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.edit.gui.ICellEditDialog#open()
+ *
+ * @return
+ */
+
+ @Override
+ public int open() {
+ return ((AbstractDialogCellEditor)this.wrappedCellEditor).open();
+ }
+
+ /**
+ * Sets the dialog settings.
+ *
+ * @param editDialogSettings
+ * the edit dialog settings
+ * @see org.eclipse.nebula.widgets.nattable.edit.gui.ICellEditDialog#setDialogSettings(java.util.Map)
+ */
+
+ @Override
+ public void setDialogSettings(Map<String, Object> editDialogSettings) {
+ ((AbstractDialogCellEditor)this.wrappedCellEditor).setDialogSettings(editDialogSettings);
+ }
+
+}
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java
index 090ef4431d7..df1a74c8e4d 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/cell/StereotypePropertyCellManager.java
@@ -141,9 +141,15 @@ public class StereotypePropertyCellManager extends UMLFeatureCellManager {
final List<Object> umlObjects = organizeAndResolvedObjects(columnElement, rowElement, null);
final Element el = (Element)umlObjects.get(0);
final String id = (String)umlObjects.get(1);
+ final Property prop = UMLTableUtils.getRealStereotypeProperty(el, id);
switch(UMLTableUtils.getAppliedStereotypesWithThisProperty(el, id).size()) {
+ case 0:
+ // to apply required stereotype before edition
+ // see bug 426709: [Table 2][Stereotype] Papyrus Table must allows to edit stereotype properties even if the required stereotypes is not yet applied
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=426709
+ final int nbApplicablesSte = UMLTableUtils.getApplicableStereotypesWithThisProperty(el, id).size();
+ return nbApplicablesSte == 1 && !prop.isDerived() && !prop.isReadOnly();
case 1:
- final Property prop = UMLTableUtils.getRealStereotypeProperty(el, id);
return !prop.isDerived() && !prop.isReadOnly();
default:
return false;
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/utils/UMLTableUtils.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/utils/UMLTableUtils.java
index 61526ace9c2..cefd7a205f1 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/utils/UMLTableUtils.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/utils/UMLTableUtils.java
@@ -143,6 +143,33 @@ public class UMLTableUtils {
* the UML::Element on which we are looking for applied Stereotype with the property identified by its id
* @param id
* the id used to identify the property of the stereotype
+ *
+ * @return
+ * the list of UML::Stereotype which have the property identified by this id and which are applied on the Element or <code>null</code> if
+ * we can't resolve it (the required profile is not applied)
+ */
+ public static final List<Stereotype> getApplicableStereotypesWithThisProperty(final Element element, final String id) {
+ assert id.startsWith(PROPERTY_OF_STEREOTYPE_PREFIX);
+ final List<Stereotype> stereotypes = new ArrayList<Stereotype>();
+ if(element.eResource() != null) {
+ final Object prop = getRealStereotypeProperty(element, id);
+ if(prop instanceof Property) {
+ for(final Stereotype current : element.getApplicableStereotypes()) {
+ if(current.getAllAttributes().contains(prop)) {
+ stereotypes.add(current);
+ }
+ }
+ }
+ }
+ return stereotypes;
+ }
+
+ /**
+ *
+ * @param element
+ * the UML::Element on which we are looking for applied Stereotype with the property identified by its id
+ * @param id
+ * the id used to identify the property of the stereotype
* @param sharedMap
* a map owning interesting information, like {@link StereotypeApplicationStructure} which can be used to find stereotype, stereotype
* application and so on
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/model/UmlModel.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/model/UmlModel.java
index 773ef2b7ba2..eac2984ff4d 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/model/UmlModel.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/model/UmlModel.java
@@ -118,7 +118,7 @@ public class UmlModel extends AbstractBaseModel implements IModel {
@Override
public void unload() {
if(resource != null) {
- CacheAdapter.INSTANCE.clear(resource);
+ CacheAdapter.getInstance().clear(resource);
}
super.unload();
}

Back to the top