01: /*******************************************************************************
02: * Copyright (c) 2005, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.nls;
11:
12: import org.eclipse.jface.resource.FontRegistry;
13: import org.eclipse.jface.resource.JFaceResources;
14: import org.eclipse.jface.viewers.IFontProvider;
15: import org.eclipse.jface.viewers.ITableLabelProvider;
16: import org.eclipse.jface.viewers.LabelProvider;
17: import org.eclipse.swt.graphics.Font;
18: import org.eclipse.swt.graphics.Image;
19:
20: public class ExternalizeStringsLabelProvider extends LabelProvider
21: implements ITableLabelProvider, IFontProvider {
22:
23: private FontRegistry fFontRegistry;
24:
25: public ExternalizeStringsLabelProvider() {
26: fFontRegistry = JFaceResources.getFontRegistry();
27: }
28:
29: public String getColumnText(Object element, int columnIndex) {
30: if (element instanceof ModelChangeElement) {
31: ModelChangeElement changeElement = (ModelChangeElement) element;
32: if (columnIndex == ExternalizeStringsWizardPage.VALUE) {
33: return StringHelper.unwindEscapeChars(changeElement
34: .getValue());
35: } else if (columnIndex == ExternalizeStringsWizardPage.KEY) {
36: return StringHelper.unwindEscapeChars(changeElement
37: .getKey());
38: }
39: }
40: return ""; //$NON-NLS-1$
41: }
42:
43: public Image getColumnImage(Object element, int columnIndex) {
44: return null;
45: }
46:
47: public Font getFont(Object element) {
48: if (element instanceof ModelChangeElement) {
49: ModelChangeElement changeElement = (ModelChangeElement) element;
50: if (changeElement.isExternalized()) {
51: return fFontRegistry
52: .getBold(JFaceResources.DIALOG_FONT);
53: }
54: }
55: return null;
56: }
57: }
|