Example #1
0
 public Macro create(int id, String name) {
   Macro m = (Macro) db.createModel(NAME);
   m.setId(id);
   m.setName(name);
   update(m);
   return m;
 }
 public void loadMacros() {
   File f = new File(System.getProperty("user.dir"));
   String[] files = f.list();
   for (int i = 0; i < files.length; i++) {
     try {
       if (files[i].startsWith("macro_")
           && files[i].endsWith(".class")
           && files[i].indexOf('$') == -1) {
         System.out.println(files[i]);
         Class clazz = Class.forName(files[i].substring(0, files[i].length() - ".class".length()));
         Macro macro =
             (Macro)
                 clazz
                     .getConstructor(new Class[] {mudclient_Debug.class})
                     .newInstance(new Object[] {inner});
         String[] commands = macro.getCommands();
         for (int j = 0; j < commands.length; j++) {
           System.out.println("command registered:" + commands[j]);
           mudclient_Debug.macros.put(commands[j], macro);
         }
       }
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
 }
Example #3
0
 public Macro get(String name) {
   Map m = db.getMap(NAME);
   Macro c;
   for (Iterator i = m.values().iterator(); i.hasNext(); ) {
     c = (Macro) i.next();
     if (c.getName().equals(name)) {
       return c;
     }
   }
   return null;
 }
Example #4
0
 void abortPluginOrMacro(ImagePlus imp) {
   if (imp != null) {
     ImageWindow win = imp.getWindow();
     if (win != null) {
       win.running = false;
       win.running2 = false;
     }
   }
   Macro.abort();
   Interpreter.abort();
   if (Interpreter.getInstance() != null) IJ.beep();
 }
Example #5
0
 public void remove(Macro macro) {
   Map m = db.getMap(NAME);
   m.remove(new Integer(macro.getId()));
 }
Example #6
0
 public void update(Macro macro) {
   Map m = db.getMap(NAME);
   m.put(new Integer(macro.getId()), macro);
 }
Example #7
0
 public Macro create(int id) {
   Macro m = (Macro) db.createModel(NAME);
   m.setId(id);
   update(m);
   return m;
 }