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.ConstantNameAndTypeInfo; 13 import org.gjt.jclasslib.util.ExtendedJLabel; 14 15 import javax.swing.tree.TreePath ; 16 17 23 public class ConstantNameAndTypeInfoDetailPane extends AbstractConstantInfoDetailPane { 24 25 27 private ExtendedJLabel lblName; 28 private ExtendedJLabel lblNameVerbose; 29 private ExtendedJLabel lblDescriptor; 30 private ExtendedJLabel lblDescriptorVerbose; 31 32 36 public ConstantNameAndTypeInfoDetailPane(BrowserServices services) { 37 super(services); 38 } 39 40 protected void setupLabels() { 41 42 addDetailPaneEntry(normalLabel("Name:"), 43 lblName = linkLabel(), 44 lblNameVerbose = highlightLabel()); 45 46 addDetailPaneEntry(normalLabel("Descriptor:"), 47 lblDescriptor = linkLabel(), 48 lblDescriptorVerbose = highlightLabel()); 49 } 50 51 public void show(TreePath treePath) { 52 53 int constantPoolIndex = constantPoolIndex(treePath); 54 55 try { 56 ConstantNameAndTypeInfo entry = (ConstantNameAndTypeInfo)services.getClassFile().getConstantPoolEntry(constantPoolIndex, ConstantNameAndTypeInfo.class); 57 58 constantPoolHyperlink(lblName, 59 lblNameVerbose, 60 entry.getNameIndex()); 61 62 constantPoolHyperlink(lblDescriptor, 63 lblDescriptorVerbose, 64 entry.getDescriptorIndex()); 65 66 } catch (InvalidByteCodeException ex) { 67 lblNameVerbose.setText(MESSAGE_INVALID_CONSTANT_POOL_ENTRY); 68 } 69 70 super.show(treePath); 71 72 } 73 74 } 75 76 | Popular Tags |