Mode selection is saved as a user preference and preference to use both mode has been removed.
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 42ae2f5..b5b8c34 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
@@ -18,7 +18,7 @@
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_USEBOTHMODE = PREFIX + "syncview_use_bothmode"; //$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$
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 fcb3d00..9f18abc 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
@@ -32,6 +32,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.team.internal.ui.jobs.RefreshSubscriberInputJob;
import org.eclipse.team.internal.ui.jobs.RefreshSubscriberJob;
+import org.eclipse.team.internal.ui.sync.actions.SyncViewerDirectionFilters;
import org.eclipse.team.internal.ui.sync.views.SyncViewerTableSorter;
import org.eclipse.team.ui.ISharedImages;
import org.eclipse.ui.IWorkbenchPage;
@@ -149,6 +150,7 @@
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, SyncViewerDirectionFilters.BOTH_MODE);
store.setDefault(IPreferenceIds.SYNCVIEW_DEFAULT_PERSPECTIVE, "org.eclipse.team.internal.ui.sync.views.TeamSynchronizingPerspective"); //$NON-NLS-1$
}
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 e81757e..ba221ce 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
@@ -148,9 +148,6 @@
compressFolders = new BooleanFieldEditor(SYNCVIEW_COMPRESS_FOLDERS, Policy.bind("SyncViewerPreferencePage.9"), SWT.NONE, displayGroup); //$NON-NLS-1$
addField(compressFolders);
- useBothMode = new BooleanFieldEditor(SYNCVIEW_USEBOTHMODE, Policy.bind("SyncViewerPreferencePage.10"), SWT.NONE, displayGroup); //$NON-NLS-1$
- addField(useBothMode);
-
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$
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerDirectionFilters.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerDirectionFilters.java
index d55b92c..fc79110 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerDirectionFilters.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerDirectionFilters.java
@@ -48,6 +48,11 @@
private DirectionFilterAction conflictsMode;
private final static int[] DEFAULT_FILTER = new int[] {SyncInfo.INCOMING, SyncInfo.OUTGOING, SyncInfo.CONFLICTING};
+
+ public final static int INCOMING_MODE = 1;
+ public final static int OUTGOING_MODE = 2;
+ public final static int BOTH_MODE = 3;
+ public final static int CONFLICTING_MODE = 4;
/**
* Action for toggling the sync mode.
@@ -56,9 +61,11 @@
// The sync mode that this action enables
private int[] syncMode;
private boolean toggled;
- public DirectionFilterAction(String prefix,String commandId, int[] mode) {
+ private int modeId;
+ public DirectionFilterAction(String prefix,String commandId, int[] mode, int modeId) {
super("", AS_RADIO_BUTTON); //$NON-NLS-1$
this.syncMode = mode;
+ this.modeId = modeId;
Utils.initAction(this, prefix);
Action a = new Action() {
public void run() {
@@ -70,6 +77,7 @@
Utils.registerAction(kbs, a, commandId); //$NON-NLS-1$
}
public void run() {
+ TeamUIPlugin.getPlugin().getPreferenceStore().setValue(IPreferenceIds.SYNCVIEW_SELECTED_MODE, modeId);
updateFilter(this);
}
public int[] getFilter() {
@@ -88,16 +96,16 @@
*/
private void createActions() {
// Create the actions
- incomingMode = new DirectionFilterAction("action.directionFilterIncoming.", "org.eclipse.team.ui.syncview.incomingFilter", new int[] {SyncInfo.INCOMING, SyncInfo.CONFLICTING}); //$NON-NLS-1$ //$NON-NLS-2$
+ incomingMode = new DirectionFilterAction("action.directionFilterIncoming.", "org.eclipse.team.ui.syncview.incomingFilter", new int[] {SyncInfo.INCOMING, SyncInfo.CONFLICTING}, INCOMING_MODE); //$NON-NLS-1$ //$NON-NLS-2$
actions.add(incomingMode);
- outgoingMode = new DirectionFilterAction("action.directionFilterOutgoing.", "org.eclipse.team.ui.syncview.outgoingFilter", new int[] {SyncInfo.OUTGOING, SyncInfo.CONFLICTING}); //$NON-NLS-1$ //$NON-NLS-2$
+ outgoingMode = new DirectionFilterAction("action.directionFilterOutgoing.", "org.eclipse.team.ui.syncview.outgoingFilter", new int[] {SyncInfo.OUTGOING, SyncInfo.CONFLICTING}, OUTGOING_MODE); //$NON-NLS-1$ //$NON-NLS-2$
actions.add(outgoingMode);
- bothMode = new DirectionFilterAction("action.directionFilterBoth.", "org.eclipse.team.ui.syncview.bothFilter", new int[] {SyncInfo.OUTGOING, SyncInfo.INCOMING, SyncInfo.CONFLICTING}); //$NON-NLS-1$ //$NON-NLS-2$
+ bothMode = new DirectionFilterAction("action.directionFilterBoth.", "org.eclipse.team.ui.syncview.bothFilter", new int[] {SyncInfo.OUTGOING, SyncInfo.INCOMING, SyncInfo.CONFLICTING}, BOTH_MODE); //$NON-NLS-1$ //$NON-NLS-2$
actions.add(bothMode);
- conflictsMode = new DirectionFilterAction("action.directionFilterConflicts.", "org.eclipse.team.ui.syncview.conflictsFilter", new int[] {SyncInfo.CONFLICTING}); //$NON-NLS-1$ //$NON-NLS-2$
+ conflictsMode = new DirectionFilterAction("action.directionFilterConflicts.", "org.eclipse.team.ui.syncview.conflictsFilter", new int[] {SyncInfo.CONFLICTING}, CONFLICTING_MODE); //$NON-NLS-1$ //$NON-NLS-2$
actions.add(conflictsMode);
updateEnablement(null);
@@ -180,15 +188,24 @@
} else {
outgoingMode.setEnabled(true);
}
- if(TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(IPreferenceIds.SYNCVIEW_USEBOTHMODE)) {
- bothMode.setChecked(true);
- incomingMode.setChecked(false);
- } else {
- incomingMode.setChecked(true);
- bothMode.setChecked(false);
- }
+ int defaultMode = TeamUIPlugin.getPlugin().getPreferenceStore().getInt(IPreferenceIds.SYNCVIEW_SELECTED_MODE);
+ bothMode.setChecked(false);
+ incomingMode.setChecked(false);
outgoingMode.setChecked(false);
conflictsMode.setChecked(false);
+ switch(defaultMode) {
+ case INCOMING_MODE: incomingMode.setChecked(true); break;
+ case CONFLICTING_MODE: conflictsMode.setChecked(true); break;
+ case BOTH_MODE: bothMode.setChecked(true); break;
+ case OUTGOING_MODE:
+ // handle the case where the outgoing mode is disabled.
+ if(outgoingMode.isEnabled()) {
+ outgoingMode.setChecked(true);
+ } else {
+ incomingMode.setChecked(true);
+ }
+ break;
+ }
}
}