1 11 12 package org.eclipse.ui.views.markers.internal; 13 14 import org.eclipse.osgi.util.NLS; 15 import org.eclipse.swt.graphics.Image; 16 17 23 public class FieldMessage extends AbstractField { 24 25 28 public FieldMessage() { 29 } 30 31 36 public String getDescription() { 37 return MarkerMessages.description_message; 38 } 39 40 45 public Image getDescriptionImage() { 46 return null; 47 } 48 49 54 public String getColumnHeaderText() { 55 return MarkerMessages.description_message; 56 } 57 58 63 public Image getColumnHeaderImage() { 64 return null; 65 } 66 67 72 public String getValue(Object obj) { 73 if (obj == null) { 74 return MarkerMessages.FieldMessage_NullMessage; 75 } 76 77 if (obj instanceof MarkerNode) { 78 return ((MarkerNode) obj).getDescription(); 79 } 80 return NLS.bind(MarkerMessages.FieldMessage_WrongType, obj.toString()); 81 } 82 83 88 public Image getImage(Object obj) { 89 return null; 90 } 91 92 98 public int compare(Object obj1, Object obj2) { 99 if (obj1 == null || obj2 == null || !(obj1 instanceof ConcreteMarker) 100 || !(obj2 instanceof ConcreteMarker)) { 101 return 0; 102 } 103 104 ConcreteMarker marker1 = (ConcreteMarker) obj1; 105 ConcreteMarker marker2 = (ConcreteMarker) obj2; 106 107 return marker1.getDescriptionKey().compareTo( 108 marker2.getDescriptionKey()); 109 } 110 111 116 public int getDefaultDirection() { 117 return TableComparator.ASCENDING; 118 } 119 120 125 public int getPreferredWidth() { 126 return 250; 127 } 128 } 129 | Popular Tags |