Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Webster2007-05-13 16:33:31 +0000
committerPaul Webster2007-05-13 16:33:31 +0000
commit9e3873b8aa690308e76a3e65104a950ac548d460 (patch)
treeac3b92f73c91e967f43ebc5ecc30db90195559d1 /bundles/org.eclipse.ui.workbench/Eclipse UI/org
parent4143f5b6138cad95b1862e35afb484bb7233480c (diff)
downloadeclipse.platform.ui-9e3873b8aa690308e76a3e65104a950ac548d460.tar.gz
eclipse.platform.ui-9e3873b8aa690308e76a3e65104a950ac548d460.tar.xz
eclipse.platform.ui-9e3873b8aa690308e76a3e65104a950ac548d460.zip
Bug 172191 [GlobalActions] Window>Show View>Other fails with NPE
provide for an optional makeFast parameter on the command
Diffstat (limited to 'bundles/org.eclipse.ui.workbench/Eclipse UI/org')
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ShowViewHandler.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenu.java36
2 files changed, 37 insertions, 2 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ShowViewHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ShowViewHandler.java
index 9af4bcd5ac9..afe4880c8f2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ShowViewHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/handlers/ShowViewHandler.java
@@ -42,6 +42,7 @@ public final class ShowViewHandler extends AbstractHandler {
*/
private static final String PARAMETER_NAME_VIEW_ID = "org.eclipse.ui.views.showView.viewId"; //$NON-NLS-1$
private boolean makeFast = false;
+ private static final String PARAMETER_MAKE_FAST = "org.eclipse.ui.views.showView.makeFast"; //$NON-NLS-1$
/**
* Creates a new ShowViewHandler that will open the view in its default location.
@@ -68,6 +69,8 @@ public final class ShowViewHandler extends AbstractHandler {
// Get the view identifier, if any.
final Map parameters = event.getParameters();
final Object value = parameters.get(PARAMETER_NAME_VIEW_ID);
+ makeFast = "true".equals(parameters.get(PARAMETER_MAKE_FAST)); //$NON-NLS-1$
+
if (value == null) {
openOther(window);
} else {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenu.java
index 324b04ebc09..ea9d2fb935a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenu.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenu.java
@@ -20,9 +20,13 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IParameter;
import org.eclipse.core.commands.NotEnabledException;
import org.eclipse.core.commands.NotHandledException;
+import org.eclipse.core.commands.Parameterization;
+import org.eclipse.core.commands.ParameterizedCommand;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ContributionItem;
@@ -38,6 +42,7 @@ import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.activities.WorkbenchActivityHelper;
+import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.internal.intro.IIntroConstants;
import org.eclipse.ui.views.IViewDescriptor;
@@ -51,6 +56,8 @@ import com.ibm.icu.text.Collator;
* Perspective Customize dialog.
*/
public class ShowViewMenu extends ContributionItem {
+ private static final String SHOW_VIEW_ID = "org.eclipse.ui.views.showView"; //$NON-NLS-1$
+ private static final String PARAMETER_MAKE_FAST = "org.eclipse.ui.views.showView.makeFast"; //$NON-NLS-1$
private IWorkbenchWindow window;
@@ -111,11 +118,15 @@ public class ShowViewMenu extends ContributionItem {
this.window = window;
final IHandlerService handlerService = (IHandlerService) window
.getService(IHandlerService.class);
+ final ICommandService commandService = (ICommandService) window
+ .getService(ICommandService.class);
+ final ParameterizedCommand cmd = getCommand(commandService, makeFast);
+
showDlgAction = new Action(WorkbenchMessages.ShowView_title) {
public void run() {
try {
handlerService.executeCommand(
- "org.eclipse.ui.views.showView", null); //$NON-NLS-1$
+ cmd, null);
} catch (final ExecutionException e) {
// Do nothing.
} catch (NotDefinedException e) {
@@ -134,7 +145,7 @@ public class ShowViewMenu extends ContributionItem {
((WorkbenchWindow) window)
.addSubmenu(WorkbenchWindow.SHOW_VIEW_SUBMENU);
- showDlgAction.setActionDefinitionId("org.eclipse.ui.views.showView"); //$NON-NLS-1$
+ showDlgAction.setActionDefinitionId(SHOW_VIEW_ID);
this.makeFast = makeFast;
}
@@ -273,4 +284,25 @@ public class ShowViewMenu extends ContributionItem {
actions.remove(viewId);
}
+
+ /**
+ * @param commandService
+ * @param makeFast
+ */
+ private ParameterizedCommand getCommand(ICommandService commandService,
+ final boolean makeFast) {
+ Command c = commandService.getCommand(SHOW_VIEW_ID);
+ Parameterization[] parms = null;
+ if (makeFast) {
+ try {
+ IParameter parmDef = c.getParameter(PARAMETER_MAKE_FAST);
+ parms = new Parameterization[] {
+ new Parameterization(parmDef, "true") //$NON-NLS-1$
+ };
+ } catch (NotDefinedException e) {
+ // this should never happen
+ }
+ }
+ return new ParameterizedCommand(c, parms);
+ }
}

Back to the top