@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());
              }
            }
          });
    }
  }
Esempio n. 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;
  }
 /**
  * This method expects that one OSEE server job is running, namely the job calling this method, so
  * it will return true if 1 or less jobs are running.
  */
 @Override
 public boolean isSystemIdle() {
   return !Operations.areOperationsScheduled();
 }