Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanh Liem PHAN2017-02-03 10:18:06 +0000
committerGerrit Code Review @ Eclipse.org2017-02-13 16:31:07 +0000
commitab72855fe5e4410565b1521fc6d9fc968d473a6b (patch)
treeeed040729abdcfb2df8ad5d56dd543b4ea7a21ac
parent6d837be05a8f6c176c25d0e3e0e452aecba1fb81 (diff)
downloadorg.eclipse.papyrus-ab72855fe5e4410565b1521fc6d9fc968d473a6b.tar.gz
org.eclipse.papyrus-ab72855fe5e4410565b1521fc6d9fc968d473a6b.tar.xz
org.eclipse.papyrus-ab72855fe5e4410565b1521fc6d9fc968d473a6b.zip
Bug 509357: [Model Explorer] Rename... Contextual menu doesn't exist
anymore for element https://bugs.eclipse.org/bugs/show_bug.cgi?id=509357 - Add commands to rename an element and its label - Refactor common methods into the ModelExplorerEditionUtil class - Refactor rename handlers - Correct an NPE in DirectEditorEditingSupport - Externalise the dialog's parameters Change-Id: I96dd078590139bde342fa6c0e633d04c4cd40b92 Signed-off-by: Thanh Liem PHAN <thanhliem.phan@all4tec.net>
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/commands/RenameDiagramLabelCommand.java51
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/handlers/RenameDiagramHandler.java99
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/messages/Messages.java68
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/messages/messages.properties7
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/commands/RenameTableLabelCommand.java51
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/handlers/RenameTableHandler.java90
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/messages/Messages.java68
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/messages/messages.properties7
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/command/AbstractCommandHandler.java1
-rw-r--r--plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/WorkbenchPartHelper.java59
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/command/RenameNamedElementLabelCommand.java51
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/RenameNamedElementHandler.java103
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/messages/Messages.java36
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/messages/messages.properties3
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF3
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DirectEditorEditingSupport.java30
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/RenameElementCommand.java117
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/RenameLabelCommand.java94
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/messages/Messages.java32
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/messages/messages.properties1
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/util/ModelExplorerEditionUtil.java85
21 files changed, 748 insertions, 308 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/commands/RenameDiagramLabelCommand.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/commands/RenameDiagramLabelCommand.java
new file mode 100644
index 00000000000..85f71ca420c
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/commands/RenameDiagramLabelCommand.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.modelexplorer.commands;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
+import org.eclipse.papyrus.views.modelexplorer.commands.RenameLabelCommand;
+
+/**
+ * Command to rename a label of a {@link Diagram}.
+ */
+public class RenameDiagramLabelCommand extends RenameLabelCommand {
+
+ /**
+ * Default constructor.
+ *
+ * @param editingDomain
+ * The editing domain
+ * @param commandLabel
+ * The command label
+ * @param element
+ * The element whose label is renamed
+ * @param elementLabel
+ * The element label
+ * @param dialogTitle
+ * The dialog title
+ */
+ public RenameDiagramLabelCommand(final TransactionalEditingDomain editingDomain, final String commandLabel, final EObject element, final String elementLabel, final String dialogTitle) {
+ super(editingDomain, commandLabel, element, elementLabel, dialogTitle);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void renameLabel(final EObject element, final String newLabel) {
+ if (element instanceof Diagram) {
+ LabelInternationalization.getInstance().setDiagramLabel((Diagram) element, newLabel, null);
+ }
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/handlers/RenameDiagramHandler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/handlers/RenameDiagramHandler.java
index a318f4d1a89..98c0cb7dd2a 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/handlers/RenameDiagramHandler.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/handlers/RenameDiagramHandler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2016 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2011, 2016, 2017 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -11,35 +11,33 @@
* Christian W. Damus - bug 485220
* Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 509357
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.modelexplorer.handlers;
import java.util.List;
+import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.UnexecutableCommand;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.gmfdiag.modelexplorer.commands.RenameDiagramLabelCommand;
import org.eclipse.papyrus.infra.gmfdiag.modelexplorer.messages.Messages;
import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationPreferencesUtils;
-import org.eclipse.papyrus.views.modelexplorer.DirectEditorEditingSupport;
-import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
-import org.eclipse.swt.widgets.Display;
+import org.eclipse.papyrus.views.modelexplorer.commands.RenameElementCommand;
+import org.eclipse.papyrus.views.modelexplorer.util.ModelExplorerEditionUtil;
/**
- * This handler provides the method to rename a Diagram
+ * This handler provides the method to rename a Diagram.
*/
public class RenameDiagramHandler extends AbstractDiagramCommandHandler {
@@ -54,56 +52,16 @@ public class RenameDiagramHandler extends AbstractDiagramCommandHandler {
if (editingDomain != null && diagrams.size() == 1) {
final Diagram diag = diagrams.get(0);
-
+
final String diagramLabel = LabelInternationalization.getInstance().getDiagramLabelWithoutName(diag);
- if(null != diagramLabel && LabelInternationalizationPreferencesUtils.getInternationalizationPreference(diag)){
- AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(editingDomain, "ChangeDiagramLabelCommand", null) { //$NON-NLS-1$
-
- /**
- *
- * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- *
- * @param monitor
- * @param info
- * @return
- * @throws ExecutionException
- */
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Rename diagram label...", "New label:", diagramLabel, null); //$NON-NLS-1$ //$NON-NLS-2$
- if (Window.OK == dialog.open()) {
- final String label = dialog.getValue();
- if (label != null && label.length() > 0) {
- LabelInternationalization.getInstance().setDiagramLabel(diag, label, null);
- }
- return CommandResult.newOKCommandResult();
- } else {
- return CommandResult.newCancelledCommandResult();
- }
- }
- };
+ if (null != diagramLabel && LabelInternationalizationPreferencesUtils.getInternationalizationPreference(diag)) {
+ AbstractTransactionalCommand cmd = new RenameDiagramLabelCommand(editingDomain, "ChangeDiagramLabelCommand", diag, diagramLabel, Messages.RenameDiagramHandler_Label_DialogTitle); //$NON-NLS-1$
return new GMFtoEMFCommandWrapper(cmd);
- }else{
+ } else {
final String currentName = diag.getName();
if (currentName != null) {
-
- AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(editingDomain, "RenameDiagramCommand", null) { //$NON-NLS-1$
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), Messages.RenameDiagramHandler_RenameAnExistingDiagram, Messages.RenameDiagramHandler_NewName, currentName, null);
- if (dialog.open() == Window.OK) {
- final String name = dialog.getValue();
- if (name != null && name.length() > 0) {
- diag.setName(name);
- }
- return CommandResult.newOKCommandResult();
- } else {
- return CommandResult.newCancelledCommandResult();
- }
- }
- };
- return new GMFtoEMFCommandWrapper(cmd);
+ EStructuralFeature nameFeature = diag.eClass().getEStructuralFeature("name"); //$NON-NLS-1$
+ return new RenameElementCommand(editingDomain, "RenameDiagramCommand", diag, currentName, nameFeature, Messages.RenameDiagramHandler_RenameAnExistingDiagram, Messages.RenameDiagramHandler_NewName); //$NON-NLS-1$
}
}
}
@@ -119,21 +77,30 @@ public class RenameDiagramHandler extends AbstractDiagramCommandHandler {
if (computeEnabled) {
List<EObject> selectedElements = getSelectedElements();
EObject selection = selectedElements.get(0);
- computeEnabled = !EMFHelper.isReadOnly(selection) && !isHandledByDirectEditor(selection);
+ computeEnabled = !EMFHelper.isReadOnly(selection);
}
return computeEnabled;
}
/**
- * Check whether the editing of an element is handled by a direct editor. In this case, we do
- * not want to open the rename pop-up.
- *
- * @param element
- * an element that should be edited.
- * @return true, if handled by a direct editor
+ * {@inheritDoc}
+ *
+ * Overridden to inline edit a diagram if it is handled by direct editor.
*/
- protected boolean isHandledByDirectEditor(final EObject element) {
- return null != DirectEditorEditingSupport.getConfiguration(element);
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ EObject selectedDiagram = getSelectedElement();
+
+ // If the diagram could be handled by direct editor
+ if (ModelExplorerEditionUtil.isHandledByDirectEditor(selectedDiagram)) {
+ // Call the edit element method from the model explorer to trigger DirectEditor
+ ModelExplorerEditionUtil.editElement(selectedDiagram);
+ } else {
+ // Otherwise, show the model dialog to get user input
+ super.execute(event);
+ }
+
+ return null;
}
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/messages/Messages.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/messages/Messages.java
index 80beb8c4d98..154e3311a9a 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/messages/Messages.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/messages/Messages.java
@@ -1,33 +1,35 @@
-/*****************************************************************************
- * Copyright (c) 2014 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:
- * Patrick Tessier (CEA LIST) - Initial API and implementation
- /*****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.modelexplorer.messages;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.gmfdiag.modelexplorer.messages.messages"; //$NON-NLS-1$
-
- public static String DuplicateDiagramHandler_CopyOf;
-
- public static String RenameDiagramHandler_NewName;
-
- public static String RenameDiagramHandler_RenameAnExistingDiagram;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014, 2017 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:
+ * Patrick Tessier (CEA LIST) - Initial API and implementation
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 509357
+ /*****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.modelexplorer.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.gmfdiag.modelexplorer.messages.messages"; //$NON-NLS-1$
+
+ public static String DuplicateDiagramHandler_CopyOf;
+
+ public static String RenameDiagramHandler_NewName;
+
+ public static String RenameDiagramHandler_RenameAnExistingDiagram;
+
+ public static String RenameDiagramHandler_Label_DialogTitle;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/messages/messages.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/messages/messages.properties
index 696090c9cea..799ff43fbf6 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/messages/messages.properties
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/messages/messages.properties
@@ -1,3 +1,4 @@
-DuplicateDiagramHandler_CopyOf=Copy Of {0}
-RenameDiagramHandler_NewName=New name:
-RenameDiagramHandler_RenameAnExistingDiagram=Rename an existing diagram
+DuplicateDiagramHandler_CopyOf=Copy Of {0}
+RenameDiagramHandler_NewName=New name:
+RenameDiagramHandler_RenameAnExistingDiagram=Rename an existing diagram
+RenameDiagramHandler_Label_DialogTitle=Rename diagram label... \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/commands/RenameTableLabelCommand.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/commands/RenameTableLabelCommand.java
new file mode 100644
index 00000000000..f1f2886ac81
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/commands/RenameTableLabelCommand.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.modelexplorer.commands;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.views.modelexplorer.commands.RenameLabelCommand;
+
+/**
+ * Command to rename a label of a {@link Table}.
+ */
+public class RenameTableLabelCommand extends RenameLabelCommand {
+
+ /**
+ * Default constructor.
+ *
+ * @param editingDomain
+ * The editing domain
+ * @param commandLabel
+ * The command label
+ * @param element
+ * The element whose label is renamed
+ * @param elementLabel
+ * The element label
+ * @param dialogTitle
+ * The dialog title
+ */
+ public RenameTableLabelCommand(final TransactionalEditingDomain editingDomain, final String commandLabel, final EObject element, final String elementLabel, final String dialogTitle) {
+ super(editingDomain, commandLabel, element, elementLabel, dialogTitle);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void renameLabel(final EObject element, final String newLabel) {
+ if (element instanceof Table) {
+ LabelInternationalization.getInstance().setTableLabel((Table) element, newLabel, null);
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/handlers/RenameTableHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/handlers/RenameTableHandler.java
index 097ef1f69fa..fe5e827234f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/handlers/RenameTableHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/handlers/RenameTableHandler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2017 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -10,35 +10,33 @@
* Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
* Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 509357
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.modelexplorer.handlers;
import java.util.List;
+import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.UnexecutableCommand;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationPreferencesUtils;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.modelexplorer.commands.RenameTableLabelCommand;
import org.eclipse.papyrus.infra.nattable.modelexplorer.messages.Messages;
-import org.eclipse.papyrus.views.modelexplorer.DirectEditorEditingSupport;
-import org.eclipse.swt.widgets.Display;
+import org.eclipse.papyrus.views.modelexplorer.commands.RenameElementCommand;
+import org.eclipse.papyrus.views.modelexplorer.util.ModelExplorerEditionUtil;
/**
- * This handler provides the method to rename a Table
+ * This handler provides the method to rename a Table.
*/
public class RenameTableHandler extends AbstractTableCommandHandler {
@@ -52,47 +50,16 @@ public class RenameTableHandler extends AbstractTableCommandHandler {
if (editingDomain != null && tables.size() == 1) {
final Table table = tables.get(0);
-
+
final String tableLabel = LabelInternationalization.getInstance().getTableLabelWithoutName(table);
- if(null != tableLabel && LabelInternationalizationPreferencesUtils.getInternationalizationPreference(table)){
- AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(editingDomain, "ChangeTableLabelCommand", null) { //$NON-NLS-1$
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Rename table label...", "New label:", tableLabel, null); //$NON-NLS-1$ //$NON-NLS-2$
- if (Window.OK == dialog.open()) {
- final String label = dialog.getValue();
- if (label != null && label.length() > 0) {
- LabelInternationalization.getInstance().setTableLabel(table, label, null);
- }
- return CommandResult.newOKCommandResult();
- } else {
- return CommandResult.newCancelledCommandResult();
- }
- }
- };
+ if (null != tableLabel && LabelInternationalizationPreferencesUtils.getInternationalizationPreference(table)) {
+ AbstractTransactionalCommand cmd = new RenameTableLabelCommand(editingDomain, "ChangeTableLabelCommand", table, tableLabel, Messages.RenameTableHandler_Label_DialogTitle); //$NON-NLS-1$
return new GMFtoEMFCommandWrapper(cmd);
- }else{
+ } else {
final String currentName = table.getName();
- if (currentName != null) {
-
- AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(editingDomain, "RenameTableCommand", null) { //$NON-NLS-1$
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) {
- InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), Messages.RenameTableHandler_RenameAnExistingTable, Messages.RenameTableHandler_NewName, currentName, null);
- if (dialog.open() == Window.OK) {
- final String name = dialog.getValue();
- if (name != null && name.length() > 0) {
- table.setName(name);
- }
- return CommandResult.newOKCommandResult();
- } else {
- return CommandResult.newCancelledCommandResult();
- }
- }
- };
- return new GMFtoEMFCommandWrapper(cmd);
+ if (null != currentName) {
+ EStructuralFeature nameFeature = table.eClass().getEStructuralFeature("name"); //$NON-NLS-1$
+ return new RenameElementCommand(editingDomain, "RenameTableCommand", table, currentName, nameFeature, Messages.RenameTableHandler_RenameAnExistingTable, Messages.RenameTableHandler_NewName); // $NON-NLS-1$
}
}
}
@@ -108,21 +75,30 @@ public class RenameTableHandler extends AbstractTableCommandHandler {
if (computeEnabled) {
List<EObject> selectedElements = getSelectedElements();
EObject selection = selectedElements.get(0);
- computeEnabled = !EMFHelper.isReadOnly(selection) && !isHandledByDirectEditor(selection);
+ computeEnabled = !EMFHelper.isReadOnly(selection);
}
return computeEnabled;
}
/**
- * Check whether the editing of an element is handled by a direct editor. In this case, we do
- * not want to open the rename pop-up.
- *
- * @param element
- * an element that should be edited.
- * @return true, if handled by a direct editor
+ * {@inheritDoc}
+ *
+ * Overridden to inline edit a table if it is handled by direct editor.
*/
- protected boolean isHandledByDirectEditor(final EObject element) {
- return null != DirectEditorEditingSupport.getConfiguration(element);
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ EObject selectedTable = getSelectedElement();
+
+ // If the selected table could be handled by direct editor
+ if (ModelExplorerEditionUtil.isHandledByDirectEditor(selectedTable)) {
+ // Call the edit element method from the model explorer to trigger DirectEditor
+ ModelExplorerEditionUtil.editElement(selectedTable);
+ } else {
+ // Otherwise, show the model dialog to get user input
+ super.execute(event);
+ }
+
+ return null;
}
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/messages/Messages.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/messages/Messages.java
index d0fe7a9f2b2..9e0ed57180e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/messages/Messages.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/messages/Messages.java
@@ -1,32 +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:
- * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.modelexplorer.messages;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.nattable.modelexplorer.messages.messages"; //$NON-NLS-1$
-
- public static String DuplicateTableHandler_CopyOf;
-
- public static String RenameTableHandler_NewName;
-
- public static String RenameTableHandler_RenameAnExistingTable;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+/*****************************************************************************
+ * 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:
+ * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 509357
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.modelexplorer.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.nattable.modelexplorer.messages.messages"; //$NON-NLS-1$
+
+ public static String DuplicateTableHandler_CopyOf;
+
+ public static String RenameTableHandler_NewName;
+
+ public static String RenameTableHandler_RenameAnExistingTable;
+
+ public static String RenameTableHandler_Label_DialogTitle;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/messages/messages.properties b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/messages/messages.properties
index 4cd13849a21..1f426b55e17 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/messages/messages.properties
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/messages/messages.properties
@@ -1,3 +1,4 @@
-DuplicateTableHandler_CopyOf=Copy Of {0}
-RenameTableHandler_NewName=New name:
-RenameTableHandler_RenameAnExistingTable=Rename an existing table
+DuplicateTableHandler_CopyOf=Copy Of {0}
+RenameTableHandler_NewName=New name:
+RenameTableHandler_RenameAnExistingTable=Rename an existing table
+RenameTableHandler_Label_DialogTitle=Rename table label...
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/command/AbstractCommandHandler.java b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/command/AbstractCommandHandler.java
index c80791a8047..46088acc19a 100644
--- a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/command/AbstractCommandHandler.java
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/command/AbstractCommandHandler.java
@@ -183,7 +183,6 @@ public abstract class AbstractCommandHandler extends AbstractPapyrusHandler {
if (selection instanceof Collection<?>) {
this.selection = (selection instanceof List<?>) ? (List<?>) selection : new java.util.ArrayList<Object>((Collection<?>) selection);
setBaseEnabled(computeEnabled(context));
- this.selection = Collections.EMPTY_LIST;
}
}
super.setEnabled(evaluationContext);
diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/WorkbenchPartHelper.java b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/WorkbenchPartHelper.java
index 440fd597ff0..240874d8f23 100644
--- a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/WorkbenchPartHelper.java
+++ b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/util/WorkbenchPartHelper.java
@@ -1,6 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
+ * Copyright (c) 2012, 2017 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,7 +8,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 509357
*****************************************************************************/
package org.eclipse.papyrus.infra.ui.util;
@@ -21,11 +20,14 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
/**
- *
- * a helper for the Eclipse workbench part
+ * A helper for retrieving from Eclipse Platform UI:
+ * <ul>
+ * <li>the active editor part</li>
+ * <li>the active workbench part</li>
+ * <li>and the active workbench</li>
+ * </ul>
*
* @since 1.2
- *
*/
public class WorkbenchPartHelper {
@@ -34,40 +36,45 @@ public class WorkbenchPartHelper {
}
/**
- *
* @return
- * the current IWorkbenchPart or <code>null</code> if not found
+ * The current {@link IWorkbenchPage} or <code>null</code> if not found
*/
- public static final IWorkbenchPart getCurrentActiveWorkbenchPart() {
+ public static final IWorkbenchPage getCurrentActiveWorkbenchPage() {
final IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null) {
+ if (null != workbench) {
final IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow();
- if (activeWorkbench != null) {
- final IWorkbenchPage activePage = activeWorkbench.getActivePage();
- if (activePage != null) {
- return activePage.getActivePart();
- }
+ if (null != activeWorkbench) {
+ return activeWorkbench.getActivePage();
}
}
+
+ return null;
+ }
+
+
+ /**
+ * @return
+ * The current {@link IWorkbenchPart} or <code>null</code> if not found
+ */
+ public static final IWorkbenchPart getCurrentActiveWorkbenchPart() {
+ final IWorkbenchPage activePage = getCurrentActiveWorkbenchPage();
+ if (null != activePage) {
+ return activePage.getActivePart();
+ }
+
return null;
}
/**
- *
* @return
- * the current IEditorPart or <code>null</code> if not found
+ * The current {@link IEditorPart} or <code>null</code> if not found
*/
public static final IEditorPart getCurrentActiveEditorPart() {
- final IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null) {
- final IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow();
- if (activeWorkbench != null) {
- final IWorkbenchPage activePage = activeWorkbench.getActivePage();
- if (activePage != null) {
- return activePage.getActiveEditor();
- }
- }
+ final IWorkbenchPage activePage = getCurrentActiveWorkbenchPage();
+ if (null != activePage) {
+ return activePage.getActiveEditor();
}
+
return null;
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/command/RenameNamedElementLabelCommand.java b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/command/RenameNamedElementLabelCommand.java
new file mode 100644
index 00000000000..4fc978e26e4
--- /dev/null
+++ b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/command/RenameNamedElementLabelCommand.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.commands.command;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization;
+import org.eclipse.papyrus.views.modelexplorer.commands.RenameLabelCommand;
+import org.eclipse.uml2.uml.NamedElement;
+
+/**
+ * Command to rename a label of a {@link NamedElement}.
+ */
+public class RenameNamedElementLabelCommand extends RenameLabelCommand {
+
+ /**
+ * Default constructor.
+ *
+ * @param editingDomain
+ * The editing domain
+ * @param commandLabel
+ * The command label
+ * @param element
+ * The element whose label is renamed
+ * @param elementLabel
+ * The element label
+ * @param dialogTitle
+ * The dialog title
+ */
+ public RenameNamedElementLabelCommand(final TransactionalEditingDomain editingDomain, final String commandLabel, final EObject element, final String elementLabel, final String dialogTitle) {
+ super(editingDomain, commandLabel, element, elementLabel, dialogTitle);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void renameLabel(final EObject element, final String newLabel) {
+ if (element instanceof NamedElement) {
+ UMLLabelInternationalization.getInstance().setLabel((NamedElement) element, newLabel, null);
+ }
+ }
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/RenameNamedElementHandler.java b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/RenameNamedElementHandler.java
index 0650c1c249a..50a01f35e38 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/RenameNamedElementHandler.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/handler/RenameNamedElementHandler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2016 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2011, 2016, 2017 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -10,40 +10,31 @@
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Christian W. Damus - bug 506896
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
- *
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 509357
*****************************************************************************/
package org.eclipse.papyrus.uml.commands.handler;
import java.util.List;
+import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.UnexecutableCommand;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.emf.gmf.command.ICommandWrapper;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationPreferencesUtils;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.infra.ui.command.AbstractCommandHandler;
-import org.eclipse.papyrus.infra.ui.command.InteractiveCommandWrapper;
+import org.eclipse.papyrus.uml.commands.command.RenameNamedElementLabelCommand;
+import org.eclipse.papyrus.uml.commands.messages.Messages;
import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization;
-import org.eclipse.papyrus.views.modelexplorer.DirectEditorEditingSupport;
-import org.eclipse.swt.widgets.Display;
+import org.eclipse.papyrus.views.modelexplorer.commands.RenameElementCommand;
+import org.eclipse.papyrus.views.modelexplorer.util.ModelExplorerEditionUtil;
import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.UMLPackage;
-
-import com.google.common.base.Strings;
/**
* This handler implements renaming of {@link NamedElement}s.
@@ -58,61 +49,18 @@ public class RenameNamedElementHandler extends AbstractCommandHandler {
EObject selectedElement = getSelectedElement();
if (selectedElement instanceof NamedElement) {
final NamedElement namedElement = (NamedElement) selectedElement;
-
+
// If the label exists, modify the label instead of name
final String label = UMLLabelInternationalization.getInstance().getLabelWithoutUML(namedElement);
if (null != label && LabelInternationalizationPreferencesUtils.getInternationalizationPreference(namedElement)) {
- AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(editingDomain, "ChangeLabelCommand", null) { //$NON-NLS-1$
-
- /**
- *
- * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
- *
- * @param monitor
- * @param info
- * @return
- * @throws ExecutionException
- */
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Rename label...", "New label:", label, null); //$NON-NLS-1$ //$NON-NLS-2$
- if (Window.OK == dialog.open()) {
- final String label = dialog.getValue();
- if (label != null && label.length() > 0) {
- UMLLabelInternationalization.getInstance().setLabel(namedElement, label, null);
- }
- return CommandResult.newOKCommandResult();
- } else {
- return CommandResult.newCancelledCommandResult();
- }
- }
- };
+ AbstractTransactionalCommand cmd = new RenameNamedElementLabelCommand(editingDomain, "ChangeLabelCommand", namedElement, label, Messages.RenameNamedElementHandler_Label_DialogTitle); //$NON-NLS-1$
result = new GMFtoEMFCommandWrapper(cmd);
} else {
final String currentName = namedElement.getName();
if (currentName != null) {
- result = new InteractiveCommandWrapper("Rename", "Change the name of an element") {
- @Override
- protected Command createCommand() {
- Command result = UnexecutableCommand.INSTANCE;
-
- InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Rename...", "New name:", currentName, null);
- if (dialog.open() == Window.OK) {
- String name = dialog.getValue();
-
- if (!Strings.isNullOrEmpty(name) && !name.equals(currentName)) {
- IElementEditService edit = ElementEditServiceUtils.getCommandProvider(namedElement);
- SetRequest request = new SetRequest(editingDomain, namedElement, UMLPackage.Literals.NAMED_ELEMENT__NAME, name);
- if (edit.canEdit(request)) {
- result = ICommandWrapper.wrap(edit.getEditCommand(request), Command.class);
- }
- }
- }
-
- return result;
- }
- };
+ EStructuralFeature nameFeature = namedElement.eClass().getEStructuralFeature("name"); //$NON-NLS-1$
+ result = new RenameElementCommand(editingDomain, "Rename", namedElement, currentName, nameFeature, Messages.RenameNamedElementHandler_Name_DialogTitle, Messages.RenameNamedElementHandler_Name_DialogMessage); //$NON-NLS-1$
}
}
}
@@ -126,20 +74,29 @@ public class RenameNamedElementHandler extends AbstractCommandHandler {
if (enabled) {
List<EObject> selectedElements = getSelectedElements();
EObject selection = selectedElements.get(0);
- enabled = !EMFHelper.isReadOnly(selection) && !isHandledByDirectEditor(selection);
+ enabled = !EMFHelper.isReadOnly(selection);
}
return enabled;
}
/**
- * Check whether the editing of an element is handled by a direct editor. In this case, we do
- * not want to open the rename pop-up.
- *
- * @param element
- * an element that should be edited.
- * @return true, if handled by a direct editor
+ * {@inheritDoc}
+ *
+ * Overridden to inline edit a named element if it is handled by direct editor.
*/
- protected boolean isHandledByDirectEditor(EObject element) {
- return DirectEditorEditingSupport.getConfiguration(element) != null;
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ EObject selectedElement = getSelectedElement();
+
+ // If the selected named element could be handled by direct editor
+ if (ModelExplorerEditionUtil.isHandledByDirectEditor(selectedElement)) {
+ // Call the edit element method from the model explorer to trigger DirectEditor
+ ModelExplorerEditionUtil.editElement(selectedElement);
+ } else {
+ // Otherwise, show the model dialog to get user input
+ super.execute(event);
+ }
+
+ return null;
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/messages/Messages.java b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/messages/Messages.java
new file mode 100644
index 00000000000..b1c77e8a42c
--- /dev/null
+++ b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/messages/Messages.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.commands.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Messages class for the plugin org.eclipse.papyrus.uml.commands.
+ */
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.commands.messages.messages"; //$NON-NLS-1$
+
+ public static String RenameNamedElementHandler_Label_DialogTitle;
+
+ public static String RenameNamedElementHandler_Name_DialogTitle;
+
+ public static String RenameNamedElementHandler_Name_DialogMessage;
+
+ static {
+ // Initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/messages/messages.properties b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/messages/messages.properties
new file mode 100644
index 00000000000..799d556d267
--- /dev/null
+++ b/plugins/uml/org.eclipse.papyrus.uml.commands/src/org/eclipse/papyrus/uml/commands/messages/messages.properties
@@ -0,0 +1,3 @@
+RenameNamedElementHandler_Label_DialogTitle=Rename label...
+RenameNamedElementHandler_Name_DialogTitle=Rename...
+RenameNamedElementHandler_Name_DialogMessage=New name: \ No newline at end of file
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF
index 303731cc0ea..bf007871e7e 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/META-INF/MANIFEST.MF
@@ -10,7 +10,8 @@ Export-Package: org.eclipse.papyrus.views.modelexplorer,
org.eclipse.papyrus.views.modelexplorer.handler,
org.eclipse.papyrus.views.modelexplorer.matching,
org.eclipse.papyrus.views.modelexplorer.preferences,
- org.eclipse.papyrus.views.modelexplorer.queries
+ org.eclipse.papyrus.views.modelexplorer.queries,
+ org.eclipse.papyrus.views.modelexplorer.util
Require-Bundle: org.eclipse.ui.navigator;bundle-version="[3.6.0,4.0.0)";visibility:=reexport,
org.eclipse.emf.converter;bundle-version="[2.7.0,3.0.0)",
org.eclipse.emf.ecore.editor;bundle-version="[2.11.0,3.0.0)",
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DirectEditorEditingSupport.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DirectEditorEditingSupport.java
index 52109dc3526..dd6ef9f3af7 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DirectEditorEditingSupport.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DirectEditorEditingSupport.java
@@ -94,7 +94,7 @@ public class DirectEditorEditingSupport extends EditingSupport {
}
/**
- * Obtain direct editor configuration for a semantic element
+ * Obtain direct editor configuration for a semantic element.
*
* @param semanticElement
* a semantic element
@@ -102,22 +102,26 @@ public class DirectEditorEditingSupport extends EditingSupport {
*/
public static ICustomDirectEditorConfiguration getConfiguration(final EObject semanticElement) {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
- EClass eClass = semanticElement.eClass();
- String semanticClassName = eClass.getInstanceClassName();
- String key = IDirectEditorsIds.EDITOR_FOR_ELEMENT + semanticClassName;
- String languagePreferred = store.getString(key);
- IDirectEditorConfiguration configuration = null;
+ if (null != semanticElement) {
+ EClass eClass = semanticElement.eClass();
+ String semanticClassName = eClass.getInstanceClassName();
+ String key = IDirectEditorsIds.EDITOR_FOR_ELEMENT + semanticClassName;
+ String languagePreferred = store.getString(key);
- if (null != languagePreferred && !languagePreferred.isEmpty()) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, semanticElement, semanticElement);
- } else {
- configuration = getConfigurationSuperType(eClass, semanticElement);
- }
+ IDirectEditorConfiguration configuration = null;
+
+ if (null != languagePreferred && !languagePreferred.isEmpty()) {
+ configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, semanticElement, semanticElement);
+ } else {
+ configuration = getConfigurationSuperType(eClass, semanticElement);
+ }
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- return (ICustomDirectEditorConfiguration) configuration;
+ if (configuration instanceof ICustomDirectEditorConfiguration) {
+ return (ICustomDirectEditorConfiguration) configuration;
+ }
}
+
return null;
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/RenameElementCommand.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/RenameElementCommand.java
new file mode 100644
index 00000000000..64bcf11f63a
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/RenameElementCommand.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.views.modelexplorer.commands;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.emf.gmf.command.ICommandWrapper;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.infra.ui.command.InteractiveCommandWrapper;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Command to rename an element.
+ */
+public class RenameElementCommand extends InteractiveCommandWrapper {
+
+ /**
+ * The editing domain.
+ */
+ private TransactionalEditingDomain editingDomain = null;
+
+ /**
+ * The element to be renamed.
+ */
+ private EObject element = null;
+
+ /**
+ * The current name of element.
+ */
+ private String currentElementName = null;
+
+ /**
+ * The structural feature of name.
+ */
+ private EStructuralFeature nameStructuralFeature = null;
+
+ /**
+ * The input dialog title.
+ */
+ private String dialogTitle = null;
+
+ /**
+ * The input dialog message.
+ */
+ private String dialogMessage = null;
+
+ /**
+ * Default constructor.
+ *
+ * @param editingDomain
+ * The editing domain
+ * @param commandLabel
+ * The command label
+ * @param element
+ * The named element
+ * @param currentElementName
+ * The current element name
+ * @param nameStructuralFeature
+ * The name structural feature
+ * @param dialogTitle
+ * The dialog title
+ * @param dialogMessage
+ * The dialog message
+ */
+ public RenameElementCommand(final TransactionalEditingDomain editingDomain, final String commandLabel, final EObject element, final String currentElementName, final EStructuralFeature nameStructuralFeature, final String dialogTitle,
+ final String dialogMessage) {
+ super(commandLabel);
+ this.editingDomain = editingDomain;
+ this.element = element;
+ this.currentElementName = currentElementName;
+ this.nameStructuralFeature = nameStructuralFeature;
+ this.dialogTitle = dialogTitle;
+ this.dialogMessage = dialogMessage;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command createCommand() {
+ Command result = UnexecutableCommand.INSTANCE;
+
+ InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), this.dialogTitle, this.dialogMessage, this.currentElementName, null);
+
+ // Check parameters before opening the input dialog
+ if (null != this.editingDomain && null != this.element && null != this.nameStructuralFeature && Window.OK == dialog.open()) {
+ String newName = dialog.getValue();
+
+ if (null != newName && !newName.isEmpty() && !newName.equals(this.currentElementName)) {
+ IElementEditService edit = ElementEditServiceUtils.getCommandProvider(this.element);
+
+ SetRequest request = new SetRequest(this.editingDomain, this.element, this.nameStructuralFeature, newName);
+ if (edit.canEdit(request)) {
+ result = ICommandWrapper.wrap(edit.getEditCommand(request), Command.class);
+ }
+ }
+ }
+
+ return result;
+ }
+}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/RenameLabelCommand.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/RenameLabelCommand.java
new file mode 100644
index 00000000000..ab8a36a63f7
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/RenameLabelCommand.java
@@ -0,0 +1,94 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.views.modelexplorer.commands;
+
+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.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.views.modelexplorer.messages.Messages;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Command to rename a label of an element.
+ */
+public abstract class RenameLabelCommand extends AbstractTransactionalCommand {
+
+ /**
+ * The element whose label will be renamed.
+ */
+ private EObject element = null;
+
+ /**
+ * The current element label.
+ */
+ private String currentElementLabel = null;
+
+ /**
+ * The input dialog title.
+ */
+ private String dialogTitle = null;
+
+ /**
+ * Default constructor.
+ *
+ * @param editingDomain
+ * The editing domain
+ * @param commandLabel
+ * The command label
+ * @param element
+ * The element whose label is renamed
+ * @param currentElementLabel
+ * The current element label
+ * @param dialogTitle
+ * The dialog title
+ */
+ public RenameLabelCommand(final TransactionalEditingDomain editingDomain, final String commandLabel, final EObject element, final String currentElementLabel, final String dialogTitle) {
+ super(editingDomain, commandLabel, null);
+ this.element = element;
+ this.currentElementLabel = currentElementLabel;
+ this.dialogTitle = dialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), this.dialogTitle, Messages.RenameLabelCommand_DialogMessage, this.currentElementLabel, null);
+
+ if (Window.OK == dialog.open()) {
+ final String newLabel = dialog.getValue();
+ if (null != newLabel && !newLabel.equals(this.currentElementLabel)) {
+ renameLabel(this.element, newLabel);
+ }
+ return CommandResult.newOKCommandResult();
+ } else {
+ return CommandResult.newCancelledCommandResult();
+ }
+ }
+
+ /**
+ * Rename the label of an element.
+ *
+ * @param element
+ * The element
+ * @param newLabel
+ * The new label
+ */
+ protected abstract void renameLabel(final EObject element, final String newLabel);
+}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/messages/Messages.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/messages/Messages.java
new file mode 100644
index 00000000000..b6b81990ad9
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/messages/Messages.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.views.modelexplorer.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Messages class for the plugin org.eclipse.papyrus.views.modelexplorer.
+ */
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.views.modelexplorer.messages.messages"; //$NON-NLS-1$
+
+ public static String RenameLabelCommand_DialogMessage;
+
+ static {
+ // Initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/messages/messages.properties b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/messages/messages.properties
new file mode 100644
index 00000000000..6cd545bbd4d
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/messages/messages.properties
@@ -0,0 +1 @@
+RenameLabelCommand_DialogMessage=New label:
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/util/ModelExplorerEditionUtil.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/util/ModelExplorerEditionUtil.java
new file mode 100644
index 00000000000..1cfcd090b74
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/util/ModelExplorerEditionUtil.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2017 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:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.views.modelexplorer.util;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.ui.util.WorkbenchPartHelper;
+import org.eclipse.papyrus.views.modelexplorer.DirectEditorEditingSupport;
+import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
+import org.eclipse.papyrus.views.modelexplorer.ModelExplorerView;
+import org.eclipse.papyrus.views.modelexplorer.core.ui.pagebookview.MultiViewPageBookView;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * Class contains common methods to be used by different handlers in Model Explorer.
+ */
+public class ModelExplorerEditionUtil {
+
+ /**
+ * @return The Model Explorer active view part
+ */
+ public static IViewPart getModelExplorerActiveViewPart() {
+ IViewPart activeView = null;
+
+ final IWorkbenchPage activeWorkbenchPage = WorkbenchPartHelper.getCurrentActiveWorkbenchPage();
+
+ if (null != activeWorkbenchPage) {
+ // Get Model Explorer view part
+ final IViewPart modelExplorerView = activeWorkbenchPage.findView(ModelExplorerPageBookView.VIEW_ID);
+
+ if (modelExplorerView instanceof MultiViewPageBookView) {
+ final MultiViewPageBookView pageBook = (MultiViewPageBookView) modelExplorerView;
+ activeView = pageBook.getActiveView();
+ }
+ }
+
+ return activeView;
+ }
+
+ /**
+ * Check whether the editing of an element is handled by a direct editor. In this case, we do
+ * not want to open the rename pop-up.
+ *
+ * @param element
+ * The element that should be edited
+ * @return <code>true</code> if the element is handled by a direct editor, <code>false</code> otherwise
+ */
+ public static boolean isHandledByDirectEditor(final EObject element) {
+ return null != DirectEditorEditingSupport.getConfiguration(element);
+ }
+
+ /**
+ * Edit a selection element from the model explorer view.
+ *
+ * @param selectionObject
+ * The selection object to be edited
+ */
+ public static void editElement(final EObject selectionObject) {
+ Display.getCurrent().asyncExec(new Runnable() {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void run() {
+ IViewPart viewPart = getModelExplorerActiveViewPart();
+
+ if (viewPart instanceof ModelExplorerView) {
+ ((ModelExplorerView) viewPart).editElement(selectionObject, 0);
+ }
+ }
+ });
+ }
+}

Back to the top