From a0ccdec6424fc2df162fff928da3e35e742a6939 Mon Sep 17 00:00:00 2001 From: Jean Michel-Lemieux Date: Sun, 1 Feb 2004 03:18:23 +0000 Subject: *** empty log message *** --- bundles/org.eclipse.team.ui/TODO-syncview.txt | 14 +- .../synchronize/actions/OpenInCompareAction.java | 2 +- .../actions/ShowSynchronizeParticipantAction.java | 41 ----- .../actions/SynchronizePageDropDownAction.java | 1 + .../synchronize/compare/SyncInfoCompareInput.java | 160 ------------------- .../synchronize/DiffTreeViewerConfiguration.java | 10 +- .../team/ui/synchronize/SyncInfoCompareInput.java | 173 +++++++++++++++++++++ .../team/ui/synchronize/SyncInfoDiffNode.java | 8 +- .../team/ui/synchronize/SyncInfoDiffNodeRoot.java | 6 - .../actions/ShowSynchronizeParticipantAction.java | 41 +++++ 10 files changed, 240 insertions(+), 216 deletions(-) delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java delete mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoCompareInput.java create mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoCompareInput.java create mode 100644 bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/ShowSynchronizeParticipantAction.java diff --git a/bundles/org.eclipse.team.ui/TODO-syncview.txt b/bundles/org.eclipse.team.ui/TODO-syncview.txt index 9753feaf5..3700ff388 100644 --- a/bundles/org.eclipse.team.ui/TODO-syncview.txt +++ b/bundles/org.eclipse.team.ui/TODO-syncview.txt @@ -87,19 +87,29 @@ x memory and sync set disposal in syncsetcompare input!!!! VERY IMPORTANT!!! - actions in sync view all assume that selection will have a resource (e.g refresh action). - how would a refresh know what to select if a change comment node was selected, for example - could first attempt to obtain resource and, if that fails, visit children to obtain resources + [jm] I think that actions will have to know about DiffNodes and we need the helper to + get the list of children nodes. - sorter is related to input so may need to change when input does - there does not appear to be a clean way to change the sorter and input without causing two refreshes - SyncInfoSet##getOutOfSyncDescendants(IResource) is speced to include the resource itself if it is out-of-sync - this is a bit confusing as the name implies otherwise - should either consider a name change or a soec change + [jm] I never understood why is was spec'd like that :) You can decide... - compare input requires root node to have children or diff viewer is not added - this is problematic when creating a wizard page that is dynamically populated - not sure if there's problems caused by returning true when there are no children + [jm] I think this it's fine to have root nodes return true to hasChildren. I don't like + compares subtle way of determining is the diff viewer should be shown, but in our case a + root node can safely always have children. - several places require a resource - e.g. conflict propogation requires a resource but shouldn't (modified to work without a resource) - conflicts do not propogate in comment view + [jm] we have to change this assumption everywhere! Actions, label decorators... and such. +- there are times when the sync set changes but the input hasn't yet and the given input + doesn't handle outgoing changes. For example, when changing from incoming to outgoing with + the change log root, the change log root gets a reset from the sync set then the input + is changed. this can cause an NPE. Must look into the ordering here. - the test cases starve the subscriber event handler such that an event has additions and removals for the same resources - this causes failures in the diff tree builders - although less likely in UI, can still happen - - need tests for these scenarios to ensure generated event is correct after addition and removal - \ No newline at end of file + - need tests for these scenarios to ensure generated event is correct after addition and removal \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java index f3c3c8585..b573ec953 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java @@ -19,7 +19,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.team.core.subscribers.SyncInfo; import org.eclipse.team.internal.ui.Utils; import org.eclipse.team.internal.ui.actions.TeamAction; -import org.eclipse.team.internal.ui.synchronize.compare.SyncInfoCompareInput; +import org.eclipse.team.ui.synchronize.*; import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; import org.eclipse.team.ui.synchronize.ISynchronizeView; import org.eclipse.ui.*; diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java deleted file mode 100644 index e0d21abd6..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ShowSynchronizeParticipantAction.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * 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.ui.synchronize.actions; - -import org.eclipse.jface.action.Action; -import org.eclipse.team.ui.synchronize.ISynchronizeView; -import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; - -public class ShowSynchronizeParticipantAction extends Action { - - private ISynchronizeParticipant fPage; - private ISynchronizeView fView; - - public void run() { - if (!fPage.equals(fView.getParticipant())) { - fView.display(fPage); - } - } - - /** - * Constructs an action to display the given synchronize participant in the - * synchronize view. - * - * @param view the synchronize view in which the given page is contained - * @param participant the participant to show - */ - public ShowSynchronizeParticipantAction(ISynchronizeView view, ISynchronizeParticipant participant) { - super(participant.getName(), Action.AS_RADIO_BUTTON); - fPage = participant; - fView = view; - setImageDescriptor(participant.getImageDescriptor()); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java index 875eae831..c772d53da 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/SynchronizePageDropDownAction.java @@ -25,6 +25,7 @@ import org.eclipse.team.ui.TeamUI; import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; import org.eclipse.team.ui.synchronize.ISynchronizeParticipantListener; import org.eclipse.team.ui.synchronize.ISynchronizeView; +import org.eclipse.team.ui.synchronize.actions.*; import org.eclipse.ui.texteditor.IUpdate; public class SynchronizePageDropDownAction extends Action implements IMenuCreator, ISynchronizeParticipantListener, IUpdate { diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoCompareInput.java deleted file mode 100644 index c374bc350..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoCompareInput.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * 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.ui.synchronize.compare; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.*; -import org.eclipse.compare.structuremergeviewer.DiffNode; -import org.eclipse.core.runtime.*; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Image; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.subscribers.SyncInfo; -import org.eclipse.team.internal.ui.*; -import org.eclipse.team.ui.ISharedImages; -import org.eclipse.team.ui.synchronize.SyncInfoDiffNode; - -public class SyncInfoCompareInput extends CompareEditorInput { - - private SyncInfo sync; - private SyncInfoDiffNode node; - - public SyncInfoCompareInput(SyncInfo sync) { - super(new CompareConfiguration()); - this.sync = sync; - this.node = new SyncInfoDiffNode(sync); - initializeContentChangeListeners(); - } - - private void initializeContentChangeListeners() { - ITypedElement te = node.getLeft(); - if (te instanceof IContentChangeNotifier) { - ((IContentChangeNotifier) te).addContentChangeListener(new IContentChangeListener() { - public void contentChanged(IContentChangeNotifier source) { - try { - saveChanges(new NullProgressMonitor()); - } catch (CoreException e) { - } - } - }); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.compare.CompareEditorInput#getTitleImage() - */ - public Image getTitleImage() { - ImageRegistry reg = TeamUIPlugin.getPlugin().getImageRegistry(); - Image image = reg.get(ISharedImages.IMG_SYNC_VIEW); - if (image == null) { - image = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_VIEW).createImage(); - reg.put(ISharedImages.IMG_SYNC_VIEW, image); - } - return image; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.compare.CompareEditorInput#prepareInput(org.eclipse.core.runtime.IProgressMonitor) - */ - protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - // update the title now that the remote revision number as been fetched - // from the server - setTitle(getTitle()); - Utils.updateLabels(sync, getCompareConfiguration()); - try { - node.cacheContents(monitor); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } - return node; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.compare.CompareEditorInput#getTitle() - */ - public String getTitle() { - return Policy.bind("SyncInfoCompareInput.title", node.getName()); //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IEditorInput#getImageDescriptor() - */ - public ImageDescriptor getImageDescriptor() { - return TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_MODE_FREE); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IEditorInput#getToolTipText() - */ - public String getToolTipText() { - return ""; - //return Policy.bind("SyncInfoCompareInput.tooltip", participant.getName(), node.getName()); //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object other) { - if (other == this) - return true; - if (other instanceof SyncInfoCompareInput) { - return getSyncInfo().equals(((SyncInfoCompareInput) other).getSyncInfo()); - } - return false; - } - - /* - * (non-Javadoc) - * - * @see CompareEditorInput#saveChanges(org.eclipse.core.runtime.IProgressMonitor) - */ - public void saveChanges(IProgressMonitor pm) throws CoreException { - super.saveChanges(pm); - if (node != null) { - try { - commit(pm, node); - } finally { - setDirty(false); - } - } - } - - /* - * Recursively walks the diff tree and commits all changes. - */ - private static void commit(IProgressMonitor pm, DiffNode node) throws CoreException { - ITypedElement left = node.getLeft(); - if (left instanceof LocalResourceTypedElement) - ((LocalResourceTypedElement) left).commit(pm); - - ITypedElement right = node.getRight(); - if (right instanceof LocalResourceTypedElement) - ((LocalResourceTypedElement) right).commit(pm); - } - - public SyncInfo getSyncInfo() { - return sync; - } -} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/DiffTreeViewerConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/DiffTreeViewerConfiguration.java index 57070800a..1450f0a3d 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/DiffTreeViewerConfiguration.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/DiffTreeViewerConfiguration.java @@ -17,8 +17,7 @@ import org.eclipse.jface.viewers.*; import org.eclipse.swt.events.MenuEvent; import org.eclipse.swt.events.MenuListener; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.*; import org.eclipse.team.core.subscribers.SyncInfoSet; import org.eclipse.team.internal.core.Assert; import org.eclipse.team.internal.ui.*; @@ -292,4 +291,11 @@ public class DiffTreeViewerConfiguration implements IPropertyChangeListener { private boolean getShowCompressedFolders() { return TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS); } + + protected void aSyncExec(Runnable r) { + final Control ctrl = viewer.getControl(); + if (ctrl != null && !ctrl.isDisposed()) { + ctrl.getDisplay().asyncExec(r); + } + } } \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoCompareInput.java new file mode 100644 index 000000000..f88ce1963 --- /dev/null +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoCompareInput.java @@ -0,0 +1,173 @@ +/******************************************************************************* + * 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.ui.synchronize; + +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.compare.*; +import org.eclipse.compare.structuremergeviewer.DiffNode; +import org.eclipse.core.runtime.*; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; +import org.eclipse.team.core.TeamException; +import org.eclipse.team.core.subscribers.SyncInfo; +import org.eclipse.team.internal.ui.*; +import org.eclipse.team.internal.ui.synchronize.compare.LocalResourceTypedElement; +import org.eclipse.team.ui.ISharedImages; + +/** + * A {@link SyncInfo} editor input used as input to a two-way or three-way + * compare viewer. It defines methods for accessing the three sides for the + * compare, and a name and image which is used when displaying the three way input + * in an editor. This input can alternatly be used to show compare results in + * a dialog by calling {@link CompareUI#openCompareDialog()}. + *

+ * Supports saving the local resource if changed in the editor. + *

+ *

+ * Use {@link SyncInfoCompareInput} to display more than one SyncInfo + * in an compare viewer. + *

+ * @see SyncInfoDiffNode + * @since 3.0 + */ +public class SyncInfoCompareInput extends CompareEditorInput { + + private SyncInfo sync; + private SyncInfoDiffNode node; + + public SyncInfoCompareInput(SyncInfo sync) { + super(new CompareConfiguration()); + this.sync = sync; + this.node = new SyncInfoDiffNode(sync); + initializeContentChangeListeners(); + } + + private void initializeContentChangeListeners() { + ITypedElement te = node.getLeft(); + if (te instanceof IContentChangeNotifier) { + ((IContentChangeNotifier) te).addContentChangeListener(new IContentChangeListener() { + public void contentChanged(IContentChangeNotifier source) { + try { + saveChanges(new NullProgressMonitor()); + } catch (CoreException e) { + } + } + }); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.compare.CompareEditorInput#getTitleImage() + */ + public Image getTitleImage() { + ImageRegistry reg = TeamUIPlugin.getPlugin().getImageRegistry(); + Image image = reg.get(ISharedImages.IMG_SYNC_VIEW); + if (image == null) { + image = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_VIEW).createImage(); + reg.put(ISharedImages.IMG_SYNC_VIEW, image); + } + return image; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.compare.CompareEditorInput#prepareInput(org.eclipse.core.runtime.IProgressMonitor) + */ + protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + // update the title now that the remote revision number as been fetched + // from the server + setTitle(getTitle()); + Utils.updateLabels(sync, getCompareConfiguration()); + try { + node.cacheContents(monitor); + } catch (TeamException e) { + throw new InvocationTargetException(e); + } + return node; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.compare.CompareEditorInput#getTitle() + */ + public String getTitle() { + return Policy.bind("SyncInfoCompareInput.title", node.getName()); //$NON-NLS-1$ + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.IEditorInput#getImageDescriptor() + */ + public ImageDescriptor getImageDescriptor() { + return TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_SYNC_MODE_FREE); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.IEditorInput#getToolTipText() + */ + public String getToolTipText() { + return ""; + //return Policy.bind("SyncInfoCompareInput.tooltip", participant.getName(), node.getName()); //$NON-NLS-1$ + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#equals(java.lang.Object) + */ + public boolean equals(Object other) { + if (other == this) + return true; + if (other instanceof SyncInfoCompareInput) { + return getSyncInfo().equals(((SyncInfoCompareInput) other).getSyncInfo()); + } + return false; + } + + /* + * (non-Javadoc) + * + * @see CompareEditorInput#saveChanges(org.eclipse.core.runtime.IProgressMonitor) + */ + public void saveChanges(IProgressMonitor pm) throws CoreException { + super.saveChanges(pm); + if (node != null) { + try { + commit(pm, node); + } finally { + setDirty(false); + } + } + } + + private static void commit(IProgressMonitor pm, DiffNode node) throws CoreException { + ITypedElement left = node.getLeft(); + if (left instanceof LocalResourceTypedElement) + ((LocalResourceTypedElement) left).commit(pm); + + ITypedElement right = node.getRight(); + if (right instanceof LocalResourceTypedElement) + ((LocalResourceTypedElement) right).commit(pm); + } + + public SyncInfo getSyncInfo() { + return sync; + } +} \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffNode.java index 6befd009c..87818e5ea 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffNode.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffNode.java @@ -27,7 +27,7 @@ import org.eclipse.ui.model.IWorkbenchAdapter; public class SyncInfoDiffNode extends DiffNode implements IAdaptable, IWorkbenchAdapter { private IResource resource; - private SyncInfoSet input; + private SyncInfoSet syncSet; private SyncInfo info; /** @@ -111,7 +111,7 @@ public class SyncInfoDiffNode extends DiffNode implements IAdaptable, IWorkbench */ public SyncInfoDiffNode(IDiffContainer parent, SyncInfoSet set, IResource resource) { this(parent, createBaseTypeElement(set, resource), createLocalTypeElement(set, resource), createRemoteTypeElement(set, resource), getSyncKind(set, resource)); - this.input = set; + this.syncSet = set; this.resource = resource; this.info = null; } @@ -125,7 +125,7 @@ public class SyncInfoDiffNode extends DiffNode implements IAdaptable, IWorkbench public SyncInfoDiffNode(SyncInfo info) { this(null, createBaseTypeElement(info), createLocalTypeElement(info), createRemoteTypeElement(info), info.getKind()); this.info = info; - this.input = null; + this.syncSet = null; this.resource = info.getLocal(); } @@ -229,7 +229,7 @@ public class SyncInfoDiffNode extends DiffNode implements IAdaptable, IWorkbench * @return a SyncInfoSet */ public SyncInfoSet getSyncInfoSet() { - return input; + return syncSet; } /** diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffNodeRoot.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffNodeRoot.java index d119e3a2a..0a743abb5 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffNodeRoot.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SyncInfoDiffNodeRoot.java @@ -16,12 +16,6 @@ import org.eclipse.team.core.subscribers.SyncInfoSet; import org.eclipse.team.ui.synchronize.views.SyncInfoDiffNodeBuilder; import org.eclipse.team.ui.synchronize.views.SyncInfoDiffNodeSorter; -/** - * @author Administrator - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ public class SyncInfoDiffNodeRoot extends SyncInfoDiffNode { SyncInfoDiffNodeBuilder builder; diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/ShowSynchronizeParticipantAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/ShowSynchronizeParticipantAction.java new file mode 100644 index 000000000..0db3424b5 --- /dev/null +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/actions/ShowSynchronizeParticipantAction.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * 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.ui.synchronize.actions; + +import org.eclipse.jface.action.Action; +import org.eclipse.team.ui.synchronize.ISynchronizeView; +import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; + +public class ShowSynchronizeParticipantAction extends Action { + + private ISynchronizeParticipant fPage; + private ISynchronizeView fView; + + public void run() { + if (!fPage.equals(fView.getParticipant())) { + fView.display(fPage); + } + } + + /** + * Constructs an action to display the given synchronize participant in the + * synchronize view. + * + * @param view the synchronize view in which the given page is contained + * @param participant the participant to show + */ + public ShowSynchronizeParticipantAction(ISynchronizeView view, ISynchronizeParticipant participant) { + super(participant.getName(), Action.AS_RADIO_BUTTON); + fPage = participant; + fView = view; + setImageDescriptor(participant.getImageDescriptor()); + } +} -- cgit v1.2.3