Beispiel #1
0
  /**
   * Create the composite.
   *
   * @param parent
   * @param style
   */
  public FeatureOffset(Composite parent, int style) {
    super(parent, style);
    setLayout(new GridLayout(3, true));

    stylerange = new StyleRange();
    stylerange.background = AndrospyMain.shell.getDisplay().getSystemColor(SWT.COLOR_YELLOW);

    txtSrch = new Text(this, SWT.BORDER);
    txtSrch.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

    Button btnSearch = new Button(this, SWT.NONE);
    btnSearch.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent arg0) {
            String srch = txtSrch.getText();
            String fulltext = text.getText();
            if (srch != "" && fulltext != "") {
              find(srch, fulltext);
            }
          }
        });
    GridData gd_btnSearch = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnSearch.widthHint = 104;
    btnSearch.setLayoutData(gd_btnSearch);
    btnSearch.setText("lk.score.androphsy.main.Search");

    text = new StyledText(this, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
    GridData gd_text = new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1);
    gd_text.heightHint = 230;
    text.setLayoutData(gd_text);

    lblOffset = new Label(this, SWT.NONE);
    lblOffset.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lblOffset.setText("Offset:");

    txtOffset = new Text(this, SWT.BORDER);
    txtOffset.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    btnHexView = new Button(this, SWT.NONE);
    btnHexView.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent arg0) {
            if (txtOffset.getText().equals("")) {
              MessageBox msbox = new MessageBox(getShell(), SWT.ICON_ERROR);
              msbox.setMessage("ERROR - Hex View");
              msbox.setText("Offset value cannot be null");
              msbox.open();
              return;
            }
            hv.getHexdump(txtOffset.getText());
          }
        });
    btnHexView.setText("Hex View");

    hv = new HexViewer(this, SWT.NONE);
    hv.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
  }
Beispiel #2
0
  /**
   * Create the composite.
   *
   * @param parent
   * @param style
   */
  public RecoverData(Composite parent, int style) {
    super(parent, style);
    setLayout(new GridLayout(3, false));

    tree = new Tree(this, SWT.BORDER);
    GridData gd_tree = new GridData(SWT.FILL, SWT.FILL, false, true, 1, 2);
    gd_tree.widthHint = 150;
    tree.setLayoutData(gd_tree);
    tree.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent arg0) {
            table.removeAll();
            table.setItemCount(0);

            Display.getDefault()
                .syncExec(
                    new Runnable() {

                      @Override
                      public void run() {
                        populateTable(tree);
                      }
                    });
          }
        });

    ScrolledComposite scrolledComposite =
        new ScrolledComposite(this, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    GridData gd_scrolledComposite = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
    gd_scrolledComposite.widthHint = 140;
    gd_scrolledComposite.heightHint = 56;
    scrolledComposite.setLayoutData(gd_scrolledComposite);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);

    table = new Table(scrolledComposite, SWT.BORDER | SWT.FULL_SELECTION);
    table.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent arg0) {
            TableItem row = table.getItem(table.getSelectionIndex());
            final String path = row.getText(2);
            Display.getDefault()
                .syncExec(
                    new Runnable() {

                      @Override
                      public void run() {
                        // hex.ViewHexDump(path);
                        showHexDump(path);
                        showPic(path);
                      }
                    });
          }
        });

    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    TableColumn tblclmnFileName = new TableColumn(table, SWT.NONE);
    tblclmnFileName.setWidth(100);
    tblclmnFileName.setText("File Name");

    TableColumn tblclmnSize = new TableColumn(table, SWT.NONE);
    tblclmnSize.setWidth(50);
    tblclmnSize.setText("Size");

    TableColumn tblclmnPath = new TableColumn(table, SWT.NONE);
    tblclmnPath.setWidth(-245);
    tblclmnPath.setText("Path");

    scrolledComposite.setContent(table);
    scrolledComposite.setMinSize(table.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    canvas = new Canvas(this, SWT.BORDER);
    canvas.setLayout(new GridLayout(1, false));
    GridData gd_scrolledComposite_1 = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_scrolledComposite_1.widthHint = 119;
    canvas.setLayoutData(gd_scrolledComposite_1);

    label = new Label(canvas, SWT.BORDER);
    label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    hexview = new HexViewer(this, SWT.NONE);
    hexview.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 2, 1));
  }