Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 115776 Details for
Bug 73032
[Repo View] CVS Tag deletion
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch to fix this bug(20081022)
removeTagAction20081022.patch.txt (text/plain), 37.83 KB, created by
Frank Zhang
on 2008-10-22 03:06:38 EDT
(
hide
)
Description:
Patch to fix this bug(20081022)
Filename:
MIME Type:
Creator:
Frank Zhang
Created:
2008-10-22 03:06:38 EDT
Size:
37.83 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.team.cvs.ui >Index: src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java,v >retrieving revision 1.92 >diff -u -r1.92 CVSUIMessages.java >--- src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java 12 Aug 2008 13:44:21 -0000 1.92 >+++ src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java 22 Oct 2008 06:57:19 -0000 >@@ -16,6 +16,9 @@ > > public class CVSUIMessages extends NLS { > private static final String BUNDLE_NAME = "org.eclipse.team.internal.ccvs.ui.messages";//$NON-NLS-1$ >+ >+ >+ > // > // Copyright (c) 2000, 2005 IBM Corporation and others. > // All rights reserved. This program and the accompanying materials >@@ -615,6 +618,10 @@ > public static String TagRefreshButtonArea_5; > public static String TagRefreshButtonArea_6; > public static String TagRefreshButtonArea_7; >+ >+ >+ >+ public static String TagRemoveDialogMessage; > public static String TagAction_enterTag; > public static String TagAction_moveTag; > public static String TagRootElement_0; >@@ -1183,4 +1190,12 @@ > public static String NewLocationWizard_4; > public static String ClipboardDiffOperation_Clipboard; > public static String CVSAction_doNotShowThisAgain; >+ >+ public static String TagAction_removeTag; >+ public static String TagAction_removeTagProblemsMessage; >+ public static String TagAction_removeTagProblemsMessageMultiple; >+ >+ public static String RemoveTagInRepositoryAction_removeTagProblemsMessage; >+ public static String RemoveTagInRepositoryAction_removeTagProblemsMessageMultiple; >+ > } >Index: src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java,v >retrieving revision 1.120 >diff -u -r1.120 ICVSUIConstants.java >--- src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java 11 Sep 2007 18:03:39 -0000 1.120 >+++ src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java 22 Oct 2008 06:57:19 -0000 >@@ -235,6 +235,7 @@ > public final String CMD_HISTORY = "org.eclipse.team.cvs.ui.showHistory"; //$NON-NLS-1$ > public final String CMD_ADD = "org.eclipse.team.cvs.ui.add"; //$NON-NLS-1$ > public final String CMD_IGNORE = "org.eclipse.team.cvs.ui.ignore"; //$NON-NLS-1$ >+ public final String CMD_REMOVETAG = "org.eclipse.team.cvs.ui.removeTag"; //$NON-NLS-1$ > > } > >Index: src/org/eclipse/team/internal/ccvs/ui/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties,v >retrieving revision 1.546 >diff -u -r1.546 messages.properties >--- src/org/eclipse/team/internal/ccvs/ui/messages.properties 12 Aug 2008 13:44:21 -0000 1.546 >+++ src/org/eclipse/team/internal/ccvs/ui/messages.properties 22 Oct 2008 06:57:20 -0000 >@@ -574,6 +574,7 @@ > TagRefreshButtonArea_5=Refreshing tags > TagRefreshButtonArea_6=Refreshing tags... > TagRefreshButtonArea_7=No tags could be found. >+TagRemoveDialogMessage=&Please enter a version tag to remove: > TagAction_enterTag=&Please enter a version tag: > TagAction_moveTag=&Move tag if it already exists > TagRootElement_0=Dates >@@ -584,9 +585,15 @@ > TagAction_uncommittedChangesTitle=Confirm Uncommitted Changes > TagAction_uncommittedChanges=You are tagging ''{0}'' that has uncommitted changes. These changes are not in the repository and will not be included in the version you are creating. Do you still want to tag this resource? > TagAction_existingVersions=Existing Versions >+TagAction_removeTag=Remove Tag >+TagAction_removeTagProblemsMessage=Problems reported removing the tag. >+TagAction_removeTagProblemsMessageMultiple=Problems removing the tag. Tags for {0} project(s) successfully removed and {1} project(s) with errors. > > TagInRepositoryAction_tagProblemsMessage=Problems reported tagging the resource. > TagInRepositoryAction_tagProblemsMessageMultiple=Problems tagging the resources. {0} resource(s) successfully tagged and {1} resource(s) with errors. >+RemoveTagInRepositoryAction_removeTagProblemsMessage=Problems reported removing the tag. >+RemoveTagInRepositoryAction_removeTagProblemsMessageMultiple=Problems removing the tag. Tags for {0} project(s) successfully removed and {1} project(s) with errors. >+ > > UpdateAction_update=Problems encountered performing update > UpdateAction_promptForUpdateSeveral=Are you sure you want to update {0} resources? >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.ui/plugin.xml,v >retrieving revision 1.280 >diff -u -r1.280 plugin.xml >--- plugin.xml 17 Apr 2008 15:33:21 -0000 1.280 >+++ plugin.xml 22 Oct 2008 06:57:18 -0000 >@@ -408,6 +408,14 @@ > id="org.eclipse.team.cvs.ui.tag"> > </action> > <action >+ class="org.eclipse.team.internal.ccvs.ui.actions.RemoveTagAction" >+ definitionId="org.eclipse.team.cvs.ui.removetag" >+ id="org.eclipse.team.cvs.ui.removetag" >+ label="%RemoveTagAction.label" >+ menubarPath="team.main/group2" >+ tooltip="%RemoveTagAction.tooltip"> >+ </action> >+ <action > helpContextId="org.eclipse.team.cvs.ui.compare_with_tag_action_context" > label="%CompareWithTagAction.label" > definitionId="org.eclipse.team.cvs.ui.compareWithTag" >@@ -735,6 +743,13 @@ > menubarPath="tagGroup" > id="org.eclipse.team.ccvs.ui.tagInRepository"> > </action> >+ <action >+ class="org.eclipse.team.internal.ccvs.ui.actions.RemoveTagInRepositoryAction" >+ id="org.eclipse.team.ccvs.ui.RemoveTagInRepository" >+ label="%RemoveTagInRepositoryAction.label" >+ menubarPath="tagGroup" >+ tooltip="%RemoveTagInRepositoryAction.tooltip"> >+ </action> > </objectContribution> > <objectContribution > adaptable="false" >@@ -1146,6 +1161,15 @@ > id="org.eclipse.team.cvs.ui.tag"> > </action> > <action >+ class="org.eclipse.team.internal.ccvs.ui.actions.RemoveTagAction" >+ definitionId="org.eclipse.team.cvs.ui.removeTag" >+ id="org.eclipse.team.cvs.ui.removeTag" >+ label="%RemoveTagAction.label" >+ menubarPath="cvs.main/group2" >+ style="push" >+ tooltip="%RemoveTagAction.tooltip"> >+ </action> >+ <action > helpContextId="org.eclipse.team.cvs.ui.team_create_patch_action_context" > label="%GenerateDiff.label" > definitionId="org.eclipse.team.cvs.ui.GenerateDiff" >@@ -1315,7 +1339,12 @@ > categoryId="org.eclipse.team.cvs.ui.actionSet" > description="%Synchronize.tooltip" > name="%Synchronize.name" >- id="org.eclipse.team.cvs.ui.sync"/> >+ id="org.eclipse.team.cvs.ui.sync"/> >+ <command >+ description="%RemoveTagAction.tooltip" >+ id="org.eclipse.team.cvs.ui.removeTag" >+ name="%RemoveTagAction.label"> >+ </command> > </extension> > > <!-- Commented out awaiting menu support from UI >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.ui/plugin.properties,v >retrieving revision 1.165 >diff -u -r1.165 plugin.properties >--- plugin.properties 3 Jun 2008 13:35:45 -0000 1.165 >+++ plugin.properties 22 Oct 2008 06:57:15 -0000 >@@ -120,10 +120,16 @@ > TagAction.name=Tag as Version > TagAction.tooltip=Tag the resources with a CVS version tag > >+RemoveTagAction.label=&Remove Tag... >+RemoveTagAction.tooltip=Remove an existing tag >+ > TagInRepositoryAction.label=&Tag as Version... > TagInRepositoryAction.name=Tag as Version > TagInRepositoryAction.tooltip=Tag the resources with a CVS version tag > >+RemoveTagInRepositoryAction.label=&Remove Tag... >+RemoveTagInRepositoryAction.tooltip=Remove an existing tag >+ > MoveTagAction.label=Tag with &Existing... > MoveTagAction.tooltip=Tag the selected resources with an existing tag > >Index: src/org/eclipse/team/internal/ccvs/ui/actions/RemoveTagInRepositoryAction.java >=================================================================== >RCS file: src/org/eclipse/team/internal/ccvs/ui/actions/RemoveTagInRepositoryAction.java >diff -N src/org/eclipse/team/internal/ccvs/ui/actions/RemoveTagInRepositoryAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/internal/ccvs/ui/actions/RemoveTagInRepositoryAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,58 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.team.internal.ccvs.ui.actions; >+ >+import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation; >+import org.eclipse.team.internal.ccvs.core.ICVSResource; >+import org.eclipse.team.internal.ccvs.ui.operations.*; >+import org.eclipse.team.internal.ui.actions.TeamAction; >+ >+ >+/** >+ * @author Administrator >+ * >+ */ >+public class RemoveTagInRepositoryAction extends RemoveTagAction >+{ >+ /** >+ * @see TeamAction#isEnabled() >+ */ >+ public boolean isEnabled() { >+ ICVSResource[] resources = getSelectedCVSResources(); >+ if (resources.length == 0) return false; >+ for (int i = 0; i < resources.length; i++) { >+ if (resources[i] instanceof ICVSRepositoryLocation) return false; >+ } >+ return true; >+ } >+ >+ /** >+ * @see CVSAction#needsToSaveDirtyEditors() >+ */ >+ protected boolean needsToSaveDirtyEditors() { >+ return false; >+ } >+ >+ /** >+ * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#requiresLocalSyncInfo() >+ */ >+ protected boolean requiresLocalSyncInfo() { >+ return false; >+ } >+ >+ protected ITagOperation createTagOperation() { >+ return new RemoveTagInRepositoryOperation(getTargetPart(), getSelectedRemoteResources()); >+ } >+ >+ protected boolean performPrompting(ITagOperation operation) { >+ return true; >+ } >+} >Index: src/org/eclipse/team/internal/ccvs/ui/operations/RemoveTagInRepositoryOperation.java >=================================================================== >RCS file: src/org/eclipse/team/internal/ccvs/ui/operations/RemoveTagInRepositoryOperation.java >diff -N src/org/eclipse/team/internal/ccvs/ui/operations/RemoveTagInRepositoryOperation.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/internal/ccvs/ui/operations/RemoveTagInRepositoryOperation.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,141 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.team.internal.ccvs.ui.operations; >+ >+import java.lang.reflect.InvocationTargetException; >+import java.util.HashSet; >+import java.util.Set; >+ >+import org.eclipse.core.runtime.*; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.team.internal.ccvs.core.*; >+import org.eclipse.team.internal.ccvs.core.client.Command; >+import org.eclipse.team.internal.ccvs.core.client.RTag; >+import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption; >+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages; >+import org.eclipse.team.internal.ccvs.ui.actions.TagAction; >+import org.eclipse.team.internal.ccvs.ui.tags.TagSource; >+import org.eclipse.ui.IWorkbenchPart; >+ >+ >+/** >+ * @author Administrator >+ * >+ */ >+public class RemoveTagInRepositoryOperation extends RemoteOperation implements ITagOperation >+{ >+ >+ private Set localOptions = new HashSet(); >+ private CVSTag tag; >+ >+ public RemoveTagInRepositoryOperation(IWorkbenchPart part, ICVSRemoteResource[] remoteResource) { >+ super(part, remoteResource); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException { >+ >+ moveTag(); >+ >+ ICVSRemoteResource[] resources = getRemoteResources(); >+ monitor.beginTask(null, 1000 * resources.length); >+ for (int i = 0; i < resources.length; i++) { >+ IStatus status = resources[i].tag(getTag(), getLocalOptions(), new SubProgressMonitor(monitor, 1000)); >+ collectStatus(status); >+ } >+ if (!errorsOccurred()) { >+ try { >+ TagAction.broadcastTagChange(getCVSResources(), getTag()); >+ } catch (InvocationTargetException e) { >+ throw CVSException.wrapException(e); >+ } >+ } >+ } >+ >+ /** >+ * Override to dislay the number of tag operations that succeeded >+ */ >+ protected String getErrorMessage(IStatus[] problems, int operationCount) { >+ if(operationCount == 1) { >+ return CVSUIMessages.RemoveTagInRepositoryAction_removeTagProblemsMessage; >+ } else { >+ return NLS.bind(CVSUIMessages.RemoveTagInRepositoryAction_removeTagProblemsMessageMultiple, new String[] { Integer.toString(operationCount - problems.length), Integer.toString(problems.length) }); >+ } >+ } >+ >+ private LocalOption[] getLocalOptions() { >+ return (LocalOption[]) localOptions.toArray(new LocalOption[localOptions.size()]); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#getTag() >+ */ >+ public CVSTag getTag() { >+ return tag; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#setTag(org.eclipse.team.internal.ccvs.core.CVSTag) >+ */ >+ public void setTag(CVSTag tag) { >+ this.tag = tag; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#addLocalOption(org.eclipse.team.internal.ccvs.core.client.Command.LocalOption) >+ */ >+ public void addLocalOption(LocalOption option) { >+ localOptions.add(option); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#moveTag() >+ */ >+ public void moveTag() { >+ addLocalOption(RTag.REMOVE_TAG); >+ if (tag != null && tag.getType() == CVSTag.BRANCH) { >+ addLocalOption(RTag.FORCE_BRANCH_REASSIGNMENT); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#recurse() >+ */ >+ public void doNotRecurse() { >+ addLocalOption(Command.DO_NOT_RECURSE); >+ } >+ >+ protected String getTaskName() { >+ return CVSUIMessages.TagFromRepository_taskName; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#getTagSource() >+ */ >+ public TagSource getTagSource() { >+ return TagSource.create(getCVSResources()); >+ } >+ >+ protected boolean isReportableError(IStatus status) { >+ return super.isReportableError(status) >+ || status.getCode() == CVSStatus.TAG_ALREADY_EXISTS; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#isEmpty() >+ */ >+ public boolean isEmpty() { >+ return getCVSResources().length == 0; >+ } >+ >+} >Index: src/org/eclipse/team/internal/ccvs/ui/operations/RemoveTagOperation.java >=================================================================== >RCS file: src/org/eclipse/team/internal/ccvs/ui/operations/RemoveTagOperation.java >diff -N src/org/eclipse/team/internal/ccvs/ui/operations/RemoveTagOperation.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/internal/ccvs/ui/operations/RemoveTagOperation.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,203 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.team.internal.ccvs.ui.operations; >+ >+import java.lang.reflect.InvocationTargetException; >+import java.util.*; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.mapping.ResourceMapping; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.team.internal.ccvs.core.*; >+import org.eclipse.team.internal.ccvs.core.client.*; >+import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption; >+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; >+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages; >+import org.eclipse.team.internal.ccvs.ui.Policy; >+import org.eclipse.team.internal.ccvs.ui.actions.TagAction; >+import org.eclipse.team.internal.ccvs.ui.tags.TagSource; >+import org.eclipse.ui.IWorkbenchPart; >+ >+ >+/** >+ * @author Administrator >+ * >+ */ >+public class RemoveTagOperation extends RepositoryProviderOperation implements ITagOperation >+{ >+ >+ private Set localOptions = new HashSet(); >+ private CVSTag tag; >+ >+ public RemoveTagOperation(IWorkbenchPart part, ResourceMapping[] mappers) { >+ super(part, mappers); >+ } >+ >+ public CVSTag getTag() { >+ return tag; >+ } >+ >+ public void setTag(CVSTag tag) { >+ this.tag = tag; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ protected void execute(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException { >+ IStatus status = tag(provider, resources, recurse, monitor); >+ collectStatus(status); >+ } >+ >+ /** >+ * Override to dislay the number of tag operations that succeeded >+ */ >+ protected String getErrorMessage(IStatus[] problems, int operationCount) { >+ // We accumulated 1 status per resource above. >+ if(operationCount == 1) { >+ return CVSUIMessages.TagAction_removeTagProblemsMessage; >+ } else { >+ return NLS.bind(CVSUIMessages.TagAction_removeTagProblemsMessageMultiple, new String[] { Integer.toString(operationCount - problems.length), Integer.toString(problems.length) }); >+ } >+ } >+ >+ /** >+ * Tag the resources in the CVS repository with the given tag. >+ * >+ * The returned IStatus will be a status containing any errors or warnings. >+ * If the returned IStatus is a multi-status, the code indicates the severity. >+ * Possible codes are: >+ * CVSStatus.OK - Nothing to report >+ * CVSStatus.SERVER_ERROR - The server reported an error >+ * any other code - warning messages received from the server >+ * @param recurse >+ */ >+ public IStatus tag(CVSTeamProvider provider, IResource[] resources, boolean recurse, IProgressMonitor progress) throws CVSException { >+ >+ LocalOption[] commandOptions = (LocalOption[])localOptions.toArray(new LocalOption[localOptions.size()]); >+ if (recurse) { >+ commandOptions = Command.DO_NOT_RECURSE.removeFrom(commandOptions); >+ } else { >+ commandOptions = Command.RECURSE.removeFrom(commandOptions); >+ commandOptions = Command.DO_NOT_RECURSE.addTo(commandOptions); >+ } >+ >+ // add remove tag command >+ commandOptions = Command.REMOVE_TAG.addTo( commandOptions ); >+ >+ // Build the arguments list >+ String[] arguments = getStringArguments(resources); >+ >+ // Execute the command >+ CVSWorkspaceRoot root = provider.getCVSWorkspaceRoot(); >+ Session s = new Session(root.getRemoteLocation(), root.getLocalRoot()); >+ progress.beginTask(null, 100); >+ try { >+ // Opening the session takes 20% of the time >+ s.open(Policy.subMonitorFor(progress, 20), true /* open for modification */); >+ return Command.TAG.execute(s, >+ Command.NO_GLOBAL_OPTIONS, >+ commandOptions, >+ tag, >+ arguments, >+ null, >+ Policy.subMonitorFor(progress, 80)); >+ } finally { >+ s.close(); >+ progress.done(); >+ } >+ } >+ >+ public void addLocalOption(LocalOption option) { >+ localOptions.add(option); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#moveTag() >+ */ >+ public void moveTag() { >+ addLocalOption(Tag.FORCE_REASSIGNMENT); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#recurse() >+ */ >+ public void doNotRecurse() { >+ addLocalOption(Command.DO_NOT_RECURSE); >+ } >+ >+ protected String getTaskName() { >+ return CVSUIMessages.TagFromWorkspace_taskName; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider) >+ */ >+ protected String getTaskName(CVSTeamProvider provider) { >+ return NLS.bind(CVSUIMessages.TagOperation_0, new String[] { provider.getProject().getName() }); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException { >+ super.execute(monitor); >+ if (!errorsOccurred()) { >+ try { >+ TagAction.broadcastTagChange(getCVSResources(), getTag()); >+ } catch (InvocationTargetException e) { >+ throw CVSException.wrapException(e); >+ } >+ } >+ } >+ >+ private ICVSResource[] getCVSResources() { >+ IResource[] resources = getTraversalRoots(); >+ ICVSResource[] cvsResources = new ICVSResource[resources.length]; >+ for (int i = 0; i < resources.length; i++) { >+ cvsResources[i] = CVSWorkspaceRoot.getCVSResourceFor(resources[i]); >+ } >+ return cvsResources; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#getTagSource() >+ */ >+ public TagSource getTagSource() { >+ return TagSource.create(getProjects()); >+ } >+ >+ private IProject[] getProjects() { >+ ResourceMapping[] mappings = getSelectedMappings(); >+ Set projects = new HashSet(); >+ for (int i = 0; i < mappings.length; i++) { >+ ResourceMapping mapping = mappings[i]; >+ projects.addAll(Arrays.asList(mapping.getProjects())); >+ } >+ return (IProject[]) projects.toArray(new IProject[projects.size()]); >+ } >+ >+ protected boolean isReportableError(IStatus status) { >+ return super.isReportableError(status) >+ || status.getCode() == CVSStatus.TAG_ALREADY_EXISTS; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.ITagOperation#isEmpty() >+ */ >+ public boolean isEmpty() { >+ return getSelectedMappings().length == 0; >+ } >+ >+} >Index: src/org/eclipse/team/internal/ccvs/ui/actions/RemoveTagAction.java >=================================================================== >RCS file: src/org/eclipse/team/internal/ccvs/ui/actions/RemoveTagAction.java >diff -N src/org/eclipse/team/internal/ccvs/ui/actions/RemoveTagAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/internal/ccvs/ui/actions/RemoveTagAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,103 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.team.internal.ccvs.ui.actions; >+ >+import java.lang.reflect.InvocationTargetException; >+ >+import org.eclipse.jface.window.Window; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.team.internal.ccvs.ui.*; >+import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation; >+import org.eclipse.team.internal.ccvs.ui.operations.RemoveTagOperation; >+import org.eclipse.team.internal.ccvs.ui.tags.TagRemoveDialog; >+ >+ >+/** >+ * @author Administrator >+ * >+ */ >+public class RemoveTagAction extends TagAction >+{ >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.actions.TagAction#performPrompting(org.eclipse.team.internal.ccvs.ui.operations.ITagOperation) >+ */ >+ protected boolean performPrompting(ITagOperation operation) { >+ if (operation instanceof RemoveTagOperation) { >+ final RemoveTagOperation tagOperation = (RemoveTagOperation) operation; >+ try { >+ if (hasOutgoingChanges(tagOperation)) { >+ final boolean[] keepGoing = new boolean[] { true }; >+ Display.getDefault().syncExec(new Runnable() { >+ public void run() { >+ OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(), tagOperation.getScopeManager(), >+ CVSUIMessages.TagLocalAction_2, >+ CVSUIMessages.TagLocalAction_0, >+ ""); //$NON-NLS-1$ >+ dialog.setHelpContextId(IHelpContextIds.TAG_OUTGOING_CHANGES_DIALOG); >+ int result = dialog.open(); >+ keepGoing[0] = result == Window.OK; >+ } >+ }); >+ return keepGoing[0]; >+ } >+ return true; >+ } catch (InterruptedException e) { >+ // Ignore >+ } catch (InvocationTargetException e) { >+ handle(e); >+ } >+ } >+ return false; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.actions.TagAction#createTagOperation() >+ */ >+ protected ITagOperation createTagOperation() { >+ return new RemoveTagOperation(getTargetPart(), getCVSResourceMappings()); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getId() >+ */ >+ public String getId() { >+ return ICVSUIConstants.CMD_REMOVETAG; >+ } >+ >+ /** >+ * Prompts the user for a tag name. >+ * Note: This method is designed to be overridden by test cases. >+ * @return the operation, or null to cancel >+ */ >+ protected ITagOperation configureOperation() { >+ >+ ITagOperation operation = createTagOperation(); >+ if (operation.isEmpty()) { >+ return null; >+ } >+ if (!performPrompting(operation)) { >+ return null; >+ } >+ TagRemoveDialog dialog = new TagRemoveDialog(getShell(), >+ CVSUIMessages.TagAction_removeTag, >+ operation); >+ if (dialog.open() != Window.OK) return null; >+ >+ >+ >+ // The user is a cowboy and wants to do it. >+ return dialog.getOperation(); >+ >+ >+ >+ } >+} >Index: src/org/eclipse/team/internal/ccvs/ui/tags/TagRemoveDialog.java >=================================================================== >RCS file: src/org/eclipse/team/internal/ccvs/ui/tags/TagRemoveDialog.java >diff -N src/org/eclipse/team/internal/ccvs/ui/tags/TagRemoveDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/internal/ccvs/ui/tags/TagRemoveDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,234 @@ >+package org.eclipse.team.internal.ccvs.ui.tags; >+ >+import java.util.Arrays; >+import java.util.Vector; >+ >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.dialogs.IDialogSettings; >+import org.eclipse.jface.util.IPropertyChangeListener; >+import org.eclipse.jface.util.PropertyChangeEvent; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.*; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.widgets.*; >+import org.eclipse.team.internal.ccvs.core.CVSTag; >+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages; >+import org.eclipse.team.internal.ccvs.ui.IHelpContextIds; >+import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation; >+import org.eclipse.team.internal.ccvs.ui.tags.TagSelectionArea; >+import org.eclipse.team.internal.ccvs.ui.tags.TagSource; >+import org.eclipse.team.internal.ui.*; >+import org.eclipse.team.internal.ui.dialogs.DetailsDialog; >+ >+public class TagRemoveDialog extends DetailsDialog { >+ >+ private static final int TAG_AREA_HEIGHT_HINT = 200; >+ >+ private static final int HISTORY_LENGTH = 10; >+ >+ private static final String STORE_SECTION = "TagAsVersionDialog"; //$NON-NLS-1$ >+ >+ private static final String TAG_HISTORY = "tag_history"; //$NON-NLS-1$ >+ >+ private static IDialogSettings settingsSection; >+ >+ private ITagOperation operation; >+ >+ private Combo tagCombo; >+// private Button moveTagButton; >+ >+ private String tagName = ""; //$NON-NLS-1$ >+// private boolean moveTag = false; >+ >+ private TagSource tagSource; >+ >+ private TagSelectionArea tagArea; >+ >+ public TagRemoveDialog(Shell parentShell, String title, ITagOperation operation) { >+ super(parentShell, title); >+ this.tagSource = operation.getTagSource(); >+ this.operation = operation; >+ } >+ >+ /** >+ * @see DetailsDialog#createMainDialogArea(Composite) >+ */ >+ protected void createMainDialogArea(Composite parent) { >+ >+ final int width= convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH + 50); >+ >+// final Label label = SWTUtils.createLabel(parent, CVSUIMessages.TagAction_enterTag); >+ final Label label = SWTUtils.createLabel(parent, CVSUIMessages.TagRemoveDialogMessage); >+ label.setLayoutData(SWTUtils.createGridData(width, SWT.DEFAULT, true, false)); >+ >+ tagCombo = createDropDownCombo(parent); >+ tagName = ""; //$NON-NLS-1$ >+ tagCombo.setItems(getTagNameHistory()); >+ tagCombo.setText(tagName); >+ tagCombo.addModifyListener( >+ new ModifyListener() { >+ public void modifyText(ModifyEvent e) { >+ tagName = tagCombo.getText(); >+ updateEnablements(); >+ } >+ } >+ ); >+ >+// moveTagButton= SWTUtils.createCheckBox(parent, CVSUIMessages.TagAction_moveTag); >+// moveTagButton.addSelectionListener(new SelectionAdapter() { >+// public void widgetSelected(SelectionEvent e) { >+// moveTag = moveTagButton.getSelection(); >+// } >+// }); >+ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#getHelpContextId() >+ */ >+ protected String getHelpContextId() { >+ return IHelpContextIds.TAG_AS_VERSION_DIALOG; >+ } >+ >+// public boolean shouldMoveTag() { >+// return moveTag; >+// } >+ >+ /** >+ * @see DetailsDialog#createDropDownDialogArea(Composite) >+ */ >+ protected Composite createDropDownDialogArea(Composite parent) { >+ >+ final PixelConverter converter= SWTUtils.createDialogPixelConverter(parent); >+ >+ final Composite composite = new Composite(parent, SWT.NONE); >+ composite.setLayout(SWTUtils.createGridLayout(1, converter, SWTUtils.MARGINS_DIALOG)); >+ >+ final GridData gridData = new GridData(GridData.FILL_BOTH); >+ gridData.heightHint = TAG_AREA_HEIGHT_HINT; >+ composite.setLayoutData(gridData); >+ >+ tagArea = new TagSelectionArea(getShell(), tagSource, TagSelectionArea.INCLUDE_VERSIONS, null); >+ tagArea.setTagAreaLabel(CVSUIMessages.TagAction_existingVersions); >+ tagArea.setIncludeFilterInputArea(false); >+ tagArea.createArea(composite); >+ tagArea.addPropertyChangeListener(new IPropertyChangeListener() { >+ public void propertyChange(PropertyChangeEvent event) { >+ if (event.getProperty().equals(TagSelectionArea.SELECTED_TAG)) { >+ CVSTag tag = tagArea.getSelection(); >+ if (tag != null) { >+ tagCombo.setText(tag.getName()); >+ } >+ } else if (event.getProperty().equals(TagSelectionArea.OPEN_SELECTED_TAG)) { >+ CVSTag tag = tagArea.getSelection(); >+ if (tag != null) { >+ tagCombo.setText(tag.getName()); >+ okPressed(); >+ } >+ } >+ } >+ }); >+ return composite; >+ } >+ >+ /** >+ * Validates tag name >+ */ >+ protected void updateEnablements() { >+ String message = null; >+ if(tagName.length() == 0) { >+ message = ""; //$NON-NLS-1$ >+ } else { >+ IStatus status = CVSTag.validateTagName(tagName); >+ if (!status.isOK()) { >+ message = status.getMessage(); >+ } >+ } >+ setPageComplete(message == null); >+ setErrorMessage(message); >+ if (tagArea != null) { >+ tagArea.setFilter(tagName); >+ } >+ } >+ >+ /** >+ * Returns the tag name entered into this dialog >+ */ >+ public String getTagName() { >+ return tagName; >+ } >+ >+ /** >+ * @return >+ */ >+ public ITagOperation getOperation() { >+ operation.setTag(new CVSTag(tagName, CVSTag.VERSION)); >+// if (moveTag) { >+// operation.moveTag(); >+// } >+ return operation; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ui.dialogs.DetailsDialog#isMainGrabVertical() >+ */ >+ protected boolean isMainGrabVertical() { >+ return false; >+ } >+ >+ protected Combo createDropDownCombo(Composite parent) { >+ Combo combo = new Combo(parent, SWT.DROP_DOWN); >+ GridData comboData = new GridData(GridData.FILL_HORIZONTAL); >+ comboData.verticalAlignment = GridData.CENTER; >+ comboData.grabExcessVerticalSpace = false; >+ comboData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; >+ combo.setLayoutData(comboData); >+ return combo; >+ } >+ >+ protected void okPressed() { >+ rememberTagName(tagName); >+ super.okPressed(); >+ } >+ >+ protected static String[] getTagNameHistory() { >+ IDialogSettings section = getSettingsSection(); >+ String[] array = section.getArray(TAG_HISTORY); >+ return array != null ? array : new String[]{""}; >+ } >+ >+ private void rememberTagName(String tagName) { >+ Object[] tagNameHistory = getTagNameHistory(); >+ Vector tagNames = new Vector(Arrays.asList(tagNameHistory)); >+ if (tagNames.contains(tagName)) { >+ // The item is in the list. Remove it and add it back at the >+ // beginning. If it already was at the beginning this will be a >+ // waste of time, but it's not even measurable. >+ tagNames.remove(tagName); >+ } >+ // Most recently used filename goes to the beginning of the list >+ tagNames.add(0, tagName); >+ >+ // Forget any overflowing items >+ while (tagNames.size() > HISTORY_LENGTH) { >+ tagNames.remove(HISTORY_LENGTH); >+ } >+ String[] array = (String[]) tagNames.toArray(new String[tagNames.size()]); >+ IDialogSettings section = getSettingsSection(); >+ section.put(TAG_HISTORY, array); >+ } >+ >+ private static IDialogSettings getSettingsSection() { >+ if (settingsSection != null) >+ return settingsSection; >+ >+ IDialogSettings settings = TeamUIPlugin.getPlugin().getDialogSettings(); >+ settingsSection = settings.getSection(STORE_SECTION); >+ if (settingsSection != null) >+ return settingsSection; >+ >+ settingsSection = settings.addNewSection(STORE_SECTION); >+ return settingsSection; >+ } >+} >#P org.eclipse.team.cvs.core >Index: src/org/eclipse/team/internal/ccvs/core/client/RTag.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java,v >retrieving revision 1.23 >diff -u -r1.23 RTag.java >--- src/org/eclipse/team/internal/ccvs/core/client/RTag.java 10 May 2006 18:53:48 -0000 1.23 >+++ src/org/eclipse/team/internal/ccvs/core/client/RTag.java 22 Oct 2008 06:57:24 -0000 >@@ -31,7 +31,9 @@ > public static final LocalOption CLEAR_FROM_REMOVED = new LocalOption("-a", null); //$NON-NLS-1$ > public static final LocalOption FORCE_REASSIGNMENT = new LocalOption("-F", null); //$NON-NLS-1$ > public static final LocalOption FORCE_BRANCH_REASSIGNMENT = new LocalOption("-B", null); //$NON-NLS-1$ >+ public static final LocalOption REMOVE_TAG = new LocalOption("-d", null); //$NON-NLS-1$ > >+ > /*** Default command output listener ***/ > private static final ICommandOutputListener DEFAULT_OUTPUT_LISTENER = new TagListener(); > >Index: src/org/eclipse/team/internal/ccvs/core/client/Command.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java,v >retrieving revision 1.78 >diff -u -r1.78 Command.java >--- src/org/eclipse/team/internal/ccvs/core/client/Command.java 21 Jun 2007 14:56:11 -0000 1.78 >+++ src/org/eclipse/team/internal/ccvs/core/client/Command.java 22 Oct 2008 06:57:24 -0000 >@@ -78,6 +78,8 @@ > // valid for: annotate checkout commit diff export log rdiff remove rtag status tag update > public static final LocalOption RECURSE = new LocalOption("-R"); //$NON-NLS-1$ > public static final LocalOption DO_NOT_RECURSE = new LocalOption("-l"); //$NON-NLS-1$ >+ >+ public static final LocalOption REMOVE_TAG = new LocalOption("-d"); //$NON-NLS-1$ > // valid for: checkout export update > public static final LocalOption PRUNE_EMPTY_DIRECTORIES = new LocalOption("-P"); //$NON-NLS-1$ > // valid for: checkout export update
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 73032
:
115656
|
115657
| 115776