blob: 1bfc7e805ad7449baaba35b9ad71f6a336f4a591 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 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.examples.model.ui;
import org.eclipse.team.examples.model.ModelObject;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.navigator.ICommonContentExtensionSite;
import org.eclipse.ui.navigator.ICommonLabelProvider;
/**
* Model content provider for use with the Common Navigator framework.
* It makes use of an IWorkbenchAdapter to get the label and image
* of model objects.
*/
public class ModelNavigatorLabelProvider extends WorkbenchLabelProvider implements
ICommonLabelProvider {
private ICommonContentExtensionSite extensionSite;
/* (non-Javadoc)
* @see org.eclipse.ui.navigator.ICommonLabelProvider#init(org.eclipse.ui.navigator.ICommonContentExtensionSite)
*/
public void init(ICommonContentExtensionSite aConfig) {
extensionSite = aConfig;
}
/* (non-Javadoc)
* @see org.eclipse.ui.navigator.IMementoAware#restoreState(org.eclipse.ui.IMemento)
*/
public void restoreState(IMemento aMemento) {
// Nothing to do
}
/* (non-Javadoc)
* @see org.eclipse.ui.navigator.IMementoAware#saveState(org.eclipse.ui.IMemento)
*/
public void saveState(IMemento aMemento) {
// Nothing to do
}
/* (non-Javadoc)
* @see org.eclipse.ui.navigator.IDescriptionProvider#getDescription(java.lang.Object)
*/
public String getDescription(Object anElement) {
if (anElement instanceof ModelObject) {
return ((ModelObject) anElement).getPath();
}
return null;
}
/**
* Return the extension site for this label provider.
* @return the extension site for this label provider
*/
public ICommonContentExtensionSite getExtensionSite() {
return extensionSite;
}
}