Jar help files names management
Vincent Couvert [Fri, 14 Mar 2008 16:45:59 +0000 (16:45 +0000)]
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/helpbrowser/SwingScilabHelpBrowser.java
scilab/modules/helptools/macros/help.sci

index 80edef6..3616b07 100644 (file)
@@ -15,6 +15,7 @@ import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
+import java.util.StringTokenizer;
 
 import javax.help.BadIDException;
 import javax.help.DefaultHelpModel;
@@ -40,14 +41,20 @@ public class SwingScilabHelpBrowser extends JHelp implements SimpleHelpBrowser {
         */             
        public SwingScilabHelpBrowser(String[] helps) {
                super();        
-                       
-               /* First half of helps is directories list */
-               /* Second half of helps is chapters titles */
                
-           File[] jarFiles = new File[helps.length / 2];
+           File[] jarFiles = new File[helps.length];
+           String moduleName = "";
            for (int k = 0; k < helps.length; k++) {
-                       System.out.println("Loading help from: " + helps[k]);
-                       jarFiles[k] =  new File(helps[k] + "scilab_help.jar");
+                       /* Search module name */
+                       StringTokenizer tok = new StringTokenizer(helps[k], "/");
+                       while (tok.hasMoreTokens()) {
+                               if (tok.nextToken().equals("modules")) {
+                                       moduleName = tok.nextToken();
+                                       break;
+                               }
+                       }
+                       /* Jar file name */
+                       jarFiles[k] =  new File(helps[k] + moduleName + "_help.jar");
                }
            this.setModel(new DefaultHelpModel(new HelpSet()));
         
index 45b3e1b..47337a1 100644 (file)
@@ -26,8 +26,7 @@ function help(key)
                        
                        if argn(2)==0 then
                                //global %helps
-                               //allChapters = %helps;
-                               //helpbrowser(allChapters);
+                               //helpbrowser(%helps(:,1));
                                browsehelp(INDEX,"index");
                                return
                        end
@@ -42,10 +41,9 @@ function help(key)
                        path=gethelpfile(key)
                        
                        if path<>[] then
-                               browsehelp(path,key)
                                //global %helps
-                               //allChapters = %helps;
-                               //helpbrowser(allChapters, key);
+                               //helpbrowser(%helps(:,1), key);
+                               browsehelp(path,key)
                        else
                                apropos(key)
                        end