@Override
  public void run(final TableLoadOption... tableLoadOptions) throws Exception {
    IN input = atsReport.getInputParameters();
    if (input != null) {
      final OUT output = atsReport.createOutputParameters();
      IOperation operation = atsReport.createReportOperation(input, output, tableLoadOptions);
      Operations.executeAsJob(
          operation,
          true,
          Job.LONG,
          new JobChangeAdapter() {

            @Override
            public void done(IJobChangeEvent event) {
              super.done(event);
              try {
                atsReport.displayResults(output);
              } catch (OseeCoreException ex) {
                OseeLog.logf(
                    Activator.class,
                    OseeLevel.SEVERE_POPUP,
                    ex,
                    "Error displaying [%s]",
                    atsReport.getName());
              }
            }
          });
    }
  }
示例#2
0
  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    if (HandlerUtil.getActivePartChecked(event) instanceof ViewPart) {
      ViewPart view = (ViewPart) HandlerUtil.getActivePartChecked(event);
      IWorkbenchPartSite myIWorkbenchPartSite = view.getSite();
      ISelectionProvider selectionProvider = myIWorkbenchPartSite.getSelectionProvider();

      if (selectionProvider != null
          && selectionProvider.getSelection() instanceof IStructuredSelection) {
        IStructuredSelection selection = (IStructuredSelection) selectionProvider.getSelection();

        ArtifactClipboard clipboard = new ArtifactClipboard(view.getSite().getId());
        Iterator<?> iterator = selection.iterator();
        Object selectionObject = null;

        while (iterator.hasNext()) {
          Object object = iterator.next();

          if (object instanceof IAdaptable) {
            selectionObject = ((IAdaptable) object).getAdapter(Branch.class);

            if (selectionObject == null) {
              selectionObject = ((IAdaptable) object).getAdapter(Artifact.class);
            }
          } else if (object instanceof Match) {
            selectionObject = ((Match) object).getElement();
          }

          if (selectionObject instanceof Artifact) {
            ArtifactPasteConfiguration config = new ArtifactPasteConfiguration();
            Operations.executeAsJob(
                new ArtifactPasteOperation(
                    config,
                    (Artifact) selectionObject,
                    clipboard.getCopiedContents(),
                    new ArtifactNameConflictHandler()),
                true);
          }
        }
      }
    }
    return null;
  }