Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-04-07 19:40:57 +0000
committerMichael Valenta2004-04-07 19:40:57 +0000
commitc6247d42451089c354d62700e07a731b2bbf1c42 (patch)
tree8733419c8485e27ac286bbfdafbe266d2105be7c
parent4119517d68a1e29fb85ab14f3880a73bef46c1dc (diff)
downloadeclipse.platform.team-c6247d42451089c354d62700e07a731b2bbf1c42.tar.gz
eclipse.platform.team-c6247d42451089c354d62700e07a731b2bbf1c42.tar.xz
eclipse.platform.team-c6247d42451089c354d62700e07a731b2bbf1c42.zip
Added Date tag support
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/obj16/Thumbs.dbbin0 -> 8704 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/obj16/date.gifbin0 -> 181 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/icons/full/obj16/dates.gifbin0 -> 181 bytes
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.properties5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagConfigurationDialog.java70
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagSelectionDialog.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/ProjectElement.java34
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagElement.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagRootElement.java16
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java13
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewDateTagAction.java18
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java23
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java97
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositorySorter.java8
21 files changed, 270 insertions, 77 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/Thumbs.db b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/Thumbs.db
new file mode 100644
index 000000000..c3b762ac8
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/Thumbs.db
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/date.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/date.gif
new file mode 100644
index 000000000..96aae05cb
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/date.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/dates.gif b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/dates.gif
new file mode 100644
index 000000000..96aae05cb
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/icons/full/obj16/dates.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.properties b/bundles/org.eclipse.team.cvs.ui/plugin.properties
index eb95820d9..25a16a998 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.properties
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.properties
@@ -195,4 +195,7 @@ CVSCompareSubscriber.revert.label=&Override and Update
CVSCompareSubscriber.revert.tooltip=Revert the local file contents to match that of their corresponding remotes
WorkInProgress.name=Work In Progress
-CVSRemoteQuickDiffProvider.label=&Latest CVS Revision \ No newline at end of file
+CVSRemoteQuickDiffProvider.label=&Latest CVS Revision
+
+NewDateTagAction.label=&Date Tag...
+NewDateTagAction.tooltip=Add new date tag \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index 8e9320501..8a9a891cf 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -547,6 +547,18 @@
id="org.eclipse.team.ccvs.ui.newDateTag">
</action>
</objectContribution>
+ <objectContribution
+ objectClass="org.eclipse.team.internal.ccvs.ui.model.DateTagCategory"
+ id="org.eclipse.team.ccvs.ui.DateCategoryContributions">
+ <action
+ label="%NewDateTagAction.label"
+ tooltip="%NewDateTagAction.tooltip"
+ menubarPath="group.add/group1"
+ class="org.eclipse.team.internal.ccvs.ui.repo.NewDateTagAction"
+ helpContextId="org.eclipse.team.cvs.ui.new_date_tag_action_context"
+ id="org.eclipse.team.ccvs.ui.newDateTag">
+ </action>
+ </objectContribution>
<objectContribution
objectClass="org.eclipse.team.internal.ccvs.ui.model.BranchCategory"
id="org.eclipse.team.ccvs.ui.model.BranchCategoryContributions">
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
index ac282a303..4c19ea90f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
@@ -50,8 +50,9 @@ import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.*;
import org.eclipse.team.internal.ccvs.core.util.Assert;
+import org.eclipse.team.internal.ccvs.core.util.CVSDateFormatter;
+import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
import org.eclipse.team.internal.ccvs.core.util.ResourceStateChangeListeners;
import org.eclipse.team.internal.core.ExceptionCollector;
import org.eclipse.team.internal.ui.TeamUIPlugin;
@@ -266,7 +267,11 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
CVSTag tag = getTagToShow(resource);
if (tag != null) {
- bindings.put(CVSDecoratorConfiguration.RESOURCE_TAG, tag.getName());
+ String name = tag.getName();
+ if(tag.getType() == CVSTag.DATE){
+ name = CVSDateFormatter.decoratorTimeStamp(tag.asDate());
+ }
+ bindings.put(CVSDecoratorConfiguration.RESOURCE_TAG, name);
}
if (type != IResource.FILE) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
index 7e75845d7..68127c906 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
@@ -381,6 +381,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
createImageDescriptor(ICVSUIConstants.IMG_CLEAR_DISABLED, baseURL);
createImageDescriptor(ICVSUIConstants.IMG_BRANCHES_CATEGORY, baseURL);
createImageDescriptor(ICVSUIConstants.IMG_VERSIONS_CATEGORY, baseURL);
+ createImageDescriptor(ICVSUIConstants.IMG_DATES_CATEGORY, baseURL);
createImageDescriptor(ICVSUIConstants.IMG_PROJECT_VERSION, baseURL);
createImageDescriptor(ICVSUIConstants.IMG_WIZBAN_MERGE, baseURL);
createImageDescriptor(ICVSUIConstants.IMG_WIZBAN_SHARE, baseURL);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java
index e1192e1d0..9ca98219a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/DateTagDialog.java
@@ -63,7 +63,7 @@ public class DateTagDialog extends Dialog {
//or any year written in
String days[] = new String[31];
for (int i = 0; i < 31; i++) {
- days[i] = String.valueOf(i);
+ days[i] = String.valueOf(i+1);
}
String months[] = new String[12];
@@ -106,7 +106,7 @@ public class DateTagDialog extends Dialog {
Integer.parseInt(String.valueOf(fromYearCombo.getText())),
fromMonthCombo.getSelectionIndex(),
Integer.parseInt(String.valueOf(fromDayCombo.getText())),
- 00, 00, 00);
+ 0,0,0);
}
}
public class TimeArea extends DialogArea {
@@ -158,7 +158,7 @@ public class DateTagDialog extends Dialog {
}
public void initializeValues(Calendar calendar) {
- hourCombo.select(calendar.get(Calendar.HOUR));
+ hourCombo.select(calendar.get(Calendar.HOUR_OF_DAY));//24 hour clock
minuteCombo.select(calendar.get(Calendar.MINUTE));
secondCombo.select(calendar.get(Calendar.SECOND));
@@ -175,7 +175,7 @@ public class DateTagDialog extends Dialog {
}
public void adjustCalendar(Calendar calendar) {
if (includeTime.getSelection()) {
- calendar.set(Calendar.HOUR, hourCombo.getSelectionIndex());
+ calendar.set(Calendar.HOUR_OF_DAY, hourCombo.getSelectionIndex());//24 hour clock
calendar.set(Calendar.MINUTE, minuteCombo.getSelectionIndex());
calendar.set(Calendar.SECOND, secondCombo.getSelectionIndex());
if (utcTime.getSelection()) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
index d9b445ba0..1126a1ea9 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
@@ -32,9 +32,11 @@ public interface ICVSUIConstants {
public final String IMG_TAG = "obj16/tag.gif"; //$NON-NLS-1$
public final String IMG_BRANCHES_CATEGORY = "obj16/branches_rep.gif"; //$NON-NLS-1$
public final String IMG_VERSIONS_CATEGORY = "obj16/versions_rep.gif"; //$NON-NLS-1$
+ public final String IMG_DATES_CATEGORY = "obj16/dates.gif"; //
+
public final String IMG_MODULE = "obj16/module_rep.gif"; //$NON-NLS-1$
public final String IMG_PROJECT_VERSION = "obj16/prjversions_rep.gif"; //$NON-NLS-1$
- public final String IMG_DATE = "obj16/day_obj.gif"; //$NON-NLS-1$
+ public final String IMG_DATE = "obj16/date.gif"; //$NON-NLS-1$
// toolbar
public final String IMG_REFRESH = "clcl16/refresh.gif"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagConfigurationDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagConfigurationDialog.java
index 962ef69f4..597602265 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagConfigurationDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagConfigurationDialog.java
@@ -33,6 +33,7 @@ import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -64,6 +65,7 @@ import org.eclipse.team.internal.ccvs.ui.model.CVSFileElement;
import org.eclipse.team.internal.ccvs.ui.model.CVSFolderElement;
import org.eclipse.team.internal.ccvs.ui.model.CVSRootFolderElement;
import org.eclipse.team.internal.ccvs.ui.model.RemoteContentProvider;
+import org.eclipse.team.internal.ccvs.ui.repo.NewDateTagAction;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.ui.model.WorkbenchContentProvider;
@@ -160,8 +162,8 @@ public class TagConfigurationDialog extends Dialog {
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
gridLayout.makeColumnsEqualWidth = true;
- gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
shell.setLayout (gridLayout);
Composite comp = new Composite(shell, SWT.NULL);
@@ -177,7 +179,7 @@ public class TagConfigurationDialog extends Dialog {
data = new GridData();
data.horizontalSpan = 1;
cvsResourceTreeLabel.setLayoutData(data);
-
+
Tree tree = new Tree(comp, SWT.BORDER | SWT.MULTI);
cvsResourceTree = new TreeViewer (tree);
cvsResourceTree.setContentProvider(new RemoteContentProvider());
@@ -198,8 +200,8 @@ public class TagConfigurationDialog extends Dialog {
updateEnablements();
}
});
-
-
+
+
comp = new Composite(shell, SWT.NULL);
gridLayout = new GridLayout();
gridLayout.numColumns = 1;
@@ -207,7 +209,7 @@ public class TagConfigurationDialog extends Dialog {
gridLayout.marginHeight = 0;
comp.setLayout(gridLayout);
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
-
+
Label cvsTagTreeLabel = new Label(comp, SWT.NONE);
cvsTagTreeLabel.setText(Policy.bind("TagConfigurationDialog.6")); //$NON-NLS-1$
data = new GridData();
@@ -283,7 +285,7 @@ public class TagConfigurationDialog extends Dialog {
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
rememberedTags.setLayout (gridLayout);
-
+
Label rememberedTagsLabel = new Label (rememberedTags, SWT.NONE);
rememberedTagsLabel.setText (Policy.bind("TagConfigurationDialog.7")); //$NON-NLS-1$
data = new GridData ();
@@ -299,9 +301,10 @@ public class TagConfigurationDialog extends Dialog {
data.horizontalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
cvsDefinedTagsTree.getTree().setLayoutData(data);
- cvsDefinedTagsRootElement = new ProjectElement(roots[0], ProjectElement.INCLUDE_BRANCHES | ProjectElement.INCLUDE_VERSIONS);
+ cvsDefinedTagsRootElement = new ProjectElement(roots[0], ProjectElement.INCLUDE_BRANCHES | ProjectElement.INCLUDE_VERSIONS |ProjectElement.INCLUDE_DATES);
cvsDefinedTagsRootElement.getBranches().add(CVSUIPlugin.getPlugin().getRepositoryManager().getKnownTags(root, CVSTag.BRANCH));
cvsDefinedTagsRootElement.getVersions().add(CVSUIPlugin.getPlugin().getRepositoryManager().getKnownTags(root, CVSTag.VERSION));
+ cvsDefinedTagsRootElement.getDates().add(CVSUIPlugin.getPlugin().getRepositoryManager().getKnownTags(root, CVSTag.DATE));
cvsDefinedTagsTree.setInput(cvsDefinedTagsRootElement);
cvsDefinedTagsTree.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
@@ -309,7 +312,7 @@ public class TagConfigurationDialog extends Dialog {
}
});
cvsDefinedTagsTree.setSorter(new ProjectElementSorter());
-
+
Composite buttonComposite = new Composite(rememberedTags, SWT.NONE);
data = new GridData ();
data.verticalAlignment = GridData.BEGINNING;
@@ -331,7 +334,19 @@ public class TagConfigurationDialog extends Dialog {
updateEnablements();
}
});
-
+ Button addDatesButton = new Button(buttonComposite, SWT.PUSH);
+ addDatesButton.setText("Add Date...");
+ data = getStandardButtonData(addDatesButton);
+ data.horizontalAlignment = GridData.FILL;
+ addDatesButton.setLayoutData(data);
+ addDatesButton.addListener(SWT.Selection, new Listener(){
+ public void handleEvent(Event event){
+ CVSTag dateTag = NewDateTagAction.getDateTag(getShell(), CVSUIPlugin.getPlugin().getRepositoryManager().getRepositoryLocationFor(root));
+ addDateTagsSelected(dateTag);
+ updateShownTags();
+ updateEnablements();
+ }
+ });
removeTagButton = new Button (buttonComposite, SWT.PUSH);
removeTagButton.setText (Policy.bind("TagConfigurationDialog.9")); //$NON-NLS-1$
data = getStandardButtonData(removeTagButton);
@@ -428,14 +443,14 @@ public class TagConfigurationDialog extends Dialog {
data = new GridData (GridData.FILL_BOTH);
data.horizontalSpan = 2;
seperator.setLayoutData(data);
-
+
WorkbenchHelp.setHelp(shell, IHelpContextIds.TAG_CONFIGURATION_OVERVIEW);
-
+
updateEnablements();
- Dialog.applyDialogFont(parent);
+ Dialog.applyDialogFont(parent);
return shell;
}
-
+
private void updateShownTags() {
final CVSFileElement[] filesSelection = getSelectedFiles();
final Set tags = new HashSet();
@@ -467,6 +482,7 @@ public class TagConfigurationDialog extends Dialog {
List knownTags = new ArrayList();
knownTags.addAll(Arrays.asList(cvsDefinedTagsRootElement.getBranches().getTags()));
knownTags.addAll(Arrays.asList(cvsDefinedTagsRootElement.getVersions().getTags()));
+ knownTags.addAll(Arrays.asList(cvsDefinedTagsRootElement.getDates().getTags()));
if(!knownTags.contains(tag)) {
TagElement tagElem = new TagElement(tag);
cvsTagTree.add(tagElem);
@@ -539,7 +555,9 @@ public class TagConfigurationDialog extends Dialog {
CVSTag tag = ((TagElement)checked[i]).getTag();
if(tag.getType() == CVSTag.BRANCH) {
cvsDefinedTagsRootElement.getBranches().add(new CVSTag[] {tag});
- } else {
+ }else if(tag.getType() == CVSTag.DATE){
+ cvsDefinedTagsRootElement.getDates().add(new CVSTag[] {tag});
+ }else {
cvsDefinedTagsRootElement.getVersions().add(new CVSTag[] {tag});
}
}
@@ -558,14 +576,25 @@ public class TagConfigurationDialog extends Dialog {
cvsDefinedTagsRootElement.getBranches().remove(tag);
} else if(tag.getType()==CVSTag.VERSION) {
cvsDefinedTagsRootElement.getVersions().remove(tag);
- }
+ } else if(tag.getType() == CVSTag.DATE){
+ cvsDefinedTagsRootElement.getDates().remove(tag);
+ }
}
}
}
cvsDefinedTagsTree.refresh();
cvsDefinedTagsTree.getTree().setFocus();
}
-
+ private void addDateTagsSelected(CVSTag tag){
+ if(tag == null) return;
+ List knownTags = new ArrayList();
+ knownTags.addAll(Arrays.asList(cvsDefinedTagsRootElement.getDates().getTags()));
+ if(!knownTags.contains( tag)){
+ cvsDefinedTagsRootElement.getDates().add(tag);
+ }
+ cvsDefinedTagsTree.refresh();
+ cvsDefinedTagsTree.getTree().setFocus();
+ }
private boolean isTagSelectedInKnownTagTree() {
IStructuredSelection selection = (IStructuredSelection)cvsDefinedTagsTree.getSelection();
if (!selection.isEmpty()) {
@@ -585,6 +614,7 @@ public class TagConfigurationDialog extends Dialog {
private void removeAllKnownTags() {
cvsDefinedTagsRootElement.getBranches().removeAll();
cvsDefinedTagsRootElement.getVersions().removeAll();
+ cvsDefinedTagsRootElement.getDates().removeAll();
cvsDefinedTagsTree.refresh();
}
@@ -622,6 +652,7 @@ public class TagConfigurationDialog extends Dialog {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
CVSTag[] branches = cvsDefinedTagsRootElement.getBranches().getTags();
CVSTag[] versions = cvsDefinedTagsRootElement.getVersions().getTags();
+ CVSTag[] dates = cvsDefinedTagsRootElement.getDates().getTags();
try {
for(int i = 0; i < roots.length; i++) {
CVSTag[] oldTags = manager.getKnownTags(roots[i]);
@@ -631,7 +662,10 @@ public class TagConfigurationDialog extends Dialog {
}
if(versions.length>0) {
manager.addTags(roots[i], versions);
- }
+ }
+ if(dates.length>0) {
+ manager.addTags(roots[i], dates);
+ }
}
} catch (CVSException e) {
throw new InvocationTargetException(e);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagSelectionDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagSelectionDialog.java
index 109bd5e43..630afe45e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagSelectionDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagSelectionDialog.java
@@ -55,6 +55,7 @@ public class TagSelectionDialog extends Dialog {
public static final int INCLUDE_BASE_TAG = ProjectElement.INCLUDE_BASE_TAG;
public static final int INCLUDE_BRANCHES = ProjectElement.INCLUDE_BRANCHES;
public static final int INCLUDE_VERSIONS = ProjectElement.INCLUDE_VERSIONS;
+ public static final int INCLUDE_DATES = ProjectElement.INCLUDE_DATES;
public static final int INCLUDE_ALL_TAGS = ProjectElement.INCLUDE_ALL_TAGS;
// widgets;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/ProjectElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/ProjectElement.java
index 7f25dbc83..cad8d4d99 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/ProjectElement.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/ProjectElement.java
@@ -25,27 +25,32 @@ public class ProjectElement implements IAdaptable, IWorkbenchAdapter {
ICVSFolder project;
TagRootElement branches;
TagRootElement versions;
+ TagRootElement dates;
int includeFlags;
public static final int INCLUDE_HEAD_TAG = 1;
public static final int INCLUDE_BASE_TAG = 2;
public static final int INCLUDE_BRANCHES = 4;
public static final int INCLUDE_VERSIONS = 8;
- public static final int INCLUDE_ALL_TAGS = INCLUDE_HEAD_TAG | INCLUDE_BASE_TAG | INCLUDE_BRANCHES | INCLUDE_VERSIONS;
+ public static final int INCLUDE_DATES = 16;
+ public static final int INCLUDE_ALL_TAGS = INCLUDE_HEAD_TAG | INCLUDE_BASE_TAG | INCLUDE_BRANCHES | INCLUDE_VERSIONS | INCLUDE_DATES;
public static class ProjectElementSorter extends ViewerSorter {
/*
- * The order in the diaog should be HEAD, Branches, Versions, BASE
+ * The order in the diaog should be HEAD, Branches, Versions, Dates, BASE
*/
public int category(Object element) {
if (element instanceof TagElement) {
CVSTag tag = ((TagElement)element).getTag();
if (tag == CVSTag.DEFAULT) return 1;
- if (tag == CVSTag.BASE) return 4;
+ if (tag == CVSTag.BASE) return 5;
if (tag.getType() == CVSTag.BRANCH) return 2;
if (tag.getType() == CVSTag.VERSION) return 3;
+ if (tag.getType() == CVSTag.DATE) return 4;
} else if (element instanceof TagRootElement) {
- return ((TagRootElement)element).getTypeOfTagRoot() == CVSTag.BRANCH ? 2 : 3;
+ if(((TagRootElement)element).getTypeOfTagRoot() == CVSTag.BRANCH) return 2;
+ if(((TagRootElement)element).getTypeOfTagRoot() == CVSTag.VERSION) return 3;
+ if(((TagRootElement)element).getTypeOfTagRoot() == CVSTag.DATE) return 4;
}
return 0;
}
@@ -54,8 +59,14 @@ public class ProjectElement implements IAdaptable, IWorkbenchAdapter {
int cat2 = category(e2);
if (cat1 != cat2) return cat1 - cat2;
// Sort version tags in reverse order
- if (e1 instanceof TagElement && ((TagElement)e1).getTag().getType() == CVSTag.VERSION) {
- return -1 * super.compare(viewer, e1, e2);
+ if (e1 instanceof TagElement){
+ CVSTag tag1 = ((TagElement)e1).getTag();
+ int type = tag1.getType();
+ if(type == CVSTag.VERSION) {
+ return -1 * super.compare(viewer, e1, e2);
+ }else if(type == CVSTag.DATE){
+ return -1*tag1.compareTo(((TagElement)e2).getTag());
+ }
}
return super.compare(viewer, e1, e2);
}
@@ -71,6 +82,9 @@ public class ProjectElement implements IAdaptable, IWorkbenchAdapter {
if ((includeFlags & INCLUDE_VERSIONS) > 0) {
versions = new TagRootElement(project, CVSTag.VERSION);
}
+ if ((includeFlags & INCLUDE_DATES) > 0) {
+ dates = new TagRootElement(project, CVSTag.DATE);
+ }
}
public Object[] getChildren(Object o) {
@@ -87,6 +101,9 @@ public class ProjectElement implements IAdaptable, IWorkbenchAdapter {
if ((includeFlags & INCLUDE_VERSIONS) > 0) {
children.add(versions);
}
+ if ((includeFlags & INCLUDE_DATES) > 0) {
+ children.add(dates);
+ }
return (Object[]) children.toArray(new Object[children.size()]);
}
public int getIncludeFlags() {
@@ -97,7 +114,10 @@ public class ProjectElement implements IAdaptable, IWorkbenchAdapter {
}
public TagRootElement getVersions() {
return versions;
- }
+ }
+ public TagRootElement getDates(){
+ return dates;
+ }
public Object getAdapter(Class adapter) {
if (adapter == IWorkbenchAdapter.class) return this;
return null;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagElement.java
index a54b84bfa..e8457b94e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagElement.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagElement.java
@@ -14,6 +14,7 @@ package org.eclipse.team.internal.ccvs.ui.merge;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.util.CVSDateFormatter;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.ui.model.IWorkbenchAdapter;
@@ -33,12 +34,15 @@ public class TagElement implements IWorkbenchAdapter, IAdaptable {
public ImageDescriptor getImageDescriptor(Object object) {
if (tag.getType() == CVSTag.BRANCH || tag == CVSTag.DEFAULT) {
return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_TAG);
- } else {
+ } else if (tag.getType() == CVSTag.DATE){
+ return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_DATE);
+ }else {
return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_PROJECT_VERSION);
}
}
public String getLabel(Object o) {
- return tag.getName();
+ if(tag.getType() != CVSTag.DATE)return tag.getName();
+ return CVSDateFormatter.repoViewTimeStamp(tag.asDate());
}
public Object getParent(Object o) {
return null;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagRootElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagRootElement.java
index 64b321c46..de698f1c2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagRootElement.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/TagRootElement.java
@@ -46,6 +46,8 @@ public class TagRootElement implements IWorkbenchAdapter, IAdaptable {
childTags = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownTags(project, CVSTag.BRANCH);
} else if(typeOfTagRoot==CVSTag.VERSION) {
childTags = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownTags(project, CVSTag.VERSION);
+ }else if(typeOfTagRoot==CVSTag.DATE){
+ childTags = CVSUIPlugin.getPlugin().getRepositoryManager().getKnownTags(project, CVSTag.DATE);
}
} else {
childTags = getTags();
@@ -61,6 +63,12 @@ public class TagRootElement implements IWorkbenchAdapter, IAdaptable {
cachedTags.clear();
}
}
+ public void add(CVSTag tag){
+ if(cachedTags==null) {
+ cachedTags = new ArrayList();
+ }
+ cachedTags.add(tag);
+ }
public void add(CVSTag[] tags) {
if(cachedTags==null) {
cachedTags = new ArrayList(tags.length);
@@ -86,14 +94,18 @@ public class TagRootElement implements IWorkbenchAdapter, IAdaptable {
public ImageDescriptor getImageDescriptor(Object object) {
if(typeOfTagRoot==CVSTag.BRANCH) {
return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_BRANCHES_CATEGORY);
- } else {
+ } else if(typeOfTagRoot==CVSTag.DATE){
+ return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_DATES_CATEGORY);
+ }else {
return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_VERSIONS_CATEGORY);
}
}
public String getLabel(Object o) {
if(typeOfTagRoot==CVSTag.BRANCH) {
return Policy.bind("MergeWizardEndPage.branches"); //$NON-NLS-1$
- } else {
+ } else if(typeOfTagRoot==CVSTag.DATE){
+ return "Dates";
+ }else {
return Policy.bind("VersionsElement.versions"); //$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java
index d5de0c7ca..3d7438cfa 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java
@@ -23,6 +23,7 @@ import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
+import org.eclipse.team.internal.ccvs.core.util.CVSDateFormatter;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.team.internal.ccvs.ui.Policy;
@@ -71,13 +72,18 @@ public class CVSTagElement extends CVSModelElement implements IDeferredWorkbench
ICVSUIConstants.IMG_PROJECT_VERSION);
} else {
// This could be a Date tag
- return null;
+ return CVSUIPlugin.getPlugin().getImageDescriptor(
+ ICVSUIConstants.IMG_DATE);
}
}
public String getLabel(Object o) {
if (!(o instanceof CVSTagElement))
return null;
- return ((CVSTagElement) o).tag.getName();
+ CVSTag aTag = ((CVSTagElement) o).tag;
+ if(aTag.getType() == CVSTag.DATE){
+ return CVSDateFormatter.repoViewTimeStamp(aTag.asDate());
+ }
+ return aTag.getName();
}
public String toString() {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java
index 2163d713c..4326ab42f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/DateTagCategory.java
@@ -38,8 +38,7 @@ public class DateTagCategory extends TagCategory {
* @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
*/
public ImageDescriptor getImageDescriptor(Object object) {
- // TODO Auto-generated method stub
- return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_TAG);
+ return CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_DATES_CATEGORY);
}
/* (non-Javadoc)
@@ -48,5 +47,15 @@ public class DateTagCategory extends TagCategory {
public String getLabel(Object o) {
return "Dates";
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.model.TagCategory#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ if (adapter.equals(ICVSRepositoryLocation.class)) {
+ return getRepository(null);
+ }
+ return super.getAdapter(adapter);
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewDateTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewDateTagAction.java
index 3df430979..1c971df03 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewDateTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/NewDateTagAction.java
@@ -15,9 +15,9 @@ import java.util.Date;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.core.util.CVSDateFormatter;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.DateTagDialog;
@@ -32,13 +32,18 @@ public class NewDateTagAction extends CVSRepoViewAction {
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
ICVSRepositoryLocation[] locations = getSelectedRepositoryLocations();
if (locations.length != 1) return;
- DateTagDialog dialog = new DateTagDialog(getShell());
+ CVSTag tag = getDateTag(getShell(), locations[0]);
+ CVSUIPlugin.getPlugin().getRepositoryManager().addDateTag(locations[0], tag);
+ }
+
+ public static CVSTag getDateTag(Shell shell, ICVSRepositoryLocation location) {
+ DateTagDialog dialog = new DateTagDialog(shell);
if (dialog.open() == Window.OK) {
- Date date = dialog.getDate();
- String dateString = CVSDateFormatter.dateToServerStamp(date);
- CVSTag tag = new CVSTag(dateString, CVSTag.DATE);
- CVSUIPlugin.getPlugin().getRepositoryManager().addDateTag(locations[0], tag);
+ Date date = dialog.getDate();
+ CVSTag tag = new CVSTag(date);
+ return tag;
}
+ return null;
}
/* (non-Javadoc)
@@ -49,5 +54,4 @@ public class NewDateTagAction extends CVSRepoViewAction {
if (locations.length != 1) return false;
return true;
}
-
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java
index f954b22ac..5177da27b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java
@@ -30,6 +30,8 @@ public class RepositoriesViewContentHandler extends DefaultHandler {
public static final String MODULE_TAG = "module"; //$NON-NLS-1$
public static final String TAG_TAG = "tag"; //$NON-NLS-1$
public static final String AUTO_REFRESH_FILE_TAG = "auto-refresh-file"; //$NON-NLS-1$
+ public static final String DATE_TAGS_TAG = "date-tags";
+ public static final String DATE_TAG_TAG = "date-tag";
public static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
public static final String NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
@@ -46,9 +48,11 @@ public class RepositoriesViewContentHandler extends DefaultHandler {
private RepositoryManager manager;
private StringBuffer buffer = new StringBuffer();
private Stack tagStack = new Stack();
+ private Stack dateTagStack = new Stack();
private RepositoryRoot currentRepositoryRoot;
private String currentRemotePath;
private List tags;
+ private List dateTags;
private List autoRefreshFiles;
private boolean ignoreElements;
@@ -93,6 +97,14 @@ public class RepositoriesViewContentHandler extends DefaultHandler {
currentRepositoryRoot.setAutoRefreshFiles(currentRemotePath,
(String[]) autoRefreshFiles.toArray(new String[autoRefreshFiles.size()]));
}
+ }else if(elementName.equals(DATE_TAG_TAG)){
+ if (! ignoreElements && currentRepositoryRoot != null) {
+ Iterator iter = dateTags.iterator();
+ while(iter.hasNext()){
+ CVSTag tag = (CVSTag)iter.next();
+ currentRepositoryRoot.addDateTag(tag);
+ }
+ }
}
tagStack.pop();
}
@@ -137,7 +149,16 @@ public class RepositoriesViewContentHandler extends DefaultHandler {
if (writeLocation != null) {
((CVSRepositoryLocation)root).setWriteLocation(writeLocation);
}
- } else if (elementName.equals(WORKING_SET_TAG)) {
+ } else if(elementName.equals(DATE_TAGS_TAG)){
+ //prepare to collect date tag
+ dateTags = new ArrayList();
+ } else if (elementName.equals(DATE_TAG_TAG)){
+ String name = atts.getValue(NAME_ATTRIBUTE);
+ if (name == null) {
+ throw new SAXException(Policy.bind("RepositoriesViewContentHandler.missingAttribute", DATE_TAGS_TAG, NAME_ATTRIBUTE)); //$NON-NLS-1$
+ }
+ dateTags.add(new CVSTag(name, CVSTag.DATE));
+ }else if (elementName.equals(WORKING_SET_TAG)) {
String name = atts.getValue(NAME_ATTRIBUTE);
if (name == null) {
throw new SAXException(Policy.bind("RepositoriesViewContentHandler.missingAttribute", WORKING_SET_TAG, NAME_ATTRIBUTE)); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
index ef501a477..180426576 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
@@ -121,7 +121,7 @@ public class RepositoryManager {
String[] paths = root.getKnownRemotePaths();
for (int i = 0; i < paths.length; i++) {
String path = paths[i];
- CVSTag[] tags = root.getKnownTags(path);
+ CVSTag[] tags = root.getAllKnownTags(path);
for (int j = 0; j < tags.length; j++) {
CVSTag tag = tags[j];
if (tag.getType() == tagType)
@@ -157,7 +157,7 @@ public class RepositoryManager {
public CVSTag[] getKnownTags(ICVSFolder project) throws CVSException {
RepositoryRoot root = getRepositoryRootFor(project);
String remotePath = RepositoryRoot.getRemotePathFor(project);
- return root.getKnownTags(remotePath);
+ return root.getAllKnownTags(remotePath);
}
/*
@@ -170,7 +170,7 @@ public class RepositoryManager {
for (int i = 0; i < paths.length; i++) {
String path = paths[i];
Set result = new HashSet();
- result.addAll(Arrays.asList(root.getKnownTags(path)));
+ result.addAll(Arrays.asList(root.getAllKnownTags(path)));
knownTags.put(path, result);
}
return knownTags;
@@ -204,7 +204,7 @@ public class RepositoryManager {
String[] paths = root.getKnownRemotePaths();
for (int i = 0; i < paths.length; i++) {
String path = paths[i];
- List tags = Arrays.asList(root.getKnownTags(path));
+ List tags = Arrays.asList(root.getAllKnownTags(path));
if (tags.contains(tag)) {
ICVSRemoteFolder remote = root.getRemoteFolder(path, tag, Policy.subMonitorFor(monitor, 100));
result.add(remote);
@@ -261,8 +261,8 @@ public class RepositoryManager {
root.addTags(remotePath, tags);
broadcastRepositoryChange(root);
}
-
public void addDateTag(ICVSRepositoryLocation location, CVSTag tag) {
+ if(tag == null) return;
RepositoryRoot root = getRepositoryRootFor(location);
root.addDateTag(tag);
broadcastRepositoryChange(root);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java
index eafc28ce7..be3fedc53 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java
@@ -28,7 +28,7 @@ public class RepositoryRoot extends PlatformObject {
ICVSRepositoryLocation root;
String name;
// Map of String (remote folder path) -> Set (CVS tags)
- Map knownTags = new HashMap();
+ Map versionAndBranchTags = new HashMap();
// Map of String (remote folder path) -> Set (file paths that are project relative)
Map autoRefreshFiles = new HashMap();
// Map of String (module name) -> ICVSRemoteFolder (that is a defined module)
@@ -159,22 +159,35 @@ public class RepositoryRoot extends PlatformObject {
* It is the reponsibility of the caller to ensure that the given remote path is valid.
*/
public void addTags(String remotePath, CVSTag[] tags) {
+ addDateTags(tags);
+ addVersionAndBranchTags(remotePath, tags);
+ }
+ private void addDateTags(CVSTag[] tags){
+ for(int i = 0; i < tags.length; i++){
+ if(tags[i].getType() == CVSTag.DATE){
+ dateTags.add(tags[i]);
+ }
+ }
+ }
+ private void addVersionAndBranchTags(String remotePath, CVSTag[] tags) {
// Get the name to cache the version tags with
String name = getCachePathFor(remotePath);
// Make sure there is a table for the ancestor that holds the tags
- Set set = (Set)knownTags.get(name);
+ Set set = (Set)versionAndBranchTags.get(name);
if (set == null) {
set = new HashSet();
- knownTags.put(name, set);
+ versionAndBranchTags.put(name, set);
}
// Store the tag with the appropriate ancestor
for (int i = 0; i < tags.length; i++) {
- set.add(tags[i]);
+ if(tags[i].getType() != CVSTag.DATE){
+ set.add(tags[i]);
+ }
}
}
-
+
/**
* Add the given date tag to the list of date tags associated with the repository.
* @param tag a date tag
@@ -198,12 +211,25 @@ public class RepositoryRoot extends PlatformObject {
* @param remotePath
* @param tags
*/
- public void removeTags(String remotePath, CVSTag[] tags) {
+ public void removeTags(String remotePath, CVSTag[] tags) {
+ removeDateTags(tags);
+ removeVersionAndBranchTags(remotePath, tags);
+ }
+
+ private void removeDateTags(CVSTag[] tags) {
+ if(dateTags.isEmpty())return;
+ // Store the tag with the appropriate ancestor
+ for (int i = 0; i < tags.length; i++) {
+ dateTags.remove(tags[i]);
+ }
+ }
+
+ private void removeVersionAndBranchTags(String remotePath, CVSTag[] tags) {
// Get the name to cache the version tags with
String name = getCachePathFor(remotePath);
// Make sure there is a table for the ancestor that holds the tags
- Set set = (Set)knownTags.get(name);
+ Set set = (Set)versionAndBranchTags.get(name);
if (set == null) {
return;
}
@@ -213,7 +239,7 @@ public class RepositoryRoot extends PlatformObject {
set.remove(tags[i]);
}
}
-
+
/**
* Returns the absolute paths of the auto refresh files relative to the
* repository.
@@ -336,10 +362,19 @@ public class RepositoryRoot extends PlatformObject {
}
writer.startTag(RepositoriesViewContentHandler.REPOSITORY_TAG, attributes, true);
+
+ //put date tag under repository
+ if(!dateTags.isEmpty()){
+ writer.startTag(RepositoriesViewContentHandler.DATE_TAGS_TAG, attributes, true);
+ Iterator iter = dateTags.iterator();
+ while(iter.hasNext()){
+ CVSTag tag = (CVSTag)iter.next();
+ writeATag(writer, attributes, tag, RepositoriesViewContentHandler.DATE_TAG_TAG);
+ }
+ writer.endTag(RepositoriesViewContentHandler.DATE_TAGS_TAG);
+ }
// Gather all the modules that have tags and/or auto-refresh files
-
-
// for each module, write the moduel, tags and auto-refresh files.
String[] paths = getKnownRemotePaths();
for (int i = 0; i < paths.length; i++) {
@@ -348,19 +383,17 @@ public class RepositoryRoot extends PlatformObject {
String name = path;
if (isDefinedModuleName(path)) {
name = getDefinedModuleName(path);
+
attributes.put(RepositoriesViewContentHandler.TYPE_ATTRIBUTE, RepositoriesViewContentHandler.DEFINED_MODULE_TYPE);
}
attributes.put(RepositoriesViewContentHandler.PATH_ATTRIBUTE, name);
writer.startTag(RepositoriesViewContentHandler.MODULE_TAG, attributes, true);
- Set tagSet = (Set)knownTags.get(path);
+ Set tagSet = (Set)versionAndBranchTags.get(path);
if (tagSet != null) {
Iterator tagIt = tagSet.iterator();
while (tagIt.hasNext()) {
CVSTag tag = (CVSTag)tagIt.next();
- attributes.clear();
- attributes.put(RepositoriesViewContentHandler.NAME_ATTRIBUTE, tag.getName());
- attributes.put(RepositoriesViewContentHandler.TYPE_ATTRIBUTE, RepositoriesViewContentHandler.TAG_TYPES[tag.getType()]);
- writer.startAndEndTag(RepositoriesViewContentHandler.TAG_TAG, attributes, true);
+ writeATag(writer, attributes, tag, RepositoriesViewContentHandler.TAG_TAG);
}
}
Set refreshSet = (Set)autoRefreshFiles.get(path);
@@ -378,20 +411,40 @@ public class RepositoryRoot extends PlatformObject {
writer.endTag(RepositoriesViewContentHandler.REPOSITORY_TAG);
}
+
+ private void writeATag(XMLWriter writer, HashMap attributes, CVSTag tag, String s) {
+ attributes.clear();
+ attributes.put(RepositoriesViewContentHandler.NAME_ATTRIBUTE, tag.getName());
+ writer.startAndEndTag(s, attributes, true);
+ }
+
/**
* Method getKnownTags.
* @param remotePath
* @return CVSTag[]
*/
- public CVSTag[] getKnownTags(String remotePath) {
- Set tagSet = (Set)knownTags.get(getCachePathFor(remotePath));
- if (tagSet == null) return new CVSTag[0];
- return (CVSTag[]) tagSet.toArray(new CVSTag[tagSet.size()]);
+ public CVSTag[] getAllKnownTags(String remotePath) {
+ Set tagSet = (Set)versionAndBranchTags.get(getCachePathFor(remotePath));
+ if(tagSet != null){
+ CVSTag [] tags1 = (CVSTag[]) tagSet.toArray(new CVSTag[tagSet.size()]);
+ CVSTag[] tags2 = getDateTags();
+ int len = tags1.length + tags2.length;
+ CVSTag[] tags = new CVSTag[len];
+ for(int i = 0; i < len; i++){
+ if(i < tags1.length){
+ tags[i] = tags1[i];
+ }else{
+ tags[i] = tags2[i-tags1.length];
+ }
+ }
+ return tags;
+ }
+ return getDateTags();
}
-
+
public String[] getKnownRemotePaths() {
Set paths = new HashSet();
- paths.addAll(knownTags.keySet());
+ paths.addAll(versionAndBranchTags.keySet());
paths.addAll(autoRefreshFiles.keySet());
return (String[]) paths.toArray(new String[paths.size()]);
}
@@ -426,7 +479,7 @@ public class RepositoryRoot extends PlatformObject {
if (remoteResource instanceof ICVSRemoteFolder) {
ICVSRemoteFolder folder = (ICVSRemoteFolder) remoteResource;
String path = getCachePathFor(folder.getRepositoryRelativePath());
- CVSTag[] tags = getKnownTags(path);
+ CVSTag[] tags = getAllKnownTags(path);
CVSTag tag = folder.getTag();
for (int i = 0; i < tags.length; i++) {
CVSTag knownTag = tags[i];
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositorySorter.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositorySorter.java
index ad050801b..53e208799 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositorySorter.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositorySorter.java
@@ -20,6 +20,7 @@ import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.ui.model.BranchCategory;
import org.eclipse.team.internal.ccvs.ui.model.CVSTagElement;
+import org.eclipse.team.internal.ccvs.ui.model.DateTagCategory;
import org.eclipse.team.internal.ccvs.ui.model.RemoteModule;
import org.eclipse.team.internal.ccvs.ui.model.VersionCategory;
@@ -52,8 +53,10 @@ public class RepositorySorter extends ViewerSorter {
return 4;
} else if (tagElement.getTag().getType() == CVSTag.VERSION) {
return 5;
- } else {
+ } else if (tagElement.getTag().getType() == CVSTag.DATE){
return 6;
+ }else{
+ return 7;
}
}
if (element instanceof BranchCategory) {
@@ -62,6 +65,9 @@ public class RepositorySorter extends ViewerSorter {
if (element instanceof VersionCategory) {
return 5;
}
+ if (element instanceof DateTagCategory){
+ return 6;
+ }
return 0;
}

Back to the top