Exemplo 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());
    }
  }
Exemplo n.º 2
0
  private void sendSootOutputEvent(String toSend) {
    SootOutputEvent send = new SootOutputEvent(this, ISootOutputEventConstants.SOOT_NEW_TEXT_EVENT);
    send.setTextToAppend(toSend);
    final SootOutputEvent sendFinal = send;

    Display.getCurrent()
        .asyncExec(
            new Runnable() {
              public void run() {
                SootPlugin.getDefault().fireSootOutputEvent(sendFinal);
              };
            });
  }
Exemplo n.º 3
0
  public void performFinish(IProgressMonitor monitor) {
    Display.getDefault()
        .asyncExec(
            new Runnable() {

              public void run() {
                PHPUiPlugin.getDefault()
                    .getPreferenceStore()
                    .setValue(
                        (PreferenceConstants.JavaScriptSupportEnable),
                        fJavaScriptSupportGroup.getSelection());
              }
            });
  }
Exemplo n.º 4
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());
    }
  }
  private void createSectionToolbar(Section section, FormToolkit toolkit) {
    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    ToolBar toolbar = toolBarManager.createControl(section);
    final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
    toolbar.setCursor(handCursor);
    // Cursor needs to be explicitly disposed
    toolbar.addDisposeListener(
        new DisposeListener() {
          public void widgetDisposed(DisposeEvent e) {
            if (handCursor.isDisposed() == false) {
              handCursor.dispose();
            }
          }
        });
    fNewPluginAction = new NewPluginAction();
    fNewFragmentAction = new NewFragmentAction();
    toolBarManager.add(fNewPluginAction);
    toolBarManager.add(fNewFragmentAction);

    toolBarManager.update(true);
    section.setTextClient(toolbar);
  }
 @Override
 protected Control createMessageArea(Composite composite) {
   // create composite
   // create image
   Image image = getImage();
   if (image != null) {
     imageLabel = new Label(composite, SWT.NULL);
     image.setBackground(imageLabel.getBackground());
     imageLabel.setImage(image);
     addAccessibleListeners(imageLabel, image);
     GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel);
   }
   // create message
   if (message != null) {
     FormToolkit toolkit = new FormToolkit(Display.getDefault());
     Composite toolkitComp = toolkit.createComposite(composite);
     toolkitComp.setLayout(new FillLayout(SWT.HORIZONTAL | SWT.VERTICAL));
     FormText text = toolkit.createFormText(toolkitComp, false);
     text.setText(message, true, true);
     text.setBackground(composite.getBackground());
     GridDataFactory.fillDefaults()
         .align(SWT.FILL, SWT.BEGINNING)
         .grab(true, false)
         .hint(
             convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH),
             SWT.DEFAULT)
         .applyTo(toolkitComp);
     text.addHyperlinkListener(
         new HyperlinkAdapter() {
           public void linkActivated(HyperlinkEvent event) {
             try {
               URI uri = URI.create((String) event.data);
               if ("pref".equals(uri.getScheme())) { // $NON-NLS-1$
                 Map<String, String> para = new HashMap<String, String>();
                 para.put(
                     IWorkbenchCommandConstants.WINDOW_PREFERENCES_PARM_PAGEID,
                     uri.getAuthority());
                 Command prefCommand =
                     PlatformUI.getWorkbench()
                         .getActiveWorkbenchWindow()
                         .getService(ICommandService.class)
                         .getCommand(IWorkbenchCommandConstants.WINDOW_PREFERENCES);
                 prefCommand.executeWithChecks(new ExecutionEvent(prefCommand, para, null, null));
               }
             } catch (ExecutionException e) {
               Platform.getLog(Platform.getBundle(Constants.Bundle_ID))
                   .log(new Status(IStatus.ERROR, Constants.Bundle_ID, e.getMessage(), e));
             } catch (NotDefinedException e) {
               Platform.getLog(Platform.getBundle(Constants.Bundle_ID))
                   .log(new Status(IStatus.ERROR, Constants.Bundle_ID, e.getMessage(), e));
             } catch (NotEnabledException e) {
               Platform.getLog(Platform.getBundle(Constants.Bundle_ID))
                   .log(new Status(IStatus.ERROR, Constants.Bundle_ID, e.getMessage(), e));
             } catch (NotHandledException e) {
               Platform.getLog(Platform.getBundle(Constants.Bundle_ID))
                   .log(new Status(IStatus.ERROR, Constants.Bundle_ID, e.getMessage(), e));
             }
           }
         });
   }
   return composite;
 }