📄 verifydialog.java
字号:
package org.apache.bcel.verifier;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache BCEL" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache BCEL", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import org.apache.bcel.*;
import org.apache.bcel.classfile.*;
import java.awt.Color;
/**
* A class for simple graphical class file verification.
* Use the main(String []) method with fully qualified
* class names as arguments to use it as a stand-alone
* application.
* Use the VerifyDialog(String) constructor to use this
* class in your application.
* [This class was created using VisualAge for Java,
* but it does not work under VAJ itself (Version 3.02 JDK 1.2)]
* @version $Id: VerifyDialog.java,v 1.2 2006/09/04 15:43:18 andos Exp $
* @author <A HREF="http://www.inf.fu-berlin.de/~ehaase"/>Enver Haase</A>
* @see #main(String[])
* @see #VerifyDialog(String)
*/
public class VerifyDialog extends javax.swing.JDialog {
/** Machine-generated. */
private javax.swing.JPanel ivjJDialogContentPane = null;
/** Machine-generated. */
private javax.swing.JPanel ivjPass1Panel = null;
/** Machine-generated. */
private javax.swing.JPanel ivjPass2Panel = null;
/** Machine-generated. */
private javax.swing.JPanel ivjPass3Panel = null;
/** Machine-generated. */
private javax.swing.JButton ivjPass1Button = null;
/** Machine-generated. */
private javax.swing.JButton ivjPass2Button = null;
/** Machine-generated. */
private javax.swing.JButton ivjPass3Button = null;
/** Machine-generated. */
IvjEventHandler ivjEventHandler = new IvjEventHandler();
/**
* The class to verify. Default set to 'java.lang.Object'
* in case this class is instantiated via one of the many
* machine-generated constructors.
*/
private String class_name = "java.lang.Object";
/**
* This field is here to count the number of open VerifyDialog
* instances so the JVM can be exited afer every Dialog had been
* closed.
*/
private static int classes_to_verify;
/** Machine-generated. */
class IvjEventHandler implements java.awt.event.ActionListener {
public void actionPerformed(java.awt.event.ActionEvent e) {
if (e.getSource() == VerifyDialog.this.getPass1Button())
connEtoC1(e);
if (e.getSource() == VerifyDialog.this.getPass2Button())
connEtoC2(e);
if (e.getSource() == VerifyDialog.this.getPass3Button())
connEtoC3(e);
if (e.getSource() == VerifyDialog.this.getFlushButton())
connEtoC4(e);
};
};
/** Machine-generated. */
private javax.swing.JButton ivjFlushButton = null;
/** Machine-generated. */
public VerifyDialog() {
super();
initialize();
}
/** Machine-generated. */
public VerifyDialog(java.awt.Dialog owner) {
super(owner);
}
/** Machine-generated. */
public VerifyDialog(java.awt.Dialog owner, String title) {
super(owner, title);
}
/** Machine-generated. */
public VerifyDialog(java.awt.Dialog owner, String title, boolean modal) {
super(owner, title, modal);
}
/** Machine-generated. */
public VerifyDialog(java.awt.Dialog owner, boolean modal) {
super(owner, modal);
}
/** Machine-generated. */
public VerifyDialog(java.awt.Frame owner) {
super(owner);
}
/** Machine-generated. */
public VerifyDialog(java.awt.Frame owner, String title) {
super(owner, title);
}
/** Machine-generated. */
public VerifyDialog(java.awt.Frame owner, String title, boolean modal) {
super(owner, title, modal);
}
/** Machine-generated. */
public VerifyDialog(java.awt.Frame owner, boolean modal) {
super(owner, modal);
}
/**
* Use this constructor if you want a possibility to verify other
* class files than java.lang.Object.
* @param fully_qualified_class_name java.lang.String
*/
public VerifyDialog(String fully_qualified_class_name) {
super();
int dotclasspos = fully_qualified_class_name.lastIndexOf(".class");
if (dotclasspos != -1) fully_qualified_class_name = fully_qualified_class_name.substring(0,dotclasspos);
fully_qualified_class_name = fully_qualified_class_name.replace('/', '.');
class_name = fully_qualified_class_name;
initialize();
}
/** Machine-generated. */
private void connEtoC1(java.awt.event.ActionEvent arg1) {
try {
// user code begin {1}
// user code end
this.pass1Button_ActionPerformed(arg1);
// user code begin {2}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {3}
// user code end
handleException(ivjExc);
}
}
/** Machine-generated. */
private void connEtoC2(java.awt.event.ActionEvent arg1) {
try {
// user code begin {1}
// user code end
this.pass2Button_ActionPerformed(arg1);
// user code begin {2}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {3}
// user code end
handleException(ivjExc);
}
}
/** Machine-generated. */
private void connEtoC3(java.awt.event.ActionEvent arg1) {
try {
// user code begin {1}
// user code end
this.pass4Button_ActionPerformed(arg1);
// user code begin {2}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {3}
// user code end
handleException(ivjExc);
}
}
/** Machine-generated. */
private void connEtoC4(java.awt.event.ActionEvent arg1) {
try {
// user code begin {1}
// user code end
this.flushButton_ActionPerformed(arg1);
// user code begin {2}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {3}
// user code end
handleException(ivjExc);
}
}
/** Machine-generated. */
public void flushButton_ActionPerformed(java.awt.event.ActionEvent actionEvent) {
VerifierFactory.getVerifier(class_name).flush();
Repository.removeClass(class_name); // Make sure it will be reloaded.
getPass1Panel().setBackground(Color.gray);
getPass1Panel().repaint();
getPass2Panel().setBackground(Color.gray);
getPass2Panel().repaint();
getPass3Panel().setBackground(Color.gray);
getPass3Panel().repaint();
}
/** Machine-generated. */
private javax.swing.JButton getFlushButton() {
if (ivjFlushButton == null) {
try {
ivjFlushButton = new javax.swing.JButton();
ivjFlushButton.setName("FlushButton");
ivjFlushButton.setText("Flush: Forget old verification results");
ivjFlushButton.setBackground(java.awt.SystemColor.controlHighlight);
ivjFlushButton.setBounds(60, 215, 300, 30);
ivjFlushButton.setForeground(java.awt.Color.red);
ivjFlushButton.setActionCommand("FlushButton");
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjFlushButton;
}
/** Machine-generated. */
private javax.swing.JPanel getJDialogContentPane() {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -