Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java23
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java.rej30
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockPropertyCompositeEditPart.java1
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintNodeLabelEditPart.java107
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/ConstraintPropertyEditHelperAdvice.java.rej9
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/PartPropertyEditHelperAdvice.java2
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/ReferencePropertyEditHelperAdvice.java2
7 files changed, 150 insertions, 24 deletions
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java
index 2371e626b6e..c9ce1224ac1 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * 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
@@ -8,7 +8,7 @@
*
* Contributors:
*
- * CEA LIST - Initial API and implementation
+ * Régis Chevrel (chevrel.regis@gmail.com) CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.common.commands;
@@ -106,25 +106,6 @@ public class CreateConstraintPropertyWithTypeConfigureCommandFactory extends Abs
ICommand newConstraintCreateCommand = commandService.getEditCommand(createTypeRequest);
if (newConstraintCreateCommand.canExecute()) {
newConstraintCreateCommand.execute(monitor, info);
- Object newObject = newConstraintCreateCommand.getCommandResult().getReturnValue();
- // Create the constraint specification
- if (newObject instanceof EObject) {
- final EObject newElement = (EObject)newObject;
- final IDirectEditorConfiguration configuration = initExtendedEditorConfiguration(newElement);
- Dialog dialog = new ConstraintExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), newElement, configuration.getTextToEdit(newElement), configuration);
- final Dialog finalDialog = dialog;
- if(Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Constraint specification") {
- @Override
- protected void doExecute() {
- configuration.postEditAction(newElement, ((ILabelEditorDialog)finalDialog).getValue());
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
-
}
}
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java.rej b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java.rej
new file mode 100644
index 00000000000..b38fb2c614a
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java.rej
@@ -0,0 +1,30 @@
+@@ -105,29 +99,6 @@
+ ICommand newConstraintCreateCommand = commandService.getEditCommand(createTypeRequest);
+ if (newConstraintCreateCommand.canExecute()) {
+ newConstraintCreateCommand.execute(monitor, info);
+- Object newObject = newConstraintCreateCommand.getCommandResult().getReturnValue();
+- // Create the constraint specification
+- if (newObject instanceof EObject) {
+- final EObject newElement = (EObject)newObject;
+- final IDirectEditorConfiguration configuration = initExtendedEditorConfiguration(newElement);
+- try {
+- Dialog dialog = new ConstraintExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), newElement, configuration.getTextToEdit(newElement), configuration);
+- final Dialog finalDialog = dialog;
+- if(Window.OK == dialog.open()) {
+- TransactionalEditingDomain domain = getEditingDomain();
+- RecordingCommand command = new RecordingCommand(domain, "Edit Constraint specification") {
+- @Override
+- protected void doExecute() {
+- configuration.postEditAction(newElement, ((ILabelEditorDialog)finalDialog).getValue());
+- }
+- };
+- domain.getCommandStack().execute(command);
+- }
+- } catch (Exception e) {
+- Activator.log.error("Problem during editing Constaint", e);
+- }
+- }
+-
+ }
+ }
+ }
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockPropertyCompositeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockPropertyCompositeEditPart.java
index 8b99c4cb2a3..95f1a1aa452 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockPropertyCompositeEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockPropertyCompositeEditPart.java
@@ -38,7 +38,6 @@ import org.eclipse.papyrus.sysml.diagram.common.figure.ConstraintBlockPropertyCo
import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart;
import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintNodeLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintParameterAffixedNodeEditPart;
-import org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedNodeEditPart;
import org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyNodeLabelEditPart;
import org.eclipse.papyrus.uml.diagram.common.edit.policy.EncapsulatedClassifierResizableShapeEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy;
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintNodeLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintNodeLabelEditPart.java
index 6609dcb8f8d..105cdee08ee 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintNodeLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintNodeLabelEditPart.java
@@ -14,11 +14,28 @@
package org.eclipse.papyrus.uml.diagram.common.edit.part;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Constraint;
/**
@@ -67,4 +84,94 @@ public class ConstraintNodeLabelEditPart extends AbstractElementNodeLabelEditPar
// do nothing else refresh
refresh();
}
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ if(IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
+ directEditionMode = getDirectEditionType();
+ }
+ switch(directEditionMode) {
+ case IDirectEdition.NO_DIRECT_EDITION:
+ // no direct edition mode => does nothing
+ return;
+ case IDirectEdition.EXTENDED_DIRECT_EDITOR:
+ updateExtendedEditorConfiguration();
+ if(configuration == null || configuration.getLanguage() == null) {
+ performDefaultDirectEditorEdit(theRequest);
+ } else {
+ configuration.preEditAction(resolveSemanticElement());
+ Dialog dialog = null;
+ if(configuration instanceof IPopupEditorConfiguration) {
+ IPopupEditorHelper helper = ((IPopupEditorConfiguration)configuration).createPopupEditorHelper(this);
+ helper.showEditor();
+ return;
+ } else if(configuration instanceof IAdvancedEditorConfiguration) {
+ dialog = ((IAdvancedEditorConfiguration)configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
+ } else if(configuration instanceof IDirectEditorConfiguration) {
+ dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), ((IDirectEditorConfiguration)configuration).getTextToEdit(resolveSemanticElement()), (IDirectEditorConfiguration)configuration);
+ } else {
+ return;
+ }
+ final Dialog finalDialog = dialog;
+ if(Window.OK == dialog.open()) {
+ TransactionalEditingDomain domain = getEditingDomain();
+ RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
+
+ @Override
+ protected void doExecute() {
+ configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog)finalDialog).getValue());
+ }
+ };
+ domain.getCommandStack().execute(command);
+ }
+ }
+ break;
+ case IDirectEdition.DEFAULT_DIRECT_EDITOR:
+ // initialize the direct edit manager
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if(isActive() && isEditable()) {
+ if(theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character)theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest)theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if(getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager)getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ protected void performDirectEdit(Point eventLocation) {
+ if(getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager)getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/ConstraintPropertyEditHelperAdvice.java.rej b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/ConstraintPropertyEditHelperAdvice.java.rej
new file mode 100644
index 00000000000..3a19c611dae
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/ConstraintPropertyEditHelperAdvice.java.rej
@@ -0,0 +1,9 @@
+@@ -116,7 +116,7 @@
+ // Create targetProperty
+ Property targetProperty = UMLFactory.eINSTANCE.createProperty();
+ targetProperty.setType(sourceType);
+- targetProperty.setName(sourceType.getName().toLowerCase()); // all elements in UML must have a qualified name
++ targetProperty.setName(sourceType.getName() != null ? sourceType.getName().toLowerCase() : "null");
+
+ Association association = UMLFactory.eINSTANCE.createAssociation();
+ association.getMemberEnds().add(sourcePart);
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/PartPropertyEditHelperAdvice.java b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/PartPropertyEditHelperAdvice.java
index 285655e0866..473a9534cd7 100644
--- a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/PartPropertyEditHelperAdvice.java
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/PartPropertyEditHelperAdvice.java
@@ -119,7 +119,7 @@ public class PartPropertyEditHelperAdvice extends AbstractPropertyEditHelperAdvi
// Create targetProperty
Property targetProperty = UMLFactory.eINSTANCE.createProperty();
targetProperty.setType(sourceType);
- targetProperty.setName("");
+ targetProperty.setName(sourceType.getName() != null ? sourceType.getName().toLowerCase() : "null");
Association association = UMLFactory.eINSTANCE.createAssociation();
association.getMemberEnds().add(sourcePart);
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/ReferencePropertyEditHelperAdvice.java b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/ReferencePropertyEditHelperAdvice.java
index ef33c792a83..d6507b5e382 100644
--- a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/ReferencePropertyEditHelperAdvice.java
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/ReferencePropertyEditHelperAdvice.java
@@ -117,7 +117,7 @@ public class ReferencePropertyEditHelperAdvice extends AbstractPropertyEditHelpe
// Create targetProperty
Property targetProperty = UMLFactory.eINSTANCE.createProperty();
targetProperty.setType(sourceType);
- targetProperty.setName("");
+ targetProperty.setName(sourceType.getName() != null ? sourceType.getName().toLowerCase() : "null");
Association association = UMLFactory.eINSTANCE.createAssociation();
association.getMemberEnds().add(sourcePart);

Back to the top