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 148993 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 v04
clipboard.txt (text/plain), 27.94 KB, created by
Tomasz Zarna
on 2009-10-07 10:00:00 EDT
(
hide
)
Description:
Fix v04
Filename:
MIME Type:
Creator:
Tomasz Zarna
Created:
2009-10-07 10:00:00 EDT
Size:
27.94 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 7 Oct 2009 14:02:08 -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 7 Oct 2009 14:02:08 -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,21 +15,13 @@ > 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; >-import org.eclipse.core.runtime.jobs.IJobChangeListener; >+import org.eclipse.core.runtime.jobs.*; > import org.eclipse.jface.dialogs.*; > import org.eclipse.jface.operation.IRunnableWithProgress; > import org.eclipse.jface.preference.IPreferenceStore; >@@ -38,15 +30,21 @@ > 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.*; >+import org.eclipse.team.core.mapping.*; >+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.actions.CommitAction; >+import org.eclipse.team.internal.ccvs.ui.mappings.AbstractCommitAction; >+import org.eclipse.team.internal.ccvs.ui.mappings.WorkspaceSubscriberContext; > import org.eclipse.team.internal.ccvs.ui.operations.*; >-import org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoCollector; >+import org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler; > 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,71 @@ > 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 = createWorkspaceParticipant(mappings, getShell()); >+ >+ getAllOutOfSync(); >+ fUnaddedDiffs = getUnaddedResources(getDiffTree().getAffectedResources()); > } > >+ private ModelSynchronizeParticipant createWorkspaceParticipant(ResourceMapping[] selectedMappings, Shell shell) { >+ ISynchronizationScopeManager manager = WorkspaceSubscriberContext.createWorkspaceScopeManager(selectedMappings, true, CommitAction.isIncludeChangeSets(shell, CVSUIMessages.SyncAction_1)); >+ return new CommitWizardParticipant(WorkspaceSubscriberContext.createContext(manager, ISynchronizationContext.THREE_WAY), this); >+ } >+ > 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); >+ >+ ISynchronizationContext context = getParticipant().getContext(); >+ SubscriberDiffTreeEventHandler handler = (SubscriberDiffTreeEventHandler) Utils.getAdapter(context, SubscriberDiffTreeEventHandler.class); >+ handler.initializeIfNeeded(); >+ Job.getJobManager().join(context, monitor); >+ >+ 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); >+ } >+ }); > } > >+ boolean hasConflicts() { >+ IResourceDiffTree tree = getDiffTree(); >+ return tree != null && tree.hasMatchingDiffs(ResourcesPlugin.getWorkspace().getRoot().getFullPath(), new FastDiffFilter() { >+ public boolean select(IDiff diff) { >+ if (diff instanceof IThreeWayDiff) { >+ IThreeWayDiff twd = (IThreeWayDiff) diff; >+ return twd.getDirection() == IThreeWayDiff.CONFLICTING; >+ } >+ return false; >+ } >+ }); >+ } >+ > public int getHighestProblemSeverity() { >- IResource[] resources = fOutOfSyncInfos.getResources(); >+ IResource[] resources = getDiffTree().getAffectedResources(); > int mostSeriousSeverity = -1; > > for (int i = 0; i < resources.length; i++) { >@@ -227,7 +253,11 @@ > > return mostSeriousSeverity; > } >- >+ >+ IResourceDiffTree getDiffTree() { >+ return fParticipant.getContext().getDiffTree(); >+ } >+ > public CommitWizardFileTypePage getFileTypePage() { > return fFileTypePage; > } >@@ -236,7 +266,7 @@ > return fCommitPage; > } > >- public CommitWizardParticipant getParticipant() { >+ public ModelSynchronizeParticipant getParticipant() { > return fParticipant; > } > >@@ -253,25 +283,20 @@ > if (comment == null) > return false; > >- final SyncInfoSet infos= fCommitPage.getInfosToCommit(); >- if (infos.size() == 0) >- return true; >+ IResource[] resources = AbstractCommitAction.getOutgoingChanges(getDiffTree(), fCommitPage.getTraversalsToCommit(), 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 +340,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 +444,45 @@ > 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>*/(); >+ for (int i = 0; i < resources.length; i++) { >+ if (!isAdded(resources[i])) { >+ unadded.add(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.29 >diff -u -r1.29 CommitWizardCommitPage.java >--- src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java 29 Sep 2009 15:02:06 -0000 1.29 >+++ src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardCommitPage.java 7 Oct 2009 14:02:08 -0000 >@@ -15,8 +15,10 @@ > 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.core.runtime.IPath; >+import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.jface.dialogs.*; > import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.jface.layout.GridLayoutFactory; >@@ -33,16 +35,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.core.diff.*; > 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.ui.synchronize.*; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.part.PageBook; >@@ -88,6 +87,18 @@ > fCommentArea.setProposedComment(getProposedComment(resources)); > if (resources.length > 0) > fCommentArea.setProject(resources[0].getProject()); >+ fWizard.getDiffTree().addDiffChangeListener(new IDiffChangeListener() { >+ public void propertyChanged(IDiffTree tree, int property, IPath[] paths) { >+ // ignore property changes >+ } >+ public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) { >+ Utils.syncExec(new Runnable() { >+ public void run() { >+ updateEnablements(); >+ } >+ }, CommitWizardCommitPage.this.getControl()); >+ } >+ }); > } > > /* (non-Javadoc) >@@ -166,8 +177,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); >@@ -203,7 +214,7 @@ > ((Composite)getControl()).layout(); > } > >- private Control createChangesPage(final Composite composite, CommitWizardParticipant participant) { >+ private Control createChangesPage(final Composite composite, ISynchronizeParticipant participant) { > fConfiguration= participant.createPageConfiguration(); > CompareConfiguration cc = new CompareConfiguration(); > cc.setLeftEditable(false); >@@ -214,27 +225,26 @@ > return control; > } > >- private class CommitWizardParticipantPageCompareEditorInput extends ParticipantPageCompareEditorInput { >+ private class CommitWizardParticipantPageCompareEditorInput extends >+ ParticipantPageCompareEditorInput { > public CommitWizardParticipantPageCompareEditorInput( > CompareConfiguration cc, > ISynchronizePageConfiguration configuration, >- CommitWizardParticipant participant) { >+ ISynchronizeParticipant participant) { > super(cc, configuration, participant); > } > > protected boolean isOfferToRememberParticipant() { > return false; > } >- >+ > protected CompareViewerSwitchingPane createContentViewerSwitchingPane( > Splitter parent, int style, CompareEditorInput cei) { > return super.createContentViewerSwitchingPane(horizontalSash, style, cei); > } >- >- protected CompareViewerPane createStructureInputPane(Composite parent) { >- CompareViewerPane pane = super.createStructureInputPane(parent); >- pane.setText(TeamUIMessages.ParticipantPageSaveablePart_0); >- return pane; >+ >+ protected void setPageDescription(String title) { >+ super.setPageDescription(TeamUIMessages.ParticipantPageSaveablePart_0); > } > } > >@@ -292,9 +302,10 @@ > final Viewer viewer= fConfiguration.getPage().getViewer(); > viewer.refresh(); > } >- fCommentArea.setFocus(); >+ updateEnablements(); >+ setFocus(); > } >- >+ > protected void expand() { > if (fConfiguration != null) { > final Viewer viewer= fConfiguration.getPage().getViewer(); >@@ -324,11 +335,10 @@ > fHasConflicts = false; > fIsEmpty = false; > >- SyncInfoSet set = fConfiguration.getSyncInfoSet(); >- if (set.hasConflicts()) { >+ if (fWizard.hasConflicts()) { > fHasConflicts = true; > } >- if (set.isEmpty()) { >+ if (!fWizard.hasOutgoingChanges()) { > fIsEmpty = true; > } > } >@@ -373,28 +383,11 @@ > protected IWizardContainer getContainer() { > 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[] getTraversalsToCommit() { >+ return fWizard.getParticipant().getContext().getScope().getTraversals(); > } >- >+ > /* (non-Javadoc) > * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) > */ >Index: src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java,v >retrieving revision 1.11 >diff -u -r1.11 CommitWizardParticipant.java >--- src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java 29 Sep 2009 15:02:06 -0000 1.11 >+++ src/org/eclipse/team/internal/ccvs/ui/wizards/CommitWizardParticipant.java 7 Oct 2009 14:02:08 -0000 >@@ -16,24 +16,26 @@ > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; >-import org.eclipse.jface.action.Action; >+import org.eclipse.jface.action.*; > import org.eclipse.jface.dialogs.IDialogSettings; > import org.eclipse.jface.operation.IRunnableContext; > import org.eclipse.jface.operation.IRunnableWithProgress; > import org.eclipse.jface.viewers.*; > import org.eclipse.swt.widgets.Display; >+import org.eclipse.team.core.mapping.provider.SynchronizationContext; > import org.eclipse.team.internal.ccvs.ui.CVSDecoration; > import org.eclipse.team.internal.ccvs.ui.Policy; >+import org.eclipse.team.internal.ccvs.ui.mappings.WorkspaceModelParticipant; > import org.eclipse.team.internal.ccvs.ui.subscriber.CVSParticipantLabelDecorator; >-import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant; > import org.eclipse.team.internal.ui.Utils; >-import org.eclipse.team.internal.ui.synchronize.*; >+import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration; >+import org.eclipse.team.ui.mapping.SynchronizationActionProvider; > import org.eclipse.team.ui.synchronize.*; > > /** > * A participant that uses our decorator instead of the standard one. > */ >-public class CommitWizardParticipant extends WorkspaceSynchronizeParticipant { >+public class CommitWizardParticipant extends WorkspaceModelParticipant { > > /** > * The actions to be displayed in the context menu. >@@ -79,31 +81,27 @@ > final CommitWizard fWizard; > protected Action showComparePaneAction; > >- public CommitWizardParticipant(ISynchronizeScope scope, CommitWizard wizard) { >- super(scope); >+ public CommitWizardParticipant(SynchronizationContext context, CommitWizard wizard) { >+ super(context); > fWizard= wizard; > } > > protected ILabelDecorator getLabelDecorator(ISynchronizePageConfiguration configuration) { > return new Decorator(configuration, fWizard); > } >- >- public ChangeSetCapability getChangeSetCapability() { >- return null; // we don't want that button >- } >- >+ > /* (non-Javadoc) > * @see org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration) > */ >- protected void initializeConfiguration( final ISynchronizePageConfiguration configuration) { >+ protected void initializeConfiguration(final ISynchronizePageConfiguration configuration) { > super.initializeConfiguration(configuration); >- configuration.setProperty(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String[] {ACTION_GROUP, ISynchronizePageConfiguration.LAYOUT_GROUP}); >+ configuration.setProperty(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String[] {ACTION_GROUP, ISynchronizePageConfiguration.NAVIGATE_GROUP}); > configuration.setProperty(ISynchronizePageConfiguration.P_CONTEXT_MENU, ISynchronizePageConfiguration.DEFAULT_CONTEXT_MENU); > configuration.addMenuGroup( > ISynchronizePageConfiguration.P_CONTEXT_MENU, > CONTEXT_MENU_CONTRIBUTION_GROUP_3); > configuration.addActionContribution(new ActionContribution()); >- >+ > // Wrap the container so that we can update the enablements after the runnable > // (i.e. the container resets the state to what it was at the beginning of the > // run even if the state of the page changed. Remove from View changes the state) >@@ -137,7 +135,7 @@ > ISelection selection = configuration.getSite().getSelectionProvider().getSelection(); > if(selection instanceof IStructuredSelection) { > final Object obj = ((IStructuredSelection) selection).getFirstElement(); >- if (obj instanceof SyncInfoModelElement) { >+ if (fWizard.getParticipant().hasCompareInputFor(obj)) { > fWizard.getCommitPage().showComparePane(true); > showComparePaneAction.setChecked(true); > } >@@ -157,4 +155,27 @@ > IDialogSettings section = fWizard.getDialogSettings().getSection(CommitWizard.COMMIT_WIZARD_DIALOG_SETTINGS); > return section == null ? false : section.getBoolean(CommitWizardCommitPage.SHOW_COMPARE); > } >+ >+ protected ModelSynchronizeParticipantActionGroup createMergeActionGroup() { >+ return new WorkspaceMergeActionGroup() { >+ protected void addToContextMenu(String mergeActionId, Action action, IMenuManager manager) { >+ if (mergeActionId == SynchronizationActionProvider.MERGE_ACTION_ID >+ || mergeActionId == SynchronizationActionProvider.OVERWRITE_ACTION_ID >+ || mergeActionId == SynchronizationActionProvider.MARK_AS_MERGE_ACTION_ID) { >+ // skip merge actions >+ return; >+ } >+ super.addToContextMenu(mergeActionId, action, manager); >+ } >+ >+ protected void appendToGroup(String menuId, String groupId, IAction action) { >+ if (menuId == ISynchronizePageConfiguration.P_CONTEXT_MENU >+ && groupId == WorkspaceModelParticipant.CONTEXT_MENU_COMMIT_GROUP_1) { >+ // skip commit action >+ return; >+ } >+ super.appendToGroup(menuId, groupId, action); >+ } >+ }; >+ } > }
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