Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 236961 Details for
Bug 297816
[SysML Parametric Diagram] Papyrus shall provide a parametric diagram editor.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Parametric diaram v2.2
01-Suppress-representation-of-Property-which-are-retype.patch (text/plain), 12.79 KB, created by
Régis Chevrel
on 2013-10-28 11:23:05 EDT
(
hide
)
Description:
Parametric diaram v2.2
Filename:
MIME Type:
Creator:
Régis Chevrel
Created:
2013-10-28 11:23:05 EDT
Size:
12.79 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.papyrus.sysml.diagram.common >diff --git src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectBlockPropertyTypeDialog.java src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectBlockPropertyTypeDialog.java >index 28ba0f9..277b43c 100644 >--- src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectBlockPropertyTypeDialog.java >+++ src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectBlockPropertyTypeDialog.java >@@ -13,12 +13,18 @@ > *****************************************************************************/ > package org.eclipse.papyrus.sysml.diagram.common.dialogs; > >+import java.util.Arrays; >+import java.util.List; >+ > import org.eclipse.papyrus.sysml.blocks.BlocksPackage; > import org.eclipse.papyrus.sysml.diagram.common.messages.Messages; > import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; >+import org.eclipse.papyrus.sysml.util.SysmlResource; > import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; > import org.eclipse.swt.widgets.Shell; > import org.eclipse.uml2.uml.NamedElement; >+import org.eclipse.uml2.uml.Stereotype; >+import org.eclipse.uml2.uml.UMLFactory; > import org.eclipse.uml2.uml.UMLPackage; > > /** >@@ -28,7 +34,21 @@ > > /** Constructor */ > public CreateOrSelectBlockPropertyTypeDialog(Shell shell, NamedElement owner) { >- super(shell, owner, SysMLElementTypes.BLOCK, UMLPackage.eINSTANCE.getTypedElement_Type(), BlocksPackage.eINSTANCE.getBlock(), UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null); >+ super(shell, owner, SysMLElementTypes.BLOCK, UMLPackage.eINSTANCE.getTypedElement_Type(), BlocksPackage.eINSTANCE.getBlock(), UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null, getConstraintBlockAsStereotype()); >+ } >+ >+ /** >+ * If we create a Part type by a ConstraintBlock, thisPart will become a ConstraintProperty and representation will immediately disappear. >+ * So we filter ConstraintBlock type => Only strict Block are allowed >+ * @return >+ */ >+ @SuppressWarnings("deprecation") >+ private static List<?> getConstraintBlockAsStereotype() { >+ // We create a mock Stereotype to pass in the good code section of SemanticUMLContentProvider.isCompatibleMetaclass (bad gestion of static stereotypes) >+ Stereotype mockStereotype = UMLFactory.eINSTANCE.createStereotype(); >+ // We use this stereotype with namespace instead of ConstraintsPackage.eINSTANCE.getConstraintBlock() >+ mockStereotype.setName(SysmlResource.CONSTRAINT_BLOCK_ID); >+ return Arrays.asList(mockStereotype); > } > > /** >diff --git src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectTypeDialog.java src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectTypeDialog.java >index 2b1e9e1..18f6346 100644 >--- src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectTypeDialog.java >+++ src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectTypeDialog.java >@@ -15,6 +15,8 @@ > *****************************************************************************/ > package org.eclipse.papyrus.sysml.diagram.common.dialogs; > >+import java.util.List; >+ > import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.emf.ecore.EClass; > import org.eclipse.emf.ecore.EObject; >@@ -101,6 +103,8 @@ > > protected EClass containerEClass; > >+ protected List<?> notWantedMetaclasses; >+ > /** > * Create a new dialog to initialize an ActivityParameterNode. > * >@@ -119,6 +123,19 @@ > this.containerFeature = containerFeature; > this.containerEClass = containerEClass; > this.labelProvider = new UMLLabelProvider(); >+ } >+ >+ /** >+ * Create a new dialog to initialize an ActivityParameterNode. >+ * This dialog will filter certain Stereotypes >+ * @param shell >+ * parent shell >+ * @param owner >+ * the activity that owns the action >+ */ >+ public CreateOrSelectTypeDialog(Shell shell, EObject defaultContainer, IElementType elementType, EStructuralFeature editedFeature, EClass elementEClass, IElementType containerType, EStructuralFeature containerFeature, EClass containerEClass, List<?> notWantedMetaclasses) { >+ this(shell, defaultContainer, elementType, editedFeature, elementEClass, containerType, containerFeature, containerEClass); >+ this.notWantedMetaclasses = notWantedMetaclasses; > } > > protected String getDialogTitle() { >@@ -481,9 +498,11 @@ > dialog.setInput(EcoreUtil.getRootContainer(defaultContainer)); > > ServiceEditContentProvider provider = new ServiceEditContentProvider(elementType, editedFeature, EcoreUtil.getRootContainer(defaultContainer)); >+ provider.setNotWantedMetaclasses(notWantedMetaclasses); >+ > dialog.setContentProvider(provider); > dialog.setLabelProvider(labelProvider); >- >+ > if(dialog.open() == Window.OK) { > Object result = dialog.getResult()[0]; > if(result instanceof IAdaptable) { >#P org.eclipse.papyrus.sysml.service.types >diff --git src/org/eclipse/papyrus/sysml/service/types/helper/advice/PropertyEditHelperAdvice.java src/org/eclipse/papyrus/sysml/service/types/helper/advice/PropertyEditHelperAdvice.java >index b9cb070..b68ab61 100644 >--- src/org/eclipse/papyrus/sysml/service/types/helper/advice/PropertyEditHelperAdvice.java >+++ src/org/eclipse/papyrus/sysml/service/types/helper/advice/PropertyEditHelperAdvice.java >@@ -16,6 +16,7 @@ > import java.util.ArrayList; > import java.util.Arrays; > import java.util.List; >+import java.util.Set; > > import org.eclipse.core.commands.ExecutionException; > import org.eclipse.core.runtime.IAdaptable; >@@ -25,22 +26,28 @@ > import org.eclipse.gmf.runtime.common.core.command.CommandResult; > import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; > 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.ISpecializationType; > import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice; > import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; > import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; > import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; >+import org.eclipse.gmf.runtime.notation.View; >+import org.eclipse.jface.dialogs.MessageDialogWithToggle; >+import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; > import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; >-import org.eclipse.papyrus.sysml.blocks.BlocksPackage; >+import org.eclipse.papyrus.infra.services.edit.utils.RequestParameterConstants; > import org.eclipse.papyrus.sysml.constraints.ConstraintBlock; > import org.eclipse.papyrus.sysml.constraints.ConstraintProperty; > import org.eclipse.papyrus.sysml.constraints.ConstraintsPackage; >+import org.eclipse.papyrus.sysml.service.types.Activator; > import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; >+import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil; > import org.eclipse.papyrus.uml.service.types.utils.ElementUtil; > import org.eclipse.papyrus.uml.service.types.utils.NamedElementHelper; >-import org.eclipse.papyrus.infra.services.edit.utils.RequestParameterConstants; >+import org.eclipse.swt.widgets.Display; > import org.eclipse.uml2.uml.Association; > import org.eclipse.uml2.uml.Element; > import org.eclipse.uml2.uml.Port; >@@ -71,10 +78,9 @@ > @SuppressWarnings("unchecked") > @Override > protected ICommand getBeforeSetCommand(SetRequest request) { >- ICommand gmfCommand = super.getBeforeSetCommand(request); >+ ICommand gmfCommand = super.getBeforeSetCommand(request); > > EObject elementToEdit = request.getElementToEdit(); >- > if((elementToEdit instanceof Property) && !(elementToEdit instanceof Port) && > (request.getFeature() == UMLPackage.eINSTANCE.getTypedElement_Type()) && (request.getValue() instanceof Type)) { > >@@ -82,11 +88,11 @@ > > // SysML specification : all property typed by a ConstraintBlock must have a ContraintProperty stereotype applied > if (request.getValue() instanceof org.eclipse.uml2.uml.Class) { >- ICommand stereotypeApplication = getConstraintPropertyStereotypeApplicationCommand(propertyToEdit, (org.eclipse.uml2.uml.Class)request.getValue()); >- gmfCommand = CompositeCommand.compose(gmfCommand, stereotypeApplication); >+ ICommand stereotypeApplicationCommand = getConstraintPropertyStereotypeApplicationCommand(propertyToEdit, (org.eclipse.uml2.uml.Class)request.getValue(), request); >+ gmfCommand = CompositeCommand.compose(gmfCommand, stereotypeApplicationCommand); > } > >- // Exclude ConstraintParameter (simple property without stereotype owned by a ConstraintBlock) >+ // Exclude ConstraintParameter (simple property without ConstraintProperty stereotype owned by a ConstraintBlock) > if (propertyToEdit.eContainer() instanceof org.eclipse.uml2.uml.Class && UMLUtil.getStereotypeApplication((Element)propertyToEdit.eContainer(), ConstraintBlock.class) != null) { > if (UMLUtil.getStereotypeApplication(propertyToEdit, ConstraintProperty.class) == null) { > return gmfCommand; >@@ -230,20 +236,10 @@ > * > * @return the ConstraintProperty stereotype application command > */ >- private ICommand getConstraintPropertyStereotypeApplicationCommand(final Property sourceProperty, final org.eclipse.uml2.uml.Class targetBlock) { >+ private ICommand getConstraintPropertyStereotypeApplicationCommand(final Property sourceProperty, final org.eclipse.uml2.uml.Class targetBlock, final SetRequest request) { > >- return new AbstractCommand("Apply/Remove ConstraintProperty Stereotype") { >- >- @Override >- protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { >- return null; >- } >- >- @Override >- protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { >- return null; >- } >- >+ return new AbstractTransactionalCommand(request.getEditingDomain(), "Apply/Remove ConstraintProperty Stereotype", null) { >+ > @Override > protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { > // SysML specification : all property typed by a ConstraintBlock must have a ContraintProperty stereotype applied >@@ -251,6 +247,34 @@ > if (UMLUtil.getStereotypeApplication(targetBlock, ConstraintBlock.class) != null) { > if (constraintPropertyApplication == null) { > StereotypeApplicationHelper.INSTANCE.applyStereotype(sourceProperty, ConstraintsPackage.eINSTANCE.getConstraintProperty()); >+ // Remove representations >+ Set<View> memberViewsToDestroy = CrossReferencerUtil.getCrossReferencingViews(sourceProperty, null); >+ if (memberViewsToDestroy.size() != 0) { >+ final IPreferenceStore store = Activator.getDefault().getPreferenceStore(); >+ final String DISPLAY_MESSAGE_FOR_TYPING_ACTION_PREFERENCE_KEY = "displayMessageForTypingActionPreferenceKey"; >+ boolean contains = store.contains(DISPLAY_MESSAGE_FOR_TYPING_ACTION_PREFERENCE_KEY); >+ if(!contains) { >+ store.setValue(DISPLAY_MESSAGE_FOR_TYPING_ACTION_PREFERENCE_KEY, MessageDialogWithToggle.NEVER); >+ store.setDefault(DISPLAY_MESSAGE_FOR_TYPING_ACTION_PREFERENCE_KEY, MessageDialogWithToggle.NEVER); >+ } >+ final String hideValue = store.getString(DISPLAY_MESSAGE_FOR_TYPING_ACTION_PREFERENCE_KEY); >+ if(!hideValue.equals(MessageDialogWithToggle.ALWAYS)) { >+ int size = memberViewsToDestroy.size(); >+ MessageDialogWithToggle.openInformation(Display.getDefault().getActiveShell(), >+ "Change Type Action", >+ "WARNING! Typing a Property by a ConstraintBlock make this property become a ConstraintProperty. ConstraintProperty have a specific representation. " >+ + "\nSo all representations of this property will be removed from the model (" + size + " occurence" + ((size > 1) ? "s" : "") + ")." >+ , "Don't show this dialog the next time", >+ false, store, DISPLAY_MESSAGE_FOR_TYPING_ACTION_PREFERENCE_KEY); >+ } >+ >+ } >+ for (View view : memberViewsToDestroy) { >+ final DestroyElementRequest destroyRequest = new DestroyElementRequest(request.getEditingDomain(), view, false); >+ final IElementEditService commandProvider = ElementEditServiceUtils.getCommandProvider(view); >+ ICommand editCommand = commandProvider.getEditCommand(destroyRequest); >+ editCommand.execute(progressMonitor, info); >+ } > } > } > else { >@@ -263,7 +287,6 @@ > }; > } > >- > /** > * Create a part association destroy command. > *
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 297816
:
233707
|
234574
|
234575
|
234689
|
236075
|
236536
| 236961 |
236962