Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2014-02-18 15:18:55 +0000
committerptessier2014-02-18 15:18:55 +0000
commitc45050eef7a8b729c3c5519a682fc021034bef46 (patch)
tree604312c722ef35fcdf456172d116d4c358410d9f
parent696699135625f4aecd0014601073adbbe81e916e (diff)
parentd678c26eea16eea70b7b65cf9aff41e7f8512aa4 (diff)
downloadorg.eclipse.papyrus-c45050eef7a8b729c3c5519a682fc021034bef46.tar.gz
org.eclipse.papyrus-c45050eef7a8b729c3c5519a682fc021034bef46.tar.xz
org.eclipse.papyrus-c45050eef7a8b729c3c5519a682fc021034bef46.zip
Merge branch 'master' into bugs/386118-emf-facet
Conflicts: plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/providers/ModifySemanticValuesActionProvider.java plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.edit/META-INF/MANIFEST.MF plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.edit/src-gen/org/eclipse/papyrus/uml/diagram/paletteconfiguration/edit/provider/PaletteConfigurationEditPlugin.java plugins/uml/tools/org.eclipse.papyrus.uml.tools.extendedtypes/META-INF/MANIFEST.MF
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/META-INF/MANIFEST.MF31
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/providers/ModifySemanticValuesActionProvider.java186
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes/META-INF/MANIFEST.MF16
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes/src/org/eclipse/papyrus/infra/extendedtypes/advices/ExtendedTypesOwnerAdvice.java372
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF3
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF4
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.edit/META-INF/MANIFEST.MF28
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools.extendedtypes/META-INF/MANIFEST.MF33
9 files changed, 296 insertions, 380 deletions
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/META-INF/MANIFEST.MF b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/META-INF/MANIFEST.MF
index 29862d671e9..0bfa05d111f 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/META-INF/MANIFEST.MF
+++ b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/META-INF/MANIFEST.MF
@@ -1,22 +1,31 @@
Manifest-Version: 1.0
Export-Package: org.eclipse.papyrus.infra.extendedtypes.emf,
- org.eclipse.papyrus.infra.extendedtypes.emf.modifysemanticvaluesactionconfiguration,
- org.eclipse.papyrus.infra.extendedtypes.emf.modifysemanticvaluesactionconfiguration.impl,
- org.eclipse.papyrus.infra.extendedtypes.emf.modifysemanticvaluesactionconfiguration.util,
- org.eclipse.papyrus.infra.extendedtypes.emf.providers
+ org.eclipse.papyrus.infra.extendedtypes.emf.converter,
+ org.eclipse.papyrus.infra.extendedtypes.emf.runtimevalueseditionactionconfiguration,
+ org.eclipse.papyrus.infra.extendedtypes.emf.runtimevalueseditionactionconfiguration.impl,
+ org.eclipse.papyrus.infra.extendedtypes.emf.runtimevalueseditionactionconfiguration.util,
+ org.eclipse.papyrus.infra.extendedtypes.emf.setvaluesactionconfiguration,
+ org.eclipse.papyrus.infra.extendedtypes.emf.setvaluesactionconfiguration.impl,
+ org.eclipse.papyrus.infra.extendedtypes.emf.setvaluesactionconfiguration.util
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
- org.eclipse.emf.ecore;bundle-version="2.7.0";visibility:=reexport,
- org.eclipse.emf.ecore.xmi;bundle-version="2.6.0";visibility:=reexport,
- org.eclipse.papyrus.infra.queries.core.configuration;bundle-version="1.0.0",
+ org.eclipse.emf.ecore;bundle-version="2.7.0",
+ org.eclipse.emf.ecore.xmi;bundle-version="2.6.0",
org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.0.0",
- org.eclipse.emf.facet.infra.query;bundle-version="0.1.0",
- org.eclipse.uml2.uml;bundle-version="3.2.0",
+ org.eclipse.uml2.uml,
+ org.eclipse.uml2.types,
+ org.eclipse.emf.edit,
+ org.eclipse.emf.ecore.edit,
+ org.eclipse.uml2.uml.edit,
org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
org.eclipse.ui;bundle-version="3.7.0",
org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.queries.core;bundle-version="1.0.0",
org.eclipse.gmf.runtime.common.core;bundle-version="1.4.1",
- org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.4.0"
+ org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.4.0",
+ org.eclipse.core.databinding;bundle-version="1.4.1",
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0",
+ org.eclipse.papyrus.views.properties;bundle-version="1.0.0",
+ org.eclipse.papyrus.views.properties.model;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.constraints;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/providers/ModifySemanticValuesActionProvider.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/providers/ModifySemanticValuesActionProvider.java
deleted file mode 100644
index 039a038df90..00000000000
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/providers/ModifySemanticValuesActionProvider.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 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) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.emf.providers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
-import org.eclipse.gmf.runtime.common.core.service.IOperation;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.papyrus.infra.extendedtypes.ActionConfiguration;
-import org.eclipse.papyrus.infra.extendedtypes.emf.Activator;
-import org.eclipse.papyrus.infra.extendedtypes.emf.modifysemanticvaluesactionconfiguration.ConstantValue;
-import org.eclipse.papyrus.infra.extendedtypes.emf.modifysemanticvaluesactionconfiguration.FeatureToSet;
-import org.eclipse.papyrus.infra.extendedtypes.emf.modifysemanticvaluesactionconfiguration.FeatureValue;
-import org.eclipse.papyrus.infra.extendedtypes.emf.modifysemanticvaluesactionconfiguration.ListValue;
-import org.eclipse.papyrus.infra.extendedtypes.emf.modifysemanticvaluesactionconfiguration.ModifySemanticValuesActionConfiguration;
-import org.eclipse.papyrus.infra.extendedtypes.emf.modifysemanticvaluesactionconfiguration.QueryExecutionValue;
-import org.eclipse.papyrus.infra.extendedtypes.emf.modifysemanticvaluesactionconfiguration.util.ModifySemanticValuesActionConfigurationSwitch;
-import org.eclipse.papyrus.infra.extendedtypes.providers.GetAllExtendedElementTypeActionProvidersOperation;
-import org.eclipse.papyrus.infra.extendedtypes.providers.GetExtendedElementTypeActionProviderOperation;
-import org.eclipse.papyrus.infra.extendedtypes.providers.IExtendedElementTypeActionProvider;
-import org.eclipse.papyrus.infra.queries.core.configuration.QueryConfiguration;
-import org.eclipse.papyrus.infra.queries.core.converter.ConverterNotfoundException;
-import org.eclipse.papyrus.infra.queries.core.converter.ConverterRegistry;
-import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-
-/**
- * Provider for Action that set semantic values to an element on creation
- */
-public class ModifySemanticValuesActionProvider extends AbstractProvider implements IExtendedElementTypeActionProvider {
-
- /**
- * {@inheritDoc}
- */
- public boolean provides(IOperation operation) {
- if(operation instanceof GetAllExtendedElementTypeActionProvidersOperation) {
- return true;
- }
- if(operation instanceof GetExtendedElementTypeActionProviderOperation) {
- return (((GetExtendedElementTypeActionProviderOperation)operation).getActionConfiguration() instanceof ModifySemanticValuesActionConfiguration);
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public ICommand getICommand(List<? extends Object> elementsToEdit, ActionConfiguration configuration) {
- // try to create the command that will apply the stereotypes
- if(!(configuration instanceof ModifySemanticValuesActionConfiguration)) {
- Activator.log.error("Trying to configure a modify semantic values action configuration with a configuration which is not a semantic value one: " + configuration, null);
- return UnexecutableCommand.INSTANCE;
- }
-
- CompositeCommand compositeCommand = new CompositeCommand("Set Values");
- ModifySemanticValuesActionConfiguration modifySemanticValuesActionConfiguration = (ModifySemanticValuesActionConfiguration)configuration;
-
- // for each object in the list of eobjects to edit, create the stereotype apply command
- for(Object objectToEdit : elementsToEdit) {
- // for each feature in the configuration, sets the value
- if(objectToEdit instanceof EObject) {
- for(FeatureToSet featureToSet : modifySemanticValuesActionConfiguration.getFeaturesToSet()) {
- // create a command from a set request and use the Papyrus edit service
- EObject eObject = (EObject)objectToEdit;
- EStructuralFeature feature = eObject.eClass().getEStructuralFeature(featureToSet.getFeatureName());
- if(feature != null && feature.isChangeable()) {
- // retrieve the value to set
- FeatureValue featureValue = featureToSet.getValue();
- Object value = computeValue(eObject, feature, featureValue);
- SetRequest request = new SetRequest(eObject, feature, value);
- IElementEditService service = ElementEditServiceUtils.getCommandProvider(eObject);
- ICommand command = service.getEditCommand(request);
- if(command != null) {
- compositeCommand.add(command);
- }
- }
- }
-
- // for dynamic features, opens the pop up and ask for the values to set
- }
- }
- return compositeCommand;
- }
-
- /**
- * Retrieves the value from the feature value parameter
- *
- * @param eObject
- * the context of the value
- * @param feature
- * the feature for which the value is computed
- * @param featureValue
- * the representation of the value of the feature from which to compute the real value
- * @return the value of the feature
- */
- protected Object computeValue(final EObject eObject, final EStructuralFeature feature, FeatureValue featureValue) {
- Object value = new ModifySemanticValuesActionConfigurationSwitch<Object>() {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object caseListValue(ListValue listValue) {
- List<Object> values = new ArrayList<Object>();
- for(FeatureValue fValue : listValue.getValues()) {
- Object value = computeValue(eObject, feature, fValue);
- values.add(value);
- }
- return values;
- };
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object caseQueryExecutionValue(QueryExecutionValue queryExecutionValue) {
- Object value = null;
- QueryConfiguration configuration = queryExecutionValue.getConfiguration();
- try {
- //value = QueryUtil.evaluateQuery(eObject, configuration);
- } catch (Exception e) {
- Activator.log.error(e);
- }
- return value;
- };
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object caseConstantValue(ConstantValue constantValue) {
- Class<?> parameterType = feature.getEType().getInstanceClass();
- try {
- Object convertedValue = ConverterRegistry.getSingleton().convert(parameterType, constantValue.getValueInstance());
- return convertedValue;
- } catch (ConverterNotfoundException e) {
- Activator.log.error(e);
- }
- return null;
- }
-
- }.doSwitch(featureValue);
-
- return value;
- }
-
- /**
- * {@inheritDoc}
- */
- public ICommand getBeforeCreateValidationCommand(List<? extends Object> elementsToEdit, ActionConfiguration configuration) {
- // here, element to edit should be the parent of the created element on which the stereotype is applied.
- ModifySemanticValuesActionConfiguration modifySemanticValuesActionConfiguration = (ModifySemanticValuesActionConfiguration)configuration;
-
- for(Object objectToEdit : elementsToEdit) {
- // FIXME ...
- }
- // returns a null command, which means it is possible to apply the stereotype
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setConfiguration(IConfigurationElement element) {
- // something to do here ?
- }
-
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes/META-INF/MANIFEST.MF b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes/META-INF/MANIFEST.MF
index 8fe2e90f82e..6c9133f3d07 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes/META-INF/MANIFEST.MF
+++ b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes/META-INF/MANIFEST.MF
@@ -1,22 +1,30 @@
Manifest-Version: 1.0
Export-Package: org.eclipse.papyrus.infra.extendedtypes,
org.eclipse.papyrus.infra.extendedtypes.advices,
+ org.eclipse.papyrus.infra.extendedtypes.handler,
org.eclipse.papyrus.infra.extendedtypes.impl,
+ org.eclipse.papyrus.infra.extendedtypes.invariantcontainerconfiguration,
+ org.eclipse.papyrus.infra.extendedtypes.invariantcontainerconfiguration.impl,
+ org.eclipse.papyrus.infra.extendedtypes.invariantcontainerconfiguration.util,
+ org.eclipse.papyrus.infra.extendedtypes.invariantsemantictypeconfiguration,
+ org.eclipse.papyrus.infra.extendedtypes.invariantsemantictypeconfiguration.impl,
+ org.eclipse.papyrus.infra.extendedtypes.invariantsemantictypeconfiguration.util,
org.eclipse.papyrus.infra.extendedtypes.preferences,
org.eclipse.papyrus.infra.extendedtypes.providers,
+ org.eclipse.papyrus.infra.extendedtypes.semantic,
org.eclipse.papyrus.infra.extendedtypes.types,
org.eclipse.papyrus.infra.extendedtypes.util
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
org.eclipse.emf.ecore;bundle-version="2.7.0";visibility:=reexport,
org.eclipse.emf.ecore.xmi;bundle-version="2.6.0";visibility:=reexport,
- org.eclipse.papyrus.infra.queries.core.configuration;bundle-version="1.0.0",
- org.eclipse.emf.facet.infra.query;bundle-version="0.1.0",
+ org.eclipse.uml2.types;visibility:=reexport,
org.eclipse.uml2.uml;bundle-version="3.2.0",
org.eclipse.ui;bundle-version="3.7.0",
org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.4.0",
org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.queries.core;bundle-version="1.0.0",
- org.eclipse.gmf.runtime.common.ui.services;bundle-version="1.3.0"
+ org.eclipse.gmf.runtime.common.ui.services;bundle-version="1.3.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes/src/org/eclipse/papyrus/infra/extendedtypes/advices/ExtendedTypesOwnerAdvice.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes/src/org/eclipse/papyrus/infra/extendedtypes/advices/ExtendedTypesOwnerAdvice.java
index 139ff2798c5..df13a584f95 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes/src/org/eclipse/papyrus/infra/extendedtypes/advices/ExtendedTypesOwnerAdvice.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes/src/org/eclipse/papyrus/infra/extendedtypes/advices/ExtendedTypesOwnerAdvice.java
@@ -1,140 +1,232 @@
-/*****************************************************************************
- * Copyright (c) 2010 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) remi.schnekenburger@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.advices;
-
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-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.papyrus.infra.extendedtypes.Activator;
-import org.eclipse.papyrus.infra.extendedtypes.ExtendedElementTypeConfiguration;
-import org.eclipse.papyrus.infra.extendedtypes.PostActionConfiguration;
-import org.eclipse.papyrus.infra.extendedtypes.providers.ExtendedElementTypeActionService;
-import org.eclipse.papyrus.infra.extendedtypes.providers.ProviderNotFoundException;
-import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
-import org.eclipse.papyrus.infra.queries.core.configuration.QueryConfiguration;
-import org.eclipse.papyrus.infra.queries.core.modisco.QueryUtil;
-
-
-/**
- * Advice for potential owners of Extended Element Types. This advice will help to the pre/post validation for the creation of child element which is
- * describe by the extended type
- */
-public class ExtendedTypesOwnerAdvice extends AbstractEditHelperAdvice {
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected ICommand getBeforeCreateCommand(CreateElementRequest request) {
- // test if the type element to be created is an extended one. If yes, test the validation queries.
- // if they are valid, return identity command, which does nothing
- // else, if not valid, return a not executable command
- IElementType typeToCreate = request.getElementType();
- if(typeToCreate instanceof IExtendedHintedElementType) {
- ExtendedElementTypeConfiguration configuration = ((IExtendedHintedElementType)typeToCreate).getConfiguration();
- List<QueryConfiguration> queryConfigurations = configuration.getPreValidation();
- if(queryConfigurations == null || queryConfigurations.isEmpty()) {
- return super.getBeforeCreateCommand(request);
- }
-
- // check all validation rules given by the configuration
- for(Object objectToEdit : request.getElementsToEdit()) {
- // there are queries to test
- for(QueryConfiguration queryConfiguration : queryConfigurations) {
- try {
- boolean result = QueryUtil.evaluateBooleanQuery((EObject)objectToEdit, queryConfiguration);
- if(!result) {
- // return an unexecutable command, so the create command will not be executable
- return UnexecutableCommand.INSTANCE;
- }
- } catch (Exception e) {
- Activator.log.error(e);
- }
- }
- }
-
- // Check all pre and post action validation rules. They are given by the provider of the action
- CompositeCommand compositeCommand = new CompositeCommand("PreValidationPostAction");
- for(PostActionConfiguration postActionConfiguration : configuration.getPostAction()) {
- ICommand command = null;
- try {
- command = ExtendedElementTypeActionService.getInstance().getPreValidationCommand(request.getElementsToEdit(), postActionConfiguration);
- } catch (ProviderNotFoundException e) {
- Activator.log.error(e);
- }
- if(command != null) {
- compositeCommand.add(command);
- }
- }
- // get the super command
- ICommand superCommand = super.getBeforeCreateCommand(request);
-
- // if not null, adds it to the result
- if(superCommand != null) {
- compositeCommand.compose(superCommand);
- }
-
- // if result not null, returns the composite command
- if(!compositeCommand.isEmpty()) {
- return compositeCommand;
- }
- return super.getBeforeCreateCommand(request);
- }
- return super.getBeforeCreateCommand(request);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected ICommand getBeforeConfigureCommand(ConfigureRequest request) {
- return super.getBeforeConfigureCommand(request);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected ICommand getAfterConfigureCommand(ConfigureRequest request) {
- // IElementType type = request.getTypeToConfigure();
- // if(type instanceof IExtendedHintedElementType) {
- // CompositeCommand compositeCommand = new CompositeCommand("AfterConfigureCommand");
- // IExtendedHintedElementType extendedHintedElementType = (IExtendedHintedElementType)type;
- // ExtendedElementTypeConfiguration configuration = extendedHintedElementType.getConfiguration();
- // for(PostActionConfiguration postActionConfiguration : configuration.getPostAction()) {
- // ICommand command = null;
- // try {
- // command = ExtendedElementTypeActionService.getInstance().getICommand(request.getElementsToEdit(), postActionConfiguration);
- // } catch (ProviderNotFoundException e) {
- // Activator.log.error(e);
- // }
- // if(command != null) {
- // compositeCommand.add(command);
- // }
- // }
- // // return the composite command only if it is not empty
- // if(!compositeCommand.isEmpty()) {
- // return compositeCommand;
- // }
- // }
- return super.getAfterConfigureCommand(request);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2010 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) remi.schnekenburger@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.extendedtypes.advices;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IContainerDescriptor;
+import org.eclipse.gmf.runtime.emf.type.core.IElementMatcher;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+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.MoveRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType;
+
+/**
+ * Advice for potential owners of Extended Element Types. This advice will help to the pre/post validation for the creation of child element which is
+ * describe by the extended type
+ */
+public class ExtendedTypesOwnerAdvice extends AbstractEditHelperAdvice {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean approveRequest(IEditCommandRequest request) {
+ if(request instanceof CreateElementRequest) {
+ // approve the request for this element and all super types
+ IElementType typeToCreate = ((CreateElementRequest)request).getElementType();
+ if(typeToCreate instanceof IExtendedHintedElementType) {
+ if(!approveCreationRequest(((IExtendedHintedElementType)typeToCreate), (CreateElementRequest)request)) {
+ return false;
+ }
+ // ask for extended super types
+ List<IExtendedHintedElementType> superExtendedTypes = getAllSuperExtendedTypes((IExtendedHintedElementType)typeToCreate);
+ if(superExtendedTypes == null || superExtendedTypes.size() == 0) {
+ return super.approveRequest(request);
+ } else {
+ for(IExtendedHintedElementType superType : superExtendedTypes) {
+ // only refuse if one element refuses the request
+ if(!approveCreationRequest(superType, (CreateElementRequest)request)) {
+ return false;
+ }
+ }
+ }
+ }
+ } else if(request instanceof SetRequest) {
+ // check the feature to set is a containment feature and element to move is an extended element type
+ EStructuralFeature feature = ((SetRequest)request).getFeature();
+ if(feature instanceof EReference) {
+ if(!((EReference)feature).isContainment()) {
+ return super.approveRequest(request);
+ } else {
+ // containment. Check the kind of element to edit
+ Object value = ((SetRequest)request).getValue();
+ // value = single object or list ?
+ if(value instanceof EObject) {
+ IElementType type = ElementTypeRegistry.getInstance().getElementType((EObject)value, request.getClientContext());
+ if(type instanceof IExtendedHintedElementType) {
+ return approveMoveRequest((IExtendedHintedElementType)type, (SetRequest)request);
+ }
+ } else if(value instanceof List<?>) {
+ for(Object object : (List<Object>)value) {
+ if(object instanceof EObject) {
+ IElementType[] types = ElementTypeRegistry.getInstance().getAllTypesMatching((EObject)object, request.getClientContext());
+ for(IElementType type : types) {
+ if(type instanceof IExtendedHintedElementType) {
+ if(!approveMoveRequest((IExtendedHintedElementType)type, (SetRequest)request)) {
+ return false;
+ }
+ List<IExtendedHintedElementType> superExtendedTypes = getAllSuperExtendedTypes((IExtendedHintedElementType)type);
+ if(superExtendedTypes == null || superExtendedTypes.size() == 0) {
+ // nothing here
+ } else {
+ for(IExtendedHintedElementType superType : superExtendedTypes) {
+ // only refuse if one element refuses the request
+ if(!approveMoveRequest(superType, (SetRequest)request)) {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ } else if(request instanceof MoveRequest) {
+ // check the feature to set is a containment feature and element to move is an extended element type
+ Map<EObject, EReference> objectsToMove = ((MoveRequest)request).getElementsToMove();
+ if(objectsToMove == null || objectsToMove.isEmpty()) {
+ return super.approveRequest(request);
+ }
+ for(Entry<EObject, EReference> movedElement : objectsToMove.entrySet()) {
+ // do not compute with reference, this can be null. This could be interesting to check...
+ IElementType[] types = ElementTypeRegistry.getInstance().getAllTypesMatching(movedElement.getKey(), request.getClientContext());
+ for(IElementType type : types) {
+ if(type instanceof IExtendedHintedElementType) {
+ if(!approveMoveRequest((IExtendedHintedElementType)type, movedElement.getKey(), (MoveRequest)request)) {
+ return false;
+ }
+ List<IExtendedHintedElementType> superExtendedTypes = getAllSuperExtendedTypes((IExtendedHintedElementType)type);
+ if(superExtendedTypes == null || superExtendedTypes.size() == 0) {
+ // nothing here
+ } else {
+ for(IExtendedHintedElementType superType : superExtendedTypes) {
+ // only refuse if one element refuses the request
+ if(!approveMoveRequest(superType, movedElement.getKey(), (MoveRequest)request)) {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ }
+ return super.approveRequest(request);
+ }
+ return super.approveRequest(request);
+ }
+
+ /**
+ * @param iExtendedHintedElementType
+ * @param request
+ * @return
+ */
+ protected boolean approveCreationRequest(IExtendedHintedElementType typeToCreate, CreateElementRequest request) {
+ IContainerDescriptor containerDescriptor = typeToCreate.getEContainerDescriptor();
+ EObject newContainer = request.getContainer();
+ // check it matches the container descriptor for the element type
+ if(containerDescriptor == null || newContainer == null) {
+ return true;
+ }
+ if(containerDescriptor.getContainmentFeatures() != null && containerDescriptor.getContainmentFeatures().length > 0) {
+ // check containment feature
+ List<EReference> references = Arrays.asList(containerDescriptor.getContainmentFeatures());
+ if(!(references.contains(request.getContainmentFeature()))) {
+ return false;
+ }
+ }
+ IElementMatcher containerMatcher = containerDescriptor.getMatcher();
+ if(containerMatcher != null) {
+ return containerMatcher.matches(newContainer);
+ }
+ // check container is matching the matcher of the container descriptor for the new type
+ return true;
+ }
+
+ protected boolean approveMoveRequest(IExtendedHintedElementType typeToMove, SetRequest request) {
+ IContainerDescriptor containerDescriptor = typeToMove.getEContainerDescriptor();
+ EObject newContainer = request.getElementToEdit();
+ // check it matches the container descriptor for the element type
+ if(containerDescriptor == null || newContainer == null) {
+ return true;
+ }
+ if(containerDescriptor.getContainmentFeatures() != null && containerDescriptor.getContainmentFeatures().length > 0) {
+ // check containment feature
+ List<EReference> references = Arrays.asList(containerDescriptor.getContainmentFeatures());
+ if(!(references.contains(request.getFeature()))) {
+ return false;
+ }
+ }
+ IElementMatcher containerMatcher = containerDescriptor.getMatcher();
+ if(containerMatcher != null) {
+ return containerMatcher.matches(newContainer);
+ }
+ // check container is matching the matcher of the container descriptor for the new type
+ return true;
+ }
+
+ protected boolean approveMoveRequest(IExtendedHintedElementType typeToMove, EObject objectToMove, MoveRequest request) {
+ IContainerDescriptor containerDescriptor = typeToMove.getEContainerDescriptor();
+ EObject newContainer = request.getTargetContainer();
+ // check it matches the container descriptor for the element type
+ if(containerDescriptor == null || newContainer == null) {
+ return true;
+ }
+ if(containerDescriptor.getContainmentFeatures() != null && containerDescriptor.getContainmentFeatures().length > 0) {
+ // check containment feature
+ List<EReference> references = Arrays.asList(containerDescriptor.getContainmentFeatures());
+ if(!(references.contains(request.getTargetFeature(objectToMove)))) {
+ return false;
+ }
+ }
+ IElementMatcher containerMatcher = containerDescriptor.getMatcher();
+ if(containerMatcher != null) {
+ return containerMatcher.matches(newContainer);
+ }
+ // check container is matching the matcher of the container descriptor for the new type
+ return true;
+ }
+
+ public List<IExtendedHintedElementType> getAllSuperExtendedTypes(IExtendedHintedElementType type) {
+ IElementType[] superTypes = type.getAllSuperTypes();
+ if(superTypes.length == 0) {
+ return Collections.emptyList();
+ }
+ List<IExtendedHintedElementType> superExtendedTypes = new ArrayList<IExtendedHintedElementType>();
+ // get the reverse order (the extended element types are the closest types
+ for(int i = superTypes.length - 1; i >= 0; i--) {
+ if(superTypes[i] instanceof IExtendedHintedElementType) {
+ superExtendedTypes.add((IExtendedHintedElementType)superTypes[i]);
+ } /*
+ * else { // optimization: once we are in the hierarchy of "standard" types, we should not go into this hierarchy
+ * return superExtendedTypes;
+ * }
+ */
+ }
+ return superExtendedTypes;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF
index 9c8ee27c98a..341591db8ee 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/META-INF/MANIFEST.MF
@@ -33,7 +33,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.0.0",
- org.eclipse.gmf.tooling.runtime;bundle-version="3.1.0"
+ org.eclipse.gmf.tooling.runtime;bundle-version="3.1.0",
+ org.eclipse.papyrus.infra.tools;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.sysml.diagram.blockdefinition,
org.eclipse.papyrus.sysml.diagram.blockdefinition.command,
org.eclipse.papyrus.sysml.diagram.blockdefinition.dnd.helper,
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF
index 8e5e8926f68..1fbe843a56b 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF
@@ -33,7 +33,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.0.0",
org.eclipse.gmf.tooling.runtime;bundle-version="3.1.0",
- org.eclipse.papyrus.uml.diagram.composite;bundle-version="1.0.0"
+ org.eclipse.papyrus.uml.diagram.composite;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.tools;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.gmf.diagram.common.commands,
org.eclipse.papyrus.gmf.diagram.common.compatibility,
org.eclipse.papyrus.gmf.diagram.common.edit.part,
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF
index f427481bf2b..9e3a680ea4e 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/META-INF/MANIFEST.MF
@@ -28,7 +28,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.uml2.uml;bundle-version="4.0.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.0",
org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.0.0",
- org.eclipse.gmf.tooling.runtime;bundle-version="3.1.0"
+ org.eclipse.gmf.tooling.runtime;bundle-version="3.1.0",
+ org.eclipse.papyrus.infra.tools;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.sysml.diagram.internalblock,
org.eclipse.papyrus.sysml.diagram.internalblock.compatibility,
org.eclipse.papyrus.sysml.diagram.internalblock.dnd.helper,
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.edit/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.edit/META-INF/MANIFEST.MF
index 8b94f85a138..93b437f50a8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.edit/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.paletteconfiguration.edit/META-INF/MANIFEST.MF
@@ -1,21 +1,27 @@
Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.uml.diagram.paletteconfiguration.provider
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.uml.diagram.paletteconfiguration.e
+ dit.provider
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.papyrus.uml.diagram.paletteconfiguration;visibility:=reexport;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.diagram.paletteconfiguration;bundle-version="1.0.0";visibility:=reexport,
org.eclipse.emf.edit;visibility:=reexport,
+ org.eclipse.papyrus.infra.queries.core.configuration;bundle-version="1.0.0";visibility:=reexport,
+ org.eclipse.papyrus.infra.queries.core.configuration.edit;bundle-version="1.0.0";visibility:=reexport,
org.eclipse.emf.ecore;visibility:=reexport,
org.eclipse.emf.ecore.edit;visibility:=reexport,
+ org.eclipse.emf.facet.infra.query;visibility:=reexport,
+ org.eclipse.emf.facet.infra.query.edit;visibility:=reexport,
org.eclipse.uml2.uml,
- org.eclipse.uml2.uml.edit,
- org.eclipse.papyrus.emf.facet.efacet.metamodel.edit
+ org.eclipse.uml2.uml.edit
Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
Bundle-Version: 1.0.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.paletteconfiguration.provider.PaletteConfigurationEditPlugin$Implementation
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.paletteconfiguration.edit;singleton:=true
+Bundle-Activator: org.eclipse.papyrus.uml.diagram.paletteconfiguration
+ .edit.provider.PaletteConfigurationEditPlugin$Implementation
+Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.paletteconfigurat
+ ion.edit;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.extendedtypes/META-INF/MANIFEST.MF b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.extendedtypes/META-INF/MANIFEST.MF
index a249e605d80..0b5b57eeb56 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.extendedtypes/META-INF/MANIFEST.MF
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.extendedtypes/META-INF/MANIFEST.MF
@@ -2,36 +2,17 @@ Manifest-Version: 1.0
Export-Package: org.eclipse.papyrus.uml.tools.extendedtypes,
org.eclipse.papyrus.uml.tools.extendedtypes.applystereotypeactionconfiguration,
org.eclipse.papyrus.uml.tools.extendedtypes.applystereotypeactionconfiguration.impl,
- org.eclipse.papyrus.uml.tools.extendedtypes.applystereotypeactionconfiguration.util,
- org.eclipse.papyrus.uml.tools.extendedtypes.invariantstereotypeconfiguration,
- org.eclipse.papyrus.uml.tools.extendedtypes.invariantstereotypeconfiguration.impl,
- org.eclipse.papyrus.uml.tools.extendedtypes.invariantstereotypeconfiguration.util,
- org.eclipse.papyrus.uml.tools.extendedtypes.stereotypedelementmatcherconfiguration,
- org.eclipse.papyrus.uml.tools.extendedtypes.stereotypedelementmatcherconfiguration.impl,
- org.eclipse.papyrus.uml.tools.extendedtypes.stereotypedelementmatcherconfiguration.util,
- org.eclipse.papyrus.uml.tools.extendedtypes.settypeactionconfiguration,
- org.eclipse.papyrus.uml.tools.extendedtypes.settypeactionconfiguration.impl,
- org.eclipse.papyrus.uml.tools.extendedtypes.settypeactionconfiguration.util
+ org.eclipse.papyrus.uml.tools.extendedtypes.applystereotypeactionconfiguration.util
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport,
org.eclipse.emf.ecore.xmi;visibility:=reexport,
+ org.eclipse.papyrus.infra.queries.core.configuration;bundle-version="1.0.0";visibility:=reexport,
org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.0.0";visibility:=reexport,
-<<<<<<< HEAD
-=======
- org.eclipse.uml2.types;visibility:=reexport,
->>>>>>> refs/heads/master
+ org.eclipse.emf.facet.infra.query;visibility:=reexport,
org.eclipse.uml2.uml,
org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0",
- org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.4.0",
- org.eclipse.papyrus.infra.extendedtypes.emf;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.tools;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.emf;bundle-version="1.0.0",
- org.eclipse.papyrus.views.properties;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.properties;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0",
- org.eclipse.swt
+ org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.4.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
@@ -39,7 +20,9 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Name: %pluginName
Bundle-Localization: plugin
Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.uml.tools.extendedtypes.Activator$Implementation
-Bundle-SymbolicName: org.eclipse.papyrus.uml.tools.extendedtypes;singleton:=true
+Bundle-Activator: org.eclipse.papyrus.uml.tools.extendedtypes.Activato
+ r$Implementation
+Bundle-SymbolicName: org.eclipse.papyrus.uml.tools.extendedtypes;singl
+ eton:=true
Bundle-RequiredExecutionEnvironment: J2SE-1.5

Back to the top