Esempio n. 1
0
  protected void runSootDirectly(String mainClass) {

    int length = getSootCommandList().getList().size();
    String temp[] = new String[length];

    getSootCommandList().getList().toArray(temp);

    sendSootOutputEvent(mainClass);
    sendSootOutputEvent(" ");

    final String[] cmdAsArray = temp;

    for (int i = 0; i < temp.length; i++) {

      sendSootOutputEvent(temp[i]);
      sendSootOutputEvent(" ");
    }
    sendSootOutputEvent("\n");

    IRunnableWithProgress op;
    try {
      newProcessStarting();
      op = new SootRunner(temp, Display.getCurrent(), mainClass);
      ((SootRunner) op).setParent(this);
      ModalContext.run(op, true, new NullProgressMonitor(), Display.getCurrent());
    } catch (InvocationTargetException e1) {
      // handle exception
      System.out.println("InvocationTargetException: " + e1.getMessage());
      System.out.println("InvocationTargetException: " + e1.getTargetException());
      System.out.println(e1.getStackTrace());
    } catch (InterruptedException e2) {
      // handle cancelation
      System.out.println("InterruptedException: " + e2.getMessage());
    }
  }
  private void importContent(
      Object source,
      IPath destPath,
      IImportStructureProvider provider,
      List filesToImport,
      IProgressMonitor monitor)
      throws CoreException {
    IOverwriteQuery query =
        new IOverwriteQuery() {
          public String queryOverwrite(String file) {
            return ALL;
          }
        };
    ImportOperation op = new ImportOperation(destPath, source, provider, query);
    op.setCreateContainerStructure(false);
    if (filesToImport != null) {
      op.setFilesToImport(filesToImport);
    }

    try {
      op.run(monitor);
    } catch (InvocationTargetException e) {
      Throwable th = e.getTargetException();
      if (th instanceof CoreException) {
        throw (CoreException) th;
      }
      IStatus status =
          new Status(IStatus.ERROR, MDEPlugin.getPluginId(), IStatus.ERROR, e.getMessage(), e);
      throw new CoreException(status);
    } catch (InterruptedException e) {
      throw new OperationCanceledException(e.getMessage());
    }
  }
Esempio n. 3
0
  protected void runSootAsProcess(String cmd) {

    SootProcessRunner op;
    try {
      newProcessStarting();
      op = new SootProcessRunner(Display.getCurrent(), cmd, sootClasspath);

      if (window == null) {
        window = SootPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
      }
      new ProgressMonitorDialog(window.getShell()).run(true, true, op);

    } catch (InvocationTargetException e1) {
      // handle exception
    } catch (InterruptedException e2) {
      // handle cancelation
      System.out.println(e2.getMessage());
    }
  }