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')
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/runtimevalueseditionactionconfiguration/RuntimeValuesEditionActionConfigurationModelCreation.java29
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/runtimevalueseditionactionconfiguration/RuntimeValuesEditionActionCreationElementValidator.java36
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/runtimevalueseditionactionconfiguration/RuntimeValuesEditionActionEditHelperAdvice.java138
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionEditHelperAdvice.java66
4 files changed, 216 insertions, 53 deletions
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/runtimevalueseditionactionconfiguration/RuntimeValuesEditionActionConfigurationModelCreation.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/runtimevalueseditionactionconfiguration/RuntimeValuesEditionActionConfigurationModelCreation.java
new file mode 100644
index 00000000000..d709ce447ee
--- /dev/null
+++ b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/runtimevalueseditionactionconfiguration/RuntimeValuesEditionActionConfigurationModelCreation.java
@@ -0,0 +1,29 @@
+
+/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * Remi Schnekenburger (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.extendedtypes.emf.runtimevalueseditionactionconfiguration;
+
+import org.eclipse.papyrus.infra.extendedtypes.IActionConfigurationModelCreation;
+
+/**
+ * {@link IActionConfigurationModelCreation} for {@link SetValuesActionConfiguration}
+ */
+public class RuntimeValuesEditionActionConfigurationModelCreation implements IActionConfigurationModelCreation<RuntimeValuesEditionActionConfiguration> {
+
+ /**
+ * {@inheritDoc}
+ */
+ public RuntimeValuesEditionActionConfiguration createConfigurationModel() {
+ return RuntimeValuesEditionActionConfigurationFactory.eINSTANCE.createRuntimeValuesEditionActionConfiguration();
+ }
+}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/runtimevalueseditionactionconfiguration/RuntimeValuesEditionActionCreationElementValidator.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/runtimevalueseditionactionconfiguration/RuntimeValuesEditionActionCreationElementValidator.java
new file mode 100644
index 00000000000..6e0279917f3
--- /dev/null
+++ b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/runtimevalueseditionactionconfiguration/RuntimeValuesEditionActionCreationElementValidator.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * Remi Schnekenburger (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.extendedtypes.emf.runtimevalueseditionactionconfiguration;
+
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.infra.extendedtypes.IActionCreationElementValidator;
+import org.eclipse.papyrus.infra.extendedtypes.ICreationElementValidator;
+
+/**
+ * {@link ICreationElementValidator} for {@link SetValuesActionConfiguration}
+ */
+public class RuntimeValuesEditionActionCreationElementValidator implements IActionCreationElementValidator<RuntimeValuesEditionActionConfiguration> {
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean canCreate(CreateElementRequest request) {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void init(RuntimeValuesEditionActionConfiguration configuration) {
+ }
+}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/runtimevalueseditionactionconfiguration/RuntimeValuesEditionActionEditHelperAdvice.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/runtimevalueseditionactionconfiguration/RuntimeValuesEditionActionEditHelperAdvice.java
new file mode 100644
index 00000000000..5a9b8495d47
--- /dev/null
+++ b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/runtimevalueseditionactionconfiguration/RuntimeValuesEditionActionEditHelperAdvice.java
@@ -0,0 +1,138 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * Remi Schnekenburger (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.extendedtypes.emf.runtimevalueseditionactionconfiguration;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.papyrus.infra.extendedtypes.IActionEditHelperAdvice;
+import org.eclipse.papyrus.infra.extendedtypes.emf.setvaluesactionconfiguration.SetValuesActionConfiguration;
+import org.eclipse.papyrus.views.properties.contexts.View;
+import org.eclipse.papyrus.views.properties.creation.EditionDialog;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * advice for the {@link SetValuesActionConfiguration}
+ */
+public class RuntimeValuesEditionActionEditHelperAdvice extends AbstractEditHelperAdvice implements IActionEditHelperAdvice<RuntimeValuesEditionActionConfiguration> {
+
+ /** list of views to display */
+ protected Set<View> viewsToDisplay;
+
+ /**
+ * {@inheritDoc}
+ */
+ public void init(RuntimeValuesEditionActionConfiguration configuration) {
+ viewsToDisplay = new HashSet<View>();
+ for(ViewToDisplay display : configuration.getViewsToDisplay()) {
+ View view = display.getView();
+ if(view!=null) {
+ viewsToDisplay.add(view);
+ }
+ }
+ }
+
+ /**
+ * Default Constructor
+ */
+ public RuntimeValuesEditionActionEditHelperAdvice() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean approveRequest(IEditCommandRequest request) {
+ return super.approveRequest(request);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ICommand getBeforeCreateCommand(CreateElementRequest request) {
+ return super.getBeforeCreateCommand(request);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ICommand getAfterCreateCommand(CreateElementRequest request) {
+ return super.getAfterCreateCommand(request);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ICommand getBeforeConfigureCommand(ConfigureRequest request) {
+ return super.getBeforeConfigureCommand(request);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ICommand getAfterConfigureCommand(final ConfigureRequest request) {
+ final EObject elementToConfigure = request.getElementToConfigure();
+ if(elementToConfigure==null) {
+ return null;
+ }
+
+ return new AbstractTransactionalCommand(request.getEditingDomain(), "Editing "+EMFCoreUtil.getName(elementToConfigure), Collections.singletonList(WorkspaceSynchronizer.getFile((elementToConfigure.eResource())))) {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ Set<View> viewsToDisplay = getViewsToDisplay();
+ if(!viewsToDisplay.isEmpty()) {
+ EditionDialog dialog = new EditionDialog(Display.getCurrent().getActiveShell()) {
+
+ };
+ dialog.setTitle("Edit "+EMFCoreUtil.getName(elementToConfigure));
+ dialog.setViews(viewsToDisplay);
+ dialog.setInput(elementToConfigure);
+
+ dialog.open();
+ }
+
+ return CommandResult.newOKCommandResult(elementToConfigure);
+ }
+ };
+
+ }
+
+
+ /**
+ * @return the viewsToDisplay
+ */
+ public Set<View> getViewsToDisplay() {
+ return viewsToDisplay;
+ }
+
+}
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 168ba3dc00f..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
@@ -12,41 +12,22 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.extendedtypes.emf.setvaluesactionconfiguration;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
import java.util.Map.Entry;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.core.resources.GMFHelper;
-import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.papyrus.infra.extendedtypes.IActionEditHelperAdvice;
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;
-import org.eclipse.papyrus.views.properties.contexts.View;
-import org.eclipse.papyrus.views.properties.creation.EditionDialog;
-import org.eclipse.papyrus.views.properties.creation.PropertyEditorFactory;
-import org.eclipse.papyrus.views.properties.runtime.ConfigurationManager;
-import org.eclipse.papyrus.views.properties.runtime.ViewConstraintEngine;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
/**
* advice for the {@link SetValuesActionConfiguration}
@@ -56,7 +37,7 @@ public class SetValuesActionEditHelperAdvice extends AbstractEditHelperAdvice im
/** list of the features to set */
//protected Map<String, FeatureValue> featuresToValues = null;
/** list of runtime defined features */
- protected Map<String, FeatureValue> featuresToRuntimeDefinitions = null;
+ //protected Map<String, FeatureValue> featuresToRuntimeDefinitions = null;
/** list of static defined features */
protected Map<String, FeatureValue> featuresToStaticDefinitions = null;
@@ -65,17 +46,13 @@ public class SetValuesActionEditHelperAdvice extends AbstractEditHelperAdvice im
* {@inheritDoc}
*/
public void init(SetValuesActionConfiguration configuration) {
- featuresToRuntimeDefinitions = new HashMap<String, FeatureValue>();
+ //featuresToRuntimeDefinitions = new HashMap<String, FeatureValue>();
featuresToStaticDefinitions = new HashMap<String, FeatureValue>();
if(configuration == null) {
return;
}
for(FeatureToSet featureToSet : configuration.getFeaturesToSet()) {
- if(featureToSet.isAtRuntime()) {
- featuresToRuntimeDefinitions.put(featureToSet.getFeatureName(), featureToSet.getValue());
- } else {
- featuresToStaticDefinitions.put(featureToSet.getFeatureName(), featureToSet.getValue());
- }
+ featuresToStaticDefinitions.put(featureToSet.getFeatureName(), featureToSet.getValue());
}
}
@@ -147,16 +124,16 @@ 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(!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) {
@@ -167,23 +144,6 @@ public class SetValuesActionEditHelperAdvice extends AbstractEditHelperAdvice im
return super.getAfterConfigureCommand(request);
}
- /**
- * @param elementToConfigure
- * @param featuresToRuntimeDefinitions2
- * @param service
- * @param request
- * @return
- */
- protected ICommand getDynamicSetFeatureValueCommand(final EObject elementToConfigure, Map<String, FeatureValue> featuresToRuntimeDefinitions, IElementEditService service, ConfigureRequest request) {
- return new AbstractTransactionalCommand(request.getEditingDomain(), "Editing "+EMFCoreUtil.getName(elementToConfigure), Collections.singletonList(WorkspaceSynchronizer.getFile((elementToConfigure.eResource())))) {
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- new PropertyEditorFactory().edit(Display.getCurrent().getFocusControl(), elementToConfigure);
- return CommandResult.newOKCommandResult();
- }
- };
- }
/**
* @param elementToConfigure

Back to the top