tn5250j/src/org/tn5250j/tools LoadMacroMenu.java,1.13,1.14
Patrick Bielen <[email protected]> Thu, 01 Jul 2004 12:57:12 +0000
| Newsgroups | gmane.comp.java.tn5250j.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tn5250j/tn5250j/src/org/tn5250j/tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17806/src/org/tn5250j/tools
Modified Files:
LoadMacroMenu.java
Log Message:
Here is another change in LoadMacroMenu when running as an applet.
Contributed by Kenneth.
Index: LoadMacroMenu.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/tools/LoadMacroMenu.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** LoadMacroMenu.java 26 Jun 2004 08:42:24 -0000 1.13
--- LoadMacroMenu.java 1 Jul 2004 12:57:10 -0000 1.14
***************
*** 36,43 ****
--- 36,46 ----
import org.tn5250j.scripting.InterpreterDriverManager;
import org.tn5250j.tools.LangTool;
+ import org.tn5250j.tools.logging.*;
public final class LoadMacroMenu {
private static Vector macroVector;
+ private static TN5250jLogger log =
+ TN5250jLogFactory.getLogger("org.tn5250j.tools.LoadMacroMenu");
static {
***************
*** 178,230 ****
* @param session
*/
! private static void loadScripts(Vector vector,
! String path,
! File directory,
! Session session) {
! ExecuteScriptAction action;
! File[] macroFiles = directory.listFiles();
! if(macroFiles == null || macroFiles.length == 0)
! return;
! Arrays.sort(macroFiles,new MacroCompare());
! for(int i = 0; i < macroFiles.length; i++) {
! File file = macroFiles[i];
! String fileName = file.getName();
! if(file.isHidden()) {
! /* do nothing! */
! continue;
! }
! else if(file.isDirectory()) {
! Vector submenu = new Vector();
! submenu.addElement(fileName.replace('_',' '));
! loadScripts(submenu,path + fileName + '/',file,session);
! // if we do not want empty directories to show up uncomment this
! // line.
! // if(submenu.size() != 1)
! vector.addElement(submenu);
! }
! else {
! if (InterpreterDriverManager.isScriptSupported(fileName)) {
! String fn = fileName.replace('_',' ');
! int index = fn.lastIndexOf('.');
! if (index > 0) {
! fn = fn.substring(0,index);
! }
! action = new ExecuteScriptAction(fn,
! file.getAbsolutePath(),
! session) {
! };
! vector.addElement(action);
! }
! }
! }
! }
/**
* Create the scripts menu(s) from the vector of macros provided
! *
* @param menu
* @param vector
--- 181,234 ----
* @param session
*/
! private static void loadScripts(Vector vector, String path, File directory,
! Session session) {
! ExecuteScriptAction action;
! File[] macroFiles = directory.listFiles();
! if (macroFiles == null || macroFiles.length == 0)
! return;
! Arrays.sort(macroFiles, new MacroCompare());
! //KJP - We will wrap this in a try catch block to catch security
! // exceptions
! for (int i = 0; i < macroFiles.length; i++) {
! try {
! File file = macroFiles[i];
! String fileName = file.getName();
! if (file.isHidden()) {
! /* do nothing! */
! continue;
! } else if (file.isDirectory()) {
! Vector submenu = new Vector();
! submenu.addElement(fileName.replace('_', ' '));
! loadScripts(submenu, path + fileName + '/', file, session);
! // if we do not want empty directories to show up uncomment
! // this line.
! // if(submenu.size() != 1)
! vector.addElement(submenu);
! } else {
! if (InterpreterDriverManager.isScriptSupported(fileName)) {
! String fn = fileName.replace('_', ' ');
! int index = fn.lastIndexOf('.');
! if (index > 0) {
! fn = fn.substring(0, index);
! }
! action = new ExecuteScriptAction(fn, file
! .getAbsolutePath(), session) {
! };
! vector.addElement(action);
! }
! }
! } catch (SecurityException se) {
! log.warn(se.getMessage());
! }
! }
! }
/**
* Create the scripts menu(s) from the vector of macros provided
! *
* @param menu
* @param vector
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com