[Jarspy-commits] CVS: JarSpy/src/com/ociweb/jarspy/gui/actions ChangeJarViewerComponentAction.java,N
Status: Beta
Brought to you by:
brown_j
|
From: Jeff B. <br...@us...> - 2002-07-20 18:12:27
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/actions
In directory usw-pr-cvs1:/tmp/cvs-serv12138/src/com/ociweb/jarspy/gui/actions
Modified Files:
ActionNames.java DecompileAction.java JarSpyAction.java
Added Files:
ChangeJarViewerComponentAction.java
Log Message:
added new tree view option
--- NEW FILE: ChangeJarViewerComponentAction.java ---
// JarSpy
// Copyright (c) 2001, 2002 Jeff S. Brown
// This file is part of JarSpy.
//
// JarSpy 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.
//
// JarSpy is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with JarSpy; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package com.ociweb.jarspy.gui.actions;
import com.ociweb.jarspy.gui.JarSpyGUI;
import javax.swing.JSplitPane;
import java.awt.Component;
import java.awt.event.ActionEvent;
/**
* An action for swithcing the component used to display primary archive
* contents
*
* @version $Id: ChangeJarViewerComponentAction.java,v 1.1 2002/07/20 18:12:23 brown_j Exp $
*/
public class ChangeJarViewerComponentAction extends JarSpyAction {
private Component viewComponent;
public ChangeJarViewerComponentAction(JarSpyGUI gui,
String name,
Component viewComponent,
String imagePath) {
super(gui,
name,
imagePath,
false);
this.viewComponent = viewComponent;
}
/**
* Invoked when an action occurs.
*/
public void actionPerformed(ActionEvent e) {
jarSpyGUI.setJarViewComponent(viewComponent);
}
}
Index: ActionNames.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/actions/ActionNames.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ActionNames.java 17 Jul 2002 14:00:25 -0000 1.1
--- ActionNames.java 20 Jul 2002 18:12:23 -0000 1.2
***************
*** 31,33 ****
--- 31,35 ----
String DECOMPILE_ACTION = "Decompile Class";
String VIEW_JAR_CONTENTS_ACTION = "View Jar Contents";
+ String SHOW_JAR_LIST_VIEW = "List View";
+ String SHOW_JAR_TREE_VIEW = "Tree View";
}
Index: DecompileAction.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/actions/DecompileAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DecompileAction.java 19 Jul 2002 00:46:43 -0000 1.3
--- DecompileAction.java 20 Jul 2002 18:12:23 -0000 1.4
***************
*** 21,32 ****
import com.ociweb.jarspy.ClassInfo;
import com.ociweb.jarspy.JarInspector;
! import com.ociweb.jarspy.gui.JarFileSelectionListener;
! import com.ociweb.jarspy.gui.JarSpyGUI;
import com.ociweb.jarspy.gui.DecompileGUI;
- import javax.swing.JList;
import javax.swing.JOptionPane;
! import javax.swing.event.ListSelectionEvent;
! import javax.swing.event.ListSelectionListener;
import java.awt.event.ActionEvent;
import java.io.File;
--- 21,30 ----
import com.ociweb.jarspy.ClassInfo;
import com.ociweb.jarspy.JarInspector;
! import com.ociweb.jarspy.gui.ClassSelectionListener;
import com.ociweb.jarspy.gui.DecompileGUI;
+ import com.ociweb.jarspy.gui.JarSpyGUI;
import javax.swing.JOptionPane;
! import javax.swing.JTree;
import java.awt.event.ActionEvent;
import java.io.File;
***************
*** 37,50 ****
*/
public class DecompileAction extends JarSpyAction
! implements JarFileSelectionListener, ListSelectionListener {
private String className;
! private JList classList;
private String pathToJarFile;
private JarInspector jarInspector;
public DecompileAction(JarSpyGUI gui,
! JList classList,
! JarInspector jarInspector) {
super(gui,
ActionNames.DECOMPILE_ACTION,
--- 35,48 ----
*/
public class DecompileAction extends JarSpyAction
! implements ClassSelectionListener {
private String className;
! private JTree classTree;
private String pathToJarFile;
private JarInspector jarInspector;
public DecompileAction(JarSpyGUI gui,
! JTree classTree,
! JarInspector jarInspector) {
super(gui,
ActionNames.DECOMPILE_ACTION,
***************
*** 53,58 ****
this.jarInspector = jarInspector;
setEnabled(false);
! this.classList = classList;
! classList.addListSelectionListener(this);
}
--- 51,56 ----
this.jarInspector = jarInspector;
setEnabled(false);
! this.classTree = classTree;
! jarSpyGUI.addClassSelectionListener(this);
}
***************
*** 66,72 ****
public void actionPerformed(ActionEvent ae) {
try {
- // dec.decompile(className,
- // new java.io.PrintWriter(System.out),
- // null);
DecompileGUI dg = new DecompileGUI(jarSpyGUI,
className,
--- 64,67 ----
***************
*** 83,97 ****
}
! public void valueChanged(ListSelectionEvent lse) {
! if (!lse.getValueIsAdjusting()) {
! className = null;
! Object o = classList.getSelectedValue();
! if (o instanceof ClassInfo) {
! setEnabled(true);
! className = ((ClassInfo) o).getClassName();
! } else {
! setEnabled(false);
! }
! }
}
}
--- 78,85 ----
}
! public void classSelected(ClassInfo classInfo) {
! setEnabled(classInfo != null);
}
+
}
+
Index: JarSpyAction.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/actions/JarSpyAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** JarSpyAction.java 17 Jul 2002 14:00:25 -0000 1.1
--- JarSpyAction.java 20 Jul 2002 18:12:23 -0000 1.2
***************
*** 52,61 ****
*/
public JarSpyAction(JarSpyGUI gui,
! String actionName,
! String imagePath,
! boolean disabledWhenNoJarIsOpen) {
super(actionName);
! putValue(SMALL_ICON,
! new ImageIcon(getClass().getResource(imagePath)));
putValue(SHORT_DESCRIPTION, actionName);
gui.addJarFileSelectionListener(this);
--- 52,63 ----
*/
public JarSpyAction(JarSpyGUI gui,
! String actionName,
! String imagePath,
! boolean disabledWhenNoJarIsOpen) {
super(actionName);
! if (imagePath != null) {
! putValue(SMALL_ICON,
! new ImageIcon(getClass().getResource(imagePath)));
! }
putValue(SHORT_DESCRIPTION, actionName);
gui.addJarFileSelectionListener(this);
|