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 59953 Details for
Bug 111164
[Change Sets] Select and Commit Multiple Commit Sets at once
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Non blocking
111164_v2.txt (text/plain), 11.62 KB, created by
Krzysztof Daniel
on 2007-02-28 02:54:46 EST
(
hide
)
Description:
Non blocking
Filename:
MIME Type:
Creator:
Krzysztof Daniel
Created:
2007-02-28 02:54:46 EST
Size:
11.62 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.59 >diff -u -r1.59 CVSUIMessages.java >--- src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java 13 Feb 2007 15:11:21 -0000 1.59 >+++ src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java 26 Feb 2007 09:45:37 -0000 >@@ -1136,4 +1136,7 @@ > public static String NewLocationWizard_2; > public static String NewLocationWizard_3; > public static String NewLocationWizard_4; >+ >+ public static String AbstractCommitAction_ChangeSetsCommitDialogTitle; >+ public static String AbstractCommitAction_ChangeSetsCommitDialogMessage; > } >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.503 >diff -u -r1.503 messages.properties >--- src/org/eclipse/team/internal/ccvs/ui/messages.properties 13 Feb 2007 15:11:21 -0000 1.503 >+++ src/org/eclipse/team/internal/ccvs/ui/messages.properties 26 Feb 2007 09:45:37 -0000 >@@ -1159,3 +1159,6 @@ > AnnotatePreferencePage_AnnotatePrefPageTitle=Annotate > AnnotatePreferencePage_AnnotatePrefPageMessage=Options for CVS Annotate: > AnnotatePreferencePage_AnnotatePrefPageBinaryFileMessage=Attempt to annotate a &binary file >+ >+AbstractCommitAction_ChangeSetsCommitDialogTitle=Change sets commit >+AbstractCommitAction_ChangeSetsCommitDialogMessage=Do you want to automatically commit selected change sets with previously entered comments? >\ No newline at end of file >Index: src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractCommitAction.java >--- src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java 3 Jan 2007 21:16:29 -0000 1.2 >+++ src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java 26 Feb 2007 09:45:37 -0000 >@@ -11,23 +11,29 @@ > package org.eclipse.team.internal.ccvs.ui.mappings; > > import java.lang.reflect.InvocationTargetException; >-import java.util.ArrayList; >-import java.util.List; >+import java.util.*; > > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.mapping.ResourceTraversal; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.operation.IRunnableWithProgress; > import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.swt.widgets.Shell; > import org.eclipse.team.core.diff.IDiff; > import org.eclipse.team.core.diff.IThreeWayDiff; > import org.eclipse.team.core.mapping.IResourceDiffTree; > import org.eclipse.team.core.mapping.provider.ResourceDiffTree; > import org.eclipse.team.internal.ccvs.core.CVSException; >+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages; > import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; > import org.eclipse.team.internal.ccvs.ui.wizards.CommitWizard; >+import org.eclipse.team.internal.ccvs.ui.wizards.CommitWizard.AddAndCommitOperation; >+import org.eclipse.team.internal.core.subscribers.ChangeSet; >+import org.eclipse.team.internal.ui.Policy; > import org.eclipse.team.internal.ui.Utils; > import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration; > import org.eclipse.ui.PlatformUI; >@@ -60,6 +66,19 @@ > } catch (InterruptedException e) { > // Ignore > } >+ >+ >+ final List changeSetsOperations = new ArrayList(); >+ //check if there are selected change sets >+ if(selectedChangeSets(selection)){ >+ boolean canContinue = handleChangeSets(resources, selection, >+ changeSetsOperations); >+ if(!canContinue){ //action cancelled >+ return; >+ } >+ } >+ >+ //launch commit wizard > if (!resources.isEmpty() && ((IResource[])resources.get(0)).length > 0) { > Shell shell= getConfiguration().getSite().getShell(); > try { >@@ -68,16 +87,105 @@ > CVSUIPlugin.log(e); > } > } >+ >+ if(changeSetsOperations.size() > 0){ >+ try { >+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { >+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { >+ ((ChangeSetsCommitOperation) changeSetsOperations.get(0)).run(monitor); >+ } >+ }); >+ } catch (InvocationTargetException e) { >+ Utils.handleError(getConfiguration().getSite().getShell(), e, null, null); >+ } catch (InterruptedException e) { >+ // Ignore >+ } >+ >+ } >+ } >+ >+ private boolean selectedChangeSets(final IStructuredSelection selection) { >+ final Object [] selectionAsArray = selection.toArray(); >+ for(int i = 0; i < selectionAsArray.length; i++){ >+ if((selectionAsArray[i] instanceof ChangeSet) ){ >+ return true; >+ } >+ } >+ return false; >+ } >+ >+ /* splits the selection into resources to commit and commit sets */ >+ private boolean handleChangeSets(final List resources, >+ final IStructuredSelection selection, final List changeSetsOperations) { >+ MessageDialog question = new MessageDialog(getConfiguration().getSite().getShell(), >+ CVSUIMessages.AbstractCommitAction_ChangeSetsCommitDialogTitle, null, >+ CVSUIMessages.AbstractCommitAction_ChangeSetsCommitDialogMessage, MessageDialog.QUESTION, >+ new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, >+ IDialogConstants.CANCEL_LABEL}, 0); >+ question.setBlockOnOpen(true); >+ int result = question.open(); >+ if(result == IDialogConstants.CANCEL_ID){ >+ return false; >+ } >+ if(result == IDialogConstants.OK_ID){ >+ try { >+ PlatformUI.getWorkbench().getProgressService() >+ .busyCursorWhile(new IRunnableWithProgress() { >+ public void run(IProgressMonitor monitor) >+ throws InvocationTargetException, InterruptedException { >+ try { >+ final Object [] selectionAsArray = selection.toArray(); >+ final List changeSets = new ArrayList(); >+ for(int i = 0; i < selectionAsArray.length; i++){ >+ if((selectionAsArray[i] instanceof ChangeSet) ){ >+ changeSets.add(selectionAsArray[i]); >+ } >+ } >+ ResourceTraversal[] traversals = getCommitTraversals( >+ changeSets, monitor); >+ >+ List changeSetsResources = Arrays.asList( >+ getOutgoingChanges( >+ getSynchronizationContext().getDiffTree(), >+ traversals, monitor)); >+ List resourcesList = new ArrayList( >+ Arrays.asList((IResource[]) resources.get(0))); >+ >+ resourcesList.removeAll(changeSetsResources); >+ >+ resources.clear(); >+ resources.add((IResource[])resourcesList.toArray( >+ new IResource[]{})); >+ >+ changeSetsOperations.add(new ChangeSetsCommitOperation( >+ (ChangeSet[])changeSets.toArray(new ChangeSet[]{}))); >+ } catch (CoreException e) { >+ throw new InvocationTargetException(e); >+ } >+ } >+ }); >+ } catch (InvocationTargetException e) { >+ Utils.handleError(getConfiguration().getSite().getShell(), e, null, null); >+ } catch (InterruptedException e) { >+ // Ignore >+ } >+ } >+ return true; > } > > protected IStructuredSelection getActualSelection() { > return getStructuredSelection(); > } >+ >+ private ResourceTraversal[] getCommitTraversals(final List changeSets, >+ IProgressMonitor monitor) throws CoreException{ >+ return getCommitTraversals(new StructuredSelection(changeSets), monitor); >+ } > > protected abstract ResourceTraversal[] getCommitTraversals(IStructuredSelection selection, IProgressMonitor monitor) throws CoreException; > >- protected IResource[] getOutgoingChanges(final IResourceDiffTree tree, ResourceTraversal[] traversals, IProgressMonitor monitor) { >- final List resources = new ArrayList(); >+ protected IResource[] getOutgoingChanges(final IResourceDiffTree tree, ResourceTraversal[] traversals, IProgressMonitor monitor) { >+ final List resources = new ArrayList(); > IDiff[] diffs = tree.getDiffs(traversals); > for (int i = 0; i < diffs.length; i++) { > IDiff diff = diffs[i]; >@@ -88,8 +196,8 @@ > } > } > return (IResource[]) resources.toArray(new IResource[resources.size()]); >- } >- >+ } >+ > private boolean hasLocalChange(IDiff diff) { > if (diff instanceof IThreeWayDiff) { > IThreeWayDiff twd = (IThreeWayDiff) diff; >@@ -99,4 +207,59 @@ > return false; > } > >+ private class ChangeSetsCommitOperation implements IRunnableWithProgress { >+ private final ChangeSet[] changeSets; >+ >+ private ChangeSetsCommitOperation(ChangeSet[] changeSets) { >+ this.changeSets = changeSets; >+ } >+ >+ public void run(IProgressMonitor monitor) >+ throws InvocationTargetException, InterruptedException { >+ monitor.beginTask(null, changeSets.length * 100); >+ for (int i = 0; i < changeSets.length; i++) { >+ ChangeSet changeSet = (ChangeSet) changeSets[i]; >+ IResource[] setResources = changeSet.getResources(); >+ IResource[] toAddArray = null; >+ try { >+ toAddArray = findToAddResources(setResources); >+ } catch (CVSException e) { >+ Utils.handleError(getConfiguration().getSite().getShell(), >+ e, null, null); >+ return; >+ } >+ String comment = getComment(changeSet); >+ AddAndCommitOperation op = new AddAndCommitOperation( >+ getConfiguration().getSite().getPart(), setResources, >+ toAddArray, comment); >+ op.run(Policy.subMonitorFor(monitor, 100)); >+ } >+ } >+ >+ private IResource[] findToAddResources(IResource[] setResources) >+ throws CVSException { >+ List toAdd = new ArrayList(); >+ for (int j = 0; j < setResources.length; j++) { >+ if (!CommitWizard.isAdded(setResources[j])) { >+ toAdd.add(setResources[j]); >+ } >+ } >+ >+ IResource[] toAddArray = new IResource[toAdd.size()]; >+ for (int j = 0; j < toAdd.size(); j++) { >+ toAddArray[j] = (IResource) toAdd.get(j); >+ } >+ >+ return toAddArray; >+ } >+ >+ private String getComment(ChangeSet changeSet) { >+ String comment = changeSet.getComment(); >+ if (comment == null) { >+ comment = changeSet.getName(); >+ } >+ return comment; >+ } >+ } >+ > } >Index: src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java,v >retrieving revision 1.33 >diff -u -r1.33 CommitWizard.java >--- src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java 27 Nov 2006 15:39:59 -0000 1.33 >+++ src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java 26 Feb 2007 09:45:38 -0000 >@@ -447,7 +447,7 @@ > return files; > } > >- private static boolean isAdded(IResource resource) throws CVSException { >+ public static boolean isAdded(IResource resource) throws CVSException { > final ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource); > if (cvsResource.isFolder()) { > return ((ICVSFolder)cvsResource).isCVSFolder();
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 111164
:
59120
|
59648
|
59953
|
60364
|
83334