Exemplo n.º 1
0
  @Override
  public void sourceContainersChanged(
      final ISourceLookupDMContext sourceLookupCtx, final DataRequestMonitor<Boolean> rm) {
    if (!fDirectors.containsKey(sourceLookupCtx)) {
      rm.setStatus(
          new Status(
              IStatus.ERROR,
              GdbPlugin.PLUGIN_ID,
              IDsfStatusConstants.INVALID_HANDLE,
              "No source director configured for given context",
              null)); //$NON-NLS-1$ );
      rm.done();
      return;
    }

    Map<String, String> entries = getSubstitutionsPaths(sourceLookupCtx);
    if (entries.equals(fCachedEntries)) {
      rm.done(false);
    } else {
      /*
       * Issue the clear and set commands back to back so that the
       * executor thread atomically changes the source lookup settings.
       * Any commands to GDB issued after this call will get the new
       * source substitute settings.
       */
      CountingRequestMonitor countingRm =
          new CountingRequestMonitor(getExecutor(), rm) {
            @Override
            protected void handleSuccess() {
              rm.done(true);
            }
          };
      fCommand.queueCommand(
          fCommandFactory.createCLIUnsetSubstitutePath(sourceLookupCtx),
          new DataRequestMonitor<MIInfo>(getExecutor(), countingRm));
      initializeSourceSubstitutions(sourceLookupCtx, new RequestMonitor(getExecutor(), countingRm));
      countingRm.setDoneCount(2);
    }
  }