aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWojciech Sudol2014-04-24 07:22:37 (EDT)
committerPaul Webster2014-04-24 19:44:29 (EDT)
commit2f4ee54fdf2cb0b1f5a9fe73a52917b6b1e92779 (patch)
treed4c0b381fe236152b302c37d43a29f876d40d0ef
parent979d5bf2ce1c3233a871bb0b1391615980286358 (diff)
downloadeclipse.platform.ui-2f4ee54fdf2cb0b1f5a9fe73a52917b6b1e92779.zip
eclipse.platform.ui-2f4ee54fdf2cb0b1f5a9fe73a52917b6b1e92779.tar.gz
eclipse.platform.ui-2f4ee54fdf2cb0b1f5a9fe73a52917b6b1e92779.tar.bz2
Bug 380946 - [Commands] [Compatibility] helpContextId not registered forrefs/changes/87/25487/5
legacy handlers Change-Id: Iae388b53767326c3d53642464042b21bed876f7a Signed-off-by: Wojciech Sudol <wojciech.sudol@pl.ibm.com>
-rw-r--r--bundles/org.eclipse.core.commands/src/org/eclipse/core/internal/commands/util/Util.java36
-rw-r--r--bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/ICommandHelpService.java42
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java31
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/IHelpService.java26
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java32
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java19
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/CommandHelpServiceImpl.java72
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/HelpServiceImpl.java24
-rw-r--r--tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/HelpContextIdTest.java12
10 files changed, 290 insertions, 20 deletions
diff --git a/bundles/org.eclipse.core.commands/src/org/eclipse/core/internal/commands/util/Util.java b/bundles/org.eclipse.core.commands/src/org/eclipse/core/internal/commands/util/Util.java
index 3d5d505..186e890 100644
--- a/bundles/org.eclipse.core.commands/src/org/eclipse/core/internal/commands/util/Util.java
+++ b/bundles/org.eclipse.core.commands/src/org/eclipse/core/internal/commands/util/Util.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 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
@@ -11,6 +11,7 @@
package org.eclipse.core.internal.commands.util;
+import java.lang.reflect.Method;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -22,6 +23,8 @@ import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
+import org.eclipse.core.commands.Command;
+
/**
* A class providing utility functions for the commands plug-in.
*
@@ -348,6 +351,37 @@ public final class Util {
return set;
}
+ /**
+ * Returns context help ID which is directly assigned to the command.
+ * Context help IDs assigned to related handlers are ignored.
+ *
+ * @param command
+ * The command from which the context help ID is retrieved.
+ * @return The help context ID assigned to the command; may be
+ * <code>null</code>.
+ */
+ public static final String getHelpContextId(Command command) {
+ Method method = null;
+ try {
+ method = Command.class.getDeclaredMethod("getHelpContextId", null); //$NON-NLS-1$
+ } catch (Exception e) {
+ // do nothing
+ }
+
+ String contextId = null;
+ if (method != null) {
+ boolean accessible = method.isAccessible();
+ method.setAccessible(true);
+ try {
+ contextId = (String) method.invoke(command, null);
+ } catch (Exception e) {
+ // do nothing
+ }
+ method.setAccessible(accessible);
+ }
+ return contextId;
+ }
+
/**
* The utility class is meant to just provide static members.
*/
diff --git a/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/ICommandHelpService.java b/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/ICommandHelpService.java
new file mode 100644
index 0000000..a19132f
--- /dev/null
+++ b/bundles/org.eclipse.e4.core.commands/src/org/eclipse/e4/core/commands/internal/ICommandHelpService.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.e4.core.commands.internal;
+
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+
+/**
+ * Provides services related to the command context help.
+ */
+public interface ICommandHelpService {
+
+ /**
+ * Calculates the active help context for the command and returns the ID of the help context.
+ *
+ * @param commandId
+ * the ID of the command for which the help context ID is calculated
+ * @param context
+ * the Eclipse context in which handlers of the command will be sought
+ * @return the ID of help context which is active for the command
+ */
+ public String getHelpContextId(String commandId, IEclipseContext context);
+
+ /**
+ * Assigns the help context ID to the command handler.
+ *
+ * @param handler
+ * the command handler to which the help context ID will be assigned
+ * @param contextId
+ * the help context ID to assign
+ */
+ public void setHelpContextId(IHandler handler, String contextId);
+}
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java
index 3981d3c..efc6bc5 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java
@@ -27,6 +27,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.e4.core.commands.ECommandService;
import org.eclipse.e4.core.commands.EHandlerService;
+import org.eclipse.e4.core.commands.internal.ICommandHelpService;
import org.eclipse.e4.core.contexts.EclipseContextFactory;
import org.eclipse.e4.core.contexts.IContextFunction;
import org.eclipse.e4.core.contexts.IEclipseContext;
@@ -35,6 +36,7 @@ import org.eclipse.e4.core.services.log.Logger;
import org.eclipse.e4.ui.bindings.EBindingService;
import org.eclipse.e4.ui.internal.workbench.Activator;
import org.eclipse.e4.ui.internal.workbench.ContributionsAnalyzer;
+import org.eclipse.e4.ui.internal.workbench.IHelpService;
import org.eclipse.e4.ui.internal.workbench.Policy;
import org.eclipse.e4.ui.internal.workbench.RenderedElementUtil;
import org.eclipse.e4.ui.internal.workbench.renderers.swt.IUpdateService;
@@ -130,6 +132,15 @@ public class HandledContributionItem extends ContributionItem {
@Optional
private IUpdateService updateService;
+ @Inject
+ @Optional
+ private IHelpService helpService;
+
+ @Inject
+ @Optional
+ @SuppressWarnings("restriction")
+ private ICommandHelpService commandHelpService;
+
private Runnable unreferenceRunnable;
private ISWTResourceUtilities resUtils = null;
@@ -301,6 +312,7 @@ public class HandledContributionItem extends ContributionItem {
item.addListener(SWT.Dispose, getItemListener());
item.addListener(SWT.Selection, getItemListener());
item.addListener(SWT.DefaultSelection, getItemListener());
+ item.addListener(SWT.Help, getItemListener());
widget = item;
model.setWidget(widget);
@@ -601,6 +613,9 @@ public class HandledContributionItem extends ContributionItem {
handleWidgetSelection(event);
}
break;
+ case SWT.Help:
+ handleHelpRequest();
+ break;
}
}
};
@@ -626,6 +641,7 @@ public class HandledContributionItem extends ContributionItem {
widget.removeListener(SWT.Selection, getItemListener());
widget.removeListener(SWT.Dispose, getItemListener());
widget.removeListener(SWT.DefaultSelection, getItemListener());
+ widget.removeListener(SWT.Help, getItemListener());
widget = null;
model.setWidget(null);
disposeOldImages();
@@ -687,6 +703,21 @@ public class HandledContributionItem extends ContributionItem {
}
}
+ @SuppressWarnings("restriction")
+ private void handleHelpRequest() {
+ MCommand command = model.getCommand();
+ if (command == null || helpService == null
+ || commandHelpService == null) {
+ return;
+ }
+
+ String contextHelpId = commandHelpService.getHelpContextId(
+ command.getElementId(), getContext(model));
+ if (contextHelpId != null) {
+ helpService.displayHelp(contextHelpId);
+ }
+ }
+
/**
* @param event
* @return
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/IHelpService.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/IHelpService.java
new file mode 100644
index 0000000..474646b
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/IHelpService.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.e4.ui.internal.workbench;
+
+/**
+ * Provides services related to the help system.
+ */
+public interface IHelpService {
+
+ /**
+ * Calls the help support system to display the given help context ID.
+ *
+ * @param contextId
+ * the ID of the context to display
+ */
+ public void displayHelp(String contextId);
+}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java
index 60b4863..4f5934b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 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
@@ -26,9 +26,11 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.core.commands.internal.ICommandHelpService;
import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.internal.workbench.IHelpService;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceManager;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -50,6 +52,8 @@ import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.decorators.DecoratorManager;
import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceManager;
+import org.eclipse.ui.internal.help.CommandHelpServiceImpl;
+import org.eclipse.ui.internal.help.HelpServiceImpl;
import org.eclipse.ui.internal.intro.IIntroRegistry;
import org.eclipse.ui.internal.intro.IntroRegistry;
import org.eclipse.ui.internal.misc.StatusUtil;
@@ -200,6 +204,10 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
private ServiceTracker testableTracker = null;
+ private IHelpService helpService;
+
+ private ICommandHelpService commandHelpService;
+
/**
* Create an instance of the WorkbenchPlugin. The workbench plugin is
* effectively the "application" for the workbench UI. The entire UI
@@ -245,6 +253,9 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
productInfo = null;
introRegistry = null;
+
+ helpService = null;
+ commandHelpService = null;
if (operationSupport != null) {
operationSupport.dispose();
@@ -1524,6 +1535,25 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
return editorRegistry;
}
});
+ context.set(IHelpService.class.getName(), new ContextFunction() {
+ @Override
+ public Object compute(IEclipseContext context, String contextKey) {
+ if (helpService == null) {
+ helpService = new HelpServiceImpl();
+ }
+ return helpService;
+ }
+ });
+ context.set(ICommandHelpService.class.getName(), new ContextFunction() {
+ @Override
+ public Object compute(IEclipseContext context, String contextKey) {
+ if (commandHelpService == null) {
+ commandHelpService = ContextInjectionFactory.make(CommandHelpServiceImpl.class,
+ e4Context);
+ }
+ return commandHelpService;
+ }
+ });
}
/*
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java
index be56d25..ca64d25 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/commands/CommandService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation and others.
+ * Copyright (c) 2005, 2014 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
@@ -29,6 +29,7 @@ import org.eclipse.core.commands.State;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.e4.core.commands.internal.ICommandHelpService;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.internal.workbench.renderers.swt.IUpdateService;
import org.eclipse.e4.ui.model.application.ui.menu.MItem;
@@ -89,6 +90,8 @@ public final class CommandService implements ICommandService, IUpdateService {
private IEclipseContext context;
+ private ICommandHelpService commandHelpService;
+
/**
* Constructs a new instance of <code>CommandService</code> using a
* command manager.
@@ -104,6 +107,7 @@ public final class CommandService implements ICommandService, IUpdateService {
this.commandManager = commandManager;
this.commandPersistence = new CommandPersistence(commandManager);
this.context = context;
+ this.commandHelpService = context.get(ICommandHelpService.class);
}
@Override
@@ -193,16 +197,17 @@ public final class CommandService implements ICommandService, IUpdateService {
}
@Override
+ @SuppressWarnings("unused")
public final String getHelpContextId(final Command command)
throws NotDefinedException {
- return commandManager.getHelpContextId(command);
+ return commandHelpService.getHelpContextId(command.getId(), context);
}
@Override
public final String getHelpContextId(final String commandId)
throws NotDefinedException {
final Command command = getCommand(commandId);
- return commandManager.getHelpContextId(command);
+ return getHelpContextId(command);
}
@Override
@@ -221,9 +226,8 @@ public final class CommandService implements ICommandService, IUpdateService {
}
@Override
- public final void setHelpContextId(final IHandler handler,
- final String helpContextId) {
- commandManager.setHelpContextId(handler, helpContextId);
+ public final void setHelpContextId(final IHandler handler, final String helpContextId) {
+ commandHelpService.setHelpContextId(handler, helpContextId);
}
/**
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
index 09fae8c..ae7dfae 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/LegacyHandlerService.java
@@ -41,6 +41,7 @@ import org.eclipse.e4.core.commands.EHandlerService;
import org.eclipse.e4.core.commands.ExpressionContext;
import org.eclipse.e4.core.commands.internal.HandlerServiceHandler;
import org.eclipse.e4.core.commands.internal.HandlerServiceImpl;
+import org.eclipse.e4.core.commands.internal.ICommandHelpService;
import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.EclipseContextFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
@@ -147,12 +148,19 @@ public class LegacyHandlerService implements IHandlerService {
public static IHandlerActivation registerLegacyHandler(final IEclipseContext context,
String id, final String cmdId, IHandler handler, Expression activeWhen) {
+ return registerLegacyHandler(context, id, cmdId, handler, activeWhen, null);
+ }
+ private static IHandlerActivation registerLegacyHandler(final IEclipseContext context,
+ String id, final String cmdId, IHandler handler, Expression activeWhen, String helpContextId) {
ECommandService cs = (ECommandService) context.get(ECommandService.class.getName());
Command command = cs.getCommand(cmdId);
boolean handled = command.isHandled();
boolean enabled = command.isEnabled();
E4HandlerProxy handlerProxy = new E4HandlerProxy(command, handler);
+ if (helpContextId != null) {
+ setHelpContextId(handler, helpContextId, context);
+ }
HandlerActivation activation = new HandlerActivation(context, cmdId, handler, handlerProxy,
activeWhen);
addHandlerActivation(activation);
@@ -593,7 +601,8 @@ public class LegacyHandlerService implements IHandlerService {
commandId,
new org.eclipse.ui.internal.handlers.HandlerProxy(commandId, configElement,
IWorkbenchRegistryConstants.ATT_CLASS, enabledWhen, eclipseContext
- .get(IEvaluationService.class)), activeWhen);
+ .get(IEvaluationService.class)), activeWhen,
+ configElement.getAttribute(IWorkbenchRegistryConstants.ATT_HELP_CONTEXT_ID));
}
}
@@ -623,7 +632,13 @@ public class LegacyHandlerService implements IHandlerService {
@Override
public void setHelpContextId(IHandler handler, String helpContextId) {
- // TODO Auto-generated method stub
+ setHelpContextId(handler, helpContextId, eclipseContext);
+ }
+ private static void setHelpContextId(IHandler handler, String helpContextId,
+ IEclipseContext eclipseContext) {
+ ICommandHelpService commandHelpService = (ICommandHelpService) eclipseContext
+ .get(ICommandHelpService.class.getName());
+ commandHelpService.setHelpContextId(handler, helpContextId);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/CommandHelpServiceImpl.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/CommandHelpServiceImpl.java
new file mode 100644
index 0000000..f463593
--- /dev/null
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/CommandHelpServiceImpl.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.help;
+
+import java.util.Map;
+import java.util.WeakHashMap;
+import javax.inject.Inject;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.internal.commands.util.Util;
+import org.eclipse.e4.core.commands.ECommandService;
+import org.eclipse.e4.core.commands.internal.HandlerServiceImpl;
+import org.eclipse.e4.core.commands.internal.ICommandHelpService;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.core.services.log.Logger;
+import org.eclipse.ui.internal.handlers.E4HandlerProxy;
+
+/**
+ * @since 3.5
+ */
+@SuppressWarnings("restriction")
+public class CommandHelpServiceImpl implements ICommandHelpService {
+
+ @Inject
+ private ECommandService commandService;
+
+ @Inject
+ @Optional
+ private Logger logger;
+
+ private Map<IHandler, String> helpContextIdsByHandler = new WeakHashMap<IHandler, String>();
+
+ @Override
+ public String getHelpContextId(String commandId, IEclipseContext context) {
+ if (commandId == null || context == null) {
+ return null;
+ }
+
+ Command command = commandService.getCommand(commandId);
+ if (!command.isDefined()) {
+ if (logger != null) {
+ logger.error("The command " + commandId //$NON-NLS-1$
+ + " is not defined. Help context ID cannot be determined."); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ IHandler handler = (IHandler) HandlerServiceImpl.lookUpHandler(context, commandId);
+ if (handler instanceof E4HandlerProxy) {
+ handler = ((E4HandlerProxy) handler).getHandler();
+ }
+ String contextId = helpContextIdsByHandler.get(handler);
+ if (contextId == null) {
+ contextId = Util.getHelpContextId(command);
+ }
+ return contextId;
+ }
+
+ @Override
+ public void setHelpContextId(IHandler handler, String contextId) {
+ helpContextIdsByHandler.put(handler, contextId);
+ }
+}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/HelpServiceImpl.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/HelpServiceImpl.java
new file mode 100644
index 0000000..67c278a
--- /dev/null
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/HelpServiceImpl.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.help;
+
+import org.eclipse.e4.ui.internal.workbench.IHelpService;
+
+public class HelpServiceImpl implements IHelpService {
+
+ @Override
+ public void displayHelp(String contextId) {
+ if (contextId != null) {
+ WorkbenchHelpSystem.getInstance().displayHelp(contextId);
+ }
+ }
+}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/HelpContextIdTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/HelpContextIdTest.java
index 62aa3ea..94b1732 100644
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/HelpContextIdTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/commands/HelpContextIdTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2014 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
@@ -75,17 +75,9 @@ public final class HelpContextIdTest extends UITestCase {
assertEquals("The help context id should now be that of the command",
COMMAND_HELP_ID, helpContextId);
- // Now undefine the command and check that an exception is thrown.
+ // Now re-define the command with a different help context id.
final Command command = commandService.getCommand(COMMAND_ID);
command.undefine();
- try {
- helpContextId = commandService.getHelpContextId(COMMAND_ID);
- fail("A NotDefinedException should have been thrown");
- } catch (final NotDefinedException e) {
- // success
- }
-
- // Now define the command with a different help context id.
command.define("New Name", null, commandService.getCategory(null),
null, null, NEW_HELP_ID);
helpContextId = commandService.getHelpContextId(COMMAND_ID);