Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionEditHelperAdvice.java')
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionEditHelperAdvice.java64
1 files changed, 41 insertions, 23 deletions
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionEditHelperAdvice.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionEditHelperAdvice.java
index 6735e1dd390..e27e08a6e78 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionEditHelperAdvice.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionEditHelperAdvice.java
@@ -29,28 +29,33 @@ import org.eclipse.papyrus.infra.extendedtypes.emf.Activator;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-
/**
* advice for the {@link SetValuesActionConfiguration}
*/
public class SetValuesActionEditHelperAdvice extends AbstractEditHelperAdvice implements IActionEditHelperAdvice<SetValuesActionConfiguration> {
-
+
/** list of the features to set */
- protected Map<String, FeatureValue> featuresToValues = null;
+ //protected Map<String, FeatureValue> featuresToValues = null;
+ /** list of runtime defined features */
+ //protected Map<String, FeatureValue> featuresToRuntimeDefinitions = null;
+
+ /** list of static defined features */
+ protected Map<String, FeatureValue> featuresToStaticDefinitions = null;
/**
* {@inheritDoc}
*/
public void init(SetValuesActionConfiguration configuration) {
- featuresToValues= new HashMap<String, FeatureValue>(); // reset of the map
- if(configuration==null) {
+ //featuresToRuntimeDefinitions = new HashMap<String, FeatureValue>();
+ featuresToStaticDefinitions = new HashMap<String, FeatureValue>();
+ if(configuration == null) {
return;
}
for(FeatureToSet featureToSet : configuration.getFeaturesToSet()) {
- featuresToValues.put(featureToSet.getFeatureName(), featureToSet.getValue());
+ featuresToStaticDefinitions.put(featureToSet.getFeatureName(), featureToSet.getValue());
}
}
-
+
/**
* Default Constructor
*/
@@ -71,7 +76,7 @@ public class SetValuesActionEditHelperAdvice extends AbstractEditHelperAdvice im
protected ICommand getBeforeCreateCommand(CreateElementRequest request) {
return super.getBeforeCreateCommand(request);
}
-
+
/**
* {@inheritDoc}
*/
@@ -79,7 +84,7 @@ public class SetValuesActionEditHelperAdvice extends AbstractEditHelperAdvice im
protected ICommand getAfterCreateCommand(CreateElementRequest request) {
return super.getAfterCreateCommand(request);
}
-
+
/**
* {@inheritDoc}
*/
@@ -107,7 +112,7 @@ public class SetValuesActionEditHelperAdvice extends AbstractEditHelperAdvice im
return null;
}
- for(Entry<String, FeatureValue> featureEntry: featuresToValues.entrySet()) {
+ for(Entry<String, FeatureValue> featureEntry: featuresToStaticDefinitions.entrySet()) {
// retrieve feature value
ICommand command = getSetFeatureValueCommand(elementToConfigure, featureEntry.getKey(), featureEntry.getValue(), service, request);
if(command !=null) {
@@ -118,6 +123,19 @@ public class SetValuesActionEditHelperAdvice extends AbstractEditHelperAdvice im
}
}
}
+
+// if(!featuresToRuntimeDefinitions.isEmpty()) {
+// ICommand command = getDynamicSetFeatureValueCommand(elementToConfigure, featuresToRuntimeDefinitions, service, request);
+// if(command !=null) {
+// if(resultCommand == null) {
+// resultCommand = command;
+// } else {
+// resultCommand = resultCommand.compose(command);
+// }
+// }
+// }
+
+
if(resultCommand!=null) {
return resultCommand.reduce();
}
@@ -126,34 +144,34 @@ public class SetValuesActionEditHelperAdvice extends AbstractEditHelperAdvice im
return super.getAfterConfigureCommand(request);
}
+
/**
- * @param elementToConfigure the eobject to configure
- * @param name the name of the feature to set
- * @param value the new value of the feature
+ * @param elementToConfigure
+ * the eobject to configure
+ * @param name
+ * the name of the feature to set
+ * @param value
+ * the new value of the feature
*/
protected ICommand getSetFeatureValueCommand(EObject elementToConfigure, String name, FeatureValue featureValue, IElementEditService service, ConfigureRequest configureRequest) {
- if(name==null) {
+ if(name == null) {
Activator.log.debug("No feature name has been set.");
return null;
}
- if(elementToConfigure.eClass() ==null) {
- Activator.log.error("Impossible to find EClass from EObject: "+elementToConfigure, null);
+ if(elementToConfigure.eClass() == null) {
+ Activator.log.error("Impossible to find EClass from EObject: " + elementToConfigure, null);
return null;
}
// retrieve structural feature for the element to configure
EStructuralFeature feature = elementToConfigure.eClass().getEStructuralFeature(name);
- if(feature ==null) {
- Activator.log.error("Impossible to find feature "+name+" for eobject "+elementToConfigure, null);
- return null;
+ if(feature == null) {
+ Activator.log.error("Impossible to find feature " + name + " for eobject " + elementToConfigure, null);
+ return null;
}
-
Object value = FeatureValueUtils.getValue(elementToConfigure, feature, featureValue);
-
-
SetRequest request = new SetRequest(elementToConfigure, feature, value);
// duplicate parameters from configure request?
request.addParameters(configureRequest.getParameters());
-
return service.getEditCommand(request);
}
}

Back to the top