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 155866 Details for
Bug 298923
[Sync View][Apply patch] Merge changes from dev branch back to HEAD
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
ongoing work in o.e.team.ui
patch2_teamui.txt (text/plain), 19.39 KB, created by
Tomasz Zarna
on 2010-01-12 10:05:08 EST
(
hide
)
Description:
ongoing work in o.e.team.ui
Filename:
MIME Type:
Creator:
Tomasz Zarna
Created:
2010-01-12 10:05:08 EST
Size:
19.39 KB
patch
obsolete
>diff --git a/plugin.xml b/plugin.xml >index 54bda73..4ebd625 100644 >--- a/plugin.xml >+++ b/plugin.xml >@@ -593,11 +593,11 @@ > <modelProvider > class="org.eclipse.team.internal.ui.synchronize.patch.PatchModelProvider"/> > <extends-model id="org.eclipse.core.resources.modelProvider"/> >- <enablement> >+ <!--enablement> > <instanceof > value="org.eclipse.core.resources.IResource"> > </instanceof> >- </enablement> >+ </enablement--> > </extension> > <extension > point="org.eclipse.ui.navigator.navigatorContent"> >@@ -611,14 +611,14 @@ > policy="InvokeAlwaysRegardlessOfSuppressedExt" > suppressedExtensionId="org.eclipse.team.ui.resourceContent"> > </override> >- <triggerPoints> >+ <enablement> > <or> >- <instanceof >+ <!--instanceof > value="org.eclipse.team.core.mapping.ISynchronizationScope"> > </instanceof> > <instanceof > value="org.eclipse.team.core.mapping.ISynchronizationContext"> >- </instanceof> >+ </instanceof--> > <instanceof > value="org.eclipse.team.internal.ui.synchronize.patch.PatchWorkspace"> > </instanceof> >@@ -627,9 +627,12 @@ > </instanceof> > <instanceof > value="org.eclipse.team.internal.ui.synchronize.patch.PatchModelProvider"> >+ </instanceof> >+ <instanceof >+ value="org.eclipse.core.resources.IResource"> > </instanceof> > </or> >- </triggerPoints> >+ </enablement> > </navigatorContent> > </extension> > <extension >diff --git a/src/org/eclipse/team/internal/ui/mapping/ModelCompareEditorInput.java b/src/org/eclipse/team/internal/ui/mapping/ModelCompareEditorInput.java >index 534d8c0..54ea848 100644 >--- a/src/org/eclipse/team/internal/ui/mapping/ModelCompareEditorInput.java >+++ b/src/org/eclipse/team/internal/ui/mapping/ModelCompareEditorInput.java >@@ -189,7 +189,7 @@ public class ModelCompareEditorInput extends SaveableCompareEditorInput implemen > } > > protected void handleMenuAboutToShow(IMenuManager manager) { >- StructuredSelection selection = new StructuredSelection(((ResourceDiffCompareInput)getCompareInput()).getResource()); >+ StructuredSelection selection = new StructuredSelection(((IResourceProvider)getCompareInput()).getResource()); > final ResourceMarkAsMergedHandler markAsMergedHandler = new ResourceMarkAsMergedHandler(getSynchronizeConfiguration()); > markAsMergedHandler.updateEnablement(selection); > Action markAsMergedAction = new Action(TeamUIMessages.ModelCompareEditorInput_0) { >diff --git a/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelSynchronizeParticipant.java b/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelSynchronizeParticipant.java >index c9f56a3..4d4d92b 100644 >--- a/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelSynchronizeParticipant.java >+++ b/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchModelSynchronizeParticipant.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009 IBM Corporation and others. >+ * Copyright (c) 2009, 2010 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 >@@ -10,8 +10,10 @@ > *******************************************************************************/ > package org.eclipse.team.internal.ui.synchronize.patch; > >+import org.eclipse.core.resources.mapping.ModelProvider; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.jface.action.Action; >+import org.eclipse.jface.action.IMenuManager; > import org.eclipse.team.core.mapping.provider.SynchronizationContext; > import org.eclipse.team.ui.TeamUI; > import org.eclipse.team.ui.mapping.SynchronizationActionProvider; >@@ -56,16 +58,39 @@ public class ApplyPatchModelSynchronizeParticipant extends > protected void configureMergeAction(String mergeActionId, Action action) { > if (mergeActionId == SynchronizationActionProvider.MERGE_ACTION_ID) { > // Custom label for merge >- action.setText("Apply (merge)"); //$NON-NLS-1$ >- } else if (mergeActionId == SynchronizationActionProvider.OVERWRITE_ACTION_ID) { >- // Custom label for overwrite >- action.setText("Apply (overwrite)"); //$NON-NLS-1$ >- } else if (mergeActionId == SynchronizationActionProvider.MARK_AS_MERGE_ACTION_ID) { >- // Custom label for mark-as-merged >- action.setText("Exclude"); //$NON-NLS-1$ >+ action.setText("Apply"); //$NON-NLS-1$ > } else { > super.configureMergeAction(mergeActionId, action); > } > } >+ protected void addToContextMenu(String mergeActionId, Action action, IMenuManager manager) { >+ if (mergeActionId == SynchronizationActionProvider.OVERWRITE_ACTION_ID) { >+ // omit this action >+ return; >+ } else if (mergeActionId == SynchronizationActionProvider.MARK_AS_MERGE_ACTION_ID) { >+ // omit this action >+ return; >+ } >+ super.addToContextMenu(mergeActionId, action, manager); >+ } >+ } >+ >+ public ModelProvider[] getEnabledModelProviders() { >+ ModelProvider[] enabledProviders = super.getEnabledModelProviders(); >+ // add Patch model provider if it's not there >+ for (int i = 0; i < enabledProviders.length; i++) { >+ ModelProvider provider = enabledProviders[i]; >+ if (provider.getId().equals(PatchModelProvider.ID)) >+ return enabledProviders; >+ } >+ ModelProvider[] extended = new ModelProvider[enabledProviders.length + 1]; >+ for (int i = 0; i < enabledProviders.length; i++) { >+ extended[i] = enabledProviders[i]; >+ } >+ PatchModelProvider provider = PatchModelProvider.getProvider(); >+ if (provider == null) >+ return enabledProviders; >+ extended[extended.length - 1] = provider; >+ return extended; > } > } >diff --git a/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java b/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java >index 7e81fbb..b3373ec 100644 >--- a/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java >+++ b/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriber.java >@@ -34,6 +34,7 @@ public class ApplyPatchSubscriber extends Subscriber { > this.patcher = patcher; > this.comparator = new PatchedFileVariantComparator(); > getPatcher().refresh(); >+ // FIXME: create instance, singleton > PatchWorkspace.create(ResourcesPlugin.getWorkspace().getRoot(), getPatcher()); > } > >diff --git a/src/org/eclipse/team/internal/ui/synchronize/patch/PatchCompareAdapter.java b/src/org/eclipse/team/internal/ui/synchronize/patch/PatchCompareAdapter.java >index 50c435b..f4f2802 100644 >--- a/src/org/eclipse/team/internal/ui/synchronize/patch/PatchCompareAdapter.java >+++ b/src/org/eclipse/team/internal/ui/synchronize/patch/PatchCompareAdapter.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009 IBM Corporation and others. >+ * Copyright (c) 2009, 2010 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 >@@ -11,12 +11,15 @@ > package org.eclipse.team.internal.ui.synchronize.patch; > > import org.eclipse.compare.structuremergeviewer.ICompareInput; >-import org.eclipse.core.resources.mapping.ResourceMapping; >+import org.eclipse.core.resources.mapping.*; > import org.eclipse.team.core.mapping.ISynchronizationContext; >+import org.eclipse.team.core.mapping.ISynchronizationScope; >+import org.eclipse.team.internal.ui.mapping.DiffTreeChangesSection.ITraversalFactory; > import org.eclipse.team.ui.mapping.SynchronizationCompareAdapter; > import org.eclipse.ui.IMemento; > >-public class PatchCompareAdapter extends SynchronizationCompareAdapter { >+public class PatchCompareAdapter extends SynchronizationCompareAdapter >+ implements ITraversalFactory { > > public ICompareInput asCompareInput(ISynchronizationContext context, > Object o) { >@@ -26,13 +29,15 @@ public class PatchCompareAdapter extends SynchronizationCompareAdapter { > } > > public void save(ResourceMapping[] mappings, IMemento memento) { >- // TODO Auto-generated method stub >- >+ // Don't save > } > > public ResourceMapping[] restore(IMemento memento) { >- // TODO Auto-generated method stub >+ // Don't restore > return null; > } > >+ public ResourceTraversal[] getTraversals(ISynchronizationScope scope) { >+ return scope.getTraversals(ModelProvider.RESOURCE_MODEL_PROVIDER_ID); >+ } > } >diff --git a/src/org/eclipse/team/internal/ui/synchronize/patch/PatchModelProvider.java b/src/org/eclipse/team/internal/ui/synchronize/patch/PatchModelProvider.java >index b662cb7..24140bc 100644 >--- a/src/org/eclipse/team/internal/ui/synchronize/patch/PatchModelProvider.java >+++ b/src/org/eclipse/team/internal/ui/synchronize/patch/PatchModelProvider.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009 IBM Corporation and others. >+ * Copyright (c) 2009, 2010 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 >@@ -13,11 +13,11 @@ package org.eclipse.team.internal.ui.synchronize.patch; > import org.eclipse.compare.internal.core.patch.FileDiffResult; > import org.eclipse.compare.internal.patch.*; > import org.eclipse.compare.structuremergeviewer.IDiffElement; >-import org.eclipse.core.resources.*; >-import org.eclipse.core.resources.mapping.*; >+import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.mapping.ModelProvider; >+import org.eclipse.core.resources.mapping.ResourceMapping; > import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.team.core.subscribers.SubscriberResourceMappingContext; > import org.eclipse.team.internal.core.TeamPlugin; > > public class PatchModelProvider extends ModelProvider { >@@ -38,6 +38,7 @@ public class PatchModelProvider extends ModelProvider { > return provider; > } > >+ /* > public ResourceMapping[] getMappings(IResource resource, > ResourceMappingContext context, IProgressMonitor monitor) > throws CoreException { >@@ -55,7 +56,7 @@ public class PatchModelProvider extends ModelProvider { > } > } > return super.getMappings(resource, context, monitor); >- } >+ }*/ > > static ResourceMapping getResourceMapping(IDiffElement object) { > if (object instanceof PatchProjectDiffNode) { >@@ -102,4 +103,34 @@ public class PatchModelProvider extends ModelProvider { > } > return null; > } >+ >+ /** >+ * Returns the resource associated with the corresponding model element. >+ * >+ * @param element >+ * the model element >+ * @return the associated resource, or <code>null</code> >+ */ >+ static IResource getResource(final Object element) { >+ IResource resource= null; >+ if (element instanceof PatchProjectDiffNode) { >+ return ((PatchProjectDiffNode) element).getResource(); >+ } else if (element instanceof PatchFileDiffNode) { >+ return ((PatchFileDiffNode) element).getResource(); >+ } else if (element instanceof HunkDiffNode) { >+ return ((HunkDiffNode) element).getResource(); >+ } /*else if (element instanceof IResource) { >+ resource= (IResource) element; >+ } else if (element instanceof IAdaptable) { >+ final IAdaptable adaptable= (IAdaptable) element; >+ final Object adapted= adaptable.getAdapter(IResource.class); >+ if (adapted instanceof IResource) >+ resource= (IResource) adapted; >+ } else { >+ final Object adapted= Platform.getAdapterManager().getAdapter(element, IResource.class); >+ if (adapted instanceof IResource) >+ resource= (IResource) adapted; >+ }*/ >+ return resource; >+ } > } >diff --git a/src/org/eclipse/team/internal/ui/synchronize/patch/PatchSyncContentProvider.java b/src/org/eclipse/team/internal/ui/synchronize/patch/PatchSyncContentProvider.java >index 95890e8..d4c96a5 100644 >--- a/src/org/eclipse/team/internal/ui/synchronize/patch/PatchSyncContentProvider.java >+++ b/src/org/eclipse/team/internal/ui/synchronize/patch/PatchSyncContentProvider.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009 IBM Corporation and others. >+ * Copyright (c) 2009, 2010 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 >@@ -67,20 +67,15 @@ public class PatchSyncContentProvider extends SynchronizationContentProvider > */ > protected ResourceTraversal[] getTraversals( > ISynchronizationContext context, Object object) { >- >- ResourceMapping mapping = PatchModelProvider.getResourceMapping((IDiffElement) object); >- ResourceMappingContext rmc = new SynchronizationResourceMappingContext( >- context); >- try { >- // XXX: >- // Technically speaking, this may end up being too long >- // running for this >- // (i.e. we may end up hitting the server) but it will do >- // for illustration purposes >- return mapping >- .getTraversals(rmc, new NullProgressMonitor()); >- } catch (CoreException e) { >- TeamUIPlugin.log(e); >+ if (object instanceof IDiffElement) { >+ ResourceMapping mapping = PatchModelProvider.getResourceMapping((IDiffElement) object); >+ ResourceMappingContext rmc = new SynchronizationResourceMappingContext( >+ context); >+ try { >+ return mapping.getTraversals(rmc, new NullProgressMonitor()); >+ } catch (CoreException e) { >+ TeamUIPlugin.log(e); >+ } > } > return new ResourceTraversal[0]; > } >@@ -93,7 +88,7 @@ public class PatchSyncContentProvider extends SynchronizationContentProvider > sb.append(children[i].toString()).append(","); //$NON-NLS-1$ > } > System.out >- .println(">> [super] PatchSyncContentProvider.getChildrenInContext: context-> " + context + "parent-> " + parent.toString() + "; children-> " + sb.toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ .println(">> [super] PatchSyncContentProvider.getChildrenInContext: context-> " + context + "; parent-> " + parent.toString() + "; children-> " + sb.toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > return super.getChildrenInContext(context, parent, children); > } > >@@ -102,9 +97,11 @@ public class PatchSyncContentProvider extends SynchronizationContentProvider > } > > public void getPipelinedElements(Object anInput, Set theCurrentElements) { >- // Replace any model projects with a DiffProject if the input >- // is a synchronization context > if (anInput instanceof ISynchronizationContext) { >+ // Do not show hunks when all models are visible >+ //XXX >+ return; >+ } else if (anInput == getModelProvider()) { > List newProjects = new ArrayList(); > for (Iterator iter = theCurrentElements.iterator(); iter.hasNext();) { > Object element = iter.next(); >@@ -128,7 +125,7 @@ public class PatchSyncContentProvider extends SynchronizationContentProvider > theCurrentElements.add(getModelProvider()); > } > } >- >+ > public Object getPipelinedParent(Object anObject, Object aSuggestedParent) { > // TODO Auto-generated method stub > System.out >@@ -161,4 +158,14 @@ public class PatchSyncContentProvider extends SynchronizationContentProvider > .println(">> [false] PatchSyncContentProvider.interceptUpdate: anUpdateSynchronization-> " + anUpdateSynchronization); //$NON-NLS-1$ > return false; > } >+ >+ protected boolean isInScope(ISynchronizationScope scope, Object parent, >+ Object element) { >+ final IResource resource = PatchModelProvider.getResource(element); >+ if (resource == null) >+ return false; >+ if (scope.contains(resource)) >+ return true; >+ return false; >+ } > } >diff --git a/src/org/eclipse/team/internal/ui/synchronize/patch/PatchSyncLabelProvider.java b/src/org/eclipse/team/internal/ui/synchronize/patch/PatchSyncLabelProvider.java >index bf1b378..ab159e9 100644 >--- a/src/org/eclipse/team/internal/ui/synchronize/patch/PatchSyncLabelProvider.java >+++ b/src/org/eclipse/team/internal/ui/synchronize/patch/PatchSyncLabelProvider.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009 IBM Corporation and others. >+ * Copyright (c) 2009, 2010 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,6 +15,7 @@ import org.eclipse.compare.structuremergeviewer.IDiffElement; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.mapping.ResourceMapping; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.jface.viewers.ILabelProvider; > import org.eclipse.swt.graphics.Image; > import org.eclipse.team.core.diff.IDiff; >@@ -47,16 +48,18 @@ public class PatchSyncLabelProvider extends SynchronizationLabelProvider { > } > > protected IDiff getDiff(Object element) { >- ResourceMapping mapping = PatchModelProvider >- .getResourceMapping((IDiffElement) element); >- if (mapping != null) { >- // XXX: getting IResource for patch model object >- try { >- IResource resource = mapping.getTraversals(null, null)[0] >- .getResources()[0]; >- return getContext().getDiffTree().getDiff(resource); >- } catch (CoreException e) { >- TeamUIPlugin.log(e); >+ if (element instanceof IDiffElement) { >+ ResourceMapping mapping = PatchModelProvider >+ .getResourceMapping((IDiffElement) element); >+ if (mapping != null) { >+ // XXX: getting IResource for patch model object >+ try { >+ IResource resource = mapping.getTraversals(null, new NullProgressMonitor())[0] >+ .getResources()[0]; >+ return getContext().getDiffTree().getDiff(resource); >+ } catch (CoreException e) { >+ TeamUIPlugin.log(e); >+ } > } > } > return super.getDiff(element); >diff --git a/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipantActionGroup.java b/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipantActionGroup.java >index f0a4821..4b39691 100644 >--- a/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipantActionGroup.java >+++ b/src/org/eclipse/team/ui/synchronize/ModelSynchronizeParticipantActionGroup.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * Copyright (c) 2005, 2010 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 >@@ -49,7 +49,7 @@ public class ModelSynchronizeParticipantActionGroup extends SynchronizePageActio > > /** > * The id of the action group that determines where the other >- * actions (e.g. mark-as-mered) appear in the context menu. >+ * actions (e.g. mark-as-merged) appear in the context menu. > */ > public static final String OTHER_ACTION_GROUP = "other"; //$NON-NLS-1$ >
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 298923
:
155863
|
155865
|
155866
|
156075
|
156083
|
156229
|
156372
|
156490
|
156493
|
156536
|
157236