Ejemplo n.º 1
0
  @Override
  protected Control createDialogArea(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);

    container.setLayout(new GridLayout(1, true));
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    GridData gd = new GridData(GridData.FILL_BOTH);

    Label l1 = new Label(container, SWT.NONE);
    l1.setText(Messages.getString("CacheManagerDialog.1")); // $NON-NLS-1$

    combo = new Combo(container, SWT.BORDER);
    combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    combo.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            final String path = ((Combo) e.getSource()).getText();

            viewer.getTable().removeAll();

            // System.out.println(path);
            loadTable(new File(path));
          }
        });

    viewer = new TableViewer(container, SWT.BORDER | SWT.MULTI);
    viewer.getTable().setLayoutData(gd);

    loadData();

    return container;
  }
Ejemplo n.º 2
0
  /*
   * (non-Javadoc)
   * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
   */
  protected void createButtonsForButtonBar(Composite parent) {
    // delete selected  btn
    Button btn =
        createButton(
            parent,
            IDialogConstants.NO_ID,
            Messages.getString("CacheManagerDialog.2"),
            true); //$NON-NLS-1$

    btn.addSelectionListener(
        new SelectionAdapter() {
          @SuppressWarnings("unchecked") // $NON-NLS-1$
          public void widgetSelected(SelectionEvent e) {
            // Delete selected
            try {
              IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();

              if (selection == null || selection.isEmpty()) return;

              Iterator iter = selection.iterator();

              // delete selected items
              while (iter.hasNext()) {
                final String sel = (String) iter.next();
                // get path
                final String path = sel.split("-")[0].trim(); // $NON-NLS-1$

                // System.out.println("Delete " + path);
                deleteResource(new File(path));
              }

              // refresh table
              final String path = combo.getText();

              viewer.getTable().removeAll();

              depth = 0;
              loadTable(new File(path));
            } catch (Exception ex) {
              ex.printStackTrace();
            }
          }
        });

    // close dlg
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CLOSE_LABEL, false);
  }
Ejemplo n.º 3
0
  /** Configure dialog */
  protected void configureShell(Shell shell) {
    super.configureShell(shell);

    // set title
    shell.setText(Messages.getString("CacheManagerDialog.0")); // $NON-NLS-1$
  }