diff options
author | Jean Michel-Lemieux | 2004-01-07 02:55:01 +0000 |
---|---|---|
committer | Jean Michel-Lemieux | 2004-01-07 02:55:01 +0000 |
commit | 092b22f15a4656a57f794fd44b1f26d507a79900 (patch) | |
tree | 29fa026717860972fb0d7a6911bce358ad5c99c5 /bundles/org.eclipse.team.ui | |
parent | 871523ebe7532ec57e785317accc01be95c9d2c5 (diff) | |
download | eclipse.platform.team-092b22f15a4656a57f794fd44b1f26d507a79900.tar.gz eclipse.platform.team-092b22f15a4656a57f794fd44b1f26d507a79900.tar.xz eclipse.platform.team-092b22f15a4656a57f794fd44b1f26d507a79900.zip |
*** empty log message ***
Diffstat (limited to 'bundles/org.eclipse.team.ui')
28 files changed, 526 insertions, 797 deletions
diff --git a/bundles/org.eclipse.team.ui/TODO-syncview.txt b/bundles/org.eclipse.team.ui/TODO-syncview.txt index 20bc72e2c..8970e2ed0 100644 --- a/bundles/org.eclipse.team.ui/TODO-syncview.txt +++ b/bundles/org.eclipse.team.ui/TODO-syncview.txt @@ -1,24 +1,44 @@ -- P3 schedule support by participant. +x P3 schedule support by participant. this requires changing the refresh jobs to accept scheduling different jobs. Essentially being able to have an ordered queue of refreshes. Also, participant will need a schedule object to encapsulate the schedule logic. -- P3 status message could be more precise instead of simply "Working". But to do this we need access to the job progress monitor - and it isn't available API from the UI. + +x P3 status message could be more precise instead of simply "Working". But to do this we need access to the job progress monitor + and it isn't available API from the UI. (removed status in sync view, progress will be shown in the progress shell). + x P1 end of refresh prompt should be a property change notice, and let the participant decide what to do! -- P2 decide overview page contents and how it should be used -- P1 mode switching at the end of a refresh to ensure that changes are shown if available -- P2 need an event for adding roots to a subscriber to update the list shown -- P3 support for table widget in changes page -- remove duplicated tree/table viewers classes. the orignial ones simply have the INavigable behavior. + +x P2 decide overview page contents and how it should be used + +x remove duplicated tree/table viewers classes. the orignial ones simply have the INavigable behavior. + x P1 make changes section only be a pagebook. this would easily allow adding any number of composites to the page? should look at memory consuption and ensure that we are disposing properly! + - compareeditorinput fetcheds remote content outside of a progress monitor + - decorations for SyncInfoDiffElements (of which type.. project persistent property setting?) + - labels for compare editors (text merge viewers and title for diff viewer) + x generic navigate support for SyncInfoDiffTreeViewer, PRd compare for API support + - readonly state for compare panes + - progress support added when fetching (e.g. caching contents in ITypedElement). This will require compare to add some API. + x INavigable in compare needs to be made API. + - details dialog needs to create composites once then display them. Or only create once!!!! + - sync set filtering creation must be more precise. For example you should be able to specify a root and a direction. + x cvs update/commit action in sync view toolbar are not updating their state anymore :( -- teamsubcriberparticipant needs to be de-coupled from a sync set presentation (e.g. mode, working set...)
\ No newline at end of file + +- P3 mode switching at the end of a refresh to ensure that changes are shown if available + +x P2 need an event for adding roots to a subscriber to update the list shown + +today: +x stats +- smart mode switching at the end of an operation that affects the sync view +x remove use of automatic working set
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java index 0710fd431..38c613284 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPreferenceIds.java @@ -14,19 +14,12 @@ public interface IPreferenceIds { public static final String PREFIX = TeamUIPlugin.ID + "."; //$NON-NLS-1$ // Sync Viewer - public static final String SYNCVIEW_BACKGROUND_SYNC = PREFIX + "background_sync"; //$NON-NLS-1$ - public static final String SYNCVIEW_SCHEDULED_SYNC = PREFIX + "scheduled_sync"; //$NON-NLS-1$ - public static final String SYNCVIEW_DELAY = PREFIX + "scheduled_sync_delay"; //$NON-NLS-1$ public static final String SYNCVIEW_COMPRESS_FOLDERS = PREFIX + "compress_folders"; //$NON-NLS-1$ public static final String SYNCVIEW_SELECTED_MODE = PREFIX + "syncview_selected_mode"; //$NON-NLS-1$ public static final String SYNCVIEW_DEFAULT_PERSPECTIVE = PREFIX + "syncview_default_perspective"; //$NON-NLS-1$ public static final String SYNCVIEW_DEFAULT_PERSPECTIVE_NONE = PREFIX + "sync_view_perspective_none"; //$NON-NLS-1$ - public static final String SYNCVIEW_VIEW_TYPE = PREFIX + "view_type"; //$NON-NLS-1$ - public static final String SYNCVIEW_VIEW_TABLESORT = PREFIX + "table_column_sort"; //$NON-NLS-1$ - public static final String SYNCVIEW_VIEW_TABLESORT_REVERSED = PREFIX + "table_column_sort_reversed"; //$NON-NLS-1$ - public static final String SYNCVIEW_VIEW_SYNCINFO_IN_LABEL = PREFIX + "view_syncinfo_in_label"; //$NON-NLS-1$ public static final String SYNCVIEW_VIEW_PROMPT_WHEN_NO_CHANGES = PREFIX + "syncview_promptwhennochanges"; //$NON-NLS-1$ @@ -34,4 +27,6 @@ public interface IPreferenceIds { public static final String SYNCVIEW_VIEW_BKG_PROMPT_WHEN_NO_CHANGES = PREFIX + "syncview__bkg_promptwhennochanges"; //$NON-NLS-1$ public static final String SYNCVIEW_VIEW_BKG_PROMPT_WITH_CHANGES = PREFIX + "syncview_bkg_promptwithchanges"; //$NON-NLS-1$ + + public static final String SYNCVIEW_VIEW_SMART_MODE_SWITCH = PREFIX + "syncview_smartmode"; //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java index 43c20656e..874f09ecf 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java @@ -27,7 +27,6 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; import org.eclipse.team.internal.ui.synchronize.SynchronizeManager; import org.eclipse.team.internal.ui.synchronize.TeamSynchronizingPerspective; -import org.eclipse.team.internal.ui.synchronize.views.SyncViewerTableSorter; import org.eclipse.team.ui.ISharedImages; import org.eclipse.team.ui.TeamUI; import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant; @@ -138,19 +137,15 @@ public class TeamUIPlugin extends AbstractUIPlugin { */ protected void initializePreferences() { IPreferenceStore store = getPreferenceStore(); - store.setDefault(IPreferenceIds.SYNCVIEW_BACKGROUND_SYNC, true); - store.setDefault(IPreferenceIds.SYNCVIEW_SCHEDULED_SYNC, false); store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_SYNCINFO_IN_LABEL, false); - store.setDefault(IPreferenceIds.SYNCVIEW_DELAY, 60 /* minutes */); store.setDefault(IPreferenceIds.SYNCVIEW_COMPRESS_FOLDERS, true); - store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_TABLESORT, SyncViewerTableSorter.COL_NAME); - store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_TABLESORT_REVERSED, false); store.setDefault(IPreferenceIds.SYNCVIEW_SELECTED_MODE, TeamSubscriberParticipant.BOTH_MODE); store.setDefault(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE, TeamSynchronizingPerspective.ID); store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WHEN_NO_CHANGES, true); store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WITH_CHANGES, true); store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_BKG_PROMPT_WHEN_NO_CHANGES, false); store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_BKG_PROMPT_WITH_CHANGES, true); + store.setDefault(IPreferenceIds.SYNCVIEW_VIEW_SMART_MODE_SWITCH, false); } /** diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java index b25ba7e7b..74a23626b 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java @@ -19,12 +19,16 @@ import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.*; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.SWT; import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.widgets.*; import org.eclipse.team.core.TeamException; import org.eclipse.team.core.subscribers.SyncInfo; import org.eclipse.team.core.sync.IRemoteResource; +import org.eclipse.team.internal.ui.synchronize.sets.SyncInfoStatistics; +import org.eclipse.team.internal.ui.widgets.HyperlinkAdapter; import org.eclipse.team.ui.TeamImages; +import org.eclipse.team.ui.synchronize.ITeamSubscriberSyncInfoSets; import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant; import org.eclipse.ui.*; @@ -375,5 +379,5 @@ public class Utils { } } return text; - } + } }
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/IRefreshEvent.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/IRefreshEvent.java index cb64ad705..df791fc44 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/IRefreshEvent.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/IRefreshEvent.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.team.internal.ui.jobs; +import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IStatus; import org.eclipse.team.core.subscribers.SyncInfo; import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant; @@ -30,4 +31,6 @@ public interface IRefreshEvent { public long getStopTime(); public IStatus getStatus(); + + public IResource[] getResources(); }
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java index e493fe778..4c9c1016e 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSubscriberJob.java @@ -53,7 +53,7 @@ public class RefreshSubscriberJob extends WorkspaceJob { /** * The schedule delay used when rescheduling a completed job */ - private static long scheduleDelay = 20000; + private static long scheduleDelay; /** * The subscribers and roots to refresh. If these are changed when the job @@ -79,10 +79,12 @@ public class RefreshSubscriberJob extends WorkspaceJob { long startTime = 0; long stopTime = 0; IStatus status; + IResource[] resources; - RefreshEvent(int type, TeamSubscriberParticipant participant) { + RefreshEvent(int type, IResource[] resources, TeamSubscriberParticipant participant) { this.type = type; this.participant = participant; + this.resources = resources; } public int getRefreshType() { @@ -136,6 +138,10 @@ public class RefreshSubscriberJob extends WorkspaceJob { public void setStatus(IStatus status) { this.status = status; } + + public IResource[] getResources() { + return resources; + } } private abstract class Notification implements ISafeRunnable { @@ -169,6 +175,7 @@ public class RefreshSubscriberJob extends WorkspaceJob { this.input = input; setPriority(Job.DECORATE); + setRefreshInterval(3600 /* 1 hour */); addJobChangeListener(new JobChangeAdapter() { public void done(IJobChangeEvent event) { @@ -186,7 +193,7 @@ public class RefreshSubscriberJob extends WorkspaceJob { } public boolean shouldRun() { - return getSubscriber() != null; + return input != null && getSubscriber() != null; } public boolean belongsTo(Object family) { @@ -214,7 +221,7 @@ public class RefreshSubscriberJob extends WorkspaceJob { } monitor.beginTask(null, 100); - RefreshEvent event = new RefreshEvent(reschedule ? IRefreshEvent.SCHEDULED_REFRESH : IRefreshEvent.USER_REFRESH, input.getParticipant()); + RefreshEvent event = new RefreshEvent(reschedule ? IRefreshEvent.SCHEDULED_REFRESH : IRefreshEvent.USER_REFRESH, roots, input.getParticipant()); RefreshChangeListener changeListener = new RefreshChangeListener(input); try { // Only allow one refresh job at a time 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 1ce0713b0..34a1adc08 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,11 +1,14 @@ package org.eclipse.team.internal.ui.jobs; +import org.eclipse.core.runtime.*; import org.eclipse.swt.widgets.Shell; import org.eclipse.team.core.subscribers.SyncInfo; import org.eclipse.team.internal.ui.IPreferenceIds; import org.eclipse.team.internal.ui.TeamUIPlugin; import org.eclipse.team.internal.ui.synchronize.RefreshCompleteDialog; import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.progress.UIJob; public class RefreshUserNotificationPolicy implements IRefreshSubscriberListener { @@ -48,19 +51,32 @@ public class RefreshUserNotificationPolicy implements IRefreshSubscriberListener } if(shouldPrompt) { - notifyIfNeeded(event); + notifyIfNeededModal(event); } } - private void notifyIfNeeded(final IRefreshEvent event) { - TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { - public void run() { + private void notifyIfNeededModal(final IRefreshEvent event) { + TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { + public void run() { + RefreshCompleteDialog d = new RefreshCompleteDialog( + new Shell(TeamUIPlugin.getStandardDisplay()), event); + d.setBlockOnOpen(false); + d.open(); + } + }); + } + + private void notifyIfNeededNonModal(final IRefreshEvent event) { + String message = "Refresh of '" + event.getParticipant().getName() + "' Complete."; + PlatformUI.getWorkbench().getProgressService().requestInUI(new UIJob(message) { + public IStatus runInUIThread(IProgressMonitor monitor) { RefreshCompleteDialog d = new RefreshCompleteDialog( new Shell(TeamUIPlugin.getStandardDisplay()), event); d.setBlockOnOpen(false); d.open(); + return Status.OK_STATUS; } - }); + }, message); } }
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties index f2c3e01a9..61759a724 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties @@ -109,7 +109,7 @@ SyncInfoCompareInput.remoteLabel=Remote File SyncInfoCompareInput.baseLabel=Common Ancestor SyncInfoCompareInput.remoteLabelExists=Remote File ({0}) SyncInfoCompareInput.baseLabelExists=Common Ancestor ({0}) -SyncInfoCompareInput.title={0}: {1} +SyncInfoCompareInput.title={0} SyncInfoCompareInput.tooltip=Comparing resources from {0}: {1} TeamAction.internal=Internal error occurred. @@ -437,9 +437,6 @@ SyncViewerPreferencePage.8=Display SyncViewerPreferencePage.9=Compress in-sync folder paths when using the tree view SyncViewerPreferencePage.10=Use incoming/outgoing mode when synchronizing SyncViewerPreferencePage.11=Refreshing with Remote -SyncViewerPreferencePage.12=Refresh with the remote resources in the background -SyncViewerPreferencePage.13=Enable a background task to refresh with remote resources -SyncViewerPreferencePage.14=How often should the background refresh run? (in minutes) SyncViewerPreferencePage.15=Perspective Switching RefreshSubscriberInputJob.1=Synchronizing ''{0}'' with remote: {1} resources @@ -474,3 +471,11 @@ SyncViewerPreferencePage.17=Prompt at the end of a refresh if changes are found. SyncViewerPreferencePage.30=Prompting SyncViewerPreferencePage.31=Prompt at the end of a scheduled refresh even when no changes are found SyncViewerPreferencePage.32=Prompt at the end of a scheduled refresh when changes are found + +ChangesSection.filterHides=The current ''{0}'' mode doesn't contain any changes. +ChangesSection.filterHidesSingular=However there is {0} change in the ''{1}'' mode. +ChangesSection.filterHidesPlural=However there are {0} changes in the ''{1}'' mode. +ChangesSection.filterChange=Change to ''{0}'' mode. +ChangesSection.workingSetHiding=The current working set ''{0}'' is hiding changes in your workspace. +ChangesSection.workingSetRemove=Remove working set. +ChangesSection.noChanges=No changes in workspace. diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java index 4f4f3745c..b94fd39fe 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/preferences/SyncViewerPreferencePage.java @@ -29,18 +29,14 @@ import org.eclipse.ui.*; */ public class SyncViewerPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage, IPreferenceIds { - private BooleanFieldEditor bkgRefresh = null; - //private BooleanFieldEditor bkgScheduledRefresh = null; - //private IntegerFieldEditor2 scheduledDelay = null; private BooleanFieldEditor compressFolders = null; + private BooleanFieldEditor smartModeSwitch = null; private BooleanFieldEditor showSyncInLabels = null; private BooleanFieldEditor promptWithChanges = null; private BooleanFieldEditor promptWhenNoChanges = null; private BooleanFieldEditor promptWithChangesBkg = null; private BooleanFieldEditor promptWhenNoChangesBkg = null; - private Group refreshGroup; - private static class PerspectiveDescriptorComparator implements Comparator { /* * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) @@ -149,19 +145,8 @@ public class SyncViewerPreferencePage extends FieldEditorPreferencePage implemen addField(compressFolders); showSyncInLabels = new BooleanFieldEditor(SYNCVIEW_VIEW_SYNCINFO_IN_LABEL, Policy.bind("SyncViewerPreferencePage.19"), SWT.NONE, displayGroup); //$NON-NLS-1$ addField(showSyncInLabels); - - refreshGroup = createGroup(getFieldEditorParent(), Policy.bind("SyncViewerPreferencePage.11")); //$NON-NLS-1$ - - bkgRefresh = new BooleanFieldEditor(SYNCVIEW_BACKGROUND_SYNC, Policy.bind("SyncViewerPreferencePage.12"), SWT.NONE, refreshGroup); //$NON-NLS-1$ - addField(bkgRefresh); - - //bkgScheduledRefresh = new BooleanFieldEditor2(SYNCVIEW_SCHEDULED_SYNC, Policy.bind("SyncViewerPreferencePage.13"), SWT.NONE, refreshGroup); //$NON-NLS-1$ - //addField(bkgScheduledRefresh); - - //scheduledDelay = new IntegerFieldEditor2(SYNCVIEW_DELAY, Policy.bind("SyncViewerPreferencePage.14"), refreshGroup, 2); //$NON-NLS-1$ - //addField(scheduledDelay); - - //updateLastRunTime(createLabel(refreshGroup, null, 0)); + //smartModeSwitch = new BooleanFieldEditor(SYNCVIEW_VIEW_SMART_MODE_SWITCH, "Smart mode switch", SWT.NONE, displayGroup); //$NON-NLS-1$ + //addField(smartModeSwitch); Group promptGroup = createGroup(getFieldEditorParent(), Policy.bind("SyncViewerPreferencePage.30")); //$NON-NLS-1$ @@ -191,7 +176,6 @@ public class SyncViewerPreferencePage extends FieldEditorPreferencePage implemen Dialog.applyDialogFont(getFieldEditorParent()); updateLayout(displayGroup); updateLayout(perspectiveGroup); - updateLayout(refreshGroup); getFieldEditorParent().layout(true); } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java index 6cd785015..7d8b57a8b 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangesSection.java @@ -12,38 +12,75 @@ package org.eclipse.team.internal.ui.synchronize; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.internal.ui.widgets.FormSection; -import org.eclipse.team.internal.ui.widgets.HyperlinkAdapter; +import org.eclipse.team.core.subscribers.SyncInfo; +import org.eclipse.team.internal.ui.*; +import org.eclipse.team.internal.ui.synchronize.sets.SyncInfoStatistics; +import org.eclipse.team.internal.ui.widgets.*; import org.eclipse.team.ui.controls.IControlFactory; import org.eclipse.team.ui.synchronize.*; import org.eclipse.ui.part.PageBook; +/** + * Section shown in a participant page to show the changes for this participant. This + * includes a diff viewer for browsing the changes. + * + * @since 3.0 + */ public class ChangesSection extends FormSection { private TeamSubscriberParticipant participant; private Composite parent; - private ParticipantComposite participantComposite; private final ISynchronizeView view; - private Viewer changesViewer; + private IControlFactory factory; + private TeamSubscriberParticipantPage page; + private Button smartModeSwitchButton; + + /** + * Page book either shows the diff tree viewer if there are changes or + * shows a message to the user if there are no changes that would be + * shown in the tree. + */ private PageBook changesSectionContainer; + + /** + * Shows message to user is no changes are to be shown in the diff + * tree viewer. + */ private Composite filteredContainer; - private IControlFactory factory; + + /** + * Diff tree viewer that shows synchronization changes. This is created + * by the participant. + */ + private Viewer changesViewer; + + /** + * Label to the right of the section header showing the total number of + * changes in the workspace. + */ + private Label changeTotalsLabel; + private int totalChanges = -1; + /** + * Listen to sync set changes so that we can update message to user and totals. + */ private ISyncSetChangedListener changedListener = new ISyncSetChangedListener() { public void syncSetChanged(ISyncInfoSetChangeEvent event) { calculateDescription(); + updateChangeTotals(true); } }; - private TeamSubscriberParticipantPage page; - + + /** + * Create a changes section on the following page. + * + * @param parent the parent control + * @param page the page showing this section + */ public ChangesSection(Composite parent, TeamSubscriberParticipantPage page) { this.page = page; this.participant = page.getParticipant(); @@ -52,8 +89,6 @@ public class ChangesSection extends FormSection { setCollapsable(true); setCollapsed(false); setDescription(""); - //calculateDescription(); - updateHeaderRightText(); } /* @@ -78,18 +113,33 @@ public class ChangesSection extends FormSection { clientComposite.setLayout(layout); changesSectionContainer = new PageBook(clientComposite, SWT.NONE); GridData data = new GridData(GridData.FILL_BOTH); - changesSectionContainer.setBackground(new Color(changesSectionContainer.getDisplay(), new RGB(2,4,5))); data.grabExcessHorizontalSpace = true; data.grabExcessVerticalSpace = true; changesSectionContainer.setLayoutData(data); + changesViewer = page.createChangesViewer(changesSectionContainer); - calculateDescription(); - + calculateDescription(); participant.getInput().registerListeners(changedListener); return clientComposite; } + /* (non-Javadoc) + * @see org.eclipse.team.internal.ui.widgets.FormSection#createHeaderRight(org.eclipse.swt.widgets.Composite, org.eclipse.team.internal.ui.widgets.ControlFactory) + */ + protected Composite createHeaderRight(Composite parent, ControlFactory factory) { + Composite top = factory.createComposite(parent); + GridLayout layout = new GridLayout(); + layout.marginHeight = 0; + layout.marginWidth = 0; + top.setLayout(layout); + top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + changeTotalsLabel = factory.createLabel(top, "", 20); + int newChanges = participant.getInput().getSubscriberSyncSet().size(); + changeTotalsLabel.setText(Integer.toString(newChanges) + " Total"); + return top; + } + protected void reflow() { super.reflow(); if(parent != null && !parent.isDisposed()) { @@ -106,20 +156,20 @@ public class ChangesSection extends FormSection { if(participant.getInput().getFilteredSyncSet().size() == 0) { TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { public void run() { - filteredContainer = getEmptyChangesComposite(changesSectionContainer, factory); - changesSectionContainer.showPage(filteredContainer); + filteredContainer = getEmptyChangesComposite(changesSectionContainer, factory); + changesSectionContainer.showPage(filteredContainer); } }); } else { - if(filteredContainer != null) { - TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { - public void run() { + TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { + public void run() { + if(filteredContainer != null) { filteredContainer.dispose(); filteredContainer = null; - changesSectionContainer.showPage(changesViewer.getControl()); } - }); - } + changesSectionContainer.showPage(changesViewer.getControl()); + } + }); } } @@ -127,29 +177,63 @@ public class ChangesSection extends FormSection { Composite composite = factory.createComposite(parent); GridLayout layout = new GridLayout(); composite.setLayout(layout); + ITeamSubscriberSyncInfoSets input = participant.getInput(); int changesInWorkspace = input.getSubscriberSyncSet().size(); int changesInWorkingSet = input.getWorkingSetSyncSet().size(); - int changesInFilter = input.getFilteredSyncSet().size(); + int changesInFilter = input.getFilteredSyncSet().size(); + + SyncInfoStatistics stats = input.getWorkingSetSyncSet().getStatistics(); + long outgoingChanges = stats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK); + long incomingChanges = stats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK); + + Label l; if(changesInFilter == 0 && changesInWorkingSet != 0) { - factory.createLabel(composite, "The current mode '" + Utils.modeToString(participant.getMode()) + "' doesn't contain any changes."); - createHyperlink(factory, composite, "Change to both mode", new HyperlinkAdapter() { + int mode = participant.getMode(); + final int newMode = outgoingChanges != 0 ? TeamSubscriberParticipant.OUTGOING_MODE : TeamSubscriberParticipant.INCOMING_MODE; + long numChanges = outgoingChanges != 0 ? outgoingChanges : incomingChanges; + String text; + if(numChanges > 1) { + text = Policy.bind("ChangesSection.filterHides", Utils.modeToString(participant.getMode())) + + Policy.bind("ChangesSection.filterHidesPlural", Long.toString(numChanges), Utils.modeToString(newMode)); + } else { + text = Policy.bind("ChangesSection.filterHidesSingular", Utils.modeToString(participant.getMode()), Long.toString(numChanges), Utils.modeToString(newMode)); + } + createHyperlink(factory, composite, Policy.bind("ChangesSection.filterChange", Utils.modeToString(newMode)), new HyperlinkAdapter() { public void linkActivated(Control linkLabel) { - participant.setMode(TeamSubscriberParticipant.BOTH_MODE); + participant.setMode(newMode); } }); - } else if(changesInFilter == 0 && changesInWorkingSet == 0 && changesInWorkspace != 0) { - factory.createLabel(composite, "The current working set '" + Utils.workingSetToString(participant.getWorkingSet(), 50) + "' is hiding changes in your workspace."); - createHyperlink(factory, composite, "Remove working set", new HyperlinkAdapter() { + l = factory.createLabel(composite, text , SWT.WRAP); + +// smartModeSwitchButton = new Button(composite, SWT.CHECK | SWT.FLAT | SWT.WRAP); +// smartModeSwitchButton.setText("Enable smart mode switching."); +// smartModeSwitchButton.setBackground(factory.getBackgroundColor()); +// Label description = factory.createLabel(composite, "Smart mode switching will detect when there are changes that aren't displayed with the given mode selected and automatically change the mode that would show the changes.", SWT.WRAP); +// GridData data = new GridData(GridData.FILL_HORIZONTAL); +// data.widthHint = 100; +// description.setLayoutData(data); +// smartModeSwitchButton.addSelectionListener(new SelectionListener() { +// public void widgetSelected(SelectionEvent e) { +// TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_SMART_MODE_SWITCH, smartModeSwitchButton.getSelection()); +// } +// public void widgetDefaultSelected(SelectionEvent e) { +// } +// }); + } else if(changesInFilter == 0 && changesInWorkingSet == 0 && changesInWorkspace != 0) { + createHyperlink(factory, composite, Policy.bind("ChangesSection.workingSetRemove"), new HyperlinkAdapter() { public void linkActivated(Control linkLabel) { participant.setWorkingSet(null); } }); + l = factory.createLabel(composite, Policy.bind("ChangesSection.workingSetHiding", Utils.workingSetToString(participant.getWorkingSet(), 50)), SWT.WRAP); } else { - factory.createLabel(composite, "No changes in workspace."); + l= factory.createLabel(composite, Policy.bind("ChangesSection.noChanges"), SWT.WRAP); } - + GridData data = new GridData(GridData.FILL_HORIZONTAL); + data.widthHint = 100; + l.setLayoutData(data); return composite; } @@ -159,6 +243,8 @@ public class ChangesSection extends FormSection { */ private void createHyperlink(IControlFactory factory, Composite composite, String text, HyperlinkAdapter adapter) { final Label label = factory.createLabel(composite, text, SWT.WRAP); + GridData data = new GridData(); + label.setLayoutData(data); factory.turnIntoHyperlink(label, adapter); } @@ -174,8 +260,26 @@ public class ChangesSection extends FormSection { participant.getInput().deregisterListeners(changedListener); } - public void updateHeaderRightText() { - setHeaderRightText("Inc: 1 Out: 2 Con: 3"); - reflow(); + private int getSmartMode() { + ISyncInfoSet set = participant.getInput().getWorkingSetSyncSet(); + if(set.size() == 0) { + return -1; + } + SyncInfoStatistics stats = set.getStatistics(); + long outgoingChanges = stats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK); + long incomingChanges = stats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK); + return incomingChanges != 0 ? TeamSubscriberParticipant.INCOMING_MODE : TeamSubscriberParticipant.OUTGOING_MODE; + } + + public void updateChangeTotals(final boolean reflow) { + final int newChanges = participant.getInput().getSubscriberSyncSet().size(); + if (totalChanges != newChanges) { + TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { + public void run() { + changeTotalsLabel.setText(Integer.toString(newChanges) + " Total"); + totalChanges = newChanges; + } + }); + } } }
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java index c913dc6ec..16ec43563 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ConfigureRefreshScheduleDialog.java @@ -7,7 +7,7 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; import org.eclipse.team.internal.ui.dialogs.DetailsDialog; -import org.eclipse.team.internal.ui.jobs.RefreshSchedule; +import org.eclipse.team.ui.synchronize.RefreshSchedule; public class ConfigureRefreshScheduleDialog extends DetailsDialog { @@ -120,7 +120,9 @@ public class ConfigureRefreshScheduleDialog extends DetailsDialog { seconds = seconds * 60; } schedule.setRefreshInterval(seconds); - schedule.setEnabled(enableBackgroundRefresh.getSelection()); + if(schedule.isEnabled() != enableBackgroundRefresh.getSelection()) { + schedule.setEnabled(enableBackgroundRefresh.getSelection()); + } // update schedule schedule.getParticipant().setRefreshSchedule(schedule); diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ParticipantComposite.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ParticipantOverviewComposite.java index 0dba577c3..d3018a66b 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ParticipantComposite.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ParticipantOverviewComposite.java @@ -12,17 +12,18 @@ package org.eclipse.team.internal.ui.synchronize; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; -import org.eclipse.team.internal.ui.widgets.HyperlinkAdapter; import org.eclipse.team.ui.controls.IControlFactory; import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; import org.eclipse.team.ui.synchronize.ISynchronizeView; -public class ParticipantComposite extends Composite { +public class ParticipantOverviewComposite extends Composite { private ISynchronizeParticipant participant; private Image participantImage; @@ -30,7 +31,7 @@ public class ParticipantComposite extends Composite { private IControlFactory factory; private Composite participantComposite; - public ParticipantComposite(Composite parent, IControlFactory factory, ISynchronizeParticipant participant, ISynchronizeView view, int style) { + public ParticipantOverviewComposite(Composite parent, IControlFactory factory, ISynchronizeParticipant participant, ISynchronizeView view, int style) { super(parent, style); this.factory = factory; this.participant = participant; @@ -64,13 +65,19 @@ public class ParticipantComposite extends Composite { final Label label = factory.createLabel(composite, participant.getName(), SWT.WRAP); label.setLayoutData(new GridData()); label.setFont(JFaceResources.getBannerFont()); - label.setText(participant.getName()); - factory.turnIntoHyperlink(label, new HyperlinkAdapter() { - public void linkActivated(Control linkLabel) { + label.setText(participant.getName()); + } + { + Button button = factory.createButton(composite, "More...", SWT.FLAT); + button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END)); + button.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { view.display(participant); } + public void widgetDefaultSelected(SelectionEvent e) { + } }); - } + } { final Composite composite_1 = factory.createComposite(composite, SWT.NONE); final GridData gridData = new GridData(GridData.FILL_BOTH); @@ -82,22 +89,6 @@ public class ParticipantComposite extends Composite { composite_1.setLayout(gridLayout_1); participantComposite = participant.createOverviewComposite(composite_1, factory, view); } -// { -// final Composite composite_1 = factory.createComposite(composite, SWT.NONE); -// final GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_END); -// gridData.horizontalSpan = 3; -// composite_1.setLayoutData(gridData); -// final GridLayout gridLayout_1 = new GridLayout(); -// gridLayout_1.marginWidth = 0; -// gridLayout_1.marginHeight = 0; -// composite_1.setLayout(gridLayout_1); -// { -// final Button button = factory.createButton(composite_1, "Setup...", SWT.FLAT); -// GridData gd = new GridData(); -// gd.horizontalAlignment = GridData.END; -// button.setLayoutData(gd); -// } -// } } return area; } 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 2381d228a..d30e47b2b 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 @@ -31,17 +31,16 @@ import org.eclipse.team.internal.ui.synchronize.compare.SyncInfoSetCompareInput; public class RefreshCompleteDialog extends DetailsDialog { - private SyncInfo[] changes; private Button promptWhenNoChanges; private Button promptWithChanges; private CompareEditorInput compareEditorInput; - private int type; + private IRefreshEvent event; + private final static int RESOURCE_LIST_SIZE = 10; public RefreshCompleteDialog(Shell parentShell, IRefreshEvent event) { - super(parentShell, "Synchronization Complete"); - this.type = event.getRefreshType(); + super(parentShell, "Synchronization Complete - " + event.getParticipant().getName()); + this.event = event; setImageKey(DLG_IMG_INFO); - this.changes = event.getChanges(); this.compareEditorInput = new SyncInfoSetCompareInput(new CompareConfiguration(), getResources(), event.getParticipant().getInput()) { protected boolean allowParticipantMenuContributions() { return true; @@ -53,15 +52,31 @@ public class RefreshCompleteDialog extends DetailsDialog { * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#createMainDialogArea(org.eclipse.swt.widgets.Composite) */ protected void createMainDialogArea(Composite parent) { - String text; + StringBuffer text = new StringBuffer(); + SyncInfo[] changes = event.getChanges(); + IResource[] resources = event.getResources(); + if(changes.length != 0) { - text = Integer.toString(changes.length) + " changes found."; + text.append(Integer.toString(changes.length) + " changes found "); } else { - text = "No changes found."; + text.append("No changes found "); } - createLabel(parent, text, 2); - createLabel(parent, "", 2); + text.append("refreshing " + Integer.toString(resources.length) + " resource(s)."); + createLabel(parent, text.toString(), 2); + + StringBuffer resourcesLabel = new StringBuffer(); + StringBuffer resourcesFullListLabel = new StringBuffer(); + for (int i = 0; i < resources.length; i++) { + if(i < RESOURCE_LIST_SIZE) { + String EOL = i < RESOURCE_LIST_SIZE - 1 ? "\n" : "..."; + resourcesLabel.append(resources[i].getFullPath() + EOL); + } + resourcesFullListLabel.append(resources[i].getFullPath() + "\n"); + } + Label l = createLabel(parent, resourcesLabel.toString(), 2); + l.setToolTipText(resourcesFullListLabel.toString()); + createLabel(parent, "", 2); promptWhenNoChanges = new Button(parent, SWT.CHECK); GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); data.horizontalSpan = 2; @@ -73,7 +88,7 @@ public class RefreshCompleteDialog extends DetailsDialog { data.horizontalSpan = 2; promptWithChanges.setLayoutData(data); - if(type == IRefreshEvent.USER_REFRESH) { + if(event.getRefreshType() == IRefreshEvent.USER_REFRESH) { promptWhenNoChanges.setText(Policy.bind("SyncViewerPreferencePage.16")); promptWhenNoChanges.setSelection(TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WHEN_NO_CHANGES)); promptWithChanges.setText(Policy.bind("SyncViewerPreferencePage.17")); @@ -157,6 +172,7 @@ public class RefreshCompleteDialog extends DetailsDialog { } private IResource[] getResources() { + SyncInfo[] changes = event.getChanges(); IResource[] resources = new IResource[changes.length]; for (int i = 0; i < changes.length; i++) { SyncInfo info = changes[i]; @@ -177,19 +193,19 @@ public class RefreshCompleteDialog extends DetailsDialog { * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#includeDetailsButton() */ protected boolean includeDetailsButton() { - return changes.length != 0; + return event.getChanges().length != 0; } /* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#okPressed() */ protected void okPressed() { - if(type == IRefreshEvent.USER_REFRESH) { + if(event.getRefreshType() == IRefreshEvent.USER_REFRESH) { TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WHEN_NO_CHANGES, promptWhenNoChanges.getSelection()); - TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WITH_CHANGES, promptWhenNoChanges.getSelection()); + TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_PROMPT_WITH_CHANGES, promptWithChanges.getSelection()); } else { TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_BKG_PROMPT_WHEN_NO_CHANGES, promptWhenNoChanges.getSelection()); - TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_BKG_PROMPT_WITH_CHANGES, promptWhenNoChanges.getSelection()); + TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_BKG_PROMPT_WITH_CHANGES, promptWithChanges.getSelection()); } TeamUIPlugin.getPlugin().savePluginPreferences(); super.okPressed(); diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SummarySection.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SummarySection.java index 12cdec97d..efab451aa 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SummarySection.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SummarySection.java @@ -1,20 +1,33 @@ package org.eclipse.team.internal.ui.synchronize; import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.team.core.subscribers.ITeamResourceChangeListener; +import org.eclipse.team.core.subscribers.TeamDelta; import org.eclipse.team.internal.ui.Utils; +import org.eclipse.team.internal.ui.widgets.ControlFactory; import org.eclipse.team.internal.ui.widgets.FormSection; import org.eclipse.team.ui.controls.IControlFactory; import org.eclipse.team.ui.synchronize.ISynchronizeView; import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant; +/** + * Section shown at the top of a participant page to describe the details about a team subscriber + * participant. + * + * @since 3.0 + */ public class SummarySection extends FormSection { private TeamSubscriberParticipant participant; private Composite parent; - private ParticipantComposite participantComposite; + private ParticipantOverviewComposite participantComposite; private ISynchronizeView view; private Composite client; + private Label workingSetLabel; public SummarySection(Composite parent, TeamSubscriberParticipant participant, ISynchronizeView view) { this.participant = participant; @@ -22,8 +35,6 @@ public class SummarySection extends FormSection { this.view = view; setCollapsable(true); setCollapsed(true); - updateHeaderRightText(); - participant.addPropertyChangeListener(this); } /* @@ -41,9 +52,25 @@ public class SummarySection extends FormSection { */ public Composite createClient(Composite parent, IControlFactory factory) { client = new TeamSubscriberParticipantComposite(parent, false, factory, participant, view); + participant.addPropertyChangeListener(this); return client; } + /* (non-Javadoc) + * @see org.eclipse.team.internal.ui.widgets.FormSection#createHeaderRight(org.eclipse.swt.widgets.Composite, org.eclipse.team.internal.ui.widgets.ControlFactory) + */ + protected Composite createHeaderRight(Composite parent, ControlFactory factory) { + Composite top = factory.createComposite(parent); + GridLayout layout = new GridLayout(); + layout.marginHeight = 0; + layout.marginWidth = 0; + top.setLayout(layout); + top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + workingSetLabel = factory.createLabel(top, Utils.workingSetToString(participant.getWorkingSet(), 20)); + return top; + } + protected void reflow() { super.reflow(); parent.setRedraw(false); @@ -76,7 +103,7 @@ public class SummarySection extends FormSection { } public void updateHeaderRightText() { - setHeaderRightText(Utils.workingSetToString(participant.getWorkingSet(), 20)); + workingSetLabel.setText(Utils.workingSetToString(participant.getWorkingSet(), 20)); reflow(); } }
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoDiffTableViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoDiffTableViewer.java deleted file mode 100644 index 7a8a6f697..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncInfoDiffTableViewer.java +++ /dev/null @@ -1,100 +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; - -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.viewers.*; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.*; -import org.eclipse.team.internal.ui.Policy; -import org.eclipse.team.internal.ui.synchronize.sets.SyncSet; -import org.eclipse.team.internal.ui.synchronize.views.SyncTableViewer; -import org.eclipse.team.internal.ui.synchronize.views.SyncViewerTableSorter; -import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant; - -public class SyncInfoDiffTableViewer extends TreeViewer { - - private SyncTableViewer viewer; - - public SyncInfoDiffTableViewer(Composite parent, TeamSubscriberParticipant participant, SyncSet set) { - super(parent); - //super(participant, set); - // Create the table -// Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); -// table.setHeaderVisible(true); -// table.setLinesVisible(true); -// GridData data = new GridData(GridData.FILL_BOTH); -// table.setLayoutData(data); -// -// // Set the table layout -// TableLayout layout = new TableLayout(); -// table.setLayout(layout); -// -// // Create the viewer -// viewer = new SyncTableViewer(table); -// -// // Create the table columns -// createColumns(table, layout, viewer); -// -// // Set the table contents -// viewer.setContentProvider(new SyncSetTableContentProvider()); -// viewer.setSorter(new SyncViewerTableSorter()); -// viewer.setInput(getSyncSet()); - } - - /** - * Creates the columns for the sync viewer table. - */ - private void createColumns(Table table, TableLayout layout, TableViewer viewer) { - SelectionListener headerListener = SyncViewerTableSorter.getColumnListener(viewer); - // revision - TableColumn col = new TableColumn(table, SWT.NONE); - col.setResizable(true); - col.setText(Policy.bind("TeamSubscriberParticipantPage.7")); //$NON-NLS-1$ - col.addSelectionListener(headerListener); - layout.addColumnData(new ColumnWeightData(30, true)); - - // tags - col = new TableColumn(table, SWT.NONE); - col.setResizable(true); - col.setText(Policy.bind("TeamSubscriberParticipantPage.8")); //$NON-NLS-1$ - col.addSelectionListener(headerListener); - layout.addColumnData(new ColumnWeightData(50, true)); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.SyncChangesViewer#setContextMenu(org.eclipse.jface.action.IMenuManager) - */ - protected void setContextMenu(IMenuManager menu) { - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.SyncChangesViewer#getViewer() - */ - public StructuredViewer getViewer() { - return viewer; - } - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.synchronize.actions.INavigableControl#gotoDifference(int) - */ - public boolean gotoDifference(int direction) { - return viewer.gotoDifference(direction); - } - - /* (non-Javadoc) - * @see org.eclipse.team.ui.synchronize.SyncChangesViewer#dispose() - */ - public void dispose() { - // TODO Auto-generated method stub - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeOverviewPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeOverviewPage.java index c615dbf4c..5e436a695 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeOverviewPage.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeOverviewPage.java @@ -14,9 +14,9 @@ import java.util.HashMap; import java.util.Map; import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.*; import org.eclipse.team.internal.ui.widgets.ControlFactory; import org.eclipse.team.ui.TeamUI; import org.eclipse.team.ui.controls.IControlFactory; @@ -47,14 +47,43 @@ public class SynchronizeOverviewPage extends Page implements ISynchronizePartici public void createControl(Composite parent) { factory = new ControlFactory(parent.getDisplay()); factory.setBackgroundColor(factory.registerColor(COLOR_WHITE, 255, 255, 255)); - pageComposite = factory.createComposite(parent); + //ScrolledComposite scrolledPageComposite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); + //scrolledPageComposite.setBackground(factory.getBackgroundColor()); + pageComposite = factory.createComposite(parent, SWT.NONE); + //scrolledPageComposite.setContent(pageComposite); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = 0; layout.horizontalSpacing = 0; pageComposite.setLayout(layout); - + pageComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); + //pageComposite.setSize(pageComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + Composite introComposite = factory.createComposite(pageComposite); + layout = new GridLayout(); + layout.marginHeight = 5; + layout.marginWidth = 5; + introComposite.setLayout(layout); + introComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Label message = factory.createLabel(introComposite, "Manage the synchronization of files in your workspace with their remote locations.", SWT.WRAP); + GridData data = + new GridData( + GridData.GRAB_HORIZONTAL + | GridData.HORIZONTAL_ALIGN_FILL + | GridData.VERTICAL_ALIGN_BEGINNING); + data.widthHint = 200; + message.setLayoutData(data); + + Label seperator = factory.createSeparator(introComposite, SWT.HORIZONTAL); + data = + new GridData( + GridData.GRAB_HORIZONTAL + | GridData.HORIZONTAL_ALIGN_FILL + | GridData.VERTICAL_ALIGN_BEGINNING); + seperator.setLayoutData(data); + createParticipants(pageComposite); TeamUI.getSynchronizeManager().addSynchronizeParticipantListener(this); } @@ -66,7 +95,7 @@ public class SynchronizeOverviewPage extends Page implements ISynchronizePartici ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants(); for (int i = 0; i < participants.length; i++) { ISynchronizeParticipant participant = participants[i]; - participantsToComposites.put(participant, new ParticipantComposite(parent, factory, participant, view, SWT.NONE)); + participantsToComposites.put(participant, new ParticipantOverviewComposite(parent, factory, participant, view, SWT.NONE)); } } @@ -94,7 +123,7 @@ public class SynchronizeOverviewPage extends Page implements ISynchronizePartici for (int i = 0; i < participants.length; i++) { if (isAvailable()) { ISynchronizeParticipant participant = participants[i]; - participantsToComposites.put(participant, new ParticipantComposite(pageComposite, factory, participant, view, SWT.NONE)); + participantsToComposites.put(participant, new ParticipantOverviewComposite(pageComposite, factory, participant, view, SWT.NONE)); // re-layout and redraw with new participant added pageComposite.setRedraw(false); diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSubscriberParticipantComposite.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSubscriberParticipantComposite.java index 1b74e7b14..820edea5b 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSubscriberParticipantComposite.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSubscriberParticipantComposite.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.team.internal.ui.synchronize; -import org.eclipse.core.runtime.QualifiedName; import org.eclipse.jface.action.*; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; @@ -21,18 +20,19 @@ import org.eclipse.swt.graphics.Color; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; +import org.eclipse.team.core.subscribers.*; +import org.eclipse.team.internal.ui.Policy; import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.jobs.IJobListener; -import org.eclipse.team.internal.ui.jobs.JobStatusHandler; +import org.eclipse.team.internal.ui.jobs.*; +import org.eclipse.team.internal.ui.widgets.ControlFactory; +import org.eclipse.team.internal.ui.widgets.FormSection; import org.eclipse.team.ui.controls.IControlFactory; import org.eclipse.team.ui.controls.IHyperlinkListener; -import org.eclipse.team.ui.synchronize.ISynchronizeView; -import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant; -import org.eclipse.team.ui.synchronize.actions.SubscriberAction; +import org.eclipse.team.ui.synchronize.*; import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.model.WorkbenchLabelProvider; -public class TeamSubscriberParticipantComposite extends Composite implements IPropertyChangeListener { +public class TeamSubscriberParticipantComposite extends Composite implements IPropertyChangeListener, ITeamResourceChangeListener { private TeamSubscriberParticipant participant; private Color background; private ISynchronizeView view; @@ -40,32 +40,34 @@ public class TeamSubscriberParticipantComposite extends Composite implements IPr private Label lastSyncLabel; private Label scheduleLabel; - private Label statusLabel; private TableViewer rootsList; - private IJobListener jobListener = new IJobListener() { - public void started(QualifiedName jobType) { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - synchronized (this) { - if(statusLabel != null && !statusLabel.isDisposed()) - statusLabel.setText("Working..."); - } - } - }); + private IRefreshSubscriberListener refreshSubscriberListener = new IRefreshSubscriberListener() { + public void refreshStarted(IRefreshEvent event) { } - public void finished(QualifiedName jobType) { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - synchronized (this) { - if(statusLabel != null && !statusLabel.isDisposed()) - statusLabel.setText("Idle"); + public void refreshDone(final IRefreshEvent event) { + if (event.getParticipant() == participant) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + synchronized (this) { + if (lastSyncLabel != null && !lastSyncLabel.isDisposed()) { + StringBuffer text = new StringBuffer(); + text.append(RefreshSchedule.refreshEventAsString(event)); + SyncInfo[] changes = event.getChanges(); + if (changes.length != 0) { + text.append(" (" + Integer.toString(changes.length) + " changes found)"); + } else { + text.append(" (No changes found)"); + } + lastSyncLabel.setText(text.toString()); + } + } } - } - }); - + }); + } } }; + private boolean shortStyle; public TeamSubscriberParticipantComposite(Composite parent, boolean shortStyle, IControlFactory factory, TeamSubscriberParticipant participant, ISynchronizeView view) { @@ -74,25 +76,18 @@ public class TeamSubscriberParticipantComposite extends Composite implements IPr this.factory = factory; this.participant = participant; this.view = view; - createComposite(this); - updateLastRefreshLabel(); - updateStatusLabel(); - participant.addPropertyChangeListener(this); - - JobStatusHandler.addJobListener(jobListener, SubscriberAction.SUBSCRIBER_JOB_TYPE); - if(JobStatusHandler.hasRunningJobs(SubscriberAction.SUBSCRIBER_JOB_TYPE)) { - statusLabel.setText("Working..."); - } else { - statusLabel.setText("Idle"); - } + createComposite(this); + participant.addPropertyChangeListener(this); + RefreshSubscriberJob.addRefreshListener(refreshSubscriberListener); } - protected Composite createComposite(Composite area) { + protected Composite createComposite(final Composite area) { GridLayout layout = new GridLayout(); //layout.marginHeight = 0; //layout.marginWidth = 0; area.setLayout(layout); - setBackground(factory.getBackgroundColor()); + area.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + setBackground(factory.getBackgroundColor()); { final Composite composite_1 = factory.createComposite(area, SWT.NONE); GridData gridData = new GridData(GridData.VERTICAL_ALIGN_FILL); @@ -103,12 +98,18 @@ public class TeamSubscriberParticipantComposite extends Composite implements IPr composite_1.setLayout(gridLayout_1); composite_1.setLayoutData(gridData); { + final Label label = factory.createLabel(composite_1, participant.getInput().getSubscriber().getDescription()); + gridData = new GridData(); + gridData.horizontalSpan = 2; + label.setLayoutData(gridData); + } + { final Label label = factory.createLabel(composite_1, "Last Refresh:"); gridData = new GridData(); label.setLayoutData(gridData); } { - lastSyncLabel = factory.createLabel(composite_1, "11/23/03 10:03:12"); + lastSyncLabel = factory.createLabel(composite_1, Policy.bind("SyncViewPreferencePage.lastRefreshRunNever")); //$NON-NLS-1$); gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.grabExcessHorizontalSpace = true; lastSyncLabel.setLayoutData(gridData); @@ -135,53 +136,49 @@ public class TeamSubscriberParticipantComposite extends Composite implements IPr gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.grabExcessHorizontalSpace = true; scheduleLabel.setLayoutData(gridData); - } - { - final Label label = factory.createLabel(composite_1, "Status"); - gridData = new GridData(); - label.setLayoutData(gridData); - } - { - statusLabel = factory.createLabel(composite_1, "Idle"); - gridData = new GridData(GridData.FILL_HORIZONTAL); - gridData.grabExcessHorizontalSpace = true; - statusLabel.setLayoutData(gridData); } } - if(! shortStyle) { + + createSynchronizeResourcesComposite(area); + updateScheduleLabel(); + return area; + } + + private Composite createSynchronizeResourcesComposite(Composite area) { + { + final Composite composite_1 = factory.createComposite(area, SWT.NONE); + GridData gridData = new GridData(GridData.FILL_BOTH); + final GridLayout gridLayout_1 = new GridLayout(); + gridLayout_1.numColumns = 1; + gridLayout_1.marginHeight = 3; + gridLayout_1.marginWidth = 3; + composite_1.setLayout(gridLayout_1); + composite_1.setLayoutData(gridData); { - final Composite composite_1 = factory.createComposite(area, SWT.NONE); - GridData gridData = new GridData(GridData.FILL_BOTH); - final GridLayout gridLayout_1 = new GridLayout(); - gridLayout_1.numColumns = 1; - gridLayout_1.marginHeight = 3; - gridLayout_1.marginWidth = 3; - composite_1.setLayout(gridLayout_1); - composite_1.setLayoutData(gridData); - { - final Label label = factory.createLabel(composite_1, "Synchronized Folders:"); - rootsList = new TableViewer(composite_1, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL); - gridData = new GridData(GridData.FILL_BOTH); - gridData.heightHint = 80; - rootsList.getTable().setLayoutData(gridData); - rootsList.setLabelProvider(new WorkbenchLabelProvider()); - rootsList.setContentProvider(new ArrayContentProvider()); - rootsList.setInput(participant.getInput().subscriberRoots()); - factory.paintBordersFor(composite_1); - hookContextMenu(); - } + final Label label = factory.createLabel(composite_1, "Synchronized Folders:"); + rootsList = new TableViewer(composite_1, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL); + gridData = new GridData(GridData.FILL_BOTH); + gridData.heightHint = 80; + rootsList.getTable().setLayoutData(gridData); + rootsList.setLabelProvider(new WorkbenchLabelProvider()); + rootsList.setContentProvider(new ArrayContentProvider()); + rootsList.setInput(participant.getInput().subscriberRoots()); + factory.paintBordersFor(composite_1); + hookContextMenu(); + participant.getInput().getSubscriber().addListener(this); } + return composite_1; } - return area; } - + /* (non-Javadoc) * @see org.eclipse.swt.widgets.Widget#dispose() */ public void dispose() { super.dispose(); participant.removePropertyChangeListener(this); - JobStatusHandler.removeJobListener(jobListener, SubscriberAction.SUBSCRIBER_JOB_TYPE); + participant.getInput().getSubscriber().removeListener(this); + RefreshSubscriberJob.removeRefreshListener(refreshSubscriberListener); } /* (non-Javadoc) @@ -190,22 +187,13 @@ public class TeamSubscriberParticipantComposite extends Composite implements IPr public void propertyChange(PropertyChangeEvent event) { if(! isDisposed()) { String property = event.getProperty(); - if(property.equals(TeamSubscriberParticipant.P_SYNCVIEWPAGE_LASTSYNC)) { - updateLastRefreshLabel(); - } else if(property.equals(TeamSubscriberParticipant.P_SYNCVIEWPAGE_STATUS)) { - updateStatusLabel(); + if(property.equals(TeamSubscriberParticipant.P_SYNCVIEWPAGE_SCHEDULE)) { + updateScheduleLabel(); } layout(true); } } - private void updateStatusLabel() { - statusLabel.setText(participant.getStatusText()); - } - - private void updateLastRefreshLabel() { - } - private void updateScheduleLabel() { scheduleLabel.setText(participant.getRefreshSchedule().getScheduleAsString()); } @@ -228,4 +216,26 @@ public class TeamSubscriberParticipantComposite extends Composite implements IPr protected void setContextMenu(IMenuManager manager) { manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); } + + /* (non-Javadoc) + * @see org.eclipse.team.core.subscribers.ITeamResourceChangeListener#teamResourceChanged(org.eclipse.team.core.subscribers.TeamDelta[]) + */ + public void teamResourceChanged(TeamDelta[] deltas) { + for (int i = 0; i < deltas.length; i++) { + final TeamDelta delta = deltas[i]; + if(delta.getFlags() == TeamDelta.PROVIDER_CONFIGURED) { + TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { + public void run() { + rootsList.add(delta.getResource()); + } + }); + } else if(delta.getFlags() == TeamDelta.PROVIDER_DECONFIGURED) { + TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable() { + public void run() { + rootsList.remove(delta.getResource()); + } + }); + } + } + } }
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefreshAction.java index c07b6dd28..e951243b2 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefreshAction.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/RefreshAction.java @@ -75,12 +75,8 @@ public class RefreshAction extends Action { // Cancel the scheduled background refresh or any other refresh that is happening. // The scheduled background refresh will restart automatically. Platform.getJobManager().cancel(RefreshSubscriberJob.getFamily()); - if(TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_BACKGROUND_SYNC)) { - RefreshSubscriberJob job = new RefreshSubscriberJob(Policy.bind("SyncViewRefresh.taskName", participant.getName()), resources, participant.getInput()); //$NON-NLS-1$ - JobStatusHandler.schedule(job, SubscriberAction.SUBSCRIBER_JOB_TYPE); - } else { - runBlocking(participant.getInput().getSubscriber(), resources); - } + RefreshSubscriberJob job = new RefreshSubscriberJob(Policy.bind("SyncViewRefresh.taskName", participant.getName()), resources, participant.getInput()); //$NON-NLS-1$ + JobStatusHandler.schedule(job, SubscriberAction.SUBSCRIBER_JOB_TYPE); } private static void runBlocking(final TeamSubscriber s, final IResource[] resources) { diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ToggleViewLayoutAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ToggleViewLayoutAction.java deleted file mode 100644 index e7a13b425..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/ToggleViewLayoutAction.java +++ /dev/null @@ -1,50 +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.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; -import org.eclipse.team.internal.ui.Utils; -import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant; - -public class ToggleViewLayoutAction extends Action implements IPropertyChangeListener { - private int layout; - private TeamSubscriberParticipant participant; - - public ToggleViewLayoutAction(TeamSubscriberParticipant participant, int layout) { - super(null, SWT.RADIO); - this.participant = participant; - this.layout = layout; - if(layout == TeamSubscriberParticipant.TABLE_LAYOUT) { - Utils.initAction(this, "action.toggleViewFlat."); //$NON-NLS-1$ - } else { - Utils.initAction(this, "action.toggleViewHierarchical."); //$NON-NLS-1$ - } - setChecked(participant.getLayout() == layout); - participant.addPropertyChangeListener(this); - } - - public void run() { - participant.setLayout(layout); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - if(event.getProperty().equals(TeamSubscriberParticipant.P_SYNCVIEWPAGE_LAYOUT)) { - Integer newLayout = (Integer)event.getNewValue(); - setChecked(newLayout.intValue() == layout); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetChangedEvent.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetChangedEvent.java index 2f98b0a8e..b994b5b12 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetChangedEvent.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/sets/SyncSetChangedEvent.java @@ -10,13 +10,11 @@ *******************************************************************************/ package org.eclipse.team.internal.ui.synchronize.sets; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; +import java.util.*; import org.eclipse.core.resources.IResource; import org.eclipse.team.core.subscribers.SyncInfo; -import org.eclipse.team.ui.synchronize.*; +import org.eclipse.team.ui.synchronize.ISyncInfoSetChangeEvent; /** * This event keeps track of the changes in a sync set diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetTableContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetTableContentProvider.java deleted file mode 100644 index 72fbf8d65..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncSetTableContentProvider.java +++ /dev/null @@ -1,76 +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.views; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.team.core.subscribers.SyncInfo; -import org.eclipse.team.ui.synchronize.ISyncInfoSetChangeEvent; - -/** - * This class provides the contents for a TableViewer using a SyncSet as the model - */ -public class SyncSetTableContentProvider extends SyncSetContentProvider { - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) - */ - public Object[] getElements(Object element) { - SyncInfo[] infos = getSyncSet().members(); - return getModelObjects(infos); - } - - public TableViewer getTableViewer() { - if (viewer instanceof TableViewer) { - return (TableViewer)viewer; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.team.ccvs.syncviews.views.SyncSetContentProvider#handleResourceAdditions(org.eclipse.team.ccvs.syncviews.views.SyncSetChangedEvent) - */ - protected void handleResourceAdditions(ISyncInfoSetChangeEvent event) { - TableViewer table = getTableViewer(); - if (table != null) { - SyncInfo[] infos = event.getAddedResources(); - table.add(getModelObjects(infos)); - } else { - super.handleResourceAdditions(event); - } - - } - - /* (non-Javadoc) - * @see org.eclipse.team.ccvs.syncviews.views.SyncSetContentProvider#handleResourceRemovals(org.eclipse.team.ccvs.syncviews.views.SyncSetChangedEvent) - */ - protected void handleResourceRemovals(ISyncInfoSetChangeEvent event) { - TableViewer table = getTableViewer(); - if (table != null) { - IResource[] resources = event.getRemovedResources(); - table.remove(getModelObjects(resources)); - } else { - super.handleResourceRemovals(event); - } - } - - protected Object getModelObject(SyncInfo info) { - return getModelObject(info.getLocal()); - } - - protected Object[] getModelObjects(SyncInfo[] infos) { - Object[] resources = new Object[infos.length]; - for (int i = 0; i < resources.length; i++) { - resources[i] = getModelObject(infos[i]); - } - return resources; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTableViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTableViewer.java deleted file mode 100644 index 6584b34d0..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncTableViewer.java +++ /dev/null @@ -1,40 +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.views; - -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Table; -import org.eclipse.team.ui.synchronize.actions.INavigableControl; - -public class SyncTableViewer extends TableViewer implements INavigableControl { - - public SyncTableViewer(Table table) { - super(table); - } - - public boolean gotoDifference(int direction) { - Control c = getControl(); - - if (!(c instanceof Table)) - return false; - - Table table = (Table)c; - int inc = direction == NEXT ? 1 : -1; - int total = table.getItemCount(); - int next = table.getSelectionIndex() + inc; - if(next >= total || next < 0) { - return true; - } - table.setSelection(next); - return false; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerTableSorter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerTableSorter.java deleted file mode 100644 index 291daa611..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/SyncViewerTableSorter.java +++ /dev/null @@ -1,158 +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.views; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.team.internal.ui.IPreferenceIds; -import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.ui.views.navigator.ResourceSorter; - -/** - * Provides support for sorting the table viewer of the SynchronizeView by column - */ -public class SyncViewerTableSorter extends SyncViewerSorter { - - private boolean reversed; - private int columnNumber; - - //column constants - public static final int COL_NAME = 0; - public static final int COL_PARENT = 1; - - // column headings: "Revision" "Tags" "Date" "Author" "Comment" - private int[][] SORT_ORDERS_BY_COLUMN = { - {COL_NAME, COL_PARENT}, /* name */ - {COL_PARENT, COL_NAME} /* parent */ - }; - - /** - * Return a listener that will change the sorter in the table when the column header - * is clicked. - */ - public static SelectionListener getColumnListener(final TableViewer tableViewer) { - /** - * This class handles selections of the column headers. - * Selection of the column header will cause resorting - * of the shown tasks using that column's sorter. - * Repeated selection of the header will toggle - * sorting order (ascending versus descending). - */ - return new SelectionAdapter() { - /** - * Handles the case of user selecting the - * header area. - * <p>If the column has not been selected previously, - * it will set the sorter of that column to be - * the current tasklist sorter. Repeated - * presses on the same column header will - * toggle sorting order (ascending/descending). - */ - public void widgetSelected(SelectionEvent e) { - // column selected - need to sort - int column = tableViewer.getTable().indexOf((TableColumn) e.widget); - SyncViewerTableSorter oldSorter = (SyncViewerTableSorter)tableViewer.getSorter(); - if (oldSorter != null && column == oldSorter.getColumnNumber()) { - SyncViewerTableSorter.getStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_TABLESORT_REVERSED, !oldSorter.isReversed()); - oldSorter.setReversed(!oldSorter.isReversed()); - tableViewer.refresh(); - } else { - SyncViewerTableSorter.getStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_TABLESORT, column); - SyncViewerTableSorter.getStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_TABLESORT_REVERSED, false); - tableViewer.setSorter(new SyncViewerTableSorter()); - } - } - }; - } - - public SyncViewerTableSorter() { - super(ResourceSorter.NAME); - - this.columnNumber = getStore().getInt(IPreferenceIds.SYNCVIEW_VIEW_TABLESORT); - this.reversed = getStore().getBoolean(IPreferenceIds.SYNCVIEW_VIEW_TABLESORT_REVERSED); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ - public int compare(Viewer viewer, Object e1, Object e2) { - - IResource resource1 = getResource(e1); - IResource resource2 = getResource(e2); - int result = 0; - if (resource1 == null || resource2 == null) { - result = super.compare(viewer, e1, e2); - } else { - int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber]; - for (int i = 0; i < columnSortOrder.length; ++i) { - result = compareColumnValue(columnSortOrder[i], resource1, resource2); - if (result != 0) - break; - } - } - if (reversed) - result = -result; - return result; - } - - /** - * Compares two resources, based only on the value of the specified column. - */ - int compareColumnValue(int columnNumber, IResource e1, IResource e2) { - switch (columnNumber) { - case COL_NAME: /* revision */ - - // Category behavior from superclass - int cat1 = category(e1); - int cat2 = category(e2); - - if (cat1 != cat2) - return cat1 - cat2; - - // cat1 == cat2 - - return getCollator().compare(e1.getName(), e2.getName()); - case COL_PARENT: /* parent */ - return getCollator().compare(e1.getParent().getFullPath().toString(), e2.getParent().getFullPath().toString()); - default: - return 0; - } - } - /** - * Returns the number of the column by which this is sorting. - */ - public int getColumnNumber() { - return columnNumber; - } - /** - * Returns true for descending, or false - * for ascending sorting order. - */ - public boolean isReversed() { - return reversed; - } - /** - * Sets the sorting order. - */ - public void setReversed(boolean newReversed) { - reversed = newReversed; - } - - private static IPreferenceStore getStore() { - return TeamUIPlugin.getPlugin().getPreferenceStore(); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/FormSection.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/FormSection.java index 4926e13b2..db5190d59 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/FormSection.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/FormSection.java @@ -15,29 +15,22 @@ import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.Clipboard; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseTrackAdapter; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Layout; -import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.*; import org.eclipse.team.ui.controls.IControlFactory; public abstract class FormSection implements IPropertyChangeListener { public static final int SELECTION = 1; private String headerColorKey = ControlFactory.DEFAULT_HEADER_COLOR; private String headerText; - private String headerRightText; + //private String headerRightText; + private Composite headerRigthContents; private Control client; protected Label header; - protected Label headerRightLabel; + //protected Label headerRightLabel; protected Control separator; //private SectionChangeManager sectionManager; private String description; @@ -88,8 +81,8 @@ public abstract class FormSection implements IPropertyChangeListener { if (headerPainted && header != null) { Point hsize = header.computeSize(SWT.DEFAULT, SWT.DEFAULT, flush); maxWidth = Math.max(maxWidth, hsize.x); - if (headerRightLabel != null) { - Point hrsize = headerRightLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, flush); + if (headerRigthContents != null) { + Point hrsize = headerRigthContents.computeSize(SWT.DEFAULT, SWT.DEFAULT, flush); maxWidth += hrsize.x; } } @@ -138,8 +131,12 @@ public abstract class FormSection implements IPropertyChangeListener { if (toggleSize != null) hwidth = cwidth - toggleSize.x - 5; Point hsize = header.computeSize(hwidth, SWT.DEFAULT, flush); + if(headerRigthContents != null) { + Point hrsize = headerRigthContents.computeSize(SWT.DEFAULT, SWT.DEFAULT, flush); + hsize.y = Math.max(hrsize.y, hsize.y); + } //Point hsize = header.computeSize(-1, SWT.DEFAULT, flush); - height += 18; //(hsize.y - 20); + height += 20; //(hsize.y - 20); collapsedHeight = hsize.y; height += vspacing; } @@ -176,17 +173,21 @@ public abstract class FormSection implements IPropertyChangeListener { availableWidth = width - toggleSize.x - 5; //hsize = header.computeSize(availableWidth, SWT.DEFAULT, flush); hsize = header.computeSize(-1, SWT.DEFAULT, flush); + if(headerRigthContents != null) { + Point hrsize = headerRigthContents.computeSize(SWT.DEFAULT, SWT.DEFAULT, flush); + hsize.y = Math.max(hrsize.y, hsize.y); + } int hx = 0; if (toggle != null) { int ty = y + hsize.y - toggleSize.y; toggle.setBounds(0, ty, toggleSize.x, toggleSize.y); hx = toggleSize.x; // + 5; } - if(headerRightLabel != null) { - Point hrsize = headerRightLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, flush); + if(headerRigthContents != null) { + Point hrsize = headerRigthContents.computeSize(SWT.DEFAULT, SWT.DEFAULT, flush); int restWidth = availableWidth; availableWidth -= hrsize.x; - headerRightLabel.setBounds(availableWidth + hx, y, restWidth, hsize.y); + headerRigthContents.setBounds(availableWidth + hx, y, restWidth, hsize.y); } header.setBounds(hx, y, availableWidth, hsize.y); @@ -251,10 +252,8 @@ public abstract class FormSection implements IPropertyChangeListener { if (headerPainted) { Color headerColor = factory.getColor(getHeaderColorKey()); - header = factory.createHeadingLabel(section, getHeaderText(), headerColor, SWT.WRAP); - if(headerRightText != null) { - headerRightLabel = factory.createLabel(section, getHeaderRightText(), SWT.WRAP); - } + header = factory.createHeadingLabel(section, getHeaderText(), headerColor, SWT.WRAP); + headerRigthContents = createHeaderRight(section, factory); if (collapsable) { toggle = new ToggleControl(section, SWT.NULL); toggle.setSelection(collapsed); @@ -321,6 +320,10 @@ public abstract class FormSection implements IPropertyChangeListener { } } + protected Composite createHeaderRight(Composite parent, ControlFactory factory) { + return null; + } + protected Text createText(Composite parent, String label, ControlFactory factory) { return createText(parent, label, factory, 1); } @@ -377,9 +380,6 @@ public abstract class FormSection implements IPropertyChangeListener { public java.lang.String getHeaderText() { return headerText; } - public java.lang.String getHeaderRightText() { - return headerRightText; - } public int getHeightHint() { return heightHint; } @@ -453,11 +453,6 @@ public abstract class FormSection implements IPropertyChangeListener { if (header != null) header.setText(headerText); } - public void setHeaderRightText(String newHeaderText) { - headerRightText = newHeaderText; - if (headerRightLabel != null) - headerRightLabel.setText(headerRightText); - } public void setHeightHint(int newHeightHint) { heightHint = newHeightHint; } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSchedule.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/RefreshSchedule.java index 8dd207d92..2fc2d1944 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/jobs/RefreshSchedule.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/RefreshSchedule.java @@ -1,18 +1,18 @@ -package org.eclipse.team.internal.ui.jobs; +package org.eclipse.team.ui.synchronize; import java.text.DateFormat; import java.util.Date; +import org.eclipse.team.core.subscribers.SyncInfo; import org.eclipse.team.internal.ui.Policy; import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant; +import org.eclipse.team.internal.ui.jobs.IRefreshEvent; +import org.eclipse.team.internal.ui.jobs.RefreshSubscriberJob; import org.eclipse.ui.IMemento; public class RefreshSchedule { private long refreshInterval = 3600; // 1 hour default - private IRefreshEvent lastRefreshEvent; - private boolean enabled = false; private RefreshSubscriberJob job; @@ -44,9 +44,15 @@ public class RefreshSchedule { * @param enabled The enabled to set. */ public void setEnabled(boolean enabled) { + boolean wasEnabled = isEnabled(); this.enabled = enabled; + if(enabled && ! wasEnabled) { + startJob(); + } else { + stopJob(); + } } - + /** * @return Returns the refreshInterval. */ @@ -62,27 +68,16 @@ public class RefreshSchedule { * @param refreshInterval The refreshInterval to set. */ public void setRefreshInterval(long refreshInterval) { + stopJob(); this.refreshInterval = refreshInterval; - } - - public String lastRefreshEventAsString() { - long stopMills = lastRefreshEvent.getStopTime(); - long startMills = lastRefreshEvent.getStartTime(); - StringBuffer text = new StringBuffer(); - if(stopMills <= 0) { - text.append(Policy.bind("SyncViewPreferencePage.lastRefreshRunNever")); //$NON-NLS-1$ - } else { - Date lastTimeRun = new Date(stopMills); - text.append(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(lastTimeRun)); + if(isEnabled()) { + startJob(); } - - - return text.toString(); - } + } protected void startJob() { if(job == null) { - job = new RefreshSubscriberJob(Policy.bind("ScheduledSyncViewRefresh.taskName"), participant.getInput()); //$NON-NLS-1$ + job = new RefreshSubscriberJob("Refreshing '" + participant.getName() + "'. " + getRefreshIntervalAsString(), participant.getInput()); //$NON-NLS-1$ } job.setRestartOnCancel(true); job.setReschedule(true); @@ -90,12 +85,18 @@ public class RefreshSchedule { } protected void stopJob() { - job.setRestartOnCancel(false /* don't restart the job */); - job.setReschedule(false); - job.cancel(); - job = null; + if(job != null) { + job.setRestartOnCancel(false /* don't restart the job */); + job.setReschedule(false); + job.cancel(); + job = null; + } } + public void dispose() { + stopJob(); + } + public void saveState(IMemento memento) { memento.putString(CTX_REFRESHSCHEDULE_ENABLED, Boolean.toString(enabled)); memento.putInteger(CTX_REFRESHSCHEDULE_INTERVAL, (int)refreshInterval); @@ -103,17 +104,38 @@ public class RefreshSchedule { public static RefreshSchedule init(IMemento memento, TeamSubscriberParticipant participant) { RefreshSchedule schedule = new RefreshSchedule(participant); - String enabled = memento.getString(CTX_REFRESHSCHEDULE_ENABLED); - int interval = memento.getInteger(CTX_REFRESHSCHEDULE_INTERVAL).intValue(); - schedule.setEnabled(Boolean.getBoolean(enabled)); - schedule.setRefreshInterval(interval); + if(memento != null) { + String enabled = memento.getString(CTX_REFRESHSCHEDULE_ENABLED); + int interval = memento.getInteger(CTX_REFRESHSCHEDULE_INTERVAL).intValue(); + schedule.setRefreshInterval(interval); + schedule.setEnabled("true".equals(enabled) ? true : false); + } + // Use the defaults if a schedule hasn't been saved or can't be found. return schedule; } + public static String refreshEventAsString(IRefreshEvent event) { + long stopMills = event.getStopTime(); + long startMills = event.getStartTime(); + SyncInfo[] changes = event.getChanges(); + StringBuffer text = new StringBuffer(); + if(stopMills <= 0) { + text.append(Policy.bind("SyncViewPreferencePage.lastRefreshRunNever")); //$NON-NLS-1$ + } else { + Date lastTimeRun = new Date(stopMills); + text.append(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(lastTimeRun)); + } + return text.toString(); + } + public String getScheduleAsString() { if(! isEnabled()) { return "Not Scheduled"; - } + } + return getRefreshIntervalAsString(); + } + + private String getRefreshIntervalAsString() { StringBuffer text = new StringBuffer(); text.append("Every "); boolean hours = false; diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberConfiguration.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberConfiguration.java deleted file mode 100644 index 5aaa4de8c..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberConfiguration.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.eclipse.team.ui.synchronize; - -public class TeamSubscriberConfiguration { -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java index 33d042fcf..ebd6f6b7a 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipant.java @@ -15,7 +15,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.team.core.subscribers.TeamSubscriber; import org.eclipse.team.internal.ui.IPreferenceIds; import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.internal.ui.jobs.RefreshSchedule; import org.eclipse.team.internal.ui.synchronize.TeamSubscriberParticipantComposite; import org.eclipse.team.internal.ui.synchronize.actions.RefreshAction; import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput; @@ -35,10 +34,7 @@ public abstract class TeamSubscriberParticipant extends AbstractSynchronizeParti private RefreshSchedule refreshSchedule; private int currentMode; - private int currentLayout; - private String statusText = "Idle"; - private IWorkingSet workingSet; /** @@ -57,16 +53,6 @@ public abstract class TeamSubscriberParticipant extends AbstractSynchronizeParti public static final String P_SYNCVIEWPAGE_WORKINGSET = TeamUIPlugin.ID + ".P_SYNCVIEWPAGE_WORKINGSET"; //$NON-NLS-1$ /** - * Property constant indicating the status of a page has changed. - */ - public static final String P_SYNCVIEWPAGE_STATUS = TeamUIPlugin.ID + ".P_SYNCVIEWPAGE_STATUS"; //$NON-NLS-1$ - - /** - * Property constant indicating the last sync time of a page has changed. - */ - public static final String P_SYNCVIEWPAGE_LASTSYNC = TeamUIPlugin.ID + ".P_SYNCVIEWPAGE_LASTSYNC"; //$NON-NLS-1$ - - /** * Property constant indicating the schedule of a page has changed. */ public static final String P_SYNCVIEWPAGE_SCHEDULE = TeamUIPlugin.ID + ".P_SYNCVIEWPAGE_SCHEDULE"; //$NON-NLS-1$ @@ -75,12 +61,7 @@ public abstract class TeamSubscriberParticipant extends AbstractSynchronizeParti * Property constant indicating the mode of a page has changed. */ public static final String P_SYNCVIEWPAGE_MODE = TeamUIPlugin.ID + ".P_SYNCVIEWPAGE_MODE"; //$NON-NLS-1$ - - /** - * Property constant indicating the mode of a page has changed. - */ - public static final String P_SYNCVIEWPAGE_LAYOUT = TeamUIPlugin.ID + ".P_SYNCVIEWPAGE_LAYOUT"; //$NON-NLS-1$ - + /** * Modes are direction filters for the view */ @@ -90,18 +71,6 @@ public abstract class TeamSubscriberParticipant extends AbstractSynchronizeParti public final static int CONFLICTING_MODE = 0x8; public final static int ALL_MODES = INCOMING_MODE | OUTGOING_MODE | CONFLICTING_MODE | BOTH_MODE; - /** - * View type constant (value 0) indicating that the synchronize view will be shown - * as a tree. - */ - public static final int TREE_LAYOUT = 0; - - /** - * View type constant (value 1) indicating that the synchronize view will be shown - * as a table. - */ - public static final int TABLE_LAYOUT = 1; - public TeamSubscriberParticipant() { super(); refreshSchedule = new RefreshSchedule(this); @@ -125,16 +94,6 @@ public abstract class TeamSubscriberParticipant extends AbstractSynchronizeParti return currentMode; } - public void setLayout(int layout) { - int oldLayout = currentLayout; - currentLayout = layout; - firePropertyChange(this, P_SYNCVIEWPAGE_LAYOUT, new Integer(oldLayout), new Integer(layout)); - } - - public int getLayout() { - return currentLayout; - } - public void setRefreshSchedule(RefreshSchedule schedule) { this.refreshSchedule = schedule; firePropertyChange(this, P_SYNCVIEWPAGE_SCHEDULE, null, schedule); @@ -144,15 +103,6 @@ public abstract class TeamSubscriberParticipant extends AbstractSynchronizeParti return refreshSchedule; } - public void setStatusText(String text) { - statusText = text; - firePropertyChange(this, P_SYNCVIEWPAGE_STATUS, null, statusText); - } - - public String getStatusText() { - return statusText; - } - public void setWorkingSet(IWorkingSet set) { ITeamSubscriberSyncInfoSets input = getInput(); IWorkingSet oldSet = null; @@ -187,6 +137,7 @@ public abstract class TeamSubscriberParticipant extends AbstractSynchronizeParti * @see org.eclipse.team.ui.sync.AbstractSynchronizeViewPage#dispose() */ public void dispose() { + refreshSchedule.dispose(); removePropertyChangeListener(input); input.dispose(); } @@ -215,8 +166,7 @@ public abstract class TeamSubscriberParticipant extends AbstractSynchronizeParti if(settings != null) { String set = settings.getString(P_SYNCVIEWPAGE_WORKINGSET); String mode = settings.getString(P_SYNCVIEWPAGE_MODE); - String layout = settings.getString(P_SYNCVIEWPAGE_LAYOUT); - RefreshSchedule schedule = RefreshSchedule.init(memento.getChild(CTX_SUBSCRIBER_SCHEDULE_SETTINGS), this); + RefreshSchedule schedule = RefreshSchedule.init(settings.getChild(CTX_SUBSCRIBER_SCHEDULE_SETTINGS), this); setRefreshSchedule(schedule); if(set != null) { @@ -226,11 +176,9 @@ public abstract class TeamSubscriberParticipant extends AbstractSynchronizeParti } } setMode(Integer.parseInt(mode)); - setLayout(Integer.parseInt(layout)); } } else { setMode(BOTH_MODE); - setLayout(TREE_LAYOUT); } } @@ -243,9 +191,8 @@ public abstract class TeamSubscriberParticipant extends AbstractSynchronizeParti if(set != null) { settings.putString(P_SYNCVIEWPAGE_WORKINGSET, getWorkingSet().getName()); } - settings.putString(P_SYNCVIEWPAGE_LAYOUT, Integer.toString(getLayout())); settings.putString(P_SYNCVIEWPAGE_MODE, Integer.toString(getMode())); - refreshSchedule.saveState(settings); + refreshSchedule.saveState(settings.createChild(CTX_SUBSCRIBER_SCHEDULE_SETTINGS)); } /* (non-Javadoc) diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java index 223421dd0..65aa14b01 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java @@ -15,6 +15,7 @@ import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.*; import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.GridData; @@ -24,8 +25,6 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.team.internal.ui.*; import org.eclipse.team.internal.ui.jobs.JobBusyCursor; import org.eclipse.team.internal.ui.synchronize.*; -import org.eclipse.team.internal.ui.synchronize.ChangesSection; -import org.eclipse.team.internal.ui.synchronize.SummarySection; import org.eclipse.team.internal.ui.synchronize.actions.*; import org.eclipse.team.internal.ui.widgets.ControlFactory; import org.eclipse.team.ui.synchronize.actions.INavigableControl; @@ -67,8 +66,6 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper private OpenWithActionGroup openWithActions; private NavigateAction gotoNext; private NavigateAction gotoPrevious; - private Action toggleLayoutTree; - private Action toggleLayoutTable; private SyncViewerShowPreferencesAction showPreferences; private RefreshAction refreshAllAction; private ComparisonCriteriaActionGroup comparisonCriteriaGroup; @@ -88,7 +85,9 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl(Composite parent) { + //ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); composite = new Composite(parent, SWT.NONE); + //sc.setContent(composite); GridLayout gridLayout= new GridLayout(); gridLayout.makeColumnsEqualWidth= false; gridLayout.marginWidth= 0; @@ -120,8 +119,6 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper // view menu comparisonCriteriaGroup = new ComparisonCriteriaActionGroup(input); - toggleLayoutTable = new ToggleViewLayoutAction(participant, TeamSubscriberParticipant.TABLE_LAYOUT); - toggleLayoutTree = new ToggleViewLayoutAction(participant, TeamSubscriberParticipant.TREE_LAYOUT); workingSetGroup = new WorkingSetFilterActionGroup(getSite().getShell(), this, view, participant); showPreferences = new SyncViewerShowPreferencesAction(view.getSite().getShell()); @@ -221,8 +218,6 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper // view menu IMenuManager menu = actionBars.getMenuManager(); MenuManager layoutMenu = new MenuManager(Policy.bind("action.layout.label")); //$NON-NLS-1$ - layoutMenu.add(toggleLayoutTable); - layoutMenu.add(toggleLayoutTree); MenuManager comparisonCriteria = new MenuManager(Policy.bind("action.comparisonCriteria.label")); //$NON-NLS-1$ comparisonCriteriaGroup.addActionsToMenuMgr(comparisonCriteria); workingSetGroup.fillActionBars(actionBars); @@ -245,12 +240,8 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { - // Layout change - if(event.getProperty().equals(TeamSubscriberParticipant.P_SYNCVIEWPAGE_LAYOUT)) { - //switchViewerType(((Integer)event.getNewValue()).intValue()); - // Working set changed via menu selection - notify participant and - // do all the real work when we get the next workset changed event - } else if(event.getProperty().equals(WorkingSetFilterActionGroup.CHANGE_WORKING_SET)) { + // Working set changed by user + if(event.getProperty().equals(WorkingSetFilterActionGroup.CHANGE_WORKING_SET)) { if(settingWorkingSet) return; settingWorkingSet = true; participant.setWorkingSet((IWorkingSet)event.getNewValue()); |