示例#1
0
 private void handleDeleteFile() {
   Object selection = ((TreeSelection) fileTree.getSelection()).getFirstElement();
   if (!(selection instanceof IFile)) return;
   IFile file = (IFile) selection;
   int option =
       new MessageDialog(
               getShell(),
               "Delete " + file.getName() + "?",
               null,
               "Are you sure you want to delete "
                   + "the configuration file: "
                   + file.getName()
                   + "?",
               MessageDialog.QUESTION,
               new String[] {"Yes", "No"},
               1)
           .open();
   if (option != 0) return;
   try {
     file.delete(true, true, null);
   } catch (CoreException e) {
     VJP.logError("Could not delete file.", e);
   }
   updateTree();
 }
示例#2
0
 private void stepPause() {
   synchronized (lock) {
     try {
       while (!cancel && !step && !run) lock.wait();
     } catch (InterruptedException e) {
       VJP.logError("VJP listener step couldn't wait!!", e);
     }
   }
   step = false;
 }
示例#3
0
  private void runPause() {
    synchronized (lock) {
      long end_time = System.currentTimeMillis() + delay;

      try {
        while (!cancel && System.currentTimeMillis() < end_time) lock.wait(delay);
      } catch (InterruptedException e) {
        VJP.logError("VJP listener run couldn't wait!!", e);
      }
    }
  }
示例#4
0
  private void handleNewFile() {
    ModePropertyFileDialog dialog = new ModePropertyFileDialog(getShell());
    IFile file = dialog.getFile();
    if (file == null) return;
    IProject project = dialog.getFileProject();
    if (project == null) {
      new MessageDialog(
              getShell(),
              "Invalid Mode Property File location",
              null,
              "Mode Property Files can only be stored within a project.",
              MessageDialog.ERROR,
              new String[] {"OK"},
              0)
          .open();

      return;
    }
    if (file.exists()) {
      new MessageDialog(
              getShell(),
              "File already exists.",
              null,
              "This file location chosen already exists.",
              MessageDialog.ERROR,
              new String[] {"OK"},
              0)
          .open();
      return;
    }
    try {
      file.getLocation().toFile().getParentFile().mkdirs();
      file.getLocation().toFile().createNewFile();
      file.refreshLocal(IResource.DEPTH_INFINITE, null);
    } catch (Exception e) {
      VJP.logError("File could not be created or refreshed", e);
    }
    updateTree();
  }