コード例 #1
0
  /**
   * Validates if the drop is valid by validating the local selection transfer to ensure that a
   * watch expression can be created for each contained IVariable.
   *
   * @param target target of the drop
   * @return whether the drop is valid
   */
  private boolean validateVariableDrop(Object target) {
    // Target must be null or an IExpression, you cannot add a new watch expression inside another
    if (target != null && getTargetExpression(target) == null) {
      return false;
    }

    IStructuredSelection selection =
        (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
    int enabled = 0;
    int size = -1;
    if (selection != null) {
      size = selection.size();
      IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
      Iterator iterator = selection.iterator();
      while (iterator.hasNext()) {
        Object element = iterator.next();
        if (element instanceof IVariable) {
          IVariable variable = (IVariable) element;
          if (variable instanceof IndexedVariablePartition) {
            break;
          } else if (manager.hasWatchExpressionDelegate(variable.getModelIdentifier())
              && isFactoryEnabled(variable)) {
            enabled++;
          } else {
            break;
          }
        }
      }
    }
    return enabled == size;
  }
コード例 #2
0
ファイル: PHPWatchAction.java プロジェクト: N3X15/studio3-php
 /**
  * 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());
 }