/* (non-Javadoc)
  * @see org.eclipse.jface.dialogs.Dialog#okPressed()
  */
 @Override
 protected void okPressed() {
   String text = getValue();
   try {
     DsfUIPlugin.getDefault()
         .getPreferenceStore()
         .setValue(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH, Integer.parseInt(text));
   } catch (NumberFormatException e) {
     DsfUIPlugin.log(e);
   }
   super.okPressed();
 }
    @Override
    protected void execute(final DataRequestMonitor<FormattedValueDMData> rm) {
      DsfSession session = DsfSession.getSession(frame.getSessionId());
      IExpressions expressions = dsfServicesTracker.getService(IExpressions.class);
      if (expressions == null) {
        rm.setStatus(
            DsfUIPlugin.newErrorStatus(
                IDsfStatusConstants.REQUEST_FAILED, "No expression service", null)); // $NON-NLS-1$
        rm.done();
        return;
      }
      IExpressionDMContext expressionDMC = expressions.createExpression(frame, expression);
      FormattedValueDMContext formattedValueContext =
          expressions.getFormattedValueContext(expressionDMC, getHoverFormat());
      expressions.getFormattedExpressionValue(
          formattedValueContext,
          new DataRequestMonitor<FormattedValueDMData>(session.getExecutor(), rm) {
            @Override
            protected void handleSuccess() {
              rm.setData(getData());
              rm.done();
            }

            @Override
            protected void handleFailure() {
              rm.done();
            }
          });
    }
  @Override
  protected String evaluateExpression(String expression) {
    IFrameDMContext frame = getFrame();
    if (frame == null) {
      return null;
    }

    String sessionId = frame.getSessionId();
    DsfServicesTracker dsfServicesTracker =
        new DsfServicesTracker(DsfUIPlugin.getBundleContext(), sessionId);
    try {
      GetExpressionValueQuery query =
          new GetExpressionValueQuery(frame, expression, dsfServicesTracker);
      DsfSession session = DsfSession.getSession(sessionId);
      if (session != null) {
        session.getExecutor().execute(query);
        try {
          FormattedValueDMData data = query.get();
          if (data != null) return data.getFormattedValue();
        } catch (Exception e) {
        }
      }
    } finally {
      dsfServicesTracker.dispose();
    }
    return null;
  }
Ejemplo n.º 4
0
  @ThreadSafe
  private synchronized IRegisters getService() {

    String serviceId = DsfServices.createServiceFilter(IRegisters.class, fSession.getId());
    if (fServiceTracker == null) {
      try {
        fServiceTracker =
            new ServiceTracker(
                DsfUIPlugin.getBundleContext(),
                DsfUIPlugin.getBundleContext().createFilter(serviceId),
                null);
        fServiceTracker.open();
      } catch (InvalidSyntaxException e) {
        return null;
      }
    }
    return (IRegisters) fServiceTracker.getService();
  }
 /* (non-Javadoc)
  * @see org.eclipse.ui.dialogs.SelectionDialog#getDialogBoundsSettings()
  */
 @Override
 protected IDialogSettings getDialogBoundsSettings() {
   IDialogSettings settings = DsfUIPlugin.getDefault().getDialogSettings();
   IDialogSettings section = settings.getSection(SETTINGS_ID);
   if (section == null) {
     section = settings.addNewSection(SETTINGS_ID);
   }
   return section;
 }
 /**
  * Constructs a new dialog on the given shell.
  *
  * @param parent shell
  */
 public DetailPaneMaxLengthDialog(Shell parent) {
   super(parent);
   setShellStyle(getShellStyle() | SWT.RESIZE);
   fValue =
       Integer.toString(
           DsfUIPlugin.getDefault()
               .getPreferenceStore()
               .getInt(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH));
   fValidator =
       new IInputValidator() {
         public String isValid(String newText) {
           try {
             int num = Integer.parseInt(newText);
             if (num < 0) {
               return MessagesForDetailPane.PaneMaxLengthDialog_IntegerCannotBeNegative;
             }
           } catch (NumberFormatException e) {
             return MessagesForDetailPane.PaneMaxLengthDialog_EnterAnInteger;
           }
           return null;
         }
       };
 }