diff options
| author | Prakash Rangaraj | 2010-10-14 05:33:51 +0000 |
|---|---|---|
| committer | Paul Webster | 2012-03-12 19:04:45 +0000 |
| commit | 05ec13e27fe45d43ada84e49f46b45f7822813f8 (patch) | |
| tree | 924ca0a0096ff6af444327934380e70e8be8439b | |
| parent | cc2fde31224e85afdd2c0d0d4a4c906f4afd7e79 (diff) | |
| download | eclipse.platform.ui-05ec13e27fe45d43ada84e49f46b45f7822813f8.tar.gz eclipse.platform.ui-05ec13e27fe45d43ada84e49f46b45f7822813f8.tar.xz eclipse.platform.ui-05ec13e27fe45d43ada84e49f46b45f7822813f8.zip | |
[Bug 327690] WizardHandlers could update the contribution's UI properties
| -rw-r--r-- | bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WizardHandler.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WizardHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WizardHandler.java index 6a34bd213f2..f99576e03e5 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WizardHandler.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/WizardHandler.java @@ -11,6 +11,7 @@ *******************************************************************************/ package org.eclipse.ui.internal.handlers; +import java.util.Map; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; @@ -28,6 +29,7 @@ import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWizard; import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.IElementUpdater; import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.ui.internal.IWorkbenchHelpContextIds; import org.eclipse.ui.internal.LegacyResourceSupport; @@ -35,6 +37,7 @@ import org.eclipse.ui.internal.WorkbenchPlugin; import org.eclipse.ui.internal.dialogs.ImportExportWizard; import org.eclipse.ui.internal.dialogs.NewWizard; import org.eclipse.ui.internal.util.Util; +import org.eclipse.ui.menus.UIElement; import org.eclipse.ui.wizards.IWizardDescriptor; import org.eclipse.ui.wizards.IWizardRegistry; @@ -47,7 +50,7 @@ import org.eclipse.ui.wizards.IWizardRegistry; * * @since 3.2 */ -public abstract class WizardHandler extends AbstractHandler { +public abstract class WizardHandler extends AbstractHandler implements IElementUpdater { /** * Default handler for launching export wizards. @@ -318,6 +321,19 @@ public abstract class WizardHandler extends AbstractHandler { return StructuredSelection.EMPTY; } + public void updateElement(UIElement element, Map parameters) { + + String wizardId = (String) parameters.get(getWizardIdParameterId()); + if (wizardId == null) + return; + IWizardDescriptor wizard = getWizardRegistry().findWizard(wizardId); + if (wizard != null) { + element.setText(wizard.getLabel()); + element.setTooltip(wizard.getDescription()); + element.setIcon(wizard.getImageDescriptor()); + } + } + /** * Returns the id of the parameter used to indicate which wizard this * command should launch. |
