コード例 #1
0
  private void processItemRequest(ItemRequest request) {
    @SuppressWarnings("unchecked") // Suppress warning about lost type info.
    DataRequestMonitor<Integer> rm = (DataRequestMonitor<Integer>) request.fRequestMonitor;

    if (fChangedValues.containsKey(request.fIndex)) {
      rm.setData(fChangedValues.get(request.fIndex));
    } else {
      rm.setData(request.fIndex);
    }
    rm.done();
  }
コード例 #2
0
ファイル: GdbConnectCommand.java プロジェクト: aniefer/cdt
    @Override
    public IStatus runInUIThread(IProgressMonitor monitor) {
      final Status NO_PID_STATUS =
          new Status(
              IStatus.ERROR,
              GdbUIPlugin.PLUGIN_ID,
              -1,
              LaunchMessages.getString(
                  "LocalAttachLaunchDelegate.No_Process_ID_selected"), //$NON-NLS-1$
              null);

      try {
        PrompterInfo info = new PrompterInfo(fNewProcessSupported, fProcessList);
        Object result = new ProcessPrompter().handleStatus(null, info);
        if (result == null) {
          fRequestMonitor.cancel();
        } else if (result instanceof IProcessExtendedInfo[] || result instanceof String) {
          fRequestMonitor.setData(result);
        } else {
          fRequestMonitor.setStatus(NO_PID_STATUS);
        }
      } catch (CoreException e) {
        fRequestMonitor.setStatus(NO_PID_STATUS);
      }
      fRequestMonitor.done();

      return Status.OK_STATUS;
    }
コード例 #3
0
  /** Start executing the program. */
  @Execute
  public void stepStartExecution(final RequestMonitor rm) {
    if (fBackend.getSessionType() != SessionType.CORE) {
      // Overwrite the program name to use the binary name that was specified.
      // This is important for multi-process
      // Bug 342351
      fAttributes.put(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, fBinaryName);

      fProcService.start(
          getContainerContext(),
          fAttributes,
          new DataRequestMonitor<IContainerDMContext>(ImmediateExecutor.getInstance(), rm) {
            @Override
            protected void handleSuccess() {
              assert getData() instanceof IMIContainerDMContext;

              // Set the container that we created
              setContainerContext(
                  DMContexts.getAncestorOfType(getData(), IMIContainerDMContext.class));
              fDataRequestMonitor.setData(getContainerContext());

              // Don't call fDataRequestMonitor.done(), the sequence will
              // automatically do that when it completes;
              rm.done();
            }
          });
    } else {
      fDataRequestMonitor.setData(getContainerContext());
      rm.done();
    }
  }
コード例 #4
0
  private void processCountRequest(CountRequest request) {
    @SuppressWarnings("unchecked") // Suppress warning about lost type info.
    DataRequestMonitor<Integer> rm = (DataRequestMonitor<Integer>) request.fRequestMonitor;

    rm.setData(fCount);
    rm.done();
  }
コード例 #5
0
    @Override
    protected IStatus run(IProgressMonitor monitor) {
      final IStatus promptStatus =
          new Status(
              IStatus.INFO,
              "org.eclipse.debug.ui",
              200 /*STATUS_HANDLER_PROMPT*/,
              "",
              null); //$NON-NLS-1$//$NON-NLS-2$
      final IStatus filePrompt =
          new Status(
              IStatus.INFO,
              "org.eclipse.cdt.dsf.gdb.ui",
              1001,
              "",
              null); //$NON-NLS-1$//$NON-NLS-2$
      // consult a status handler
      final IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus);

      final Status NO_CORE_STATUS =
          new Status(
              IStatus.ERROR,
              GdbPlugin.PLUGIN_ID,
              -1,
              LaunchMessages.getString("LocalCDILaunchDelegate.6"), // $NON-NLS-1$
              null);

      if (prompter == null) {
        fRequestMonitor.setStatus(NO_CORE_STATUS);
        fRequestMonitor.done();
        return Status.OK_STATUS;
      }

      try {
        Object result = prompter.handleStatus(filePrompt, null);
        if (result == null) {
          fRequestMonitor.cancel();
        } else if (result instanceof String) {
          fRequestMonitor.setData((String) result);
        } else {
          fRequestMonitor.setStatus(NO_CORE_STATUS);
        }
      } catch (CoreException e) {
        fRequestMonitor.setStatus(NO_CORE_STATUS);
      }
      fRequestMonitor.done();

      return Status.OK_STATUS;
    }
コード例 #6
0
 /**
  * Tests whether the given element matches the given expression.
  *
  * @param element Element to test against the given expression.
  * @param expression Expression to use to check if the element is matching.
  * @param rm The request monitor for the result.
  */
 @ConfinedToDsfExecutor("#getSession#getExecutor")
 protected void testElementForExpression(
     Object element, IExpression expression, final DataRequestMonitor<Boolean> rm) {
   rm.setData(false);
   rm.done();
 }
コード例 #7
0
 @Override
 public void getFormattedExpressionValue(
     FormattedValueDMContext dmc, DataRequestMonitor<FormattedValueDMData> rm) {
   rm.setData(new FormattedValueDMData(dmc.getFormatID()));
   rm.done();
 }
コード例 #8
0
 @Override
 public void getAvailableFormats(IFormattedDataDMContext dmc, DataRequestMonitor<String[]> rm) {
   rm.setData(AVAILABLE_FORMATS);
   rm.done();
 }