Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-11-22 13:20:32 -0500
committerMichael Valenta2004-11-22 13:20:32 -0500
commitc13159e74f966aacf8fc8dafff27302afcd7be53 (patch)
tree9105fe9778bc8fc4f716b1799880ea72283e2fed
parent7666b96088ce01214957e58627d31978f6819622 (diff)
downloadeclipse.platform.team-branch_20041112_TagFiltering.tar.gz
eclipse.platform.team-branch_20041112_TagFiltering.tar.xz
eclipse.platform.team-branch_20041112_TagFiltering.zip
*** empty log message ***branch_20041112_TagFiltering
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java20
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java136
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSource.java9
6 files changed, 163 insertions, 9 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index abcdd02ef..86bb0ae70 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -444,6 +444,7 @@ MergeWizardPage.13=A start tag is required for previewing a merge in the synchro
MergeWizard.preparing=Preparing merge wizard
MergeWizard.preparingStart=Fetching tags for start page
MergeWizard.preparingEnd=Fetching tags for end page
+MergeWizardEndPage.branches=Branches
ModuleSelectionPage.moduleIsProject=Use &project name as module name
ModuleSelectionPage.specifyModule=Use &specified module name:
@@ -1322,3 +1323,4 @@ LogEntryCacheUpdateHandler.0=Errors have occured while maintaining the log entry
LogEntryCacheUpdateHandler.1=Updating revision histories
LogEntryCacheUpdateHandler.2=Could not fetch revision histories due to an internal timeout.
MultiFolderTagSource.0={0} folders
+LocalProjectTagSource.0={0} Projects
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java
index f3fc204f0..a64454789 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/BranchOperation.java
@@ -64,10 +64,9 @@ public class BranchOperation extends RepositoryProviderOperation {
protected boolean shouldRun() {
IResource[] resources = getResources();
boolean allSticky = areAllResourcesSticky(resources);
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(resources[0].getProject());
final BranchPromptDialog dialog = new BranchPromptDialog(getShell(),
Policy.bind("BranchWizard.title"), //$NON-NLS-1$
- getCVSResources(),
+ getResources(),
allSticky,
calculateInitialVersionName(resources,allSticky));
if (dialog.open() != InputDialog.OK) return false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java
index 1b06558f9..4a052014a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/BranchPromptDialog.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.tags;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -18,7 +20,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.wizards.CVSWizardPage;
@@ -42,9 +43,11 @@ public class BranchPromptDialog extends DetailsDialog {
// widgets;
private TagSource tagSource;
private TagSelectionArea tagArea;
+ private final IResource[] resources;
- public BranchPromptDialog(Shell parentShell, String title, ICVSResource[] resources, boolean allResourcesSticky, String versionName) {
+ public BranchPromptDialog(Shell parentShell, String title, IResource[] resources, boolean allResourcesSticky, String versionName) {
super(parentShell, title);
+ this.resources = resources;
this.tagSource = TagSource.create(resources);
this.allStickyResources = allResourcesSticky;
this.versionName = versionName;
@@ -79,6 +82,7 @@ public class BranchPromptDialog extends DetailsDialog {
updateVersionName(branchTag);
}
});
+ addBranchContentAssist();
final Button check = new Button(composite, SWT.CHECK);
data = new GridData();
@@ -123,7 +127,17 @@ public class BranchPromptDialog extends DetailsDialog {
branchText.setFocus();
}
- /**
+ private void addBranchContentAssist() {
+ TagSource projectTagSource = LocalProjectTagSource.create(getSeedProject());
+ if (projectTagSource != null)
+ TagContentAssistProcessor.createContentAssistant(branchText, projectTagSource, TagSelectionArea.INCLUDE_BRANCHES);
+ }
+
+ private IProject getSeedProject() {
+ return resources[0].getProject();
+ }
+
+ /**
* Updates version name
*/
protected void updateVersionName(String branchName) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java
new file mode 100644
index 000000000..1ffa1c7f1
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/LocalProjectTagSource.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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.ccvs.ui.tags;
+
+import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ccvs.core.*;
+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;
+
+/**
+ * Tag source that gets its tags from the projects exist in the workspace
+ * and are mapped to the same repository as the seed project
+ */
+public class LocalProjectTagSource extends TagSource {
+
+ public static TagSource create(IProject seedProject) {
+ try {
+ ICVSRemoteFolder seedFolder = ((ICVSRemoteFolder)CVSWorkspaceRoot.getRemoteResourceFor(seedProject));
+ ICVSRemoteFolder[] remoteFolders = getProjectRemoteFolders(seedFolder.getRepository());
+ if (remoteFolders.length == 1) {
+ // There are no other projects to get tags from so return null
+ return null;
+ }
+ return new LocalProjectTagSource(seedFolder, remoteFolders);
+ } catch (CVSException e) {
+ // Log and return null
+ CVSUIPlugin.log(e);
+ return null;
+ }
+ }
+
+ private ICVSRemoteFolder seedFolder;
+ private ICVSRemoteFolder[] remoteFolders;
+
+ private LocalProjectTagSource(ICVSRemoteFolder seedFolder, ICVSRemoteFolder[] remoteFolders) {
+ this.seedFolder = seedFolder;
+ this.remoteFolders = remoteFolders;
+ }
+
+ /*
+ * Return the list of remote folders for the projects in the workspace mapped to the given repository
+ */
+ private static ICVSRemoteFolder[] getProjectRemoteFolders(ICVSRepositoryLocation repository) {
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ List result = new ArrayList();
+ for (int i = 0; i < projects.length; i++) {
+ IProject project = projects[i];
+ try {
+ if (project.isAccessible() && RepositoryProvider.isShared(project)) {
+ ICVSRemoteFolder remote = (ICVSRemoteFolder)CVSWorkspaceRoot.getRemoteResourceFor(project);
+ if (remote != null && remote.getRepository().equals(repository)) {
+ result.add(remote);
+ }
+ }
+ } catch (CVSException e) {
+ // Log and continue
+ CVSUIPlugin.log(e);
+ }
+ }
+ return (ICVSRemoteFolder[]) result.toArray(new ICVSRemoteFolder[result.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#refresh(boolean, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public CVSTag[] refresh(boolean bestEffort, IProgressMonitor monitor) throws TeamException {
+ // This tag source should not be refreshed
+ return new CVSTag[0];
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getLocation()
+ */
+ public ICVSRepositoryLocation getLocation() {
+ return seedFolder.getRepository();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getShortDescription()
+ */
+ public String getShortDescription() {
+ return Policy.bind("LocalProjectTagSource.0", Integer.toString(remoteFolders.length)); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#commit(org.eclipse.team.internal.ccvs.core.CVSTag[], boolean, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void commit(CVSTag[] tags, boolean replace, IProgressMonitor monitor) throws CVSException {
+ // Does not commit tags
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getCVSResources()
+ */
+ public ICVSResource[] getCVSResources() {
+ return remoteFolders;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.tags.TagSource#getTags(int)
+ */
+ public CVSTag[] getTags(int type) {
+ if (type == CVSTag.HEAD || type == BASE) {
+ return super.getTags(type);
+ }
+ // Accumulate the tags for all folders
+ Set allTags = new HashSet();
+ for (int i = 0; i < remoteFolders.length; i++) {
+ ICVSRemoteFolder folder = remoteFolders[i];
+ CVSTag[] tags = SingleFolderTagSource.getTags(folder, type);
+ allTags.addAll(Arrays.asList(tags));
+ }
+ // Exclude the tags for the seedFolder
+ CVSTag[] tags = SingleFolderTagSource.getTags(seedFolder, type);
+ allTags.removeAll(Arrays.asList(tags));
+ return (CVSTag[]) allTags.toArray(new CVSTag[allTags.size()]);
+ }
+
+}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java
index b7c210b68..3a59a7026 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagAsVersionDialog.java
@@ -45,7 +45,7 @@ public class TagAsVersionDialog extends DetailsDialog {
public TagAsVersionDialog(Shell parentShell, String title, ITagOperation operation) {
super(parentShell, title);
- this.tagSource = TagSource.create(operation.getCVSResources());
+ this.tagSource = operation.getTagSource();
this.operation = operation;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSource.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSource.java
index 4c9595fc0..0e9540bfb 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSource.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/tags/TagSource.java
@@ -102,10 +102,13 @@ public abstract class TagSource {
public static TagSource create(ICVSResource[] resources) {
if (resources.length == 1 && !resources[0].isFolder())
return new SingleFileTagSource((ICVSFile)resources[0]);
- // TODO Should use a better tag source that uses all folders somehow
- return new SingleFolderTagSource(getFirstFolder(resources));
+ return create(getFolders(resources));
}
-
+
+ private static ICVSFolder[] getFolders(ICVSResource[] resources) {
+ return new ICVSFolder[] { getFirstFolder(resources) } ;
+ }
+
/**
* Create a tag source for a list of resources
* @param resources one or more resources

Back to the top