diff options
author | james | 2002-06-11 21:37:33 +0000 |
---|---|---|
committer | james | 2002-06-11 21:37:33 +0000 |
commit | c6b4b2e5c5781b7182a4840ec8d4abb95c4951e7 (patch) | |
tree | 649a13e99c4af01b2366333eddd1a3b5f9b9d773 | |
parent | e0ee74189bdf41e79774b9a6821839265bb54cb9 (diff) | |
download | eclipse.platform.team-c6b4b2e5c5781b7182a4840ec8d4abb95c4951e7.tar.gz eclipse.platform.team-c6b4b2e5c5781b7182a4840ec8d4abb95c4951e7.tar.xz eclipse.platform.team-c6b4b2e5c5781b7182a4840ec8d4abb95c4951e7.zip |
18609: Making un-added more obviousRoot_bug20715
4 files changed, 82 insertions, 1 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java index 1650bab57..9ab33137b 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java @@ -45,6 +45,7 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork private Button imageShowDirty; private Button imageShowHasRemote; private Button imageShowAdded; + private Button imageShowNewResource; private Text fileTextFormat; private Text fileTextFormatExample; @@ -201,6 +202,7 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork imageShowDirty = createCheckBox(imageGroup, Policy.bind("Sho&w_outgoing_25")); //$NON-NLS-1$ imageShowHasRemote = createCheckBox(imageGroup, Policy.bind("Show_has_&remote_26")); //$NON-NLS-1$ imageShowAdded = createCheckBox(imageGroup, Policy.bind("S&how_is_added_27")); //$NON-NLS-1$ + imageShowNewResource = createCheckBox(imageGroup, Policy.bind("CVSDecoratorPreferencesPage.newResources")); //$NON-NLS-1$ showDirty = createCheckBox(composite, Policy.bind("&Compute_deep_outgoing_state_for_folders_(disabling_this_will_improve_decorator_performance)_28")); //$NON-NLS-1$ @@ -255,6 +257,7 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork imageShowDirty.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION)); imageShowAdded.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION)); imageShowHasRemote.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION)); + imageShowNewResource.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION)); showDirty.setSelection(store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY)); @@ -284,6 +287,7 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork store.setValue(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION, imageShowDirty.getSelection()); store.setValue(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION, imageShowAdded.getSelection()); store.setValue(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION, imageShowHasRemote.getSelection()); + store.setValue(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION, imageShowNewResource.getSelection()); store.setValue(ICVSUIConstants.PREF_CALCULATE_DIRTY, showDirty.getSelection()); @@ -311,6 +315,7 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork imageShowDirty.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_DIRTY_DECORATION)); imageShowAdded.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_ADDED_DECORATION)); imageShowHasRemote.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION)); + imageShowNewResource.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION)); showDirty.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY)); } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java index 538f88a7e..8a793f20e 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java @@ -27,6 +27,7 @@ import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; @@ -49,6 +50,7 @@ import org.eclipse.team.internal.ui.sync.CatchupReleaseViewer; import org.eclipse.team.internal.ui.sync.ChangedTeamContainer; import org.eclipse.team.internal.ui.sync.ITeamNode; import org.eclipse.team.internal.ui.sync.SyncCompareInput; +import org.eclipse.team.internal.ui.sync.SyncSet; import org.eclipse.team.internal.ui.sync.TeamFile; public class CVSSyncCompareInput extends SyncCompareInput { @@ -432,4 +434,8 @@ public class CVSSyncCompareInput extends SyncCompareInput { } return result; } + + protected SyncSet getSyncSet(IStructuredSelection selection) { + return new CVSSyncSet(selection); + } } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncSet.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncSet.java index ee7ba8330..aa6be31df 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncSet.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncSet.java @@ -16,6 +16,7 @@ import org.eclipse.team.internal.ccvs.core.ICVSFolder; import org.eclipse.team.internal.ccvs.core.ICVSResource; import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; +import org.eclipse.team.internal.ccvs.ui.Policy; import org.eclipse.team.internal.ui.sync.ITeamNode; import org.eclipse.team.internal.ui.sync.SyncSet; @@ -113,4 +114,69 @@ public class CVSSyncSet extends SyncSet { } return false; } + + /** + * Returns a message for the status line describing this sync set. + * + * Override the method in SyncSet to add information about new resources + */ + public String getStatusLineMessage() { + int incoming = 0; + int outgoing = 0; + int conflicts = 0; + int newResources = 0; + ITeamNode[] nodes = getChangedNodes(); + for (int i = 0; i < nodes.length; i++) { + ITeamNode next = nodes[i]; + switch (next.getChangeDirection()) { + case IRemoteSyncElement.INCOMING: + incoming++; + break; + case IRemoteSyncElement.OUTGOING: + outgoing++; + ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(next.getResource()); + try { + if (cvsResource.exists()) { + if (cvsResource.isFolder()) { + if (!((ICVSFolder)cvsResource).isCVSFolder()) { + newResources++; + } + } else if (!cvsResource.isManaged()) { + newResources++; + } + } + } catch (CVSException e) { + CVSUIPlugin.log(e.getStatus()); + } + break; + case IRemoteSyncElement.CONFLICTING: + conflicts++; + break; + } + } + StringBuffer result = new StringBuffer(); + + if (conflicts == 0) { + result.append(Policy.bind("CVSSyncSet.noConflicts")); //$NON-NLS-1$ + } else { + result.append(Policy.bind("CVSSyncSet.conflicts", new Object[] {Integer.toString(conflicts)} )); //$NON-NLS-1$ + } + if (incoming == 0) { + result.append(Policy.bind("CVSSyncSet.noIncomings")); //$NON-NLS-1$ + } else { + result.append(Policy.bind("CVSSyncSet.incomings", new Object[] {Integer.toString(incoming)} )); //$NON-NLS-1$ + } + if (outgoing == 0) { + result.append(Policy.bind("CVSSyncSet.noOutgoings")); //$NON-NLS-1$ + } else { + result.append(Policy.bind("CVSSyncSet.outgoings", new Object[] {Integer.toString(outgoing)} )); //$NON-NLS-1$ + } + if (newResources == 0) { + result.append(Policy.bind("CVSSyncSet.noNew")); //$NON-NLS-1$ + } else { + result.append(Policy.bind("CVSSyncSet.new", new Object[] {Integer.toString(newResources)} )); //$NON-NLS-1$ + } + + return result.toString(); + } } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java index a0660860d..e94e1fe1d 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java @@ -30,6 +30,7 @@ import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.widgets.Composite; @@ -415,7 +416,7 @@ public abstract class SyncCompareInput extends CompareEditorInput { statusLine.setErrorMessage(null); return; } - SyncSet set = new SyncSet(new StructuredSelection(diffRoot.getChildren())); + SyncSet set = getSyncSet(new StructuredSelection(diffRoot.getChildren())); if (set.hasConflicts()) { statusLine.setMessage(null); statusLine.setErrorMessage(set.getStatusLineMessage()); @@ -436,6 +437,9 @@ public abstract class SyncCompareInput extends CompareEditorInput { } } + protected SyncSet getSyncSet(IStructuredSelection selection) { + return new SyncSet(selection); + } public boolean saveIfNecessary() { if (! isSaveNeeded()) return true; |