Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-04-18 17:22:22 -0400
committerJean Michel-Lemieux2002-04-18 17:22:22 -0400
commit1f18c75f2b546958aa5bf8bfbf7d350cd5802461 (patch)
treef2c8faab5fc3f735cd98a4f342fed6229a3122ef
parente367b577e40cbb90d2470eba8167659cdab51545 (diff)
downloadeclipse.platform.team-1f18c75f2b546958aa5bf8bfbf7d350cd5802461.tar.gz
eclipse.platform.team-1f18c75f2b546958aa5bf8bfbf7d350cd5802461.tar.xz
eclipse.platform.team-1f18c75f2b546958aa5bf8bfbf7d350cd5802461.zip
Bug 7327: "Add to workspace" from history doesn't update revision #
Bug 8904: tag information should be invalidated on modification Bug 9467: Exception creating branch on a file 9469: Only have partial support for branching on sub-folders/files - merge allowed on multiple selection, merge results show in same merge editor - merge allowed on all resource types - branching allowed on all resource types - replace with allowed on all resource types with multiple selection - warning dialog added when ever a user creates a project with mixed tags. It warns about the implied CVS behavior. Can be turned off. - tags only shown if different than parent tag (reduces tag clutter and makes it more obvious when a tag is different) - get revision for files allowed from history/replace/compare dialogs, to revert from a sticky revision use replace with tag and select the branch you are working on - CVS text decorations consolidated and as a result the text decorations in the sync view will follow the users preferences (except for the dirty flag which is not shown in the sync view)
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml42
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java55
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorationRunnable.java171
-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/HistoryView.java60
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java28
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/TagConfigurationDialog.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java132
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java24
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java21
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java27
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java33
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java50
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java16
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java45
20 files changed, 470 insertions, 294 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index 757998337..2d86c9ce0 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -141,6 +141,20 @@
id="org.eclipse.team.ccvs.ui.setKeywordSubstitution">
</action>
<action
+ label="%MergeAction.label"
+ tooltip="%MergeAction.tooltip"
+ class="org.eclipse.team.internal.ccvs.ui.actions.MergeAction"
+ menubarPath="team.main/group2"
+ id="org.eclipse.team.ccvs.ui.merge">
+ </action>
+ <action
+ label="%BranchAction.label"
+ tooltip="%BranchAction.tooltip"
+ class="org.eclipse.team.internal.ccvs.ui.actions.BranchAction"
+ menubarPath="team.main/group2"
+ id="org.eclipse.team.ccvs.ui.branch">
+ </action>
+ <action
label="%TagAction.label"
tooltip="%TagAction.tooltip"
class="org.eclipse.team.internal.ccvs.ui.actions.TagAction"
@@ -189,6 +203,13 @@
menubarPath="team.main/group1"
id="org.eclipse.team.ccvs.ui.sync">
</action>
+ <action
+ label="%ReplaceWithTagAction.label"
+ tooltip="%ReplaceWithTagAction.tooltip"
+ class="org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithTagAction"
+ menubarPath="replaceWithMenu/replaceWithGroup"
+ id="org.eclipse.team.ccvs.ui.replaceWithTag">
+ </action>
</objectContribution>
<objectContribution
objectClass="org.eclipse.core.resources.IProject"
@@ -205,27 +226,6 @@
menubarPath="team.main/projectGroup"
id="org.eclipse.team.ccvs.ui.unmanage">
</action>
- <action
- label="%MergeAction.label"
- tooltip="%MergeAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.MergeAction"
- menubarPath="team.main/group2"
- id="org.eclipse.team.ccvs.ui.merge">
- </action>
- <action
- label="%BranchAction.label"
- tooltip="%BranchAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.BranchAction"
- menubarPath="team.main/group2"
- id="org.eclipse.team.ccvs.ui.branch">
- </action>
- <action
- label="%ReplaceWithTagAction.label"
- tooltip="%ReplaceWithTagAction.tooltip"
- class="org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithTagAction"
- menubarPath="replaceWithMenu/replaceWithGroup"
- id="org.eclipse.team.ccvs.ui.replaceWithTag">
- </action>
</objectContribution>
<objectContribution
objectClass="org.eclipse.core.resources.IFolder"
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java
index 9601b2857..3370d00af 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java
@@ -52,6 +52,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.internal.ccvs.core.CVSTag;
@@ -59,7 +60,9 @@ import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.ILogEntry;
+import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
public class CVSCompareRevisionsInput extends CompareEditorInput {
@@ -67,7 +70,8 @@ public class CVSCompareRevisionsInput extends CompareEditorInput {
ICVSRemoteFile currentEdition;
ILogEntry[] editions;
TableViewer viewer;
- Action loadAction;
+ Action getContentsAction;
+ Action getRevisionAction;
Shell shell;
/**
@@ -270,7 +274,8 @@ public class CVSCompareRevisionsInput extends CompareEditorInput {
mm.addMenuListener(
new IMenuListener() {
public void menuAboutToShow(IMenuManager mm) {
- mm.add(loadAction);
+ mm.add(getContentsAction);
+ mm.add(getRevisionAction);
}
}
);
@@ -279,11 +284,13 @@ public class CVSCompareRevisionsInput extends CompareEditorInput {
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
if (!(selection instanceof IStructuredSelection)) {
- loadAction.setEnabled(false);
+ getContentsAction.setEnabled(false);
+ getRevisionAction.setEnabled(false);
return;
}
IStructuredSelection ss = (IStructuredSelection)selection;
- loadAction.setEnabled(ss.size() == 1);
+ getContentsAction.setEnabled(ss.size() == 1);
+ getRevisionAction.setEnabled(ss.size() == 1);
}
});
return viewer;
@@ -340,7 +347,7 @@ public class CVSCompareRevisionsInput extends CompareEditorInput {
cc.setRightLabel(rightLabel);
}
private void initializeActions() {
- loadAction = new Action(Policy.bind("CVSCompareRevisionsInput.addToWorkspace"), null) { //$NON-NLS-1$
+ getContentsAction = new Action(Policy.bind("HistoryView.getContentsAction"), null) { //$NON-NLS-1$
public void run() {
try {
new ProgressMonitorDialog(shell).run(false, true, new WorkspaceModifyOperation() {
@@ -376,8 +383,42 @@ public class CVSCompareRevisionsInput extends CompareEditorInput {
viewer.refresh();
}
};
- // set F1 help
-// WorkbenchHelp.setHelp(loadAction, new Object[] {IVCMHelpContextIds.CATCHUPRELEASE_CATCHUP_ACTION});
+
+ getRevisionAction = new Action(Policy.bind("HistoryView.getRevisionAction"), null) { //$NON-NLS-1$
+ public void run() {
+ try {
+ new ProgressMonitorDialog(shell).run(false, true, new WorkspaceModifyOperation() {
+ protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
+ if (selection.size() != 1) return;
+ VersionCompareDiffNode node = (VersionCompareDiffNode)selection.getFirstElement();
+ ResourceEditionNode right = (ResourceEditionNode)node.getRight();
+ ICVSRemoteResource edition = right.getRemoteResource();
+ // Do the load. This just consists of setting the local contents. We don't
+ // actually want to change the base.
+ try {
+ CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(resource.getProject());
+ CVSTag revisionTag = new CVSTag(((ICVSRemoteFile)edition).getRevision(), CVSTag.VERSION);
+ if(CVSAction.checkForMixingTags(shell, new IResource[] {resource}, revisionTag)) {
+ provider.update(new IResource[] {resource}, new Command.LocalOption[] {Command.UPDATE.IGNORE_LOCAL_CHANGES},
+ revisionTag, true /*create backups*/, monitor);
+ currentEdition = (ICVSRemoteFile)edition;
+ }
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ // Do nothing
+ return;
+ } catch (InvocationTargetException e) {
+ handle(e);
+ }
+ // recompute the labels on the viewer
+ viewer.refresh();
+ }
+ };
}
public boolean isSaveNeeded() {
return false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorationRunnable.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorationRunnable.java
index 322d56cb8..5863d1141 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorationRunnable.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorationRunnable.java
@@ -13,11 +13,7 @@ import java.util.Map;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.ImageData;
@@ -136,75 +132,68 @@ public class CVSDecorationRunnable implements Runnable {
return decoration;
}
- private CVSDecoration computeTextLabelFor(IResource resource, boolean isDirty) {
- Map bindings = new HashMap(3);
- String format = ""; //$NON-NLS-1$
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
-
- IPath resourceLocation = resource.getLocation();
- int type = resource.getType();
-
- // if the resource does not have a location then return. This can happen if the resource
- // has been deleted after we where asked to decorate it.
- if(resourceLocation==null) {
- return new CVSDecoration(format, bindings, null);
- }
-
- if(type==IResource.FOLDER) {
- format = store.getString(ICVSUIConstants.PREF_FOLDERTEXT_DECORATION);
- } else if(type==IResource.PROJECT) {
- format = store.getString(ICVSUIConstants.PREF_PROJECTTEXT_DECORATION);
- } else {
- format = store.getString(ICVSUIConstants.PREF_FILETEXT_DECORATION);
- }
-
- if(isDirty) {
- bindings.put(CVSDecoratorConfiguration.DIRTY_FLAG, store.getString(ICVSUIConstants.PREF_DIRTY_FLAG));
- }
-
+ public static CVSDecoration computeTextLabelFor(IResource resource, boolean isDirty) {
try {
- switch (type) {
- case IResource.FOLDER :
- case IResource.PROJECT :
- ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor((IContainer) resource);
- FolderSyncInfo folderInfo = folder.getFolderSyncInfo();
- if (folderInfo != null) {
- CVSTag tag = folderInfo.getTag();
- if(tag!=null) {
- bindings.put(CVSDecoratorConfiguration.RESOURCE_TAG, tag.getName());
- }
- ICVSRepositoryLocation location = CVSProviderPlugin.getProvider().getRepository(folderInfo.getRoot());
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_HOST, location.getHost());
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_METHOD, location.getMethod().getName());
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_USER, location.getUsername());
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_ROOT, location.getRootDirectory());
- bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_REPOSITORY, folderInfo.getRepository());
- }
- break;
- case IResource.FILE :
- format = store.getString(ICVSUIConstants.PREF_FILETEXT_DECORATION);
- ICVSFile file = CVSWorkspaceRoot.getCVSFileFor((IFile) resource);
- ResourceSyncInfo fileInfo = file.getSyncInfo();
- if (fileInfo != null) {
- CVSTag tag = fileInfo.getTag();
- if(fileInfo.isAdded()) {
- bindings.put(CVSDecoratorConfiguration.ADDED_FLAG, store.getString(ICVSUIConstants.PREF_ADDED_FLAG));
- } else {
- bindings.put(CVSDecoratorConfiguration.FILE_REVISION, fileInfo.getRevision());
- }
- KSubstOption option = fileInfo.getKeywordMode() != null ?
- fileInfo.getKeywordMode() :
- KSubstOption.fromFile((IFile) resource);
- bindings.put(CVSDecoratorConfiguration.FILE_KEYWORD, option.getShortDisplayText());
- if (tag != null && (tag.getType() != CVSTag.HEAD)) {
- bindings.put(CVSDecoratorConfiguration.RESOURCE_TAG, tag.getName());
- }
+ Map bindings = new HashMap(3);
+ String format = ""; //$NON-NLS-1$
+ IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
+
+ IPath resourceLocation = resource.getLocation();
+ int type = resource.getType();
+
+ // if the resource does not have a location then return. This can happen if the resource
+ // has been deleted after we where asked to decorate it.
+ if(resourceLocation==null) {
+ return new CVSDecoration(format, bindings, null);
+ }
+
+ if(type==IResource.FOLDER) {
+ format = store.getString(ICVSUIConstants.PREF_FOLDERTEXT_DECORATION);
+ } else if(type==IResource.PROJECT) {
+ format = store.getString(ICVSUIConstants.PREF_PROJECTTEXT_DECORATION);
+ } else {
+ format = store.getString(ICVSUIConstants.PREF_FILETEXT_DECORATION);
+ }
+
+ if(isDirty) {
+ bindings.put(CVSDecoratorConfiguration.DIRTY_FLAG, store.getString(ICVSUIConstants.PREF_DIRTY_FLAG));
+ }
+
+ CVSTag tag = getTagToShow(resource);
+ if(tag != null) {
+ bindings.put(CVSDecoratorConfiguration.RESOURCE_TAG, tag.getName());
+ }
+
+ if(type != IResource.FILE) {
+ ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor((IContainer) resource);
+ FolderSyncInfo folderInfo = folder.getFolderSyncInfo();
+ if (folderInfo != null) {
+ ICVSRepositoryLocation location = CVSProviderPlugin.getProvider().getRepository(folderInfo.getRoot());
+ bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_HOST, location.getHost());
+ bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_METHOD, location.getMethod().getName());
+ bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_USER, location.getUsername());
+ bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_ROOT, location.getRootDirectory());
+ bindings.put(CVSDecoratorConfiguration.REMOTELOCATION_REPOSITORY, folderInfo.getRepository());
+ }
+ } else {
+ format = store.getString(ICVSUIConstants.PREF_FILETEXT_DECORATION);
+ ICVSFile file = CVSWorkspaceRoot.getCVSFileFor((IFile) resource);
+ ResourceSyncInfo fileInfo = file.getSyncInfo();
+ if (fileInfo != null) {
+ if(fileInfo.isAdded()) {
+ bindings.put(CVSDecoratorConfiguration.ADDED_FLAG, store.getString(ICVSUIConstants.PREF_ADDED_FLAG));
} else {
- // only show the type that cvs will use when comitting the file
- KSubstOption option = KSubstOption.fromFile((IFile) resource);
- bindings.put(CVSDecoratorConfiguration.FILE_KEYWORD, option.getShortDisplayText());
+ bindings.put(CVSDecoratorConfiguration.FILE_REVISION, fileInfo.getRevision());
}
- break;
+ KSubstOption option = fileInfo.getKeywordMode() != null ?
+ fileInfo.getKeywordMode() :
+ KSubstOption.fromFile((IFile) resource);
+ bindings.put(CVSDecoratorConfiguration.FILE_KEYWORD, option.getShortDisplayText());
+ } else {
+ // only show the type that cvs will use when comitting the file
+ KSubstOption option = KSubstOption.fromFile((IFile) resource);
+ bindings.put(CVSDecoratorConfiguration.FILE_KEYWORD, option.getShortDisplayText());
+ }
}
return new CVSDecoration(format, bindings, null);
} catch (CVSException e) {
@@ -212,7 +201,47 @@ public class CVSDecorationRunnable implements Runnable {
return new CVSDecoration();
}
}
-
+
+ /**
+ * Only show the tag if the resources tag is different than the parents. Or else, tag
+ * names will clutter the text decorations.
+ */
+ protected static CVSTag getTagToShow(IResource resource) throws CVSException {
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ CVSTag tag = null;
+ boolean useParentTag = false;
+ if(cvsResource.isFolder()) {
+ FolderSyncInfo folderInfo = ((ICVSFolder)cvsResource).getFolderSyncInfo();
+ if(folderInfo != null) {
+ tag = folderInfo.getTag();
+ }
+ } else {
+ ResourceSyncInfo info = ((ICVSFile)cvsResource).getSyncInfo();
+ if(info != null) {
+ tag = info.getTag();
+ }
+ if(info == null || info.isAdded()) {
+ useParentTag = true;
+ }
+ }
+
+ ICVSFolder parent = cvsResource.getParent();
+ if(parent != null) {
+ FolderSyncInfo parentInfo = parent.getFolderSyncInfo();
+ if(parentInfo != null) {
+ CVSTag parentTag = parentInfo.getTag();
+ parentTag = (parentTag == null ? CVSTag.DEFAULT : parentTag);
+ tag = (tag == null ? CVSTag.DEFAULT : tag);
+ if( parentTag.equals(tag) || useParentTag ) {
+ return null;
+ } else {
+ return tag;
+ }
+ }
+ }
+ return tag;
+ }
+
private List computeLabelOverlaysFor(IResource resource, boolean isDirty, CVSTeamProvider provider) {
List overlays = new ArrayList(3);
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 9ef8967e4..ab933300a 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
@@ -202,6 +202,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
store.setDefault(ICVSUIConstants.PREF_ADDED_FLAG, CVSDecoratorConfiguration.DEFAULT_ADDED_FLAG);
store.setDefault(ICVSUIConstants.PREF_DIRTY_FLAG, CVSDecoratorConfiguration.DEFAULT_DIRTY_FLAG);
store.setDefault(ICVSUIConstants.PREF_CALCULATE_DIRTY, true);
+ store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS, true);
// Forward the values to the CVS plugin
CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(store.getBoolean(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES));
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
index 9fbe349fc..179d43231 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
@@ -76,6 +76,7 @@ import org.eclipse.team.internal.ccvs.core.ILogEntry;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.CVSCompareRevisionsInput.HistoryLabelProvider;
+import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
import org.eclipse.team.internal.ccvs.ui.actions.OpenLogEntryAction;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.ISelectionListener;
@@ -135,7 +136,7 @@ public class HistoryView extends ViewPart implements ISelectionListener {
String revision = entry.getRevision();
if (file == null) return revision;
if (currentRevision != null && currentRevision.equals(revision)) {
- Policy.bind("currentRevision", revision); //$NON-NLS-1$
+ revision = Policy.bind("currentRevision", revision); //$NON-NLS-1$
}
return revision;
case COL_TAGS:
@@ -215,27 +216,27 @@ public class HistoryView extends ViewPart implements ISelectionListener {
});
-// This code will add an action that allows getting a sticky revision of a file.
-// It has been left removed until we can support removing the stickiness of
-// the file.
-// getRevisionAction = getContextMenuAction(Policy.bind("HistoryView.getRevisionAction"), new IWorkspaceRunnable() {
-// public void run(IProgressMonitor monitor) throws CoreException {
-// ICVSRemoteFile remoteFile = currentSelection.getRemoteFile();
-// try {
-// if(confirmOverwrite()) {
-// CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(file.getProject());
-// CVSTag revisionTag = new CVSTag(remoteFile.getRevision(), CVSTag.VERSION);
-// provider.update(new IResource[] {file}, new Command.LocalOption[] {Command.UPDATE.IGNORE_LOCAL_CHANGES},
-// revisionTag, true /*create backups*/, monitor);
-// }
-// } catch (TeamException e) {
-// throw new CoreException(e.getStatus());
-// }
-// }
-// });
+ getRevisionAction = getContextMenuAction(Policy.bind("HistoryView.getRevisionAction"), new IWorkspaceRunnable() { //$NON-NLS-1$
+ public void run(IProgressMonitor monitor) throws CoreException {
+ ICVSRemoteFile remoteFile = currentSelection.getRemoteFile();
+ try {
+ if(confirmOverwrite()) {
+ CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(file.getProject());
+ CVSTag revisionTag = new CVSTag(remoteFile.getRevision(), CVSTag.VERSION);
+
+ if(CVSAction.checkForMixingTags(getSite().getShell(), new IResource[] {file}, revisionTag)) {
+ provider.update(new IResource[] {file}, new Command.LocalOption[] {Command.UPDATE.IGNORE_LOCAL_CHANGES},
+ revisionTag, true /*create backups*/, monitor);
+ currentRevision = revisionTag.getName();
+ tableViewer.refresh();
+ }
+ }
+ } catch (TeamException e) {
+ throw new CoreException(e.getStatus());
+ }
+ }
+ });
-
-
// Toggle text visible action
final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
toggleTextAction = new Action(Policy.bind("HistoryView.showComment")) { //$NON-NLS-1$
@@ -583,8 +584,8 @@ public class HistoryView extends ViewPart implements ISelectionListener {
if (!sel.isEmpty()) {
if (sel instanceof IStructuredSelection) {
if (((IStructuredSelection)sel).size() == 1) {
- //manager.add(getRevisionAction);
manager.add(getContentsAction);
+ manager.add(getRevisionAction);
}
}
}
@@ -621,7 +622,7 @@ public class HistoryView extends ViewPart implements ISelectionListener {
if (first instanceof IResource) {
showHistory((IResource)first);
} else if (first instanceof ICVSRemoteFile) {
- showHistory((ICVSRemoteFile)first);
+ showHistory((ICVSRemoteFile)first, null /* no current revision */);
}
}
}
@@ -668,12 +669,13 @@ public class HistoryView extends ViewPart implements ISelectionListener {
/**
* Shows the history for the given ICVSRemoteFile in the view.
*/
- public void showHistory(ICVSRemoteFile file) {
+ public void showHistory(ICVSRemoteFile file, String currentRevision) {
if (file == null) {
tableViewer.setInput(null);
setTitle(Policy.bind("HistoryView.title")); //$NON-NLS-1$
return;
}
+ this.currentRevision = currentRevision;
this.file = null;
tableViewer.setInput(file);
setTitle(Policy.bind("HistoryView.titleWithArgument", file.getName())); //$NON-NLS-1$
@@ -689,7 +691,7 @@ public class HistoryView extends ViewPart implements ISelectionListener {
IStructuredSelection ss = (IStructuredSelection)selection;
Object o = ss.getFirstElement();
currentSelection = (ILogEntry)o;
- new ProgressMonitorDialog(getViewSite().getShell()).run(true, true, new WorkspaceModifyOperation() {
+ new ProgressMonitorDialog(getViewSite().getShell()).run(false, true, new WorkspaceModifyOperation() {
protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
action.run(monitor);
@@ -713,6 +715,14 @@ public class HistoryView extends ViewPart implements ISelectionListener {
// Do nothing
}
}
+
+ public boolean isEnabled() {
+ ISelection selection = tableViewer.getSelection();
+ if (!(selection instanceof IStructuredSelection)) return false;
+ IStructuredSelection ss = (IStructuredSelection)selection;
+ if(ss.size() != 1) return false;
+ return true;
+ }
};
}
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 7a5d96d56..ba4a674bc 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
@@ -54,6 +54,7 @@ public interface ICVSUIConstants {
public final String PREF_REPLACE_UNMANAGED = "pref_replace_unmanaged"; //$NON-NLS-1$
public final String PREF_COMPRESSION_LEVEL = "pref_compression_level"; //$NON-NLS-1$
public final String PREF_TEXT_KSUBST = "pref_text_ksubst"; //$NON-NLS-1$
+ public final String PREF_PROMPT_ON_MIXED_TAGS = "pref_prompt_on_mixed_tags"; //$NON-NLS-1$
// console preferences
public final String PREF_CONSOLE_COMMAND_COLOR = "pref_console_command_color"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java
index 9ddcc25ee..05883a96a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/Policy.java
@@ -88,4 +88,11 @@ public class Policy {
return monitor;
return new SubProgressMonitor(monitor, ticks);
}
+ public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks, int style) {
+ if (monitor == null)
+ return new NullProgressMonitor();
+ if (monitor instanceof NullProgressMonitor)
+ return monitor;
+ return new SubProgressMonitor(monitor, ticks, style);
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java
index 7ab84e749..1dd9745f0 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java
@@ -97,18 +97,24 @@ public class RepositoryManager {
* Get the list of known version tags for a given project.
*/
public CVSTag[] getKnownVersionTags(ICVSFolder project) {
- ICVSRepositoryLocation location = getRepositoryLocationFor(project);
- Set result = new HashSet();
- Hashtable table = (Hashtable)versionTags.get(location);
- if (table == null) {
- return (CVSTag[])result.toArray(new CVSTag[result.size()]);
- }
- Set set = (Set)table.get(project.getName());
- if (set == null) {
- return (CVSTag[])result.toArray(new CVSTag[result.size()]);
+ try {
+ ICVSRepositoryLocation location = getRepositoryLocationFor(project);
+ String name = new Path(project.getFolderSyncInfo().getRepository()).segment(0);
+ Set result = new HashSet();
+ Hashtable table = (Hashtable)versionTags.get(location);
+ if (table == null) {
+ return (CVSTag[])result.toArray(new CVSTag[result.size()]);
+ }
+ Set set = (Set)table.get(name);
+ if (set == null) {
+ return (CVSTag[])result.toArray(new CVSTag[result.size()]);
+ }
+ result.addAll(set);
+ return (CVSTag[])result.toArray(new CVSTag[0]);
+ } catch(CVSException e) {
+ CVSUIPlugin.log(e.getStatus());
+ return new CVSTag[0];
}
- result.addAll(set);
- return (CVSTag[])result.toArray(new CVSTag[0]);
}
public Map getKnownProjectsAndVersions(ICVSRepositoryLocation location) {
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 c19432478..2be3a5e4f 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
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
- * IBM - Initial API and implementation
+ * IBM - Initial implementation
******************************************************************************/
package org.eclipse.team.internal.ccvs.ui;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
index 7ba9708c6..0ad109242 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
@@ -1,28 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial implementation
+ ******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.actions;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-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.wizards.BranchWizard;
-import org.eclipse.team.ui.actions.TeamAction;
/**
* BranchAction tags the selected resources with a branch tag specified by the user,
* and optionally updates the local resources to point to the new branch.
*/
-public class BranchAction extends TeamAction {
+public class BranchAction extends CVSAction {
/*
* @see IActionDelegate#run(IAction)
*/
@@ -37,21 +35,12 @@ public class BranchAction extends TeamAction {
}
});
}
+
/*
* @see TeamAction#isEnabled()
*/
protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
- if (provider == null) return false;
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (resource.getType() == IResource.PROJECT && ((ICVSFolder)cvsResource).isCVSFolder()) return true;
- if (!cvsResource.isManaged()) return false;
- }
- return true;
+ return isSelectionNonOverlapping();
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
new file mode 100644
index 000000000..a5daff07e
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial implementation
+ ******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui.actions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
+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.AvoidableMessageDialog;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
+import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.ui.actions.TeamAction;
+
+/**
+ * Contains helper methods for CVS actions.
+ *
+ * [Note: it would be nice to have common CVS error handling
+ * placed here and have all CVS actions subclass. For example
+ * error handling UI could provide a retry facility for actions
+ * if they have failed.]
+ */
+abstract public class CVSAction extends TeamAction {
+ /**
+ * Answers <code>true</code> if the current selection contains resource that don't
+ * have overlapping paths and <code>false</code> otherwise.
+ */
+ protected boolean isSelectionNonOverlapping() throws TeamException {
+ IResource[] resources = getSelectedResources();
+ // allow operation for non-overlapping resource selections
+ if(resources.length>0) {
+ List validPaths = new ArrayList(2);
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+
+ // only allow cvs resources to be selected
+ if(RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()) == null) {
+ return false;
+ }
+
+ // check if this resource overlaps other selections
+ IPath resourceFullPath = resource.getFullPath();
+ if(!validPaths.isEmpty()) {
+ for (Iterator it = validPaths.iterator(); it.hasNext();) {
+ IPath path = (IPath) it.next();
+ if(path.isPrefixOf(resourceFullPath) ||
+ resourceFullPath.isPrefixOf(path)) {
+ return false;
+ }
+ }
+ }
+ validPaths.add(resourceFullPath);
+
+ // ensure that resources are managed
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ if(cvsResource.isFolder()) {
+ if( ! ((ICVSFolder)cvsResource).isCVSFolder()) return false;
+ } else {
+ if( ! cvsResource.isManaged()) return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Checks if a the resources' parent's tags are different then the given tag.
+ * Prompts the user that they are adding mixed tags and returns <code>true</code> if
+ * the user wants to continue or <code>false</code> otherwise.
+ */
+ public static boolean checkForMixingTags(final Shell shell, IResource[] resources, final CVSTag tag) throws CVSException {
+ final IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
+ if(!store.getBoolean(ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS)) {
+ return true;
+ };
+
+ final boolean[] result = new boolean[] { true };
+
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ if (resource.getType() != IResource.PROJECT) {
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ CVSTag parentTag = cvsResource.getParent().getFolderSyncInfo().getTag();
+ if (!CVSTag.equalTags(tag, parentTag)) {
+ shell.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ AvoidableMessageDialog dialog = new AvoidableMessageDialog(
+ shell,
+ Policy.bind("CVSAction.mixingTagsTitle"), //$NON-NLS-1$
+ null, // accept the default window icon
+ Policy.bind("CVSAction.mixingTags", tag.getName()), //$NON-NLS-1$
+ MessageDialog.QUESTION,
+ new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
+ 0);
+
+ result[0] = dialog.open() == 0;
+ if(result[0] && dialog.isDontShowAgain()) {
+ store.setValue(ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS, false);
+ }
+ }
+ });
+ // only prompt once
+ break;
+ }
+ }
+ }
+ return result[0];
+ }
+}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
index 5fe3662d7..1bd1c021f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
@@ -1,19 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial implementation
+ ******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.actions;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IProject;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.ui.merge.MergeWizard;
-import org.eclipse.team.ui.actions.TeamAction;
-public class MergeAction extends TeamAction {
+public class MergeAction extends CVSAction {
/*
* @see IActionDelegate#run(IAction)
*/
@@ -22,7 +25,7 @@ public class MergeAction extends TeamAction {
shell.getDisplay().syncExec(new Runnable() {
public void run() {
MergeWizard wizard = new MergeWizard();
- wizard.setProject(getSelectedProjects()[0]);
+ wizard.setResources(getSelectedResources());
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.open();
}
@@ -32,7 +35,6 @@ public class MergeAction extends TeamAction {
* @see TeamAction#isEnabled()
*/
protected boolean isEnabled() throws TeamException {
- IProject[] projects = getSelectedProjects();
- return projects.length == 1;
+ return isSelectionNonOverlapping();
}
}
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 07df54e86..ca3b13148 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
@@ -85,24 +85,9 @@ public class ReplaceWithTagAction extends ReplaceWithAction {
// For non-projects determine if the tag being loaded is the same as the resource's parent
// If it's not, warn the user that they will have strange sync behavior
try {
- for (int i = 0; i < resources.length; i++) {
- if (resources[i].getType() != IResource.PROJECT) {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
- CVSTag parentTag = cvsResource.getParent().getFolderSyncInfo().getTag();
- if ( ! equalTags(tag[0], parentTag)) {
- final Shell shell = getShell();
- final boolean[] result = new boolean[] { false };
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = MessageDialog.openQuestion(getShell(), Policy.bind("question"), Policy.bind("ReplaceWithTagAction.mixingTags")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- });
- if (!result[0]) tag[0] = null;
- // Only ask once!
- return;
- }
- }
-
+ if(!CVSAction.checkForMixingTags(getShell(), resources, tag[0])) {
+ tag[0] = null;
+ return;
}
} catch (CVSException e) {
throw new InvocationTargetException(e);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java
index be8f69bf5..86e112f90 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowHistoryAction.java
@@ -66,7 +66,7 @@ public class ShowHistoryAction extends TeamAction {
ICVSRemoteFile[] files = getSelectedRemoteFiles();
HistoryView view = HistoryView.openInActivePerspective();
if (view != null) {
- view.showHistory(files[0]);
+ view.showHistory(files[0], null /* no current revision */);
}
}
}, Policy.bind("ShowHistoryAction.showHistory"), this.PROGRESS_BUSYCURSOR); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java
index 3a8d9722d..b44bea365 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java
@@ -6,35 +6,27 @@ package org.eclipse.team.internal.ccvs.ui.merge;
*/
import org.eclipse.compare.structuremergeviewer.ICompareInput;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.TeamPlugin;
import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.core.sync.IRemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.ui.sync.CatchupReleaseViewer;
import org.eclipse.team.ui.sync.SyncView;
-import org.eclipse.team.ui.sync.TeamFile;
public class MergeEditorInput extends CVSSyncCompareInput {
- IProject project;
CVSTag start;
CVSTag end;
- public MergeEditorInput(IProject project, CVSTag start, CVSTag end) {
- super(new IResource[] {project});
- this.project = project;
+ public MergeEditorInput(IResource[] resources, CVSTag start, CVSTag end) {
+ super(resources);
this.start = start;
this.end = end;
}
@@ -44,14 +36,21 @@ public class MergeEditorInput extends CVSSyncCompareInput {
return viewer;
}
protected IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException {
- monitor.beginTask(null, 100);
+ IResource[] resources = getResources();
+ IRemoteSyncElement[] trees = new IRemoteSyncElement[resources.length];
+ int work = 100 * resources.length;
+ monitor.beginTask(null, work);
try {
- IRemoteResource base = CVSWorkspaceRoot.getRemoteTree(project, start, Policy.subMonitorFor(monitor, 50));
- IRemoteResource remote = CVSWorkspaceRoot.getRemoteTree(project, end, Policy.subMonitorFor(monitor, 50));
- return new IRemoteSyncElement[] {new CVSRemoteSyncElement(true /*three way*/, project, base, remote)};
+ for (int i = 0; i < trees.length; i++) {
+ IResource resource = resources[i];
+ IRemoteResource base = CVSWorkspaceRoot.getRemoteTree(resource, start, Policy.subMonitorFor(monitor, 50));
+ IRemoteResource remote = CVSWorkspaceRoot.getRemoteTree(resource, end, Policy.subMonitorFor(monitor, 50));
+ trees[i] = new CVSRemoteSyncElement(true /*three way*/, resource, base, remote);
+ }
} finally {
monitor.done();
}
+ return trees;
}
public CVSTag getStartTag() {
return start;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java
index 61542db5e..62e954198 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeWizard.java
@@ -5,15 +5,9 @@ package org.eclipse.team.internal.ccvs.ui.merge;
* All Rights Reserved.
*/
-import java.lang.reflect.InvocationTargetException;
-
import org.eclipse.compare.CompareUI;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.core.resources.IResource;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.team.internal.ccvs.core.CVSTag;
@@ -24,17 +18,22 @@ import org.eclipse.team.internal.ccvs.ui.Policy;
public class MergeWizard extends Wizard {
MergeWizardStartPage startPage;
MergeWizardEndPage endPage;
- IProject project;
+ IResource[] resources;
public void addPages() {
- // Provide a progress monitor to indicate what is going on
+
+ // when merging multiple resources, use the tags found on the first selected
+ // resource. This makes sense because you would typically merge resources that
+ // have a common context and are versioned and branched together.
+ IProject projectForTagRetrieval = resources[0].getProject();
+
setWindowTitle(Policy.bind("MergeWizard.title")); //$NON-NLS-1$
ImageDescriptor mergeImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_MERGE);
startPage = new MergeWizardStartPage("startPage", Policy.bind("MergeWizard.start"), mergeImage); //$NON-NLS-1$ //$NON-NLS-2$
- startPage.setProject(project);
+ startPage.setProject(projectForTagRetrieval);
addPage(startPage);
endPage = new MergeWizardEndPage("endPage", Policy.bind("MergeWizard.end"), mergeImage, startPage); //$NON-NLS-1$ //$NON-NLS-2$
- endPage.setProject(project);
+ endPage.setProject(projectForTagRetrieval);
addPage(endPage);
}
@@ -43,11 +42,15 @@ public class MergeWizard extends Wizard {
*/
public boolean performFinish() {
CVSTag startTag = startPage.getTag();
- CVSTag endTag = endPage.getTag();
- CompareUI.openCompareEditor(new MergeEditorInput(project, startTag, endTag));
+ CVSTag endTag = endPage.getTag();
+ CompareUI.openCompareEditor(new MergeEditorInput(resources, startTag, endTag));
return true;
}
- public void setProject(IProject project) {
- this.project = project;
+
+ /*
+ * Set the resources that should be merged.
+ */
+ public void setResources(IResource[] resources) {
+ this.resources = resources;
}
}
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 3505b8788..82e79b631 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
@@ -31,12 +31,6 @@ AvoidableMessageDialog.dontShowAgain=Don't show this again
BranchWizard.createABranch=Creates a new CVS Branch
BranchWizard.title=Branch
BranchWizard.errorTagging=Error Tagging Resources
-BranchWizard.mixingTags=You are mixing tags within a project. This may cause confusion when \
- synchronizing with the repository. Synchronize uses the tag information associated with \
- each resource to determine the remote resource against which the local resource is compared. \
- For branching, this means that the part(s) of your project that you are branching will be \
- synchronized against branch tag ''{0}'' while others will be sychronized against ''HEAD'' \
- (or whichever tag is associated with the other local resources). Do you wish to continue?
BranchWizardPage.pageDescription=Creates a new branch and a starting point version.
BranchWizardPage.pageDescriptionVersion=Creates a new branch based on the version in the workspace.
BranchWizardPage.specifyVersion=The version will provide a starting point for merging the branch back to the source branch.
@@ -53,6 +47,9 @@ ConsolePreferencePage.errorColor=&Error:
ConsolePreferencePage.font=Console font setting:
ConsolePreferencePage.autoOpen=&Show CVS Console when there is output
+CVSAction.mixingTagsTitle=Confirm Mixing Tags
+CVSAction.mixingTags=You are mixing tags within a project. Beware that synchronization uses the tag information associated with each resource to determine the remote resource against which the local resource is compared. \n\nThis means that the part(s) of your project that you are replacing with another tag will be synchronized against the tag ''{0}'' while others resources in the project will be sychronized against another tag. \n\nDo you wish to continue?
+
CVSCatchupReleaseViewer.commit=&Commit
CVSCatchupReleaseViewer.update=&Update from Repository
CVSCatchupReleaseViewer.forceCommit=Override and Co&mmit
@@ -298,6 +295,7 @@ HistoryFilterDialog.fromDate = &From date (M/D/Y) :
HistoryFilterDialog.toDate = &To date (M/D/Y) :
HistoryView.getContentsAction=&Get Contents
+HistoryView.getRevisionAction=Get &Revision
HistoryView.copy=&Copy
HistoryView.revision=Revision
HistoryView.tags=Tags
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
index f9e3986ff..1d4c3bb81 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
@@ -5,8 +5,9 @@ package org.eclipse.team.internal.ccvs.ui.sync;
* All Rights Reserved.
*/
+import java.util.Map;
+
import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -29,15 +30,13 @@ import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.core.sync.IRemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.internal.ccvs.core.ILogEntry;
-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.ui.CVSDecoration;
+import org.eclipse.team.internal.ccvs.ui.CVSDecorationRunnable;
+import org.eclipse.team.internal.ccvs.ui.CVSDecoratorConfiguration;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.HistoryView;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
@@ -98,10 +97,16 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
ICVSRemoteFile baseFile = (ICVSRemoteFile)remoteSyncElement.getBase();
// can only show history if remote exists or local has a base.
+ String currentRevision = null;
+ try {
+ currentRevision = baseFile!=null ? baseFile.getRevision(): null;
+ } catch(TeamException e) {
+ CVSUIPlugin.log(e.getStatus());
+ }
if(remoteFile!=null) {
- view.showHistory(remoteFile);
+ view.showHistory(remoteFile, currentRevision);
} else if(baseFile!=null) {
- view.showHistory(baseFile);
+ view.showHistory(baseFile, currentRevision);
}
}
public void selectionChanged(SelectionChangedEvent event) {
@@ -176,31 +181,14 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
}
public String getText(Object element) {
if (element instanceof ITeamNode) {
- ITeamNode node = (ITeamNode)element;
+ ITeamNode node = (ITeamNode)element;
IResource resource = node.getResource();
if (resource.exists()) {
- try {
- if (resource.getType() == IResource.FILE) {
- ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
- ResourceSyncInfo info = cvsFile.getSyncInfo();
- KSubstOption option = info != null && info.getKeywordMode() != null ?
- info.getKeywordMode() :
- KSubstOption.fromFile((IFile)resource);
- return Policy.bind("CVSCatchupReleaseViewer.fileDecoration", oldProvider.getText(element), option.getShortDisplayText()); //$NON-NLS-1$
- } else if (resource instanceof IContainer) {
- ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)resource);
- FolderSyncInfo info = cvsFolder.getFolderSyncInfo();
- if (info != null) {
- CVSTag tag = info.getTag();
- if (tag != null) {
- return Policy.bind("CVSCatchupReleaseViewer.folderDecoration", oldProvider.getText(element), tag.getName()); //$NON-NLS-1$
- }
- }
- }
-
- } catch (CVSException e) {
- ErrorDialog.openError(getControl().getShell(), null, null, e.getStatus());
- }
+ CVSDecoration decoration = CVSDecorationRunnable.computeTextLabelFor(resource, false /*don't show dirty*/);
+ String format = decoration.getFormat();
+ Map bindings = decoration.getBindings();
+ bindings.put(CVSDecoratorConfiguration.RESOURCE_NAME, oldProvider.getText(element));
+ return CVSDecoratorConfiguration.bind(format, bindings);
}
}
return oldProvider.getText(element);
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 8c395fe5b..226bad6d7 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
@@ -33,8 +33,8 @@ import org.eclipse.team.ui.sync.SyncCompareInput;
import org.eclipse.team.ui.sync.TeamFile;
public class CVSSyncCompareInput extends SyncCompareInput {
- boolean dirty = false;
- IResource[] resources;
+ private boolean dirty = false;
+ private IResource[] resources;
/**
* Creates a new catchup or release operation.
@@ -148,7 +148,7 @@ public class CVSSyncCompareInput extends SyncCompareInput {
}
/*
- * Helper method to get cvs elements from the selection in the sync editoru input
+ * Helper method to get cvs elements from the selection in the sync editor input
*/
public static CVSRemoteSyncElement getSyncElementFrom(Object node) {
CVSRemoteSyncElement element = null;
@@ -159,12 +159,20 @@ public class CVSSyncCompareInput extends SyncCompareInput {
}
return element;
}
+
public void setDirty(boolean dirty) {
this.dirty = dirty;
super.setDirty(dirty);
}
+
public boolean isDirty() {
return dirty;
}
-
+
+ /*
+ * Returns the resources in this input.
+ */
+ public IResource[] getResources() {
+ return resources;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java
index 0d39d668c..e5b61a39b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java
@@ -20,10 +20,8 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSException;
@@ -41,6 +39,7 @@ import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.RepositoryManager;
+import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
public class BranchWizard extends Wizard {
BranchWizardPage mainPage;
@@ -86,7 +85,15 @@ public class BranchWizard extends Wizard {
if (versionString != null) {
rootVersionTag = new CVSTag(versionString, CVSTag.VERSION);
}
-
+
+ // For non-projects determine if the tag being loaded is the same as the resource's parent
+ // If it's not, warn the user that they will have strange sync behavior
+ if (update) {
+ if(!CVSAction.checkForMixingTags(getShell(), resources, branchTag)) {
+ return;
+ }
+ }
+
RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
Hashtable table = getProviderMapping(resources);
Set keySet = table.keySet();
@@ -97,31 +104,7 @@ public class BranchWizard extends Wizard {
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- // For non-projects determine if the tag being loaded is the same as the resource's parent
- // If it's not, warn the user that they will have strange sync behavior
- if (update) {
- for (int i = 0; i < resources.length; i++) {
- if (providerResources[i].getType() != IResource.PROJECT) {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
- CVSTag parentTag = cvsResource.getParent().getFolderSyncInfo().getTag();
- if (!equalTags(branchTag, parentTag)) {
- final Shell shell = getShell();
- final boolean[] result = new boolean[] { false };
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = MessageDialog.openQuestion(getShell(), Policy.bind("question"), Policy.bind("BranchWizard.mixingTags", branchTag.getName())); //$NON-NLS-1$ //$NON-NLS-2$
- }
- });
- if (!result[0]) return;
- // Only ask once!
- break;
- }
- }
-
- }
- }
-
+ IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
ICVSRepositoryLocation root = provider.getCVSWorkspaceRoot().getRemoteLocation();
try {
if (!areAllResourcesSticky(resources)) {
@@ -221,10 +204,4 @@ public class BranchWizard extends Wizard {
}
return false;
}
-
- protected boolean equalTags(CVSTag tag1, CVSTag tag2) {
- if (tag1 == null) tag1 = CVSTag.DEFAULT;
- if (tag2 == null) tag2 = CVSTag.DEFAULT;
- return tag1.equals(tag2);
- }
}

Back to the top