diff options
author | Nicolas FAUVERGUE | 2016-11-24 11:20:54 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-11-29 10:57:50 +0000 |
commit | b3141df23ca644573f8b2813ad8859722d418bd9 (patch) | |
tree | 6db261c6f918988a7117bfe93731af4ca17f0723 /plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer | |
parent | 6d4f41d7e479bfa607ffde18b16fe8ebdae561c2 (diff) | |
download | org.eclipse.papyrus-b3141df23ca644573f8b2813ad8859722d418bd9.tar.gz org.eclipse.papyrus-b3141df23ca644573f8b2813ad8859722d418bd9.tar.xz org.eclipse.papyrus-b3141df23ca644573f8b2813ad8859722d418bd9.zip |
Bug 496905: [Diagram][ModelExplorer][Table][Dialog] Papyrus must integrate
the internationalization feature provided by UML.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=496905
Commit of infra for internationalization.
Change-Id: I1b1859bf111e1ef7a7522212fbe639cf2bd13890
Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer')
2 files changed, 47 insertions, 12 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF index 60578c27e04..6c76cfaf435 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF @@ -3,7 +3,8 @@ Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0, org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)", org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)", - org.eclipse.papyrus.views.modelexplorer;bundle-version="[3.0.0,4.0.0)" + org.eclipse.papyrus.views.modelexplorer;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 1.2.0.qualifier 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 c8b292288bb..a318f4d1a89 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 @@ -10,6 +10,7 @@ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation * Christian W. Damus - bug 485220 * Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289 + * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 * *****************************************************************************/ package org.eclipse.papyrus.infra.gmfdiag.modelexplorer.handlers; @@ -31,6 +32,8 @@ import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.window.Window; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; 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; @@ -51,18 +54,27 @@ public class RenameDiagramHandler extends AbstractDiagramCommandHandler { if (editingDomain != null && diagrams.size() == 1) { final Diagram diag = diagrams.get(0); - final String currentName = diag.getName(); - if (currentName != null) { - - AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(editingDomain, "RenameDiagramCommand", null) { //$NON-NLS-1$ - + + 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(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); + 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 { @@ -71,6 +83,28 @@ public class RenameDiagramHandler extends AbstractDiagramCommandHandler { } }; return new GMFtoEMFCommandWrapper(cmd); + }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); + } } } return UnexecutableCommand.INSTANCE; |