Пример #1
0
 @Override
 public void run() {
   Module module = getModule();
   File notifier = module.getNotifier(param(0));
   if (notifier.exists()) {
     Eclipse.openFile(module.file, notifier);
   } else {
     console.err.println("notifier does not exist");
   }
 }
Пример #2
0
 @Override
 public void run() {
   Module module = getModule();
   List<File> models = module.findModels();
   if (!models.isEmpty()) {
     Collections.sort(models);
     int beginIndex = module.models.getAbsolutePath().length() + 1;
     for (File model : models) {
       String s = model.getAbsolutePath();
       s = s.substring(beginIndex, s.length() - 5);
       console.out.println(s, "open model " + s);
     }
   } else {
     console.out.println("project has no models");
   }
 }
Пример #3
0
  @Override
  public void run() {
    Module module = getModule();
    File notifier = module.getNotifier(param(0));
    String name = notifier.getName();
    name = name.substring(0, name.length() - 5);
    if (notifier.exists()) {
      String confirm = flag('f') ? "Y" : ask("Permanently remove '" + name + "'?[Y/N] ");
      if (!confirm.equalsIgnoreCase("Y")) {
        console.out.println("operation cancelled");
        return;
      }

      notifier.delete();

      Eclipse.refresh(module.file, notifier.getParentFile());
    } else {
      console.err.println(name + " does not exist in " + module);
    }
  }
 @Override
 public boolean preSave() {
   if (backups == null) {
     Module module = model.getModuleElement().getModule();
     backups = new ArrayList<Backup>();
     File file = model.getFile();
     backups.add(new Backup(file));
     backups.add(new Backup(module.getControllerFor(file)));
     backups.add(new Backup(module.getViewsFolder(file)));
     backups.add(new Backup(module.getNotifier(file)));
     model.destroy();
   } else {
     model.save();
     for (Backup backup : backups) {
       backup.restore();
     }
     backups.clear();
     backups = null;
   }
   return true;
 }