Package com.dubture.twig.ui.outline

Source Code of com.dubture.twig.ui.outline.TwigOutlineLabelProvider

/*******************************************************************************
* This file is part of the Twig eclipse plugin.
*
* (c) Robert Gruendler <r.gruendler@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
******************************************************************************/
package com.dubture.twig.ui.outline;

import org.eclipse.dltk.core.IModelElement;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.graphics.Image;

import com.dubture.twig.core.documentModel.dom.ElementImplForTwig;

/**
*
*
*
*
*
* @author Robert Gruendler <r.gruendler@gmail.com>
*
*/
@SuppressWarnings("restriction")
public class TwigOutlineLabelProvider extends XMLLabelProvider
{

    private ILabelProvider modelElementLabelProvider;

    public TwigOutlineLabelProvider(ILabelProvider modelElementLabelProvider)
    {
        this.modelElementLabelProvider = modelElementLabelProvider;
    }

    public Image getImage(Object o)
    {

        if (o instanceof IModelElement) {
            return modelElementLabelProvider.getImage(o);
        }
        return super.getImage(o);
    }

    public String getText(Object o)
    {

        if (o instanceof ElementImplForTwig) {
            ElementImplForTwig element = (ElementImplForTwig) o;
            return element.getTagName();
        }

        return super.getText(o);
    }
}
TOP

Related Classes of com.dubture.twig.ui.outline.TwigOutlineLabelProvider

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.