private void updateButtons() {
   if (parameters.getFilter() instanceof PreferencesBasedFilter) {
     PreferencesBasedFilter filter = (PreferencesBasedFilter) parameters.getFilter();
     if (filter.isEclipseOnly()) {
       eclipseOnlyButton.setSelection(true);
       addFilterButton.setEnabled(false);
       removeFilterButton.setEnabled(false);
     } else {
       eclipseOnlyButton.setSelection(false);
       addFilterButton.setEnabled(true);
       removeFilterButton.setEnabled(filter.getFilterPatterns().length > 0);
     }
   }
 }
 void processFiles(IProgressMonitor monitor) {
   File[] files = parameters.getFiles();
   monitor.beginTask("Process Files", files.length); // $NON-NLS-1$
   for (File file : files) {
     if (isDisposed()) break;
     if (monitor.isCanceled()) break;
     processFile(file, monitor);
     monitor.worked(1);
   }
   monitor.done();
 }
 private void createRemoveFilterButton(Composite parent) {
   if (parameters.getFilter() instanceof PreferencesBasedFilter) {
     removeFilterButton = new Button(parent, SWT.PUSH);
     removeFilterButton.setText(Messages.UploadPreview_11);
     removeFilterButton.addSelectionListener(
         new SelectionAdapter() {
           @Override
           public void widgetSelected(SelectionEvent e) {
             new RemoveFilterDialog((PreferencesBasedFilter) parameters.getFilter())
                 .prompt(viewer.getTable().getShell());
           }
         });
   }
 }
  private void createButtons(Composite parent) {
    Composite buttons = new Composite(parent, SWT.NONE);
    GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false);
    buttons.setLayoutData(layoutData);
    buttons.setLayout(new RowLayout());
    createAddFilterButton(buttons);
    createRemoveFilterButton(buttons);

    final FilterChangeListener filterChangeListener =
        new FilterChangeListener() {
          public void filterChanged() {
            updateButtons();
          }
        };
    parameters.getFilter().addFilterChangeListener(filterChangeListener);
    parent.addDisposeListener(
        new DisposeListener() {
          public void widgetDisposed(DisposeEvent e) {
            parameters.getFilter().removeFilterChangeListener(filterChangeListener);
          }
        });
    updateButtons();
  }
  private void createEventsTable(Composite parent) {
    viewer =
        new TableViewer(
            parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    viewer.getTable().setHeaderVisible(true);
    viewer.getTable().setLinesVisible(false);
    GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
    layoutData.widthHint = 500;
    viewer.getTable().setLayoutData(layoutData);

    createIncludeColumn();
    createWhatColumn();
    createKindColumn();
    createDescriptionColumn();
    createBundleIdColumn();
    createBundleVersionColumn();
    createTimestampColumn();

    timestampColumn.setSortColumn();

    viewer.setContentProvider(
        new IStructuredContentProvider() {
          public void dispose() {}

          public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}

          @SuppressWarnings("unchecked")
          public Object[] getElements(Object input) {
            if (input instanceof List) {
              return (Object[])
                  ((List<UsageDataEventWrapper>) input)
                      .toArray(new Object[((List<UsageDataEventWrapper>) input).size()]);
            }
            return new Object[0];
          }
        });

    /*
     * Add a FilterChangeListener to the filter; if the filter changes, we need to
     * refresh the display. The dispose listener, added to the table will clean
     * up the FilterChangeListener when the table is disposed.
     */
    final FilterChangeListener filterChangeListener =
        new FilterChangeListener() {
          public void filterChanged() {
            for (UsageDataEventWrapper event : events) {
              event.resetCaches();
            }
            viewer.refresh();
          }
        };
    parameters.getFilter().addFilterChangeListener(filterChangeListener);

    viewer
        .getTable()
        .addDisposeListener(
            new DisposeListener() {
              public void widgetDisposed(DisposeEvent e) {
                parameters.getFilter().removeFilterChangeListener(filterChangeListener);
              }
            });

    // Initially, we have nothing.
    viewer.setInput(events);
  }