Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java99
1 files changed, 0 insertions, 99 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java
deleted file mode 100644
index f1107cf34..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/RefreshUserNotificationPolicy.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.eclipse.team.internal.ui.synchronize;
-
-import java.util.*;
-import org.eclipse.compare.CompareUI;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.*;
-import org.eclipse.ui.actions.ActionFactory;
-
-/**
- * This class manages the notification and setup that occurs after a refresh is completed.
- */
-public class RefreshUserNotificationPolicy implements IRefreshSubscriberListener {
-
- private SubscriberParticipant participant;
-
- public RefreshUserNotificationPolicy(SubscriberParticipant participant) {
- this.participant = participant;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.team.internal.ui.jobs.IRefreshSubscriberListener#refreshStarted(org.eclipse.team.internal.ui.jobs.IRefreshEvent)
- */
- public void refreshStarted(IRefreshEvent event) {
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- ISynchronizeView view = TeamUI.getSynchronizeManager().showSynchronizeViewInActivePage();
- if(view != null) {
- view.display(participant);
- }
- }
- });
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.team.internal.ui.jobs.IRefreshSubscriberListener#refreshDone(org.eclipse.team.internal.ui.jobs.IRefreshEvent)
- */
- public ActionFactory.IWorkbenchAction refreshDone(final IRefreshEvent event) {
- // Ensure that this event was generated for this participant
- if (event.getSubscriber() != participant.getSubscriberSyncInfoCollector().getSubscriber()) return null;
- // If the event is for a cancelled operation, there's nothing to do
- int severity = event.getStatus().getSeverity();
- if(severity == Status.CANCEL || severity == Status.ERROR) return null;
- // Decide on what action to take after the refresh is completed
- return new WorkbenchAction() {
- public void run() {
- boolean prompt = (event.getStatus().getCode() == IRefreshEvent.STATUS_NO_CHANGES);
-
- SyncInfo[] infos = event.getChanges();
- List selectedResources = new ArrayList();
- selectedResources.addAll(Arrays.asList(event.getResources()));
- for (int i = 0; i < infos.length; i++) {
- selectedResources.add(infos[i].getLocal());
- }
- IResource[] resources = (IResource[]) selectedResources.toArray(new IResource[selectedResources.size()]);
-
- // If it's a file, simply show the compare editor
- if (resources.length == 1 && resources[0].getType() == IResource.FILE) {
- IResource file = resources[0];
- SyncInfo info = participant.getSubscriberSyncInfoCollector().getSyncInfoSet().getSyncInfo(file);
- if(info != null) {
- SyncInfoCompareInput input = new SyncInfoCompareInput(participant.getName(), info);
- CompareUI.openCompareEditor(input);
- prompt = false;
- }
- }
-
- // Prompt user if preferences are set for this type of refresh.
- if (prompt) {
- notifyIfNeededModal(event);
- } else {
- // Else simply show the synchronize view
- ISynchronizeView view = TeamUI.getSynchronizeManager().showSynchronizeViewInActivePage();
- if(view != null) {
- view.display(participant);
- }
- }
- }
- };
- }
-
- private void notifyIfNeededModal(final IRefreshEvent event) {
- TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- String title = (event.getRefreshType() == IRefreshEvent.SCHEDULED_REFRESH ?
- Policy.bind("RefreshCompleteDialog.4a", participant.getName()) : //$NON-NLS-1$
- Policy.bind("RefreshCompleteDialog.4", participant.getName()) //$NON-NLS-1$
- );
- MessageDialog.openInformation(Utils.getShell(null), title, event.getStatus().getMessage());
- }
- });
- }
-} \ No newline at end of file

Back to the top