/** * Returns a representation of the current property value as java source. * * @return a value of type 'String' */ public String getJavaInitializationString() { DiagramLink fl = (DiagramLink) getValue(); if (fl == null) { return "null"; } return "new File(\"" + fl.getURL().getFile() + "\")"; }
/** * Paints a representation of the current Object. * * @param gfx the graphics context to use * @param box the area we are allowed to paint into */ public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) { FontMetrics fm = gfx.getFontMetrics(); int vpad = (box.height - fm.getHeight()) / 2; DiagramLink fl = (DiagramLink) getValue(); String val = "No file"; IFile file = fl.getFile(); if (fl != null && file != null) { val = file.getFilename(); } gfx.drawString(val, 2, fm.getHeight() + vpad); }