1 11 package org.eclipse.pde.internal.ui.nls; 12 13 import org.eclipse.jface.resource.FontRegistry; 14 import org.eclipse.jface.resource.JFaceResources; 15 import org.eclipse.jface.viewers.IFontProvider; 16 import org.eclipse.jface.viewers.ITableLabelProvider; 17 import org.eclipse.jface.viewers.LabelProvider; 18 import org.eclipse.swt.graphics.Font; 19 import org.eclipse.swt.graphics.Image; 20 21 public class ExternalizeStringsLabelProvider extends LabelProvider 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.getValue()); 34 } else if (columnIndex == ExternalizeStringsWizardPage.KEY) { 35 return StringHelper.unwindEscapeChars(changeElement.getKey()); 36 } 37 } 38 return ""; } 40 41 public Image getColumnImage(Object element, int columnIndex) { 42 return null; 43 } 44 45 public Font getFont(Object element) { 46 if (element instanceof ModelChangeElement) { 47 ModelChangeElement changeElement = (ModelChangeElement) element; 48 if (changeElement.isExternalized()) { 49 return fFontRegistry.getBold(JFaceResources.DIALOG_FONT); 50 } 51 } 52 return null; 53 } 54 } 55 | Popular Tags |