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 147999 Details for
Bug 124039
[Wizards] Show model sync in commit dialog
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Fix v01
patch_20090924f.txt (text/plain), 19.69 KB, created by
Tomasz Zarna
on 2009-09-24 08:33:30 EDT
(
hide
)
Description:
Fix v01
Filename:
MIME Type:
Creator:
Tomasz Zarna
Created:
2009-09-24 08:33:30 EDT
Size:
19.69 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.team.cvs.ui >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.4 >diff -u -r1.4 AbstractCommitAction.java >--- src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java 18 Apr 2007 20:27:08 -0000 1.4 >+++ src/org/eclipse/team/internal/ccvs/ui/mappings/AbstractCommitAction.java 24 Sep 2009 12:25:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2007 IBM Corporation and others. >+ * Copyright (c) 2006, 2009 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 >@@ -78,7 +78,7 @@ > > protected abstract ResourceTraversal[] getCommitTraversals(IStructuredSelection selection, IProgressMonitor monitor) throws CoreException; > >- protected IResource[] getOutgoingChanges(final IResourceDiffTree tree, ResourceTraversal[] traversals, IProgressMonitor monitor) { >+ public static 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++) { >@@ -92,7 +92,7 @@ > return (IResource[]) resources.toArray(new IResource[resources.size()]); > } > >- private boolean hasLocalChange(IDiff diff) { >+ public static boolean hasLocalChange(IDiff diff) { > if (diff instanceof IThreeWayDiff) { > IThreeWayDiff twd = (IThreeWayDiff) diff; > return twd.getDirection() == IThreeWayDiff.OUTGOING >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.39 >diff -u -r1.39 CommitWizard.java >--- src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java 22 Nov 2007 12:55:10 -0000 1.39 >+++ src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizard.java 24 Sep 2009 12:25:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 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 >@@ -15,17 +15,10 @@ > package org.eclipse.team.internal.ccvs.ui.wizards; > > import java.lang.reflect.InvocationTargetException; >-import java.util.ArrayList; >-import java.util.Arrays; >-import java.util.Collection; >-import java.util.Collections; >-import java.util.HashMap; >-import java.util.HashSet; >-import java.util.Iterator; >-import java.util.List; >-import java.util.Map; >+import java.util.*; > > import org.eclipse.core.resources.*; >+import org.eclipse.core.resources.mapping.ResourceMapping; > import org.eclipse.core.resources.mapping.ResourceTraversal; > import org.eclipse.core.runtime.*; > import org.eclipse.core.runtime.jobs.IJobChangeEvent; >@@ -38,15 +31,20 @@ > import org.eclipse.swt.widgets.Shell; > import org.eclipse.team.core.IFileContentManager; > import org.eclipse.team.core.Team; >-import org.eclipse.team.core.synchronize.*; >+import org.eclipse.team.core.diff.FastDiffFilter; >+import org.eclipse.team.core.diff.IDiff; >+import org.eclipse.team.core.mapping.IResourceDiffTree; >+import org.eclipse.team.core.synchronize.SyncInfoSet; > import org.eclipse.team.internal.ccvs.core.*; > 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.*; >+import org.eclipse.team.internal.ccvs.ui.mappings.AbstractCommitAction; >+import org.eclipse.team.internal.ccvs.ui.mappings.ModelSynchronizeWizard; > import org.eclipse.team.internal.ccvs.ui.operations.*; >-import org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoCollector; > import org.eclipse.team.internal.ui.Policy; >-import org.eclipse.team.ui.synchronize.ResourceScope; >+import org.eclipse.team.internal.ui.Utils; >+import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant; > import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.PlatformUI; > >@@ -154,9 +152,8 @@ > } > > private final IResource[] fResources; >- private final SyncInfoSet fOutOfSyncInfos; >- private final SyncInfoSet fUnaddedInfos; >- private final CommitWizardParticipant fParticipant; >+ private IResource[] fUnaddedDiffs; >+ private final ModelSynchronizeParticipant fParticipant; > > private CommitWizardFileTypePage fFileTypePage; > private CommitWizardCommitPage fCommitPage; >@@ -176,42 +173,53 @@ > setDefaultPageImageDescriptor(CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_NEW_LOCATION)); > > fResources= resources; >- fParticipant= new CommitWizardParticipant(new ResourceScope(fResources), this); >- >- SyncInfoSet infos = getAllOutOfSync(); >- fOutOfSyncInfos= new SyncInfoSet(infos.getNodes(new FastSyncInfoFilter.SyncInfoDirectionFilter(new int [] { SyncInfo.OUTGOING, SyncInfo.CONFLICTING }))); >- fUnaddedInfos= getUnaddedInfos(fOutOfSyncInfos); >- } >+ ResourceMapping[] mappings = Utils.getResourceMappings(resources); >+ fParticipant = (ModelSynchronizeParticipant) ModelSynchronizeWizard.createWorkspaceParticipant(mappings, getShell()); >+// fParticipant.setMergingEnabled(false); > >+ getAllOutOfSync(); >+ fUnaddedDiffs= getUnaddedResources(getDiffTree().getAffectedResources()); >+ } >+ > public CommitWizard(SyncInfoSet infos, IJobChangeListener jobListener) throws CVSException { > this(infos); > this.jobListener = jobListener; > } > >- private SyncInfoSet getAllOutOfSync() throws CVSException { >- final SubscriberSyncInfoCollector syncInfoCollector = fParticipant.getSubscriberSyncInfoCollector(); >- try { >- PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() { >- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { >- monitor.beginTask(CVSUIMessages.CommitWizard_4, IProgressMonitor.UNKNOWN); >- syncInfoCollector.waitForCollector(monitor); >- monitor.done(); >- } >- }); >- } catch (InvocationTargetException e) { >- throw CVSException.wrapException(e); >- } catch (InterruptedException e) { >- throw new OperationCanceledException(); >- } >- return fParticipant.getSyncInfoSet(); >+ private void getAllOutOfSync() throws CVSException { >+ try { >+ PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() { >+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { >+ monitor.beginTask(null, IProgressMonitor.UNKNOWN); >+ try { >+ getParticipant().getContext().refresh(Utils.getResourceMappings(fResources), monitor); >+ } catch (CoreException e) { >+ throw new InvocationTargetException(e); >+ } >+ if (monitor.isCanceled()) { >+ throw new InterruptedException(); >+ } >+ monitor.done(); >+ } >+ }); >+ } catch (InvocationTargetException e) { >+ throw CVSException.wrapException(e); >+ } catch(InterruptedException e) { >+ throw new OperationCanceledException(); >+ } > } > > public boolean hasOutgoingChanges() { >- return fOutOfSyncInfos.size() > 0; >+ IResourceDiffTree tree = getDiffTree(); >+ return tree != null && tree.hasMatchingDiffs(ResourcesPlugin.getWorkspace().getRoot().getFullPath(), new FastDiffFilter() { >+ public boolean select(IDiff diff) { >+ return AbstractCommitAction.hasLocalChange(diff); >+ } >+ }); > } > > public int getHighestProblemSeverity() { >- IResource[] resources = fOutOfSyncInfos.getResources(); >+ IResource[] resources = getDiffTree().getAffectedResources(); > int mostSeriousSeverity = -1; > > for (int i = 0; i < resources.length; i++) { >@@ -227,6 +235,10 @@ > > return mostSeriousSeverity; > } >+ >+ IResourceDiffTree getDiffTree() { >+ return fParticipant.getContext().getDiffTree(); >+ } > > public CommitWizardFileTypePage getFileTypePage() { > return fFileTypePage; >@@ -236,7 +248,7 @@ > return fCommitPage; > } > >- public CommitWizardParticipant getParticipant() { >+ public ModelSynchronizeParticipant getParticipant() { > return fParticipant; > } > >@@ -253,25 +265,20 @@ > if (comment == null) > return false; > >- final SyncInfoSet infos= fCommitPage.getInfosToCommit(); >- if (infos.size() == 0) >- return true; >+ IResource[] resources = AbstractCommitAction.getOutgoingChanges(getDiffTree(), fCommitPage.getCommitTraversals(), null); >+ if (resources.length == 0) >+ return true; > >- final SyncInfoSet unadded; >+ final IResource[] unadded; > try { >- unadded = getUnaddedInfos(infos); >+ unadded = getUnaddedResources(resources); > } catch (CVSException e1) { > return false; > } > >- final SyncInfoSet files; >- try { >- files = getFiles(infos); >- } catch (CVSException e1) { >- return false; >- } >+ final IResource[] files = getFiles(resources); > >- final AddAndCommitOperation operation= new AddAndCommitOperation(getPart(), files.getResources(), unadded.getResources(), comment); >+ final AddAndCommitOperation operation= new AddAndCommitOperation(getPart(), files, unadded, comment); > if (jobListener != null) > operation.setJobChangeListener(jobListener); > >@@ -315,7 +322,7 @@ > > final Collection names= new HashSet(); > final Collection extensions= new HashSet(); >- getUnknownNamesAndExtension(fUnaddedInfos, names, extensions); >+ getUnknownNamesAndExtension(fUnaddedDiffs, names, extensions); > > if (names.size() + extensions.size() > 0) { > fFileTypePage= new CommitWizardFileTypePage(extensions, names); >@@ -419,50 +426,46 @@ > return dialog.open(); > } > >- private static void getUnknownNamesAndExtension(SyncInfoSet infos, Collection names, Collection extensions) { >- >- final IFileContentManager manager= Team.getFileContentManager(); >- >- for (final Iterator iter = infos.iterator(); iter.hasNext();) { >- >- final SyncInfo info = (SyncInfo)iter.next(); >- >- IResource local = info.getLocal(); >- if (local instanceof IFile && manager.getType((IFile)local) == Team.UNKNOWN) { >- final String extension= local.getFileExtension(); >- if (extension != null && !manager.isKnownExtension(extension)) { >- extensions.add(extension); >- } >- >- final String name= local.getName(); >- if (extension == null && name != null && !manager.isKnownFilename(name)) >- names.add(name); >- } >- } >- } >- >- private static SyncInfoSet getUnaddedInfos(SyncInfoSet infos) throws CVSException { >- final SyncInfoSet unadded= new SyncInfoSet(); >- for (final Iterator iter = infos.iterator(); iter.hasNext();) { >- final SyncInfo info = (SyncInfo) iter.next(); >- final IResource resource= info.getLocal(); >- if (!isAdded(resource)) >- unadded.add(info); >- } >- return unadded; >- } >- >- private static SyncInfoSet getFiles(SyncInfoSet infos) throws CVSException { >- final SyncInfoSet files= new SyncInfoSet(); >- for (final Iterator iter = infos.iterator(); iter.hasNext();) { >- final SyncInfo info = (SyncInfo) iter.next(); >- final IResource resource= info.getLocal(); >- if (resource.getType() == IResource.FILE) >- files.add(info); >- } >- return files; >+ private void getUnknownNamesAndExtension(IResource[] resources, Collection names, Collection extensions) { >+ >+ final IFileContentManager manager= Team.getFileContentManager(); >+ >+ for (int i = 0; i < resources.length; i++) { >+ >+ IResource local = resources[i]; >+ if (local instanceof IFile && manager.getType((IFile)local) == Team.UNKNOWN) { >+ final String extension= local.getFileExtension(); >+ if (extension != null && !manager.isKnownExtension(extension)) { >+ extensions.add(extension); >+ } >+ >+ final String name= local.getName(); >+ if (extension == null && name != null && !manager.isKnownFilename(name)) >+ names.add(name); >+ } >+ } > } > >+ private IResource[] getUnaddedResources(IResource[] resources) throws CVSException { >+ List/*<IResource>*/ unadded = new ArrayList/*<IResource>*/(); >+ IResourceDiffTree diffTree = getDiffTree(); >+ for (int i = 0; i < resources.length; i++) { >+ if (!isAdded(resources[i])) { >+ unadded.add(diffTree.getDiff(resources[i])); >+ } >+ } >+ return (IResource[]) unadded.toArray(new IResource[0]); >+ } >+ >+ private IResource[] getFiles(IResource[] resources) { >+ final List files = new ArrayList(); >+ for (int i = 0; i < resources.length; i++) { >+ if (resources[i].getType() == IResource.FILE) >+ files.add(resources[i]); >+ } >+ return (IResource[]) files.toArray(new IResource[0]); >+ } >+ > private static boolean isAdded(IResource resource) throws CVSException { > final ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource); > if (cvsResource.isFolder()) { >Index: src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java,v >retrieving revision 1.28 >diff -u -r1.28 CommitWizardCommitPage.java >--- src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java 13 Sep 2007 15:38:50 -0000 1.28 >+++ src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java 24 Sep 2009 12:25:40 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 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 >@@ -15,8 +15,8 @@ > import java.util.Arrays; > > import org.eclipse.compare.*; >-import org.eclipse.compare.structuremergeviewer.IDiffElement; > import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.mapping.ResourceTraversal; > import org.eclipse.jface.dialogs.*; > import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.jface.layout.GridLayoutFactory; >@@ -33,16 +33,13 @@ > import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.widgets.*; >-import org.eclipse.team.core.synchronize.SyncInfo; > import org.eclipse.team.core.synchronize.SyncInfoSet; > import org.eclipse.team.internal.ccvs.ui.*; >-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds; > import org.eclipse.team.internal.ccvs.ui.mappings.ChangeSetComparator; > import org.eclipse.team.internal.core.subscribers.ActiveChangeSet; > import org.eclipse.team.internal.core.subscribers.ChangeSet; >-import org.eclipse.team.internal.ui.*; >-import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement; >-import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration; >+import org.eclipse.team.internal.ui.PixelConverter; >+import org.eclipse.team.internal.ui.SWTUtils; > import org.eclipse.team.ui.synchronize.*; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.part.PageBook; >@@ -182,8 +179,8 @@ > > private void createChangesArea(Composite parent, PixelConverter converter) { > >- CommitWizardParticipant participant= fWizard.getParticipant(); >- int size = participant.getSyncInfoSet().size(); >+ ISynchronizeParticipant participant= fWizard.getParticipant(); >+ int size = fWizard.getDiffTree().getAffectedResources().length; > if (size > getFileDisplayThreshold()) { > // Create a page book to allow eventual inclusion of changes > bottomChild = new PageBook(parent, SWT.NONE); >@@ -219,9 +216,17 @@ > ((Composite)getControl()).layout(); > } > >- private Control createChangesPage(final Composite composite, CommitWizardParticipant participant) { >- fConfiguration= participant.createPageConfiguration(); >- fPagePane= new ParticipantPagePane(getShell(), true /* modal */, fConfiguration, participant); >+ private Control createChangesPage(final Composite composite, ISynchronizeParticipant synchronizeParticipant) { >+ fConfiguration= synchronizeParticipant.createPageConfiguration(); >+// fConfiguration.setProperty(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String[] {ISynchronizePageConfiguration.NAVIGATE_GROUP, ISynchronizePageConfiguration.LAYOUT_GROUP/*, SharingWizardPageActionGroup.ACTION_GROUP*/}); >+// fConfiguration.setProperty(ISynchronizePageConfiguration.P_CONTEXT_MENU, new String[] {ISynchronizePageConfiguration.NAVIGATE_GROUP}); >+// fConfiguration.addActionContribution(sharingWizardPageActionGroup); >+ //TODO: remove most of the context actions >+ // IS: Synchronize, Remove, Expand | Update, Commit | Overwrite, Mark | Add to .cvsignore >+ // SHOULD BE: Remove, Expand | Add to .cvsignore >+ fConfiguration.setRunnableContext(getContainer()); >+// fConfiguration.setSupportedModes(modes) >+ fPagePane= new ParticipantPagePane(getShell(), true /* modal */, fConfiguration, synchronizeParticipant); > Control control = fPagePane.createPartControl(composite); > return control; > } >@@ -362,25 +367,8 @@ > return super.getContainer(); > } > >- public SyncInfoSet getInfosToCommit() { >- >- final SyncInfoSet infos= new SyncInfoSet(); >- if (fConfiguration == null) { >- return fWizard.getParticipant().getSyncInfoSet(); >- } >- >- final IDiffElement root = (ISynchronizeModelElement)fConfiguration.getProperty(SynchronizePageConfiguration.P_MODEL); >- final IDiffElement [] elements= Utils.getDiffNodes(new IDiffElement [] { root }); >- >- for (int i = 0; i < elements.length; i++) { >- if (elements[i] instanceof SyncInfoModelElement) { >- SyncInfo syncInfo = ((SyncInfoModelElement)elements[i]).getSyncInfo(); >- int direction = syncInfo.getKind() & SyncInfo.DIRECTION_MASK; >- if (direction == SyncInfo.OUTGOING || direction == SyncInfo.CONFLICTING) >- infos.add(syncInfo); >- } >- } >- return infos; >+ ResourceTraversal[] getCommitTraversals() { >+ return fWizard.getParticipant().getContext().getScope().getTraversals(); > } > > /* (non-Javadoc)
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 124039
:
147999
|
148000
|
148539
|
148896
|
148993