2 * Copyright (c) 2004 Christopher Lenz and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * Christopher Lenz - initial API and implementation
11 * $Id: XMLOutlineLabelProvider.java,v 1.3 2006-10-21 23:14:14 pombredanne Exp $
14 package net.sourceforge.phpeclipse.xml.ui.internal.outline;
16 import net.sourceforge.phpeclipse.xml.core.model.IXMLElement;
17 import net.sourceforge.phpeclipse.xml.ui.XMLPlugin;
19 import org.eclipse.jface.viewers.LabelProvider;
20 import org.eclipse.swt.graphics.Image;
23 * Label provider for the XML outline page.
25 public class XMLOutlineLabelProvider extends LabelProvider {
27 // LabelProvider Implementation --------------------------------------------
30 * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
32 public Image getImage(Object element) {
33 if (element instanceof IXMLElement) {
34 return XMLPlugin.getDefault().getImageRegistry().get(
35 XMLPlugin.ICON_ELEMENT);
41 * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
43 public String getText(Object element) {
44 if (element instanceof IXMLElement) {
45 IXMLElement xmlElement = (IXMLElement) element;
46 StringBuffer buf = new StringBuffer();
47 if (xmlElement.getPrefix() != null) {
48 buf.append(xmlElement.getPrefix());
51 buf.append(xmlElement.getLocalName());
52 return buf.toString();