1 11 package org.eclipse.ui.views.markers.internal; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.swt.graphics.Image; 15 16 20 public class FieldCategory extends AbstractField { 21 22 27 public String getDescription() { 28 return MarkerMessages.description_type; 29 } 30 31 36 public Image getDescriptionImage() { 37 return null; 38 } 39 40 45 public String getColumnHeaderText() { 46 return getDescription(); 47 } 48 49 54 public Image getColumnHeaderImage() { 55 return null; 56 } 57 58 63 public String getValue(Object obj) { 64 65 if (obj instanceof ConcreteMarker) { 66 ConcreteMarker marker = (ConcreteMarker) obj; 67 68 if (marker.getGroup() == null) { 69 if (!marker.getMarker().exists()) 70 return MarkerMessages.FieldCategory_Uncategorized; 71 String groupName = MarkerSupportRegistry.getInstance() 72 .getCategory(marker.getMarker()); 73 if (groupName == null) { 74 75 String typeId; 76 try { 77 typeId = marker.getMarker().getType(); 78 } catch (CoreException e) { 79 Util.log(e); 80 return MarkerMessages.FieldCategory_Uncategorized; 81 } 82 MarkerType type = MarkerTypesModel.getInstance().getType( 83 typeId); 84 groupName = type.getLabel(); 85 } 86 marker.setGroup(groupName); 87 } 88 89 return (String ) marker.getGroup(); 90 91 } 92 return Util.EMPTY_STRING; 93 } 94 95 100 public Image getImage(Object obj) { 101 return null; 102 } 103 104 110 public int compare(Object obj1, Object obj2) { 111 return getValue(obj1).compareTo(getValue(obj2)); 112 } 113 114 119 public int getDefaultDirection() { 120 return TableComparator.ASCENDING; 121 } 122 123 128 public int getPreferredWidth() { 129 return 200; 130 } 131 132 } 133 | Popular Tags |