Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-05-10 20:29:41 +0000
committerMichael Valenta2004-05-10 20:29:41 +0000
commit3b4d41ca88ceed2f2b6645f4ad7429b88976520b (patch)
tree8ddbca48110c3e00f9e5cbaabf68a24359710602 /bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PinParticipantAction.java
parentfef5d04a463d5b2c9b9bde275193bfc095f36d9f (diff)
downloadeclipse.platform.team-3b4d41ca88ceed2f2b6645f4ad7429b88976520b.tar.gz
eclipse.platform.team-3b4d41ca88ceed2f2b6645f4ad7429b88976520b.tar.xz
eclipse.platform.team-3b4d41ca88ceed2f2b6645f4ad7429b88976520b.zip
Synchronize view workflow changes
Diffstat (limited to 'bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PinParticipantAction.java')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PinParticipantAction.java62
1 files changed, 62 insertions, 0 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PinParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PinParticipantAction.java
new file mode 100644
index 000000000..bfd1d5afd
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/PinParticipantAction.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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.ui.synchronize.actions;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Action that toggles pinned state of a participant
+ */
+public class PinParticipantAction extends Action {
+
+ private ISynchronizeParticipant participant;
+
+ public PinParticipantAction() {
+ super();
+ Utils.initAction(this, "action.pinParticipant.", Policy.getBundle()); //$NON-NLS-1$
+ }
+
+ public void setParticipant(ISynchronizeParticipant participant) {
+ this.participant = participant;
+ setEnabled(participant != null);
+ updateState();
+ }
+
+ private void updateState() {
+ setChecked(participant != null && participant.isPinned());
+ }
+
+ public void run() {
+ if (participant != null) {
+ try {
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ participant.setPinned(!participant.isPinned());
+ updateState();
+ }
+ });
+ } catch (InvocationTargetException e) {
+ Utils.handle(e);
+ } catch (InterruptedException e) {
+ // Cancelled. Just ignore
+ }
+ }
+ }
+}

Back to the top