Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-12-10 16:36:42 -0500
committerJean Michel-Lemieux2004-12-10 16:36:42 -0500
commit79b44a5c09847b52afed240ed140c82ab2c18da6 (patch)
tree9c60ada2cfed17b5d988c7478360016f90c989b1
parent99f09e2af8e3fbfabdfdc046889f15dc833979a3 (diff)
downloadeclipse.platform.team-branch_20041208_CVSTopLevelMenu.tar.gz
eclipse.platform.team-branch_20041208_CVSTopLevelMenu.tar.xz
eclipse.platform.team-branch_20041208_CVSTopLevelMenu.zip
*** empty log message ***branch_20041208_CVSTopLevelMenu
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/commands/WorkbenchWindowCommandDelegate.java66
2 files changed, 68 insertions, 2 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index 40031272a..8c5815281 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -1022,7 +1022,7 @@
helpContextId="org.eclipse.team.cvs.ui.team_update_action_context"
label="%UpdateAction.label"
tooltip="%UpdateAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.UpdateSilentAction"
+ class="org.eclipse.team.internal.ccvs.ui.commands.WorkbenchWindowCommandDelegate"
definitionId="org.eclipse.team.cvs.ui.update"
menubarPath="cvs.main/group1"
id="org.eclipse.team.cvs.ui.update">
@@ -1032,7 +1032,7 @@
allowLabelUpdate="false"
retarget="false"
label="%CommitAction.label"
- class="org.eclipse.team.internal.ccvs.ui.actions.CommitAction"
+ class="org.eclipse.team.internal.ccvs.ui.commands.WorkbenchWindowCommandDelegate"
definitionId="org.eclipse.team.cvs.ui.commit"
tooltip="%CommitAction.tooltip"
menubarPath="cvs.main/group1"
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/commands/WorkbenchWindowCommandDelegate.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/commands/WorkbenchWindowCommandDelegate.java
new file mode 100644
index 000000000..af779dea6
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/commands/WorkbenchWindowCommandDelegate.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui.commands;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.*;
+import org.eclipse.ui.commands.*;
+
+public class WorkbenchWindowCommandDelegate implements IWorkbenchWindowActionDelegate {
+
+ private IAction action;
+ private IWorkbenchWindow window;
+ private ICommandManager commandManager;
+ private ICommand command;
+
+ public WorkbenchWindowCommandDelegate() {
+
+ }
+
+ public void dispose() {
+ }
+
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ }
+
+ public void run(IAction action) {
+ if(action != null)
+ try {
+ commandManager.getCommand(action.getActionDefinitionId()).execute(null);
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ } catch (NotHandledException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void selectionChanged(final IAction action, ISelection selection) {
+ if(command == null) {
+ this.action = action;
+ commandManager = PlatformUI.getWorkbench().getCommandSupport().getCommandManager();
+ command = commandManager.getCommand(action.getActionDefinitionId());
+ command.addCommandListener(new ICommandListener() {
+ public void commandChanged(CommandEvent e) {
+ Boolean enabled;
+ try {
+ enabled = (Boolean) command.getAttributeValuesByName().get("enabled");
+ } catch (NotHandledException e1) {
+ enabled = Boolean.FALSE;
+ }
+ if(action != null)
+ action.setEnabled(enabled.booleanValue());
+ }
+ });
+ }
+ }
+} \ No newline at end of file

Back to the top