📄 constantreferencedetailpane.java
字号:
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the license, or (at your option) any later version.
*/
package ee.ioc.cs.jbe.browser.detail.constants;
import org.gjt.jclasslib.structures.InvalidByteCodeException;
import org.gjt.jclasslib.structures.constants.ConstantReference;
import org.gjt.jclasslib.util.ExtendedJLabel;
import ee.ioc.cs.jbe.browser.BrowserServices;
import javax.swing.tree.TreePath;
/**
Detail pane showing a <tt>CONSTANT_Fieldref</tt>, <tt>CONSTANT_Methodref</tt>,
or a <tt>CONSTANT_InterfaceMethodref</tt> constant pool entry.
@author <a href="mailto:jclasslib@ej-technologies.com">Ingo Kegel</a>
@version $Revision: 1.4 $ $Date: 2006/09/25 16:00:58 $
*/
public class ConstantReferenceDetailPane extends AbstractConstantInfoDetailPane {
// Visual components
private ExtendedJLabel lblClass;
private ExtendedJLabel lblClassVerbose;
private ExtendedJLabel lblNameAndType;
private ExtendedJLabel lblNameAndTypeVerbose;
private ClassElementOpener classElementOpener;
/**
Constructor.
@param services the associated browser services.
*/
public ConstantReferenceDetailPane(BrowserServices services) {
super(services);
}
protected void setupLabels() {
addDetailPaneEntry(normalLabel("Class name:"),
lblClass = linkLabel(),
lblClassVerbose = highlightLabel());
addDetailPaneEntry(normalLabel("Name and type:"),
lblNameAndType = linkLabel(),
lblNameAndTypeVerbose = highlightLabel());
}
protected int addSpecial(int gridy) {
classElementOpener = new ClassElementOpener(this);
if (getBrowserServices().canOpenClassFiles()) {
return classElementOpener.addSpecial(this, gridy);
} else {
return 0;
}
}
public void show(TreePath treePath) {
int constantPoolIndex = constantPoolIndex(treePath);
try {
ConstantReference entry = (ConstantReference)services.getClassFile().getConstantPoolEntry(constantPoolIndex, ConstantReference.class);
classElementOpener.setCPInfo(entry);
constantPoolHyperlink(lblClass,
lblClassVerbose,
entry.getClassIndex());
constantPoolHyperlink(lblNameAndType,
lblNameAndTypeVerbose,
entry.getNameAndTypeIndex());
} catch (InvalidByteCodeException ex) {
lblClassVerbose.setText(MESSAGE_INVALID_CONSTANT_POOL_ENTRY);
}
super.show(treePath);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -