org.eclipse.team.ui/src/org/eclipse/team/ui/mapping/SynchronizationLabelProvider.java
Parent Directory
|
Revision Log
Revision 1.18 -
(download)
(annotate)
Wed Mar 29 17:14:59 2006 UTC (3 years, 7 months ago) by mvalenta
Branch: MAIN
CVS Tags: I20080604, I200611061745, I20060510, I20070801, I20070101, I20070108, I20090323-1100, I200604271830, I20081202, I200608211720, I20070501, I20070502, I20070507, R3_3_1_1, I200702051300, I200607032320, R3_2_1, I20070426, R3_2_2, I20080819, I200604261810, I20091006-0800, I20061127, I20091013-0800, I20060917, I20070808, I20090407-0800, I200608081705, I200603301200, I20090803-1300, r34x_20080827, I20090224-0800, r34x_20080723, I20091028-0800, I200606121730, I200609251710, I20061024, r33x_20070730, I20090331-0800, I20090929-0800, I20080803, I200610301150, I20080415, r33x_20080128, r33x_20080122, I20090825-0800, I200606191715, I20070402, I20080204-0800, I20080304, I200604040100, I20060330, I200702071200, r33x_20070724, R3_4, R3_5, R3_2, R3_3, I200605031640, I20080715, I20071015, I20070303, I20070716, I20090714-0800, I20080526, I200703191600, I20070416, I20081021, I200610021645, I20090922-0800, I200606261730, I20090414-0755, I20080326, pre_R3_3, I200604120001, I20080722, I20070924, Root_bug_193324, I20080826, I200610232323, I20090309-1300, I20071001, I20070709, I20071127, I20090421, I20090916-0800, I20080328, I200606011710, I20090428, I20070423, Root_branch_20060714_FileBuffers, I200703211300, I200605311150, I20070226, I20090106, r33x_20070709, I20080923, I200603291800, R3_5_1, I20090429-0800, I20070326, I20060605-1430, I20080422, I20090304-1015, M200608151725, I20070730, I20091124-0800, I20090210-0800, I20070202, I20070430, M20060711, I20081125, I20060714, I20070316, I20091020-0800, I20080930, I20090217-0800, I20061120, I20091117-0800, I20061204, I20070129, I20061208, I20070723, I20070122, I200610161750, I20071023, I20080513, I20080515, I20070219, I20081216, I20070607, I20070606, I20070604, I20081118, I20070522, I20070523, I20080226, I20070524, I200605181830, R3_3_1, R3_3_2, I20080909, I20070910, I20070914, I20061212, I20070409, I20070115, I200604281200, I200606051140, I20061218, R3_4_2, R3_4_1, I200607101745, I20080115, I20060911, M20060801, I200607311745, I200604111815, I20070516, I20070515, I20090430-0408, I20070510, I20090317-1800, HEAD
Branch point for: branch_20060714_FileBuffers, R3_3_maintenance, bug_193324, R3_2_maintenance, R3_4_maintenance
Changes since 1.17: +2 -2 lines
Wed Mar 29 17:14:59 2006 UTC (3 years, 7 months ago) by mvalenta
Branch: MAIN
CVS Tags: I20080604, I200611061745, I20060510, I20070801, I20070101, I20070108, I20090323-1100, I200604271830, I20081202, I200608211720, I20070501, I20070502, I20070507, R3_3_1_1, I200702051300, I200607032320, R3_2_1, I20070426, R3_2_2, I20080819, I200604261810, I20091006-0800, I20061127, I20091013-0800, I20060917, I20070808, I20090407-0800, I200608081705, I200603301200, I20090803-1300, r34x_20080827, I20090224-0800, r34x_20080723, I20091028-0800, I200606121730, I200609251710, I20061024, r33x_20070730, I20090331-0800, I20090929-0800, I20080803, I200610301150, I20080415, r33x_20080128, r33x_20080122, I20090825-0800, I200606191715, I20070402, I20080204-0800, I20080304, I200604040100, I20060330, I200702071200, r33x_20070724, R3_4, R3_5, R3_2, R3_3, I200605031640, I20080715, I20071015, I20070303, I20070716, I20090714-0800, I20080526, I200703191600, I20070416, I20081021, I200610021645, I20090922-0800, I200606261730, I20090414-0755, I20080326, pre_R3_3, I200604120001, I20080722, I20070924, Root_bug_193324, I20080826, I200610232323, I20090309-1300, I20071001, I20070709, I20071127, I20090421, I20090916-0800, I20080328, I200606011710, I20090428, I20070423, Root_branch_20060714_FileBuffers, I200703211300, I200605311150, I20070226, I20090106, r33x_20070709, I20080923, I200603291800, R3_5_1, I20090429-0800, I20070326, I20060605-1430, I20080422, I20090304-1015, M200608151725, I20070730, I20091124-0800, I20090210-0800, I20070202, I20070430, M20060711, I20081125, I20060714, I20070316, I20091020-0800, I20080930, I20090217-0800, I20061120, I20091117-0800, I20061204, I20070129, I20061208, I20070723, I20070122, I200610161750, I20071023, I20080513, I20080515, I20070219, I20081216, I20070607, I20070606, I20070604, I20081118, I20070522, I20070523, I20080226, I20070524, I200605181830, R3_3_1, R3_3_2, I20080909, I20070910, I20070914, I20061212, I20070409, I20070115, I200604281200, I200606051140, I20061218, R3_4_2, R3_4_1, I200607101745, I20080115, I20060911, M20060801, I200607311745, I200604111815, I20070516, I20070515, I20090430-0408, I20070510, I20090317-1800, HEAD
Branch point for: branch_20060714_FileBuffers, R3_3_maintenance, bug_193324, R3_2_maintenance, R3_4_maintenance
Changes since 1.17: +2 -2 lines
Updated copyrights
/******************************************************************************* * Copyright (c) 2000, 2006 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 * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.team.ui.mapping; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.mapping.ModelProvider; import org.eclipse.jface.viewers.*; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.graphics.Image; import org.eclipse.team.core.mapping.ISynchronizationContext; import org.eclipse.team.core.mapping.ISynchronizationScope; import org.eclipse.team.internal.ui.TeamUIMessages; import org.eclipse.team.ui.synchronize.AbstractSynchronizeLabelProvider; import org.eclipse.ui.IMemento; import org.eclipse.ui.navigator.*; /** * A label provider wrapper that adds synchronization image and/or text decorations * to the image and label obtained from the delegate provider. * * @since 3.2 */ public abstract class SynchronizationLabelProvider extends AbstractSynchronizeLabelProvider implements ICommonLabelProvider, IFontProvider { private ISynchronizationScope scope; private ISynchronizationContext context; private ITreeContentProvider contentProvider; private ICommonContentExtensionSite site; private void init(ISynchronizationScope input, ISynchronizationContext context) { this.scope = input; this.context = context; } /* (non-Javadoc) * @see org.eclipse.ui.navigator.ICommonLabelProvider#init(org.eclipse.ui.navigator.ICommonContentExtensionSite) */ public void init(ICommonContentExtensionSite site) { this.site = site; contentProvider = site.getExtension().getContentProvider(); init((ISynchronizationScope)site.getExtensionStateModel().getProperty(ITeamContentProviderManager.P_SYNCHRONIZATION_SCOPE), (ISynchronizationContext)site.getExtensionStateModel().getProperty(ITeamContentProviderManager.P_SYNCHRONIZATION_CONTEXT)); } /** * Return the synchronization context associated with the view to which * this label provider applies. A <code>null</code> is returned if * no context is available. * @return the synchronization context or <code>null</code> */ public ISynchronizationContext getContext() { return context; } /** * Return the resource mapping scope associated with the view to which * this label provider applies. A <code>null</code> is returned if * no scope is available. * @return the resource mapping scope or <code>null</code> */ public ISynchronizationScope getScope() { return scope; } /* (non-Javadoc) * @see org.eclipse.ui.navigator.IMementoAware#restoreState(org.eclipse.ui.IMemento) */ public void restoreState(IMemento aMemento) { ILabelProvider provider = getDelegateLabelProvider(); if (provider instanceof ICommonLabelProvider) { ((ICommonLabelProvider) provider).restoreState(aMemento); } } /* (non-Javadoc) * @see org.eclipse.ui.navigator.IMementoAware#saveState(org.eclipse.ui.IMemento) */ public void saveState(IMemento aMemento) { ILabelProvider provider = getDelegateLabelProvider(); if (provider instanceof ICommonLabelProvider) { ((ICommonLabelProvider) provider).saveState(aMemento); } } /* (non-Javadoc) * @see org.eclipse.ui.navigator.IDescriptionProvider#getDescription(java.lang.Object) */ public String getDescription(Object anElement) { ILabelProvider provider = getDelegateLabelProvider(); if (provider instanceof IDescriptionProvider) { return ((IDescriptionProvider) provider).getDescription(internalGetElement(anElement)); } return null; } /* (non-Javadoc) * @see org.eclipse.team.internal.ui.mapping.SynchronizationStateLabelProvider#isDecorationEnabled() */ protected boolean isDecorationEnabled() { return getContext() != null; } /* (non-Javadoc) * @see org.eclipse.team.internal.ui.mapping.SynchronizationStateLabelProvider#getImage(java.lang.Object) */ public Image getImage(Object element) { Image image = super.getImage(element); if (image == null && internalGetElement(element) instanceof ModelProvider) { image = super.getImage(getModelRoot()); } return image; } /** * Return the root object for the model. By default, it is the * workspace root. Subclasses may override. This object is used to * obtain an image for the model provider. * @return the root object for the model */ protected Object getModelRoot() { return ResourcesPlugin.getWorkspace().getRoot(); } /* (non-Javadoc) * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeLabelProvider#getText(java.lang.Object) */ public String getText(Object element) { String text = super.getText(element); if (contentProvider instanceof SynchronizationContentProvider) { SynchronizationContentProvider scp = (SynchronizationContentProvider) contentProvider; ISynchronizationContext context = getContext(); if (context != null && !scp.isInitialized(context)) { return NLS.bind(TeamUIMessages.SynchronizationLabelProvider_0, text); } } return text; } /** * Return the Common Navigator extension site for this * label provider. * @return the Common Navigator extension site for this * label provider */ public ICommonContentExtensionSite getExtensionSite() { return site; } private Object internalGetElement(Object element) { if (element instanceof TreePath) { TreePath tp = (TreePath) element; element = tp.getLastSegment(); } return element; } }
| help@eclipse.org | ViewVC Help |
| Powered by ViewVC 1.0.3 |
