![]() |
![]() |
org.eclipse.team.ui_3.6.101.R37x_v20111109-0800eof IRevisionRulerColumnExtension)) { if ((column.getControl() != null) && (column.getControl().isDisposed())) { return null; } return (IRevisionRulerColumnExtension)column; } return null; } private RevisionAnnotationController(IRevisionRulerColumnExtension revisionRuler, ISelectionProvider historyList) { fHistoryListSelectionProvider = historyList; if (revisionRuler == null) { fRulerSelectionProvider = null; return; } fRulerSelectionProvider = revisionRuler.getRevisionSelectionProvider(); fRulerSelectionProvider.addSelectionChangedListener(rulerListener); fHistoryListSelectionProvider.addSelectionChangedListener(historyListListener); ((IRevisionRulerColumn)revisionRuler).getControl().addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { dispose(); } }); } public RevisionAnnotationController(IWorkbenchPage page, IFile file, ISelectionProvider historyList) { this(findEditorRevisonRulerColumn(page, file), historyList); } public RevisionAnnotationController(IWorkbenchPage page, IStorageEditorInput editorInput, ISelectionProvider historyList) { this(findEditorRevisonRulerColumn(page, editorInput), historyList); } public void dispose() { if (fRulerSelectionProvider != null) { fRulerSelectionProvider.removeSelectionChangedListener(rulerListener); fHistoryListSelectionProvider.removeSelectionChangedListener(historyListListener); rulerListener = null; fRulerSelectionProvider = null; historyListListener = null; fHistoryListSelectionProvider = null; } } protected void revisionSelected(Revision selected) { Object entry = getHistoryEntry(selected); if (entry != null) { IStructuredSelection selection = new StructuredSelection(entry); if ((fHistoryListSelectionProvider instanceof Viewer)) { Viewer v = (Viewer)fHistoryListSelectionProvider; v.setSelection(selection, true); } else if (fHistoryListSelectionProvider != null) { fHistoryListSelectionProvider.setSelection(selection); } } } protected abstract Object getHistoryEntry(Revision paramRevision); void historyEntrySelected(Object historyEntry) { String id = getRevisionId(historyEntry); if ((id != null) && (fRulerSelectionProvider != null)) { fRulerSelectionProvider.setSelection(new StructuredSelection(id)); } } protected String getRevisionId(Object historyEntry) { IFileRevision revision = (IFileRevision)Utils.getAdapter(historyEntry, IFileRevision.class); if (revision != null) { return revision.getContentIdentifier(); } IResourceVariant variant = (IResourceVariant)Utils.getAdapter(historyEntry, IResourceVariant.class); if (variant != null) { return variant.getContentIdentifier(); } return null; } } /* Location: * Qualified Name: org.eclipse.team.ui.history.RevisionAnnotationController * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; import org.eclipse.compare.structuremergeviewer.ICompareInput; import org.eclipse.core.resources.mapping.ResourceMapping; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.team.core.mapping.ISynchronizationContext; import org.eclipse.ui.IMemento; public abstract interface ISynchronizationCompareAdapter { public abstract boolean hasCompareInput(ISynchronizationContext paramISynchronizationContext, Object paramObject); public abstract ICompareInput asCompareInput(ISynchronizationContext paramISynchronizationContext, Object paramObject); public abstract String getName(ResourceMapping paramResourceMapping); public abstract String getPathString(ResourceMapping paramResourceMapping); public abstract ImageDescriptor getImageDescriptor(ResourceMapping paramResourceMapping); public abstract void save(ResourceMapping[] paramArrayOfResourceMapping, IMemento paramIMemento); public abstract ResourceMapping[] restore(IMemento paramIMemento); public abstract int getSynchronizationState(ITeamStateProvider paramITeamStateProvider, ResourceMapping paramResourceMapping, int paramInt, IProgressMonitor paramIProgressMonitor) throws CoreException; } /* Location: * Qualified Name: org.eclipse.team.ui.mapping.ISynchronizationCompareAdapter * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; import org.eclipse.compare.CompareConfiguration; import org.eclipse.compare.structuremergeviewer.ICompareInput; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; public abstract interface ISynchronizationCompareInput extends ICompareInput { public abstract SaveableComparison getSaveable(); public abstract void prepareInput(CompareConfiguration paramCompareConfiguration, IProgressMonitor paramIProgressMonitor) throws CoreException; public abstract String getFullPath(); public abstract boolean isCompareInputFor(Object paramObject); } /* Location: * Qualified Name: org.eclipse.team.ui.mapping.ISynchronizationCompareInput * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.preference.IPreferencePage; import org.eclipse.jface.resource.ImageDescriptor; public abstract interface ITeamContentProviderDescriptor { public abstract String getContentExtensionId(); public abstract String getModelProviderId(); public abstract ImageDescriptor getImageDescriptor(); public abstract IPreferencePage createPreferencePage() throws CoreException; public abstract boolean isEnabled(); public abstract String getName(); public abstract boolean isFlatLayoutSupported(); } /* Location: * Qualified Name: org.eclipse.team.ui.mapping.ITeamContentProviderDescriptor * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.team.core.mapping.ISynchronizationScope; public abstract interface ITeamContentProviderManager { public static final String P_SYNCHRONIZATION_PAGE_CONFIGURATION = "org.eclipse.team.ui.synchronizationPageConfiguration"; public static final String P_SYNCHRONIZATION_CONTEXT = "org.eclipse.team.ui.synchronizationContext"; public static final String P_SYNCHRONIZATION_SCOPE = "org.eclipse.team.ui.synchronizationScope"; public static final String PROP_PAGE_LAYOUT = "org.eclipse.team.ui.pageLayout"; public static final String TREE_LAYOUT = "org.eclipse.team.ui.treeLayout"; public static final String FLAT_LAYOUT = "org.eclipse.team.ui.flatLayout"; public static final String PROP_ENABLED_MODEL_PROVIDERS = "org.eclipse.team.ui.ENABLED_MODEL_PROVIDERS"; public abstract ITeamContentProviderDescriptor[] getDescriptors(); public abstract ITeamContentProviderDescriptor getDescriptor(String paramString); public abstract void addPropertyChangeListener(IPropertyChangeListener paramIPropertyChangeListener); public abstract void removePropertyChangeListener(IPropertyChangeListener paramIPropertyChangeListener); public abstract String[] getContentProviderIds(ISynchronizationScope paramISynchronizationScope); public abstract void setEnabledDescriptors(ITeamContentProviderDescriptor[] paramArrayOfITeamContentProviderDescriptor); } /* Location: * Qualified Name: org.eclipse.team.ui.mapping.ITeamContentProviderManager * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; import org.eclipse.core.resources.IResource; public abstract interface ITeamStateChangeEvent { public abstract IResource[] getAddedRoots(); public abstract IResource[] getRemovedRoots(); public abstract IResource[] getChangedResources(); public abstract boolean hasChange(IResource paramIResource); } /* Location: * Qualified Name: org.eclipse.team.ui.mapping.ITeamStateChangeEvent * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; import java.util.EventListener; public abstract interface ITeamStateChangeListener extends EventListener { public abstract void teamStateChanged(ITeamStateChangeEvent paramITeamStateChangeEvent); } /* Location: * Qualified Name: org.eclipse.team.ui.mapping.ITeamStateChangeListener * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; public abstract interface ITeamStateDescription { public abstract int getStateFlags(); public abstract int getKind(); public abstract int getDirection(); public abstract String[] getPropertyNames(); public abstract Object getProperty(String paramString); public abstract boolean equals(Object paramObject); } /* Location: * Qualified Name: org.eclipse.team.ui.mapping.ITeamStateDescription * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; import org.eclipse.core.resources.mapping.ResourceMappingContext; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; public abstract interface ITeamStateProvider { public static final int USE_DECORATED_STATE_MASK = -1; public abstract boolean isDecorationEnabled(Object paramObject); public abstract boolean hasDecoratedState(Object paramObject) throws CoreException; public abstract int getDecoratedStateMask(Object paramObject); public abstract String[] getDecoratedProperties(Object paramObject); public abstract ITeamStateDescription getStateDescription(Object paramObject, int paramInt, String[] paramArrayOfString, IProgressMonitor paramIProgressMonitor) throws CoreException; public abstract ResourceMappingContext getResourceMappingContext(Object paramObject); public abstract void addDecoratedStateChangeListener(ITeamStateChangeListener paramITeamStateChangeListener); public abstract void removeDecoratedStateChangeListener(ITeamStateChangeListener paramITeamStateChangeListener); } /* Location: * Qualified Name: org.eclipse.team.ui.mapping.ITeamStateProvider * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.SelectionChangedEvent; class MergeActionHandler$1 implements ISelectionChangedListener { final MergeActionHandler this$0; MergeActionHandler$1(MergeActionHandler paramMergeActionHandler) { this$0 = paramMergeActionHandler; } public void selectionChanged(SelectionChangedEvent event) { this$0.updatedEnablement(event); } } /* Location: * Qualified Name: org.eclipse.team.ui.mapping.MergeActionHandler.1 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; import java.lang.reflect.InvocationTargetException; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.commands.HandlerEvent; import org.eclipse.core.commands.IHandler; import org.eclipse.jface.operation.IRunnableContext; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.team.internal.ui.Utils; import org.eclipse.team.internal.ui.mapping.ResourceMarkAsMergedHandler; import org.eclipse.team.internal.ui.mapping.ResourceMergeHandler; import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration; import org.eclipse.team.ui.synchronize.ISynchronizePageSite; public abstract class MergeActionHandler extends AbstractHandler { private final ISynchronizePageConfiguration configuration; private boolean enabled = false; private IStructuredSelection selection; private ISelectionChangedListener listener = new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updatedEnablement(event); } }; public static IHandler getDefaultHandler(String mergeActionId, ISynchronizePageConfiguration configuration) { if (mergeActionId == "org.eclipse.team.ui.mergeAction") { ResourceMergeHandler resourceMergeHandler = new ResourceMergeHandler(configuration, false); resourceMergeHandler.updateEnablement((IStructuredSelection)configuration.getSite().getSelectionProvider().getSelection()); return resourceMergeHandler; } if (mergeActionId == "org.eclipse.team.ui.overwriteAction") { ResourceMergeHandler resourceMergeHandler = new ResourceMergeHandler(configuration, true); resourceMergeHandler.updateEnablement((IStructuredSelection)configuration.getSite().getSelectionProvider().getSelection()); return resourceMergeHandler; } if (mergeActionId == "org.eclipse.team.ui.markAsMergeAction") { ResourceMarkAsMergedHandler resourceMarkAsMergedHandler = new ResourceMarkAsMergedHandler(configuration); resourceMarkAsMergedHandler.updateEnablement((IStructuredSelection)configuration.getSite().getSelectionProvider().getSelection()); return resourceMarkAsMergedHandler; } return null; } public MergeActionHandler(ISynchronizePageConfiguration configuration) { this.configuration = configuration; ISelectionProvider selectionProvider = getConfiguration().getSite().getSelectionProvider(); selectionProvider.addSelectionChangedListener(listener); updateEnablement((IStructuredSelection)selectionProvider.getSelection()); } public void dispose() { getConfiguration().getSite().getSelectionProvider().removeSelectionChangedListener(listener); } void updatedEnablement(SelectionChangedEvent event) { updateEnablement((IStructuredSelection)event.getSelection()); } protected void updateEnablement(IStructuredSelection selection) { this.selection = selection; boolean isEnabled = getOperation().shouldRun(); setEnabled(isEnabled); } protected final ISynchronizePageConfiguration getConfiguration() { return configuration; } protected final IStructuredSelection getStructuredSelection() { return selection; } public boolean isEnabled() { return enabled; } protected void setEnabled(boolean isEnabled) { if (enabled != isEnabled) { enabled = isEnabled; fireHandlerChanged(new HandlerEvent(this, true, false)); } } public Object execute(ExecutionEvent event) throws ExecutionException { try { SynchronizationOperation operation = getOperation(); IRunnableContext context = getConfiguration().getRunnableContext(); if (context != null) { context.run(true, true, operation); } else { operation.run(); } } catch (InvocationTargetException e) { Utils.handle(e); } catch (InterruptedException localInterruptedException) {} return null; } protected abstract SynchronizationOperation getOperation(); public SaveableComparison getSaveable() { return getOperation().getSaveable(); } } /* Location: * Qualified Name: org.eclipse.team.ui.mapping.MergeActionHandler * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; import org.eclipse.core.runtime.ISafeRunnable; import org.eclipse.ui.IPropertyListener; class SaveableComparison$1 implements ISafeRunnable { final SaveableComparison this$0; private final Object val$object; private final int val$property; SaveableComparison$1(SaveableComparison paramSaveableComparison, Object paramObject, int paramInt) { this$0 = paramSaveableComparison;val$object = paramObject;val$property = paramInt; } public void run() throws Exception { ((IPropertyListener)val$object).propertyChanged(this$0, val$property); } public void handleException(Throwable exception) {} } /* Location: * Qualified Name: org.eclipse.team.ui.mapping.SaveableComparison.1 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.ISafeRunnable; import org.eclipse.core.runtime.ListenerList; import org.eclipse.core.runtime.SafeRunner; import org.eclipse.ui.IPropertyListener; import org.eclipse.ui.Saveable; public abstract class SaveableComparison extends Saveable { public static final int PROP_DIRTY = 257; private boolean dirty; private ListenerList listeners = new ListenerList(1); public boolean isDirty() { return dirty; } public void doSave(IProgressMonitor monitor) throws CoreException { if (!isDirty()) { return; } performSave(monitor); setDirty(false); } public void doRevert(IProgressMonitor monitor) { if (!isDirty()) { return; } performRevert(monitor); setDirty(false); } public void addPropertyListener(IPropertyListener listener) { listeners.add(listener); } public void removePropertyListener(IPropertyListener listener) { listeners.remove(listener); } protected void setDirty(boolean dirty) { if (this.dirty == dirty) { return; } this.dirty = dirty; firePropertyChange(257); } protected void firePropertyChange(int property) { Object[] allListeners = listeners.getListeners(); for (int i = 0; i < allListeners.length; i++) { Object object = allListeners[i]; SafeRunner.run(new ISafeRunnable() { private final Object val$object; private final int val$property; public void run() throws Exception { ((IPropertyListener)val$object).propertyChanged(SaveableComparison.this, val$property); } public void handleException(Throwable exception) {} }); } } protected abstract void performSave(IProgressMonitor paramIProgressMonitor) throws CoreException; protected abstract void performRevert(IProgressMonitor paramIProgressMonitor); } /* Location: * Qualified Name: org.eclipse.team.ui.mapping.SaveableComparison * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.eclipse.core.commands.IHandler; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.IMenuManager; import org.eclipse.team.core.mapping.ISynchronizationContext; import org.eclipse.team.internal.ui.mapping.CommonMenuManager; import org.eclipse.team.internal.ui.synchronize.actions.OpenWithActionGroup; import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IViewSite; import org.eclipse.ui.IWorkbenchPartSite; import org.eclipse.ui.actions.ActionContext; import org.eclipse.ui.navigator.CommonActionProvider; import org.eclipse.ui.navigator.ICommonActionExtensionSite; import org.eclipse.ui.navigator.ICommonViewerSite; import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite; import org.eclipse.ui.navigator.IExtensionStateModel; public class SynchronizationActionProvider extends CommonActionProvider { public static final String MERGE_ACTION_ID = "org.eclipse.team.ui.mergeAction"; public static final String OVERWRITE_ACTION_ID = "org.eclipse.team.ui.overwriteAction"; public static final String MARK_AS_MERGE_ACTION_ID = "org.eclipse.team.ui.markAsMergeAction"; private Map handlers = new HashMap(); private OpenWithActionGroup openWithActions; public void init(ICommonActionExtensionSite site) { super.init(site); initialize(); } protected void initialize() { initializeOpenActions(); } protected void initializeOpenActions() { ICommonViewerSite cvs = getActionSite().getViewSite(); ISynchronizePageConfiguration configuration = getSynchronizePageConfiguration(); if (((cvs instanceof ICommonViewerWorkbenchSite)) && (configuration != null)) { ICommonViewerWorkbenchSite cvws = (ICommonViewerWorkbenchSite)cvs; IWorkbenchPartSite wps = cvws.getSite(); if ((wps instanceof IViewSite)) { openWithActions = new OpenWithActionGroup(configuration, false); } } } protected final ISynchronizePageConfiguration getSynchronizePageConfiguration() { return (ISynchronizePageConfiguration)getExtensionStateModel().getProperty("org.eclipse.team.ui.synchronizationPageConfiguration"); } protected final IExtensionStateModel getExtensionStateModel() { return getActionSite().getExtensionStateModel(); } protected final ISynchronizationContext getSynchronizationContext() { return (ISynchronizationContext)getExtensionStateModel().getProperty("org.eclipse.team.ui.synchronizationContext"); } protected void registerHandler(String actionId, IHandler handler) { handlers.put(actionId, handler); } public void fillContextMenu(IMenuManager menu) { super.fillContextMenu(menu); if ((menu instanceof CommonMenuManager)) { CommonMenuManager manager = (CommonMenuManager)menu; for (Iterator iter = handlers.keySet().iterator(); iter.hasNext();) { String actionId = (String)iter.next(); manager.registerHandler(actionId, (IHandler)handlers.get(actionId)); } } IContributionItem fileGroup = menu.find("file"); if ((openWithActions != null) && (fileGroup != null)) { openWithActions.fillContextMenu(menu, fileGroup.getId()); } } public void fillActionBars(IActionBars actionBars) { super.fillActionBars(actionBars); if (openWithActions != null) { openWithActions.fillActionBars(actionBars); } } public void updateActionBars() { super.updateActionBars(); if (openWithActions != null) { openWithActions.updateActionBars(); } } public void setContext(ActionContext context) { super.setContext(context); if (openWithActions != null) { openWithActions.setContext(context); } } public void dispose() { super.dispose(); if (openWithActions != null) { openWithActions.dispose(); } for (Iterator iter = handlers.values().iterator(); iter.hasNext();) { IHandler handler = (IHandler)iter.next(); if ((handler instanceof MergeActionHandler)) { MergeActionHandler mah = (MergeActionHandler)handler; mah.dispose(); } } } public ICommonActionExtensionSite getExtensionSite() { return getActionSite(); } } /* Location: * Qualified Name: org.eclipse.team.ui.mapping.SynchronizationActionProvider * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.compare.structuremergeviewer.ICompareInput; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.mapping.IModelProviderDescriptor; 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.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.team.core.diff.IDiff; import org.eclipse.team.core.mapping.IResourceDiffTree; import org.eclipse.team.core.mapping.ISynchronizationContext; import org.eclipse.team.internal.ui.TeamUIMessages; import org.eclipse.team.internal.ui.Utils; import org.eclipse.team.internal.ui.mapping.ResourceDiffCompareInput; import org.eclipse.team.ui.TeamUI; import org.eclipse.ui.model.IWorkbenchAdapter; public abstract class SynchronizationCompareAdapter implements ISynchronizationCompareAdapter { public ICompareInput asCompareInput(ISynchronizationContext context, Object o) { IResource resource = Utils.getResource(o); if ((resource != null) && (resource.getType() == 1)) { IDiff node = context.getDiffTree().getDiff(resource); if (node != null) { return new ResourceDiffCompareInput(node, context); } } return null; } public boolean hasCompareInput(ISynchronizationContext context, Object object) { return asCompareInput(context, object) != null; } public String getName(ResourceMapping mapping) { Object object = mapping.getModelObject(); IWorkbenchAdapter adapter = (IWorkbenchAdapter)Utils.getAdapter( object, IWorkbenchAdapter.class); if (adapter != null) { String label = adapter.getLabel(object); if (label != null) { return label; } } IResource resource = Utils.getResource(object); if (resource != null) { return resource.getName(); } if ((object instanceof ModelProvider)) { ModelProvider provider = (ModelProvider)object; if (provider.getId().equals("org.eclipse.core.resources.modelProvider")) { return TeamUIMessages.SynchronizationCompareAdapter_0; } return provider.getDescriptor().getLabel(); } return ""; } public String getPathString(ResourceMapping mapping) { Object object = mapping.getModelObject(); IWorkbenchAdapter adapter = (IWorkbenchAdapter)Utils.getAdapter( object, IWorkbenchAdapter.class); if (adapter != null) { List segments = new ArrayList(); Object parent = object; do { String segment = adapter.getLabel(parent); if ((segment != null) && (segment.length() > 0)) { segments.add(0, segment); } parent = adapter.getParent(parent); } while (parent != null); if (!segments.isEmpty()) { IPath path = Path.EMPTY; for (Iterator iter = segments.iterator(); iter.hasNext();) { String segment = (String)iter.next(); path = path.append(segment); } return path.toString(); } } return getName(mapping); } public ImageDescriptor getImageDescriptor(ResourceMapping mapping) { Object object = mapping.getModelObject(); ImageDescriptor image = getImageDescriptorFromWorkbenchAdapter(object); if (image != null) { return image; } IResource resource = Utils.getResource(object); if (resource != null) { image = getImageDescriptorFromWorkbenchAdapter(resource); if (image != null) { return image; } } if ((object instanceof ModelProvider)) { ModelProvider provider = (ModelProvider)object; ITeamContentProviderDescriptor desc = TeamUI.getTeamContentProviderManager().getDescriptor(provider.getId()); if (desc != null) { return desc.getImageDescriptor(); } } return null; } private ImageDescriptor getImageDescriptorFromWorkbenchAdapter(Object object) { IWorkbenchAdapter adapter = (IWorkbenchAdapter)Utils.getAdapter( object, IWorkbenchAdapter.class); if (adapter != null) { return adapter.getImageDescriptor(object); } return null; } public int getSynchronizationState(ITeamStateProvider provider, ResourceMapping mapping, int stateMask, IProgressMonitor monitor) throws CoreException { return -1; } } /* Location: * Qualified Name: org.eclipse.team.ui.mapping.SynchronizationCompareAdapter * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; import org.eclipse.jface.viewers.TreeViewer; class SynchronizationContentProvider$1 implements Runnable { final SynchronizationContentProvider this$0; SynchronizationContentProvider$1(SynchronizationContentProvider paramSynchronizationContentProvider) { this$0 = paramSynchronizationContentProvider; } public void run() { TreeViewer treeViewer = (TreeViewer)this$0.getViewer(); if (SynchronizationContentProvider.access$0(this$0)) { treeViewer.refresh(); } else { treeViewer.refresh(this$0.getModelProvider()); } } } /* Location: * Qualified Name: org.eclipse.team.ui.mapping.SynchronizationContentProvider.1 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.ui.mapping; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.mapping.IModelProviderDescriptor; import org.eclipse.core.resources.mapping.ModelProvider; import org.eclipse.core.resources.mapping.ResourceMapping; import org.eclipse.core.resources.mapping.ResourceTraversal; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.TreePath; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.team.core.diff.IDiff; import org.eclipse.team.core.diff.IDiffChangeEvent; import org.eclipse.team.core.diff.IDiffChangeListener; import org.eclipse.team.core.diff.IDiffTree; import org.eclipse.team.core.diff.IThreeWayDiff; import org.eclipse.team.core.mapping.IResourceDiffTree; import org.eclipse.team.core.mapping.ISynchronizationContext; import org.eclipse.team.core.mapping.ISynchronizationScope; import org.eclipse.team.internal.core.TeamPlugin; import org.eclipse.team.internal.ui.Utils; import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration; import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration; import org.eclipse.ui.IMemento; import org.eclipse.ui.navigator.ICommonContentExtensionSite; import org.eclipse.ui.navigator.ICommonContentProvider; import org.eclipse.ui.navigator.IExtensionStateModel; public abstract class SynchronizationContentProvider implements ICommonContentProvider, IDiffChangeListener, IPropertyChangeListener { private Viewer viewer; private boolean empty; private ICommonContentExtensionSite site; public Object[] getChildren(Object parent) { return internalGetChildren(parent, false); } public Object[] getElements(Object parent) { return internalGetChildren(parent, true); } public Object getParent(Object element) { element = internalGetElement(element); if ((element instanceof ModelProvider)) { return null; } if (element == getModelRoot()) { return null; } Object parent = getDelegateContentProvider().getParent(element); if (parent == getModelRoot()) { return getModelProvider(); } return parent; } public boolean hasChildren(Object element) { return internalHasChildren(element); } private Object[] internalGetChildren(Object parent, boolean isElement) { Object element = internalGetElement(parent); if ((element instanceof ISynchronizationScope)) { ISynchronizationScope rms = (ISynchronizationScope)element; if (rms.getMappings(getModelProviderId()).length > 0) { empty = false; return new Object[] { getModelProvider() }; } empty = true; return new Object[0]; } if ((element instanceof ISynchronizationContext)) { ISynchronizationContext context = (ISynchronizationContext)element; ISynchronizationContext sc = (ISynchronizationContext)element; if (sc.getScope().getMappings(getModelProviderId()).length > 0) { Object root = getModelRoot(); boolean initialized = isInitialized(context); if ((!initialized) || (getChildrenInContext(sc, root, getDelegateChildren(root, isElement)).length > 0)) { if (!initialized) { requestInitialization(context); } empty = false; return new Object[] { getModelProvider() }; } } empty = true; return new Object[0]; } if (element == getModelProvider()) { ISynchronizationContext context = getContext(); if ((context != null) && (!isInitialized(context))) { return new Object[0]; } element = getModelRoot(); if ((parent instanceof TreePath)) { parent = TreePath.EMPTY.createChildPath(element); } else { parent = element; } } Object[] delegateChildren = getDelegateChildren(parent, isElement); ISynchronizationContext context = getContext(); if (context == null) { ISynchronizationScope scope = getScope(); if (scope == null) { return delegateChildren; } return getChildrenInScope(scope, parent, delegateChildren); } return getChildrenInContext(context, parent, delegateChildren); } protected boolean isInitialized(ISynchronizationContext context) { return true; } protected void requestInitialization(ISynchronizationContext context) {} protected Object[] getDelegateChildren(Object parent) { return getDelegateContentProvider().getChildren(internalGetElement(parent)); } private Object[] getDelegateChildren(Object parent, boolean isElement) { if (isElement) { return getDelegateContentProvider().getElements(parent); } return getDelegateChildren(parent); } private boolean internalHasChildren(Object elementOrPath) { Object element = internalGetElement(elementOrPath); if ((element instanceof ModelProvider)) { element = getModelRoot(); } if (getDelegateContentProvider().hasChildren(element)) { ISynchronizationContext sc = getContext(); if (sc == null) { ISynchronizationScope scope = getScope(); if (scope == null) { return true; } return hasChildrenInScope(scope, elementOrPath); } return hasChildrenInContext(sc, elementOrPath); } ISynchronizationContext sc = getContext(); if (sc != null) { return hasChildrenInContext(sc, elementOrPath); } return false; } protected boolean hasChildrenInScope(ISynchronizationScope scope, Object element) { ResourceMapping mapping = Utils.getResourceMapping(internalGetElement(element)); if (mapping != null) { ResourceMapping[] mappings = scope.getMappings(mapping.getModelProviderId()); for (int i = 0; i < mappings.length; i++) { ResourceMapping sm = mappings[i]; if (mapping.contains(sm)) { return true; } if (sm.contains(mapping)) { return getDelegateChildren(element).length > 0; } } } return false; } protected boolean hasChildrenInContext(ISynchronizationContext context, Object element) { ResourceTraversal[] traversals = getTraversals(context, element); if (traversals == null) { return true; } return context.getDiffTree().getDiffs(traversals).length > 0; } public void dispose() { ICommonContentExtensionSite extensionSite = getExtensionSite(); if (extensionSite != null) { extensionSite.getExtensionStateModel().removePropertyChangeListener(this); } ISynchronizationContext context = getContext(); if (context != null) { context.getDiffTree().removeDiffChangeListener(this); } ISynchronizePageConfiguration configuration = getConfiguration(); if (configuration != null) { configuration.removePropertyChangeListener(this); } } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { this.viewer = viewer; getDelegateContentProvider().inputChanged(viewer, oldInput, newInput); } public void init(ICommonContentExtensionSite site) { this.site = site; site.getExtensionStateModel().addPropertyChangeListener(this); ISynchronizePageConfiguration configuration = getConfiguration(); if (configuration != null) { configuration.addPropertyChangeListener(this); } ITreeContentProvider provider = getDelegateContentProvider(); if ((provider instanceof ICommonContentProvider)) { ((ICommonContentProvider)provider).init(site); } ISynchronizationContext context = getContext(); if (context != null) { context.getDiffTree().addDiffChangeListener(this); } } public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals("org.eclipse.team.ui.P_SYNCVIEWPAGE_MODE")) { refresh(); } } protected boolean includeDirection(int direction) { ISynchronizePageConfiguration configuration = getConfiguration(); if (configuration != null) { return ((SynchronizePageConfiguration)configuration).includeDirection(direction); } return true; } protected ISynchronizationContext getContext() { ICommonContentExtensionSite extensionSite = getExtensionSite(); if (extensionSite != null) { return (ISynchronizationContext)extensionSite .getExtensionStateModel() .getProperty( "org.eclipse.team.ui.synchronizationContext"); } return null; } protected ISynchronizationScope getScope() { ICommonContentExtensionSite extensionSite = getExtensionSite(); if (extensionSite != null) { return (ISynchronizationScope)extensionSite .getExtensionStateModel() .getProperty( "org.eclipse.team.ui.synchronizationScope"); } return null; } protected ISynchronizePageConfiguration getConfiguration() { ICommonContentExtensionSite extensionSite = getExtensionSite(); if (extensionSite != null) { return (ISynchronizePageConfiguration)extensionSite .getExtensionStateModel() .getProperty( "org.eclipse.team.ui.synchronizationPageConfiguration"); } return null; } public void restoreState(IMemento aMemento) { ITreeContentProvider provider = getDelegateContentProvider(); if ((provider instanceof ICommonContentProvider)) { ((ICommonContentProvider)provider).restoreState(aMemento); } } public void saveState(IMemento aMemento) { ITreeContentProvider provider = getDelegateContentProvider(); if ((provider instanceof ICommonContentProvider)) { ((ICommonContentProvider)provider).saveState(aMemento); } } public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor) { refresh(); } public void propertyChanged(IDiffTree tree, int property, IPath[] paths) {} protected void refresh() { Utils.syncExec(new Runnable() { public void run() { TreeViewer treeViewer = (TreeViewer)getViewer(); if (empty) { treeViewer.refresh(); } else { treeViewer.refresh(getModelProvider()); } } }, getViewer().getControl()); } protected abstract ITreeContentProvider getDelegateContentProvider(); protected final ModelProvider getModelProvider() { try { return ModelProvider.getModelProviderD Further reading...For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.New!JAR listings
|