/**
  * If the dragged data is a structured selection, get any IVariables in it and create expressions
  * for each of them. Insert the created expressions at the currently selected target or add them
  * to the end of the collection if no target is selected.
  *
  * @param selection Structured selection containing IVariables
  * @return whether the drop was successful
  */
 private boolean performVariableOrWatchAdaptableDrop(IStructuredSelection selection) {
   List expressions = new ArrayList(selection.size());
   for (Iterator itr = selection.iterator(); itr.hasNext(); ) {
     Object element = itr.next();
     String expressionText = createExpressionString(element);
     if (expressionText != null) {
       IExpression expression = createExpression(expressionText);
       if (expression != null) {
         expressions.add(expression);
       } else {
         DebugUIPlugin.log(
             new Status(
                 IStatus.ERROR,
                 DebugUIPlugin.getUniqueIdentifier(),
                 "Drop failed.  Watch expression could not be created for the text "
                     + expressionText)); //$NON-NLS-1$
         return false;
       }
     } else {
       return false;
     }
   }
   if (expressions.size() == selection.size()) {
     IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
     if (manager instanceof ExpressionManager) {
       IExpression targetExpression = getTargetExpression(getCurrentTarget());
       if (targetExpression != null) {
         ((ExpressionManager) manager)
             .insertExpressions(
                 (IExpression[]) expressions.toArray(new IExpression[expressions.size()]),
                 targetExpression,
                 fInsertBefore);
       } else {
         ((ExpressionManager) manager)
             .addExpressions(
                 (IExpression[]) expressions.toArray(new IExpression[expressions.size()]));
       }
       return true;
     }
   }
   return false;
 }
 /**
  * Performs the drop when text was dragged. Creates a new watch expression from the text. Inserts
  * the expression at the currently selected target or adds it to the end of the collection if no
  * target is selected.
  *
  * @param text string to use to create the expression
  * @return whether the drop was successful
  */
 private boolean performTextDrop(String text) {
   IExpression expression = createExpression(text);
   if (expression != null) {
     IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
     if (manager instanceof ExpressionManager) {
       IExpression targetExpression = getTargetExpression(getCurrentTarget());
       if (targetExpression != null) {
         ((ExpressionManager) manager)
             .insertExpressions(new IExpression[] {expression}, targetExpression, fInsertBefore);
       } else {
         ((ExpressionManager) manager).addExpression(expression);
       }
       return true;
     }
   }
   DebugUIPlugin.log(
       new Status(
           IStatus.ERROR,
           DebugUIPlugin.getUniqueIdentifier(),
           "Drop failed.  Watch expression could not be created for the text "
               + text)); //$NON-NLS-1$
   return false;
 }
  /**
   * Performs the drop when the selection is a collection of IExpressions. Moves the given
   * expressions from their original locations to the location of the current target.
   *
   * @param selection the dragged selection
   * @return whether the drop could be completed
   */
  private boolean performExpressionDrop(IStructuredSelection selection) {
    IExpression targetExpression = getTargetExpression(getCurrentTarget());
    if (targetExpression != null) {
      IExpression[] expressions = new IExpression[selection.size()];
      Object[] selectionElements = selection.toArray();
      for (int i = 0; i < selectionElements.length; i++) {
        expressions[i] = getTargetExpression(selectionElements[i]);
      }

      IExpressionManager manager = DebugPlugin.getDefault().getExpressionManager();
      if (manager instanceof ExpressionManager) {
        ((ExpressionManager) manager).moveExpressions(expressions, targetExpression, fInsertBefore);
      }
      return true;
    }
    return false;
  }