1 7 8 package org.gjt.jclasslib.browser.detail.constants; 9 10 import org.gjt.jclasslib.browser.BrowserServices; 11 import org.gjt.jclasslib.structures.InvalidByteCodeException; 12 import org.gjt.jclasslib.structures.constants.ConstantClassInfo; 13 import org.gjt.jclasslib.util.ExtendedJLabel; 14 15 import javax.swing.tree.TreePath ; 16 17 23 public class ConstantClassInfoDetailPane extends AbstractConstantInfoDetailPane { 24 25 27 private ExtendedJLabel lblClass; 28 private ExtendedJLabel lblClassVerbose; 29 30 private ClassElementOpener classElementOpener; 31 32 36 public ConstantClassInfoDetailPane(BrowserServices services) { 37 super(services); 38 } 39 40 protected void setupLabels() { 41 42 addDetailPaneEntry(normalLabel("Class name:"), 43 lblClass = linkLabel(), 44 lblClassVerbose = highlightLabel()); 45 } 46 47 protected int addSpecial(int gridy) { 48 49 classElementOpener = new ClassElementOpener(this); 50 if (getBrowserServices().canOpenClassFiles()) { 51 return classElementOpener.addSpecial(this, gridy); 52 } else { 53 return 0; 54 } 55 } 56 57 public void show(TreePath treePath) { 58 59 int constantPoolIndex = constantPoolIndex(treePath); 60 61 try { 62 ConstantClassInfo entry = (ConstantClassInfo)services.getClassFile().getConstantPoolEntry(constantPoolIndex, ConstantClassInfo.class); 63 classElementOpener.setCPInfo(entry); 64 65 constantPoolHyperlink(lblClass, 66 lblClassVerbose, 67 entry.getNameIndex()); 68 69 } catch (InvalidByteCodeException ex) { 70 lblClassVerbose.setText(MESSAGE_INVALID_CONSTANT_POOL_ENTRY); 71 } 72 73 super.show(treePath); 74 } 75 76 } 77 78 | Popular Tags |