diff options
| author | Prakash Rangaraj | 2010-12-14 10:39:05 +0000 |
|---|---|---|
| committer | Paul Webster | 2012-05-11 13:28:28 +0000 |
| commit | 1688fd0512b7cedebee78ce34891113b85f899cf (patch) | |
| tree | 94764a8fe3720b8c9a5e43e181c5c936898dc75d | |
| parent | c84e4c53437c413aded6d2229248f2a3c7f83e9c (diff) | |
| download | eclipse.platform.ui-1688fd0512b7cedebee78ce34891113b85f899cf.tar.gz eclipse.platform.ui-1688fd0512b7cedebee78ce34891113b85f899cf.tar.xz eclipse.platform.ui-1688fd0512b7cedebee78ce34891113b85f899cf.zip | |
Bug 270007 - [GlobalActions] Registering actions should not be required to use standard org.eclipse.ui commands
cherry-picked from 3.6
2 files changed, 3 insertions, 77 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionFactory.java index 46bb06396b6..6e5bfe60dc0 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionFactory.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionFactory.java @@ -22,7 +22,6 @@ import org.eclipse.ui.internal.IWorkbenchGraphicConstants; import org.eclipse.ui.internal.IWorkbenchHelpContextIds; import org.eclipse.ui.internal.IntroAction; import org.eclipse.ui.internal.NavigationHistoryAction; -import org.eclipse.ui.internal.OpenPreferencesAction; import org.eclipse.ui.internal.SaveAction; import org.eclipse.ui.internal.SaveAllAction; import org.eclipse.ui.internal.SaveAsAction; @@ -950,7 +949,9 @@ public abstract class ActionFactory { if (window == null) { throw new IllegalArgumentException(); } - IWorkbenchAction action = new OpenPreferencesAction(window); + + WorkbenchCommandAction action = new WorkbenchCommandAction( + getCommandId(), window); action.setId(getId()); return action; } diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenPreferencesAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenPreferencesAction.java deleted file mode 100644 index d976a6c6fa4..00000000000 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenPreferencesAction.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.ui.internal; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.preference.PreferenceDialog; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.ActionFactory; -import org.eclipse.ui.dialogs.PreferencesUtil; - -/** - * Open the preferences dialog - */ -public class OpenPreferencesAction extends Action implements ActionFactory.IWorkbenchAction { - - /** - * The workbench window; or <code>null</code> if this - * action has been <code>dispose</code>d. - */ - private IWorkbenchWindow workbenchWindow; - - /** - * Create a new <code>OpenPreferenceAction</code> - * This default constructor allows the the action to be called from the welcome page. - */ - public OpenPreferencesAction() { - this(PlatformUI.getWorkbench().getActiveWorkbenchWindow()); - } - - /** - * Create a new <code>OpenPreferenceAction</code> and initialize it - * from the given resource bundle. - * @param window - */ - public OpenPreferencesAction(IWorkbenchWindow window) { - super(WorkbenchMessages.OpenPreferences_text); - if (window == null) { - throw new IllegalArgumentException(); - } - this.workbenchWindow = window; - // @issue action id not set - setToolTipText(WorkbenchMessages.OpenPreferences_toolTip); - window.getWorkbench().getHelpSystem().setHelp(this, - IWorkbenchHelpContextIds.OPEN_PREFERENCES_ACTION); - } - - /* (non-Javadoc) - * Method declared on Action. - */ - public void run() { - if (workbenchWindow == null) { - // action has been dispose - return; - } - PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, null, null, null); - dialog.open(); - } - - /* (non-Javadoc) - * Method declared on ActionFactory.IWorkbenchAction. - */ - public void dispose() { - workbenchWindow = null; - } - -} |
