diff options
author | Jean Michel-Lemieux | 2004-03-03 14:24:02 +0000 |
---|---|---|
committer | Jean Michel-Lemieux | 2004-03-03 14:24:02 +0000 |
commit | 6011408d6ed3c619bf48cc50cfd21c10c4c3ea5b (patch) | |
tree | 7c44277db54d4825e7fe3d180c64e57af5c9026a | |
parent | 7b9219f663638f14c71b5a1fced4ff093bc8bb9a (diff) | |
download | eclipse.platform.team-6011408d6ed3c619bf48cc50cfd21c10c4c3ea5b.tar.gz eclipse.platform.team-6011408d6ed3c619bf48cc50cfd21c10c4c3ea5b.tar.xz eclipse.platform.team-6011408d6ed3c619bf48cc50cfd21c10c4c3ea5b.zip |
Bug 53593 No more sync actions in sync viewI20040302a
5 files changed, 34 insertions, 14 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSLocalCompareConfiguration.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSLocalCompareConfiguration.java index feee7f4bd..70304c78a 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSLocalCompareConfiguration.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSLocalCompareConfiguration.java @@ -58,7 +58,7 @@ public class CVSLocalCompareConfiguration extends TreeViewerAdvisor { } private CVSLocalCompareConfiguration(CVSCompareSubscriber subscriber, SubscriberSyncInfoCollector collector) { - super("org.eclipse.team.cvs.ui.compare-participant", collector.getSyncInfoTree()); //$NON-NLS-1$ + super("org.eclipse.team.cvs.ui.compare-participant", null, collector.getSyncInfoTree()); //$NON-NLS-1$ this.subscriber = subscriber; this.collector = collector; } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java index d6b1776fc..800693903 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshCompleteDialog.java @@ -123,7 +123,7 @@ public class RefreshCompleteDialog extends DetailsDialog { protected Composite createDropDownDialogArea(Composite parent) { try { CompareConfiguration compareConfig = new CompareConfiguration(); - TreeViewerAdvisor viewerAdvisor = new TreeViewerAdvisor(participant.getId(), syncInfoSet); + TreeViewerAdvisor viewerAdvisor = new TreeViewerAdvisor(participant.getId(), null, syncInfoSet); compareEditorInput = new SynchronizeCompareInput(compareConfig, viewerAdvisor) { public String getTitle() { diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SynchronizeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SynchronizeViewerAdvisor.java index 31a3d86ba..427c714c5 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SynchronizeViewerAdvisor.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SynchronizeViewerAdvisor.java @@ -33,7 +33,7 @@ public class SynchronizeViewerAdvisor extends TreeViewerAdvisor { private TeamParticipantRefreshAction refreshSelectionAction; public SynchronizeViewerAdvisor(ISynchronizeView view, SubscriberParticipant participant) { - super(participant.getId(), participant.getSubscriberSyncInfoCollector().getSyncInfoTree()); + super(participant.getId(), view.getViewSite(), participant.getSubscriberSyncInfoCollector().getSyncInfoTree()); this.view = view; this.participant = participant; } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/StructuredViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/StructuredViewerAdvisor.java index fa5b10140..1ac0f965b 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/StructuredViewerAdvisor.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/StructuredViewerAdvisor.java @@ -14,6 +14,7 @@ import org.eclipse.compare.structuremergeviewer.DiffNode; import org.eclipse.compare.structuremergeviewer.ICompareInput; import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IContributionItem; @@ -31,6 +32,7 @@ import org.eclipse.swt.widgets.Menu; import org.eclipse.team.core.TeamException; import org.eclipse.team.core.synchronize.SyncInfoSet; import org.eclipse.team.internal.core.Assert; +import org.eclipse.team.internal.ui.TeamUIPlugin; import org.eclipse.team.internal.ui.Utils; import org.eclipse.ui.IWorkbenchPartSite; import org.eclipse.ui.internal.PluginAction; @@ -76,6 +78,7 @@ public abstract class StructuredViewerAdvisor { private SynchronizeModelProvider modelProvider; private ListenerList listeners; private String targetID; + private IWorkbenchPartSite site; private SyncInfoSet set; private StructuredViewer viewer; @@ -86,11 +89,14 @@ public abstract class StructuredViewerAdvisor { * to call {@link #dispose()} when finished with an advisor. * * @param targetID the targetID defined in the viewer contributions in a plugin.xml file. + * @param site the workbench site with which to register the menuId. Can be <code>null</code> in which + * case a site will be found using the default workbench page. * @param set the set of <code>SyncInfo</code> objects that are to be shown to the user. */ - public StructuredViewerAdvisor(String targetID, SyncInfoSet set) { + public StructuredViewerAdvisor(String targetID, IWorkbenchPartSite site, SyncInfoSet set) { this.set = set; this.targetID = targetID; + this.site = site; } /** @@ -100,7 +106,7 @@ public abstract class StructuredViewerAdvisor { * @param set the set of <code>SyncInfo</code> objects that are to be shown to the user. */ public StructuredViewerAdvisor(SyncInfoSet set) { - this(null, set); + this(null, null, set); } /** @@ -371,12 +377,15 @@ public abstract class StructuredViewerAdvisor { }); viewer.getControl().setMenu(menu); if (allowParticipantMenuContributions()) { - IWorkbenchPartSite site = Utils.findSite(viewer.getControl()); - if (site == null) { - site = Utils.findSite(); - } - if (site != null) { - site.registerContextMenu(getTargetID(), menuMgr, viewer); + IWorkbenchPartSite ws = getWorkbenchPartSite(); + if(ws == null) + Utils.findSite(viewer.getControl()); + if (ws == null) + ws = Utils.findSite(); + if (ws != null) { + ws.registerContextMenu(getTargetID(), menuMgr, viewer); + } else { + TeamUIPlugin.log(IStatus.ERROR, "Cannot add menu contributions because the site cannot be found: " + getTargetID(), null); } } } @@ -398,4 +407,12 @@ public abstract class StructuredViewerAdvisor { }); viewer.setInput(modelProvider.getModelRoot()); } + + /** + * Returns the part site in which to register the context menu viewer contributions for this + * advisor. + */ + protected IWorkbenchPartSite getWorkbenchPartSite() { + return this.site; + } }
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/TreeViewerAdvisor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/TreeViewerAdvisor.java index 4e688fc6e..eba4fbc78 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/TreeViewerAdvisor.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/viewers/TreeViewerAdvisor.java @@ -33,6 +33,7 @@ import org.eclipse.team.internal.ui.TeamUIPlugin; import org.eclipse.team.internal.ui.Utils; import org.eclipse.team.internal.ui.synchronize.actions.ExpandAllAction; import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.IWorkbenchPartSite; import org.eclipse.ui.internal.dialogs.ContainerCheckedTreeViewer; /** @@ -107,10 +108,12 @@ public class TreeViewerAdvisor extends StructuredViewerAdvisor implements IPrope * to call {@link #dispose()} when finished with an advisor. * * @param targetID the targetID defined in the viewer contributions in a plugin.xml file. + * @param site the workbench site with which to register the menuId. Can be <code>null</code> in which + * case a site will be found using the default workbench page. * @param set the set of <code>SyncInfo</code> objects that are to be shown to the user. */ - public TreeViewerAdvisor(String menuId, SyncInfoTree set) { - super(menuId, set); + public TreeViewerAdvisor(String menuId, IWorkbenchPartSite site, SyncInfoTree set) { + super(menuId,site, set); TeamUIPlugin.getPlugin().getPreferenceStore().addPropertyChangeListener(this); } @@ -122,7 +125,7 @@ public class TreeViewerAdvisor extends StructuredViewerAdvisor implements IPrope * @param set the set of <code>SyncInfo</code> objects that are to be shown to the user. */ public TreeViewerAdvisor(SyncInfoTree set) { - this(null, set); + this(null, null, set); } /* (non-Javadoc) |