Exemplo n.º 1
0
 private String produceThreadElementName(String viewName, IMIExecutionDMContext execCtx) {
   return "Thread." + execCtx.getThreadId(); // $NON-NLS-1$
 }
Exemplo n.º 2
0
  @Override
  protected void updatePropertiesInSessionThread(IPropertiesUpdate[] updates) {
    IPropertiesUpdate[] parentUpdates = new IPropertiesUpdate[updates.length];

    for (int i = 0; i < updates.length; i++) {
      final IPropertiesUpdate update = updates[i];

      final ViewerCountingRequestMonitor countringRm =
          new ViewerCountingRequestMonitor(ImmediateExecutor.getInstance(), updates[i]);
      int count = 0;

      // Create a delegating update which will let the super-class fill in the
      // standard container properties.
      parentUpdates[i] = new VMDelegatingPropertiesUpdate(updates[i], countringRm);
      count++;

      IMIExecutionDMContext execDmc =
          findDmcInPath(
              update.getViewerInput(), update.getElementPath(), IMIExecutionDMContext.class);
      if (execDmc != null) {
        update.setProperty(ILaunchVMConstants.PROP_ID, Integer.toString(execDmc.getThreadId()));

        // set pin properties
        IPinElementColorDescriptor colorDesc =
            PinCloneUtils.getPinElementColorDescriptor(GdbPinProvider.getPinnedHandles(), execDmc);
        updates[i].setProperty(
            IGdbLaunchVMConstants.PROP_PIN_COLOR,
            colorDesc != null ? colorDesc.getOverlayColor() : null);
        updates[i].setProperty(
            IGdbLaunchVMConstants.PROP_PINNED_CONTEXT,
            PinCloneUtils.isPinnedTo(GdbPinProvider.getPinnedHandles(), execDmc));
      }

      if (update.getProperties().contains(PROP_NAME)
          || update.getProperties().contains(IGdbLaunchVMConstants.PROP_OS_ID)
          || update.getProperties().contains(IGdbLaunchVMConstants.PROP_CORES_ID)) {
        IProcesses processService = getServicesTracker().getService(IProcesses.class);
        final IThreadDMContext threadDmc =
            findDmcInPath(update.getViewerInput(), update.getElementPath(), IThreadDMContext.class);

        if (processService == null || threadDmc == null) {
          update.setStatus(
              new Status(
                  IStatus.ERROR,
                  GdbUIPlugin.PLUGIN_ID,
                  "Service or handle invalid",
                  null)); //$NON-NLS-1$
        } else {
          processService.getExecutionData(
              threadDmc,
              new ViewerDataRequestMonitor<IThreadDMData>(getExecutor(), update) {
                @Override
                public void handleCompleted() {
                  if (isSuccess()) {
                    fillThreadDataProperties(update, getData());
                  }
                  update.setStatus(getStatus());
                  countringRm.done();
                }
              });
          count++;
        }
      }

      countringRm.setDoneCount(count);
    }
    super.updatePropertiesInSessionThread(parentUpdates);
  }