1 19 20 package org.netbeans.modules.tasklist.core.editors; 21 22 import org.openide.util.NbBundle; 23 24 import java.beans.PropertyEditorSupport ; 25 26 31 public class LocationPropertyEditor extends PropertyEditorSupport { 32 33 public boolean isPaintable() { 34 return true; 35 } 36 37 public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) { 38 int y = gfx.getFontMetrics().getHeight() - gfx.getFontMetrics().getDescent(); 39 gfx.drawString(translate(getAsText()), box.x , box.y + y); 40 } 41 42 private String translate(String location) { 43 if (location == null) return NbBundle.getMessage(LocationPropertyEditor.class, "unknown"); 44 int pathEnd = location.lastIndexOf('/'); if (pathEnd > 0 ) { 46 String path = location.substring(0, pathEnd); 47 String filePos = location.substring(pathEnd + 1); 48 return filePos + " (" + path + ")"; } else { 50 return location; 51 } 52 } 53 } 54 | Popular Tags |