[Jarspy-commits] CVS: JarSpy/src/com/ociweb/jarspy/gui AboutAction.java,1.3,1.4 DecompileAction.java
Status: Beta
Brought to you by:
brown_j
|
From: Jeff B. <br...@us...> - 2002-07-17 13:50:24
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui
In directory usw-pr-cvs1:/tmp/cvs-serv19967/com/ociweb/jarspy/gui
Modified Files:
AboutAction.java DecompileAction.java ExitAction.java
ExtractArchiveAction.java JarSpyAction.java
OpenArchiveAction.java ViewJarContentsAction.java
ViewManifestAction.java
Log Message:
reconfig actions so they disable themselves when appropriate
Index: AboutAction.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/AboutAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AboutAction.java 15 Jul 2002 22:54:48 -0000 1.3
--- AboutAction.java 17 Jul 2002 13:50:19 -0000 1.4
***************
*** 27,35 ****
class AboutAction extends JarSpyAction {
- private final JarSpyGUI jarSpyGUI;
AboutAction(JarSpyGUI gui) {
! super(ActionNames.ABOUT_ACTION, "images/question.gif");
! jarSpyGUI = gui;
}
--- 27,36 ----
class AboutAction extends JarSpyAction {
AboutAction(JarSpyGUI gui) {
! super(gui,
! ActionNames.ABOUT_ACTION,
! "images/question.gif",
! false);
}
Index: DecompileAction.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/DecompileAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DecompileAction.java 15 Jul 2002 22:54:48 -0000 1.3
--- DecompileAction.java 17 Jul 2002 13:50:19 -0000 1.4
***************
*** 36,41 ****
implements JarFileSelectionListener, ListSelectionListener {
- private final JarSpyGUI jarSpyGUI;
- // private final Decompiler dec = new Decompiler();
private String className;
private JList classList;
--- 36,39 ----
***************
*** 46,60 ****
JList classList,
JarInspector jarInspector) {
! super(ActionNames.DECOMPILE_ACTION, "images/decompile.gif");
this.jarInspector = jarInspector;
- jarSpyGUI = gui;
setEnabled(false);
this.classList = classList;
classList.addListSelectionListener(this);
- jarSpyGUI.addJarFileSelectionListener(this);
}
public void jarFileSelectionChanged(File jarFile) {
! setEnabled(false);
if (jarFile != null) {
pathToJarFile = jarFile.getPath();
--- 44,59 ----
JList classList,
JarInspector jarInspector) {
! super(gui,
! ActionNames.DECOMPILE_ACTION,
! "images/decompile.gif",
! false);
this.jarInspector = jarInspector;
setEnabled(false);
this.classList = classList;
classList.addListSelectionListener(this);
}
public void jarFileSelectionChanged(File jarFile) {
! super.jarFileSelectionChanged(jarFile);
if (jarFile != null) {
pathToJarFile = jarFile.getPath();
Index: ExitAction.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/ExitAction.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ExitAction.java 19 Jun 2002 02:17:14 -0000 1.4
--- ExitAction.java 17 Jul 2002 13:50:19 -0000 1.5
***************
*** 30,38 ****
class ExitAction extends JarSpyAction implements WindowListener {
- private final JarSpyGUI jarSpyGUI;
-
ExitAction(JarSpyGUI gui) {
! super(ActionNames.EXIT_ACTION, "images/exit.gif");
! jarSpyGUI = gui;
}
--- 30,35 ----
class ExitAction extends JarSpyAction implements WindowListener {
ExitAction(JarSpyGUI gui) {
! super(gui, ActionNames.EXIT_ACTION, "images/exit.gif", false);
}
Index: ExtractArchiveAction.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/ExtractArchiveAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ExtractArchiveAction.java 17 Jul 2002 13:17:52 -0000 1.3
--- ExtractArchiveAction.java 17 Jul 2002 13:50:19 -0000 1.4
***************
*** 29,44 ****
* @version $Id$
*/
! class ExtractArchiveAction extends JarSpyAction
! implements JarFileSelectionListener {
- private final JarSpyGUI jarSpyGUI;
private final JarInspector jarInspector;
ExtractArchiveAction(JarSpyGUI gui,
JarInspector inspector) {
! super(ActionNames.EXTRACT_ARCHIVE_ACTION, "images/extract.gif");
! jarSpyGUI = gui;
jarInspector = inspector;
- jarSpyGUI.addJarFileSelectionListener(this);
}
--- 29,43 ----
* @version $Id$
*/
! class ExtractArchiveAction extends JarSpyAction {
private final JarInspector jarInspector;
ExtractArchiveAction(JarSpyGUI gui,
JarInspector inspector) {
! super(gui,
! ActionNames.EXTRACT_ARCHIVE_ACTION,
! "images/extract.gif",
! true);
jarInspector = inspector;
}
***************
*** 66,73 ****
}
}
- }
-
- public void jarFileSelectionChanged(File jarFile) {
- setEnabled(jarFile != null);
}
}
--- 65,68 ----
Index: JarSpyAction.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/JarSpyAction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** JarSpyAction.java 19 Jun 2002 01:19:10 -0000 1.2
--- JarSpyAction.java 17 Jul 2002 13:50:19 -0000 1.3
***************
*** 19,23 ****
package com.ociweb.jarspy.gui;
! import javax.swing.*;
/**
--- 19,25 ----
package com.ociweb.jarspy.gui;
! import javax.swing.AbstractAction;
! import javax.swing.ImageIcon;
! import java.io.File;
/**
***************
*** 25,36 ****
* @version $Id$
*/
! abstract class JarSpyAction extends AbstractAction {
! JarSpyAction(String actionName,
! String imagePath) {
super(actionName);
putValue(SMALL_ICON,
! new ImageIcon(getClass().getResource(imagePath)));
putValue(SHORT_DESCRIPTION, actionName);
}
}
--- 27,68 ----
* @version $Id$
*/
! abstract class JarSpyAction extends AbstractAction
! implements JarFileSelectionListener {
! /**
! * this flag indicates wether or not this action should be disabled
! * when there is not an archive currently opened
! */
! private boolean disabledWhenNoJarIsOpen = false;
!
! /**
! * the main gui
! */
! protected JarSpyGUI jarSpyGUI;
!
! /**
! * @param gui the main GUI
! * @param actionName the string name of this action
! * @param imagePath the path to the image associated with this action
! * @param disabledWhenNoJarIsOpen indicates wether or not this action
! * should be disabled when there is not an archive currently open
! */
! 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);
+ jarSpyGUI = gui;
+ this.disabledWhenNoJarIsOpen = disabledWhenNoJarIsOpen;
+ }
+
+ public void jarFileSelectionChanged(File jarFile) {
+ if (disabledWhenNoJarIsOpen) {
+ setEnabled(jarFile != null);
+ }
}
}
Index: OpenArchiveAction.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/OpenArchiveAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** OpenArchiveAction.java 20 Jun 2002 02:04:50 -0000 1.3
--- OpenArchiveAction.java 17 Jul 2002 13:50:19 -0000 1.4
***************
*** 30,39 ****
class OpenArchiveAction extends JarSpyAction {
- private final JarSpyGUI jarSpyGUI;
private final JFileChooser fileChooser = new JFileChooser();
OpenArchiveAction(JarSpyGUI gui) {
! super(ActionNames.OPEN_ARCHIVE_ACTION, "images/open.gif");
! jarSpyGUI = gui;
}
--- 30,37 ----
class OpenArchiveAction extends JarSpyAction {
private final JFileChooser fileChooser = new JFileChooser();
OpenArchiveAction(JarSpyGUI gui) {
! super(gui, ActionNames.OPEN_ARCHIVE_ACTION, "images/open.gif", false);
}
Index: ViewJarContentsAction.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/ViewJarContentsAction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ViewJarContentsAction.java 15 Jul 2002 22:54:49 -0000 1.2
--- ViewJarContentsAction.java 17 Jul 2002 13:50:19 -0000 1.3
***************
*** 19,25 ****
package com.ociweb.jarspy.gui;
! import javax.swing.*;
import javax.swing.table.TableModel;
! import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.File;
--- 19,29 ----
package com.ociweb.jarspy.gui;
! import javax.swing.JDialog;
! import javax.swing.JOptionPane;
! import javax.swing.JScrollPane;
! import javax.swing.JTable;
import javax.swing.table.TableModel;
! import java.awt.Dimension;
! import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.io.File;
***************
*** 39,44 ****
ViewJarContentsAction(JarSpyGUI jarSpyGUI) {
! super(ActionNames.VIEW_JAR_CONTENTS_ACTION, "images/jarcontents.gif");
! jarSpyGUI.addJarFileSelectionListener(this);
setEnabled(false);
}
--- 43,50 ----
ViewJarContentsAction(JarSpyGUI jarSpyGUI) {
! super(jarSpyGUI,
! ActionNames.VIEW_JAR_CONTENTS_ACTION,
! "images/jarcontents.gif",
! true);
setEnabled(false);
}
***************
*** 49,61 ****
// be disabled when the file is null...
JOptionPane.showMessageDialog(null,
! "Jar File Is Null!",
! "Error Opening Jar File",
! JOptionPane.ERROR_MESSAGE);
} else {
try {
JDialog dlg = new JDialog((Frame) null,
! "Jar Contents",
! true);
TableModel jarContentsModel = new JarContentsTableModel(new JarFile(jarFile));
JScrollPane scroller = new JScrollPane(new JTable(jarContentsModel));
--- 55,67 ----
// be disabled when the file is null...
JOptionPane.showMessageDialog(null,
! "Jar File Is Null!",
! "Error Opening Jar File",
! JOptionPane.ERROR_MESSAGE);
} else {
try {
JDialog dlg = new JDialog((Frame) null,
! "Jar Contents",
! true);
TableModel jarContentsModel = new JarContentsTableModel(new JarFile(jarFile));
JScrollPane scroller = new JScrollPane(new JTable(jarContentsModel));
***************
*** 67,73 ****
} catch (IOException exc) {
JOptionPane.showMessageDialog(null,
! "ERROR: " + exc.getMessage(),
! "Failure",
! JOptionPane.ERROR_MESSAGE);
}
}
--- 73,79 ----
} catch (IOException exc) {
JOptionPane.showMessageDialog(null,
! "ERROR: " + exc.getMessage(),
! "Failure",
! JOptionPane.ERROR_MESSAGE);
}
}
***************
*** 75,80 ****
public void jarFileSelectionChanged(File jarFile) {
this.jarFile = jarFile;
- setEnabled(jarFile != null);
}
}
--- 81,86 ----
public void jarFileSelectionChanged(File jarFile) {
+ super.jarFileSelectionChanged(jarFile);
this.jarFile = jarFile;
}
}
Index: ViewManifestAction.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/ViewManifestAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ViewManifestAction.java 17 Jul 2002 13:04:48 -0000 1.3
--- ViewManifestAction.java 17 Jul 2002 13:50:19 -0000 1.4
***************
*** 30,46 ****
* @version $Id$
*/
! class ViewManifestAction extends JarSpyAction
! implements JarFileSelectionListener {
- private final JarSpyGUI jarSpyGUI;
private JarInspector jarInspector;
ViewManifestAction(JarSpyGUI gui,
JarInspector jarInspector) {
! super(ActionNames.VIEW_MANIFEST_ACTION, "images/manifest.gif");
this.jarInspector = jarInspector;
- jarSpyGUI = gui;
setEnabled(false);
- jarSpyGUI.addJarFileSelectionListener(this);
}
--- 30,45 ----
* @version $Id$
*/
! class ViewManifestAction extends JarSpyAction {
private JarInspector jarInspector;
ViewManifestAction(JarSpyGUI gui,
JarInspector jarInspector) {
! super(gui,
! ActionNames.VIEW_MANIFEST_ACTION,
! "images/manifest.gif",
! true);
this.jarInspector = jarInspector;
setEnabled(false);
}
***************
*** 58,65 ****
md.dispose();
}
- }
-
- public void jarFileSelectionChanged(File jarFile) {
- setEnabled(jarFile != null);
}
}
--- 57,60 ----
|