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 115656 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.
The patch to fix this bug(Based on the code 20081020)
removeTagAction.patch.txt (text/plain), 27.86 KB, created by
Frank Zhang
on 2008-10-21 01:20:54 EDT
(
hide
)
Description:
The patch to fix this bug(Based on the code 20081020)
Filename:
MIME Type:
Creator:
Frank Zhang
Created:
2008-10-21 01:20:54 EDT
Size:
27.86 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.team.cvs.core >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 21 Oct 2008 05:17:37 -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 >#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 21 Oct 2008 05:17:49 -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 >@@ -27,6 +30,10 @@ > // IBM Corporation - initial API and implementation > // > >+ public static String TagAction_removeTag; >+ public static String TagAction_removeTagProblemsMessage; >+ public static String TagAction_removeTagProblemsMessageMultiple; >+ > static { > // load message values from bundle file > NLS.initializeMessages(BUNDLE_NAME, CVSUIMessages.class); >@@ -615,6 +622,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; >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 21 Oct 2008 05:17:50 -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 21 Oct 2008 05:17:52 -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,6 +585,9 @@ > 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. >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 21 Oct 2008 05:17:47 -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,14 @@ > menubarPath="tagGroup" > id="org.eclipse.team.ccvs.ui.tagInRepository"> > </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="tagGroup" >+ tooltip="%RemoveTagAction.tooltip"> >+ </action> > </objectContribution> > <objectContribution > adaptable="false" >@@ -1146,6 +1162,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" >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 21 Oct 2008 05:17:43 -0000 >@@ -120,6 +120,9 @@ > TagAction.name=Tag as Version > TagAction.tooltip=Tag the resources with a CVS version tag > >+RemoveTagAction.label=&Remove Tag... >+RemoveTagAction.tooltip=Remove a existing tag >+ > TagInRepositoryAction.label=&Tag as Version... > TagInRepositoryAction.name=Tag as Version > TagInRepositoryAction.tooltip=Tag the resources with a CVS version tag >Index: src/org/eclipse/team/internal/ccvs/ui/actions/TagRemoveDialog.java >=================================================================== >RCS file: src/org/eclipse/team/internal/ccvs/ui/actions/TagRemoveDialog.java >diff -N src/org/eclipse/team/internal/ccvs/ui/actions/TagRemoveDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/internal/ccvs/ui/actions/TagRemoveDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,234 @@ >+package org.eclipse.team.internal.ccvs.ui.actions; >+ >+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; >+ } >+} >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,102 @@ >+/******************************************************************************* >+ * 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; >+ >+ >+/** >+ * @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(); >+ >+ >+ >+ } >+}
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 Raw
Actions:
View
Attachments on
bug 73032
:
115656
|
115657
|
115776