Skip to main content
summaryrefslogtreecommitdiffstats
blob: d63839f3b6c2c0a0a9c4edd960aa92056644c6c4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/***************************************************************************************************
 * Copyright (c) 2003, 2004 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.jst.j2ee.internal.webservice.provider;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.edit.provider.ITableItemLabelProvider;
import org.eclipse.jst.j2ee.common.QName;
import org.eclipse.jst.j2ee.common.internal.provider.QNameItemProvider;


public class ATKUIQNameItemProvider extends QNameItemProvider implements ITableItemLabelProvider {
	public ATKUIQNameItemProvider(AdapterFactory adapterFactory) {
		super(adapterFactory);
	}

	/**
	 * This does the same thing as ITableLabelProvider.getColumnText.
	 */
	public String getColumnText(Object object, int columnIndex) {
		QName qname = (QName) object;
		switch (columnIndex) {
			case 0 :
				return toDisplayString(qname.getNamespaceURI());
			case 1 :
				return toDisplayString(qname.getLocalPart());
			default :
				StringBuffer sb = new StringBuffer();
				sb.append(qname.getNamespaceURI());
				sb.append("#"); //$NON-NLS-1$
				sb.append(qname.getLocalPart());
				return sb.toString();
		}
	}

	protected String toDisplayString(String s) {
		return (s != null) ? s : ""; //$NON-NLS-1$
	}

	/**
	 * This does the same thing as ITableLabelProvider.getColumnImage.
	 */
	public Object getColumnImage(Object object, int columnIndex) {
		return null;
	}
}

Back to the top