Beispiel #1
0
 /**
  * Creates an expression, adds it to the expression manager and set the debug context.<br>
  * This default behavior can be subclassed to be changed.
  *
  * @param expressionManager
  * @param expression
  */
 @SuppressWarnings("restriction")
 protected void createExpression(IExpressionManager expressionManager, String expression) {
   IWatchExpression watchExpression = expressionManager.newWatchExpression(expression.trim());
   expressionManager.addExpression(watchExpression);
   // refresh and re-evaluate
   watchExpression.setExpressionContext(getContext());
 }
 /**
  * Creates a new watch expression from a string using the default expression manager.
  *
  * @param exp the string to use to create the expression
  */
 private IExpression createExpression(String exp) {
   IWatchExpression expression =
       DebugPlugin.getDefault().getExpressionManager().newWatchExpression(exp);
   IAdaptable object = DebugUITools.getPartDebugContext(fSite);
   IDebugElement context = null;
   if (object instanceof IDebugElement) {
     context = (IDebugElement) object;
   } else if (object instanceof ILaunch) {
     context = ((ILaunch) object).getDebugTarget();
   }
   expression.setExpressionContext(context);
   return expression;
 }