示例#1
0
 public static void doHelp(java.awt.Component comp, String token) {
   if (!quickHelpLoaded) {
     quickHelpWords = loadHelp(QUICKHELPWORDS_PATH);
     // if we're not in 3D don't load the 3d dictionary words
     // cause we don't need 'em and they'll override the 2d
     // dictionary ev 10/25/07
     if (org.nlogo.api.Version.is3D()) {
       quickHelpWords3d = loadHelp(QUICKHELPWORDS_PATH3D);
     } else {
       quickHelpWords3d = new HashMap<String, String>();
     }
     quickHelpLoaded = true;
   }
   if (token == null) {
     return;
   }
   token = token.toLowerCase();
   // if there is an entry in the 3D dictionary then it overrides
   // the 2D entry ev 10/25/07
   if (quickHelpWords3d.containsKey(token)) {
     openDictionary(comp, token, quickHelpWords3d);
   } else if (quickHelpWords.containsKey(token)) {
     openDictionary(comp, token, quickHelpWords);
   } else {
     if (0
         == javax.swing.JOptionPane.showConfirmDialog(
             comp,
             token.toUpperCase()
                 + " could not be found in the NetLogo Dictionary.\n"
                 + "Would you like to open the full NetLogo Dictionary?",
             "NetLogo",
             javax.swing.JOptionPane.YES_NO_OPTION)) {
       org.nlogo.swing.BrowserLauncher.openURL(comp, "docs/index2.html", true);
     }
   }
 }
示例#2
0
 private static void openDictionary(
     java.awt.Component comp, String theWord, Map<String, String> words) {
   String theFile = words.get(theWord);
   org.nlogo.swing.BrowserLauncher.openURL(comp, "docs/dict/" + theFile, true);
 }