Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulian Honnen2019-03-14 10:09:39 -0400
committerJulian Honnen2019-03-14 10:09:39 -0400
commitbc1f4989372b140b7f271e300da7224825ea1911 (patch)
tree0166c26013584a73d1b11bacf0f8571ece8dd6cf
parent84f915fb01dcc3ffdcccc225cda66f0fe2c2e0ca (diff)
downloadeclipse.platform.team-bc1f4989372b140b7f271e300da7224825ea1911.tar.gz
eclipse.platform.team-bc1f4989372b140b7f271e300da7224825ea1911.tar.xz
eclipse.platform.team-bc1f4989372b140b7f271e300da7224825ea1911.zip
Bug 545372 - Replace deprecated HandlerSubmissionI20190318-1800
Replaced deprecated HandlerSubmission with equivalent handler activation. Change-Id: I261cc6b3563070dba99d9d3765bae75e5d60f625 Signed-off-by: Julian Honnen <julian.honnen@vector.com>
-rw-r--r--bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DialogSynchronizePageSite.java27
2 files changed, 14 insertions, 16 deletions
diff --git a/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF
index bc23e733a..a2720af66 100644
--- a/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF
@@ -30,7 +30,8 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.3.0,4.0.0)";resolution:=op
org.eclipse.ui.forms;bundle-version="[3.3.0,4.0.0)",
org.eclipse.ui.navigator;bundle-version="[3.3.0,4.0.0)",
org.eclipse.jface.text;bundle-version="[3.3.0,4.0.0)",
- org.eclipse.ui.editors;bundle-version="[3.3.0,4.0.0)"
+ org.eclipse.ui.editors;bundle-version="[3.3.0,4.0.0)",
+ org.eclipse.core.expressions;bundle-version="[3.6.0,4.0.0)"
Bundle-ActivationPolicy: lazy
Import-Package: com.ibm.icu.text,
com.ibm.icu.util
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DialogSynchronizePageSite.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DialogSynchronizePageSite.java
index debc26fa9..fd1c315a2 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DialogSynchronizePageSite.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/DialogSynchronizePageSite.java
@@ -14,13 +14,15 @@
package org.eclipse.team.internal.ui.synchronize;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.expressions.Expression;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.commands.ActionHandler;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.widgets.Shell;
@@ -29,12 +31,10 @@ import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IKeyBindingService;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.LegacyHandlerSubmissionExpression;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ActionHandler;
-import org.eclipse.ui.commands.HandlerSubmission;
-import org.eclipse.ui.commands.IHandler;
-import org.eclipse.ui.commands.IWorkbenchCommandSupport;
-import org.eclipse.ui.commands.Priority;
+import org.eclipse.ui.handlers.IHandlerActivation;
+import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.services.IServiceLocator;
/**
@@ -48,7 +48,7 @@ public class DialogSynchronizePageSite implements ISynchronizePageSite {
private final boolean isModal;
// Keybindings enabled in the dialog, these should be removed
// when the dialog is closed.
- private List<HandlerSubmission> actionHandlers = new ArrayList<>(2);
+ private List<IHandlerActivation> actionHandlers = new ArrayList<>(2);
/**
* Create a site for use in a dialog
@@ -139,9 +139,9 @@ public class DialogSynchronizePageSite implements ISynchronizePageSite {
public void setGlobalActionHandler(String actionId, IAction action) {
if (actionId != null && !"".equals(actionId)) { //$NON-NLS-1$
IHandler handler = new ActionHandler(action);
- HandlerSubmission handlerSubmission = new HandlerSubmission(null, shell, null, actionId, handler, Priority.MEDIUM);
- PlatformUI.getWorkbench().getCommandSupport().addHandlerSubmission(handlerSubmission);
- actionHandlers.add(handlerSubmission);
+ Expression expression = new LegacyHandlerSubmissionExpression(null, shell, null);
+ IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class);
+ actionHandlers.add(handlerService.activateHandler(actionId, handler, expression));
}
}
@@ -160,10 +160,7 @@ public class DialogSynchronizePageSite implements ISynchronizePageSite {
* Cleanup when the dialog is closed
*/
public void dispose() {
- IWorkbenchCommandSupport cm = PlatformUI.getWorkbench().getCommandSupport();
- for (Iterator it = actionHandlers.iterator(); it.hasNext();) {
- HandlerSubmission handler = (HandlerSubmission) it.next();
- cm.removeHandlerSubmission(handler);
- }
+ IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class);
+ actionHandlers.forEach(handlerService::deactivateHandler);
}
} \ No newline at end of file

Back to the top