1 11 12 package org.eclipse.ui.views.markers.internal; 13 14 import org.eclipse.swt.graphics.Image; 15 16 20 public class FieldResource extends AbstractField { 21 22 private String description; 23 24 private Image image; 25 26 29 public FieldResource() { 30 description = MarkerMessages.description_resource; 31 } 32 33 37 public String getDescription() { 38 return description; 39 } 40 41 45 public Image getDescriptionImage() { 46 return image; 47 } 48 49 53 public String getColumnHeaderText() { 54 return description; 55 } 56 57 61 public Image getColumnHeaderImage() { 62 return image; 63 } 64 65 69 public String getValue(Object obj) { 70 if (obj == null || !(obj instanceof ConcreteMarker)) { 71 return ""; } 73 ConcreteMarker marker = (ConcreteMarker) obj; 74 return marker.getResourceName(); 75 } 76 77 81 public Image getImage(Object obj) { 82 return null; 83 } 84 85 89 public int compare(Object obj1, Object obj2) { 90 if (obj1 == null || obj2 == null || !(obj1 instanceof ConcreteMarker) 91 || !(obj2 instanceof ConcreteMarker)) { 92 return 0; 93 } 94 95 ConcreteMarker marker1 = (ConcreteMarker) obj1; 96 ConcreteMarker marker2 = (ConcreteMarker) obj2; 97 98 return marker1.getResourceName().compareTo( 99 marker2.getResourceName()); 100 } 101 102 105 public int getDefaultDirection() { 106 return TableComparator.ASCENDING; 107 } 108 109 112 public int getPreferredWidth() { 113 return 75; 114 } 115 } 116 | Popular Tags |