Bug 532486 - Commands contributed to an E4 view don't update text if nl
changes
Change-Id: Ida39aced6cc017197b6af1d69f930681e2be9500
Signed-off-by: kalyan prasad <kalyan_prasad@in.ibm.com>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CommandToModelProcessor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CommandToModelProcessor.java
index 009fc58..060c018 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CommandToModelProcessor.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CommandToModelProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2015 IBM Corporation and others.
+ * Copyright (c) 2010, 2018 IBM Corporation and others.
* 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
@@ -77,7 +77,21 @@
*/
private void generateCommands(MApplication application, CommandManager commandManager) {
for (Command cmd : commandManager.getDefinedCommands()) {
- if (commands.containsKey(cmd.getId())) {
+ final MCommand mCommand = commands.get(cmd.getId());
+ if (mCommand != null) {
+ try {
+ // This is needed to set the command name and description using the correct locale.
+ String cmdName = cmd.getName();
+ if (!cmdName.equals(mCommand.getCommandName())) {
+ mCommand.setCommandName(cmdName);
+ String cmdDesc = cmd.getDescription();
+ if (cmdDesc != null)
+ mCommand.setDescription(cmdDesc);
+ }
+ } catch (NotDefinedException e) {
+ // Since we asked for defined commands, this shouldn't be an issue
+ WorkbenchPlugin.log(e);
+ }
continue;
}
try {