예제 #1
0
  protected void fillThreadDataProperties(IPropertiesUpdate update, IThreadDMData data) {
    if (data.getName() != null && data.getName().length() > 0) {
      update.setProperty(PROP_NAME, data.getName());
    }
    update.setProperty(IGdbLaunchVMConstants.PROP_OS_ID, data.getId());

    if (data instanceof IGdbThreadDMData) {
      String[] cores = ((IGdbThreadDMData) data).getCores();
      if (cores != null) {
        StringBuffer str = new StringBuffer();
        for (String core : cores) {
          str.append(core + ","); // $NON-NLS-1$
        }
        if (str.length() > 0) {
          String coresStr = str.substring(0, str.length() - 1);
          update.setProperty(IGdbLaunchVMConstants.PROP_CORES_ID, coresStr);
        }
      }
    }
  }
예제 #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);
  }