Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-02-26 22:05:50 +0000
committerJean Michel-Lemieux2004-02-26 22:05:50 +0000
commitb63e4ac2365b71a0bb896e7a814e4ab596af4457 (patch)
tree7787d8aaddc3b374cdb6249321f7faa4d97f9afa
parent5cfd2b65bf161109b117a403abeaf7158513359a (diff)
downloadeclipse.platform.team-b63e4ac2365b71a0bb896e7a814e4ab596af4457.tar.gz
eclipse.platform.team-b63e4ac2365b71a0bb896e7a814e4ab596af4457.tar.xz
eclipse.platform.team-b63e4ac2365b71a0bb896e7a814e4ab596af4457.zip
Supported refresh that add participant if needed.
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java33
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TeamParticipantRefreshAction.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/RefreshAction.java1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberPageDiffTreeViewerConfiguration.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipant.java37
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java5
6 files changed, 68 insertions, 18 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java
index 469146ecb..52191239a 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshUserNotificationPolicy.java
@@ -1,22 +1,32 @@
package org.eclipse.team.internal.ui.jobs;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.internal.ui.IPreferenceIds;
+import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.synchronize.*;
+import org.eclipse.team.internal.ui.synchronize.IRefreshEvent;
+import org.eclipse.team.internal.ui.synchronize.IRefreshSubscriberListener;
+import org.eclipse.team.internal.ui.synchronize.RefreshCompleteDialog;
+import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.synchronize.ISynchronizeManager;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.UIJob;
-import org.eclipse.team.internal.ui.Policy;
public class RefreshUserNotificationPolicy implements IRefreshSubscriberListener {
private SubscriberParticipant participant;
+ private boolean addIfNeeded;
- public RefreshUserNotificationPolicy(SubscriberParticipant participant) {
+ public RefreshUserNotificationPolicy(SubscriberParticipant participant, boolean addIfNeeded) {
this.participant = participant;
+ this.addIfNeeded = addIfNeeded;
}
/*
@@ -60,8 +70,21 @@ public class RefreshUserNotificationPolicy implements IRefreshSubscriberListener
}
// If there are interesting changes, ensure the sync view is showing them
- if(infos.length > 0) {
+ // Also, add the participant to the sync view only if changes have been found.
+ if (infos.length > 0) {
participant.setMode(SubscriberParticipant.INCOMING_MODE);
+ final ISynchronizeManager manager = TeamUI.getSynchronizeManager();
+ if (addIfNeeded) {
+ manager.addSynchronizeParticipants(new ISynchronizeParticipant[]{participant});
+ TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
+ public void run() {
+ ISynchronizeView view = manager.showSynchronizeViewInActivePage(null);
+ if (view != null) {
+ view.display(participant);
+ }
+ }
+ });
+ }
}
// Prompt user if preferences are set for this type of refresh.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TeamParticipantRefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TeamParticipantRefreshAction.java
index 98b0a5236..1dbb8fce9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TeamParticipantRefreshAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/TeamParticipantRefreshAction.java
@@ -23,11 +23,11 @@ import org.eclipse.ui.IWorkbenchSite;
*/
public class TeamParticipantRefreshAction extends RefreshAction {
- public TeamParticipantRefreshAction(ISelectionProvider provider, SubscriberParticipant participant, boolean refreshAll) {
- super(provider, participant.getName(), participant.getSubscriberSyncInfoCollector(), new RefreshUserNotificationPolicy(participant), refreshAll);
+ public TeamParticipantRefreshAction(ISelectionProvider provider, SubscriberParticipant participant, boolean addIfNeeded, boolean refreshAll) {
+ super(provider, participant.getName(), participant.getSubscriberSyncInfoCollector(), new RefreshUserNotificationPolicy(participant, addIfNeeded), refreshAll);
}
- public static void run(IWorkbenchSite site, IResource[] resources, SubscriberParticipant participant) {
- run(site, participant.getName(), resources, participant.getSubscriberSyncInfoCollector(), new RefreshUserNotificationPolicy(participant));
+ public static void run(IWorkbenchSite site, IResource[] resources, SubscriberParticipant participant, boolean addIfNeeded) {
+ run(site, participant.getName(), resources, participant.getSubscriberSyncInfoCollector(), new RefreshUserNotificationPolicy(participant, addIfNeeded));
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/RefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/RefreshAction.java
index 5fbbbce53..fa9c8c6a9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/RefreshAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/RefreshAction.java
@@ -89,6 +89,7 @@ public class RefreshAction extends Action {
private static void schedule(Job job, IWorkbenchSite site) {
if(site == null) {
job.schedule();
+ return;
}
IWorkbenchSiteProgressService siteProgress = (IWorkbenchSiteProgressService) site.getAdapter(IWorkbenchSiteProgressService.class);
if (siteProgress != null) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberPageDiffTreeViewerConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberPageDiffTreeViewerConfiguration.java
index c74e797aa..35475e700 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberPageDiffTreeViewerConfiguration.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberPageDiffTreeViewerConfiguration.java
@@ -46,7 +46,7 @@ public class SubscriberPageDiffTreeViewerConfiguration extends TreeViewerAdvisor
super.initializeActions(treeViewer);
openWithActions = new OpenWithActionGroup(view, participant);
refactorActions = new RefactorActionGroup(view);
- refreshSelectionAction = new TeamParticipantRefreshAction(treeViewer, participant, false /* refresh */);
+ refreshSelectionAction = new TeamParticipantRefreshAction(treeViewer, participant, false /* refresh */, false);
refreshSelectionAction.setWorkbenchSite(view.getSite());
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipant.java
index 49db0e622..86478312e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipant.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipant.java
@@ -13,14 +13,23 @@ package org.eclipse.team.ui.synchronize.subscriber;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.team.core.subscribers.*;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.ui.*;
+import org.eclipse.team.core.subscribers.Subscriber;
+import org.eclipse.team.core.subscribers.SubscriberSyncInfoCollector;
+import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
+import org.eclipse.team.core.synchronize.SyncInfo;
+import org.eclipse.team.internal.ui.IPreferenceIds;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.actions.TeamParticipantRefreshAction;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
-import org.eclipse.ui.*;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.IPageBookViewPage;
/**
@@ -135,11 +144,12 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
return workingSet;
}
- public void refreshWithRemote(IResource[] resources) {
+ public void refreshWithRemote(IResource[] resources, boolean addIfNeeded) {
+ IWorkbenchSite site = view != null ? view.getSite() : null;
if((resources == null || resources.length == 0)) {
- TeamParticipantRefreshAction.run(view.getSite(), collector.getWorkingSet(), this);
+ TeamParticipantRefreshAction.run(site, collector.getWorkingSet(), this, addIfNeeded);
} else {
- TeamParticipantRefreshAction.run(view.getSite(), resources, this);
+ TeamParticipantRefreshAction.run(site, resources, this, addIfNeeded);
}
}
@@ -277,4 +287,17 @@ public abstract class SubscriberParticipant extends AbstractSynchronizeParticipa
settings.putString(P_SYNCVIEWPAGE_MODE, Integer.toString(getMode()));
refreshSchedule.saveState(settings.createChild(CTX_SUBSCRIBER_SCHEDULE_SETTINGS));
}
+
+ public static SubscriberParticipant find(Subscriber s) {
+ ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
+ for (int i = 0; i < participants.length; i++) {
+ ISynchronizeParticipant p = participants[i];
+ if(p instanceof SubscriberParticipant) {
+ if(((SubscriberParticipant)p).getSubscriber().equals(s)) {
+ return (SubscriberParticipant)p;
+ }
+ }
+ }
+ return null;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java
index f7a9c0b90..c8193c2af 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/SubscriberParticipantPage.java
@@ -101,7 +101,7 @@ public class SubscriberParticipantPage implements IPageBookViewPage, IPropertyCh
};
gotoNext = new NavigateAction(view, nav, true /*next*/);
gotoPrevious = new NavigateAction(view, nav, false /*previous*/);
- refreshAllAction = new TeamParticipantRefreshAction(getSite().getSelectionProvider(), getParticipant(), true /* refresh all */);
+ refreshAllAction = new TeamParticipantRefreshAction(getSite().getSelectionProvider(), getParticipant(), false, true /* refresh all */);
refreshAllAction.setWorkbenchSite(view.getSite());
collapseAll = new Action() {
public void run() {
@@ -155,8 +155,11 @@ public class SubscriberParticipantPage implements IPageBookViewPage, IPropertyCh
* @see org.eclipse.ui.IWorkbenchPart#dispose()
*/
public void dispose() {
+ statusLine.dispose();
changesSection.dispose();
configuration.dispose();
+ TeamUIPlugin.getPlugin().getPreferenceStore().removePropertyChangeListener(this);
+ participant.removePropertyChangeListener(this);
}
/*

Back to the top