diff options
10 files changed, 55 insertions, 27 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/BranchPromptDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/BranchPromptDialog.java index 1ba2a9afb..8cdf8d211 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/BranchPromptDialog.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/BranchPromptDialog.java @@ -164,7 +164,7 @@ public class BranchPromptDialog extends DetailsDialog { label.setFont(composite.getFont()); tagTree = createTree(composite); - tagTree.setInput(new ProjectElement(folder, false /*show HEAD tag*/)); + tagTree.setInput(new ProjectElement(folder, ProjectElement.INCLUDE_BRANCHES | ProjectElement.INCLUDE_VERSIONS)); Runnable refresh = new Runnable() { public void run() { getShell().getDisplay().syncExec(new Runnable() { 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 287baa854..6c8d326d6 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 @@ -254,7 +254,7 @@ public class TagConfigurationDialog extends Dialog { data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; cvsDefinedTagsTree.getTree().setLayoutData(data); - cvsDefinedTagsRootElement = new ProjectElement(roots[0], false /* don't show HEAD */); + cvsDefinedTagsRootElement = new ProjectElement(roots[0], ProjectElement.INCLUDE_BRANCHES | ProjectElement.INCLUDE_VERSIONS); cvsDefinedTagsRootElement.getBranches().add(CVSUIPlugin.getPlugin().getRepositoryManager().getKnownBranchTags(root)); cvsDefinedTagsRootElement.getVersions().add(CVSUIPlugin.getPlugin().getRepositoryManager().getKnownVersionTags(root)); cvsDefinedTagsTree.setInput(cvsDefinedTagsRootElement); 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 9110287e8..bff293169 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 @@ -39,9 +39,15 @@ import org.eclipse.ui.model.WorkbenchLabelProvider; */ public class TagSelectionDialog extends Dialog { private ICVSFolder[] folders; - private boolean showHEAD; + private int includeFlags; private CVSTag result; + public static final int INCLUDE_HEAD_TAG = ProjectElement.INCLUDE_HEAD_TAG; + 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_ALL_TAGS = ProjectElement.INCLUDE_ALL_TAGS; + // widgets; private TreeViewer tagTree; private Button okButton; @@ -62,8 +68,8 @@ public class TagSelectionDialog extends Dialog { * Creates a new TagSelectionDialog. * @param resource The resource to select a version for. */ - public TagSelectionDialog(Shell parentShell, IProject[] projects, String title, String message, boolean showHead, boolean showRecurse) { - this(parentShell, getCVSFoldersFor(projects), title, message, showHead, showRecurse); //$NON-NLS-1$ + public TagSelectionDialog(Shell parentShell, IProject[] projects, String title, String message, int includeFlags, boolean showRecurse) { + this(parentShell, getCVSFoldersFor(projects), title, message, includeFlags, showRecurse); //$NON-NLS-1$ } private static ICVSFolder[] getCVSFoldersFor(IProject[] projects) { @@ -78,12 +84,12 @@ public class TagSelectionDialog extends Dialog { * Creates a new TagSelectionDialog. * @param resource The resource to select a version for. */ - public TagSelectionDialog(Shell parentShell, ICVSFolder[] folders, String title, String message, boolean showHEAD, boolean showRecurse) { + public TagSelectionDialog(Shell parentShell, ICVSFolder[] folders, String title, String message, int includeFlags, boolean showRecurse) { super(parentShell); this.folders = folders; this.title = title; this.message = message; - this.showHEAD = showHEAD; + this.includeFlags = includeFlags; this.showRecurse = showRecurse; setShellStyle(getShellStyle() | SWT.RESIZE); } @@ -153,7 +159,7 @@ public class TagSelectionDialog extends Dialog { l.setText(message); //$NON-NLS-1$ tagTree = createTree(inner); - tagTree.setInput(new ProjectElement(folders[0], showHEAD /*show HEAD tag*/)); + tagTree.setInput(new ProjectElement(folders[0], includeFlags)); Runnable refresh = new Runnable() { public void run() { getShell().getDisplay().syncExec(new Runnable() { diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java index b4c21e2f5..74f72f58a 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java @@ -29,7 +29,8 @@ public class CompareWithTagAction extends CVSAction { for (int i = 0; i < resources.length; i++) { projects[i] = resources[i].getProject(); } - TagSelectionDialog dialog = new TagSelectionDialog(getShell(), projects, Policy.bind("CompareWithTagAction.message"), Policy.bind("TagSelectionDialog.Select_a_Tag_1"), true, false); //$NON-NLS-1$ //$NON-NLS-2$ + TagSelectionDialog dialog = new TagSelectionDialog(getShell(), projects, Policy.bind("CompareWithTagAction.message"), + Policy.bind("TagSelectionDialog.Select_a_Tag_1"), TagSelectionDialog.INCLUDE_ALL_TAGS, false); //$NON-NLS-1$ //$NON-NLS-2$ dialog.setBlockOnOpen(true); int result = dialog.open(); if (result == Dialog.CANCEL || dialog.getResult() == null) { diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java index 37e2e8468..990851d80 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MoveRemoteTagAction.java @@ -61,7 +61,7 @@ public class MoveRemoteTagAction extends TagInRepositoryAction { // Allow the user to select a tag TagSelectionDialog dialog = new TagSelectionDialog(getShell(), folders, Policy.bind("MoveTagAction.title"), //$NON-NLS-1$ - Policy.bind("MoveTagAction.message"), false, true); //$NON-NLS-1$ + Policy.bind("MoveTagAction.message"), TagSelectionDialog.INCLUDE_BRANCHES | TagSelectionDialog.INCLUDE_VERSIONS, true); //$NON-NLS-1$ dialog.setBlockOnOpen(true); if (dialog.open() == Dialog.CANCEL) { return null; diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java index efc157950..c3f1b186b 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java @@ -65,7 +65,7 @@ public class ReplaceWithTagAction extends CVSAction { projects[i] = resources[i].getProject(); } TagSelectionDialog dialog = new TagSelectionDialog(getShell(), projects, Policy.bind("ReplaceWithTagAction.message"), Policy.bind("TagSelectionDialog.Select_a_Tag_1"), //$NON-NLS-1$ //$NON-NLS-2$ - true /*show HEAD*/, true /*show recurse*/); //$NON-NLS-1$ + TagSelectionDialog.INCLUDE_ALL_TAGS, true /*show recurse*/); //$NON-NLS-1$ dialog.setBlockOnOpen(true); if (dialog.open() == Dialog.CANCEL) { return; diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardEndPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardEndPage.java index 3589a05e1..bef0586b4 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardEndPage.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizardEndPage.java @@ -86,7 +86,7 @@ public class MergeWizardEndPage extends CVSWizardPage { } }); setControl(composite); - tree.setInput(new ProjectElement(CVSWorkspaceRoot.getCVSFolderFor(project), true /*show HEAD as tag*/)); + tree.setInput(new ProjectElement(CVSWorkspaceRoot.getCVSFolderFor(project), ProjectElement.INCLUDE_ALL_TAGS)); setPageComplete(false); } protected TreeViewer createTree(Composite parent) { 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 6f225c599..de81143ea 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 @@ -5,6 +5,8 @@ package org.eclipse.team.internal.ccvs.ui.merge; * All Rights Reserved. */ +import java.util.ArrayList; + import org.eclipse.core.runtime.IAdaptable; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.widgets.Shell; @@ -14,27 +16,46 @@ import org.eclipse.ui.model.IWorkbenchAdapter; public class ProjectElement implements IAdaptable, IWorkbenchAdapter { ICVSFolder project; - boolean includeHeadTag; TagRootElement branches; TagRootElement versions; + 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 ProjectElement(ICVSFolder project, boolean includeHeadTag) { + public ProjectElement(ICVSFolder project, int includeFlags) { this.project = project; - this.includeHeadTag = includeHeadTag; - branches = new TagRootElement(project, CVSTag.BRANCH); - versions = new TagRootElement(project, CVSTag.VERSION); + this.includeFlags = includeFlags; + if (this.includeFlags == 0) this.includeFlags = INCLUDE_ALL_TAGS; + if ((includeFlags & INCLUDE_BRANCHES) > 0) { + branches = new TagRootElement(project, CVSTag.BRANCH); + } + if ((includeFlags & INCLUDE_VERSIONS) > 0) { + versions = new TagRootElement(project, CVSTag.VERSION); + } } public Object[] getChildren(Object o) { - if(includeHeadTag) { - return new Object[] { branches, - new TagElement(CVSTag.DEFAULT), - new TagElement(CVSTag.BASE), - versions - }; - } else { - return new Object[] {branches, versions}; + ArrayList children = new ArrayList(4); + if ((includeFlags & INCLUDE_HEAD_TAG) > 0) { + children.add(new TagElement(CVSTag.DEFAULT)); } + if ((includeFlags & INCLUDE_BASE_TAG) > 0) { + children.add(new TagElement(CVSTag.BASE)); + } + if ((includeFlags & INCLUDE_BRANCHES) > 0) { + children.add(branches); + } + if ((includeFlags & INCLUDE_VERSIONS) > 0) { + children.add(versions); + } + return (Object[]) children.toArray(new Object[children.size()]); + } + public int getIncludeFlags() { + return includeFlags; } public TagRootElement getBranches() { return branches; diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java index a937810dd..aef81547c 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java @@ -252,7 +252,7 @@ public class SharingWizard extends Wizard implements IConfigurationWizard { TagSelectionDialog dialog = new TagSelectionDialog(getShell(), new ICVSFolder[] {(ICVSFolder)location.getRemoteFolder(moduleName, null)}, Policy.bind("SharingWizard.selectTagTitle"), //$NON-NLS-1$ - Policy.bind("SharingWizard.selectTag"), true /*show HEAD*/, false /*don't show recurse option*/); //$NON-NLS-1$ + Policy.bind("SharingWizard.selectTag"), TagSelectionDialog.INCLUDE_HEAD_TAG | TagSelectionDialog.INCLUDE_BRANCHES, false /*don't show recurse option*/); //$NON-NLS-1$ dialog.setBlockOnOpen(true); if (dialog.open() == Dialog.CANCEL) { return false; diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizardPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizardPage.java index 394f61367..20d8292b0 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizardPage.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizardPage.java @@ -106,7 +106,7 @@ public class UpdateWizardPage extends CVSWizardPage { }); setControl(composite); - tree.setInput(new ProjectElement(CVSWorkspaceRoot.getCVSFolderFor(project), true /*show HEAD as tag*/)); + tree.setInput(new ProjectElement(CVSWorkspaceRoot.getCVSFolderFor(project), ProjectElement.INCLUDE_ALL_TAGS)); Runnable refresh = new Runnable() { public void run() { |