Java 类org.eclipse.debug.core.model.IExpression 实例源码

项目:birt    文件:ScriptModelPresentation.java   
/**
 * Gets the expression display name
 * 
 * @param expression
 * @return
 * @throws DebugException
 */
private String getExpressionText( IExpression expression )
        throws DebugException
{
    StringBuffer buff = new StringBuffer( );
    IValue javaValue = expression.getValue( );

    buff.append( '"' + expression.getExpressionText( ) + '"' );

    if ( javaValue != null )
    {
        String valueString = getValueText( javaValue );
        if ( valueString.length( ) > 0 )
        {
            buff.append( "= " ); //$NON-NLS-1$
            buff.append( valueString );
        }
    }
    return buff.toString( );
}
项目:chromedevtools    文件:JsInspectSnippetAction.java   
private void displayResult(final JsValue value, String errorMessage) {
  final StyledText styledText = getStyledText(editorPart);
  if (styledText == null) {
    return; // TODO(apavlov): fix this when adding inspected variables
  } else {
    final IExpression expression = new JsInspectExpression(evaluateContext, selectedText,
        value, errorMessage);
    ChromiumDebugUIPlugin.getDisplay().asyncExec(new Runnable() {
      public void run() {
        showPopup(styledText, expression);
      }
    });
  }
}
项目:chromedevtools    文件:JsInspectSnippetAction.java   
private void showPopup(StyledText textWidget, IExpression expression) {
  final ITextEditor textEditor;
  final ISelection originalSelection;

  IWorkbenchPart part = editorPart;
  if (part instanceof ITextEditor) {
    textEditor = (ITextEditor) part;
    originalSelection = getTargetSelection(editorPart);
  } else {
    textEditor = null;
    originalSelection = null;
  }
  Shell shell = editorPart.getSite().getShell();
  DebugPopup displayPopup =
      new InspectPopupDialog(shell, getPopupAnchor(textWidget), ACTION_DEFINITION_ID,
          expression) {
        @Override
        public boolean close() {
          boolean returnValue = super.close();
          if (textEditor != null && originalSelection != null) {
            textEditor.getSelectionProvider().setSelection(originalSelection);
          }
          return returnValue;
        }
      };
  displayPopup.open();
}
项目:birt    文件:ScriptModelPresentation.java   
public String getText( Object element )
{
    try
    {
        if ( element instanceof ScriptDebugElement )
        {
            return ( (ScriptDebugElement) element ).getDisplayName( );
        }
        else if ( element instanceof IExpression )
        {
            return getExpressionText( (IExpression) element );
        }
        else if ( element instanceof ScriptLineBreakpoint )
        {
            ScriptLineBreakpoint breakPoint = (ScriptLineBreakpoint) element;
            int index = breakPoint.getFileName( )
                    .lastIndexOf( File.separator );
            String str = breakPoint.getFileName( ).substring( index + 1 );
            return str + " [line: " //$NON-NLS-1$
                    + breakPoint.getScriptLineNumber( )
                    + "]" //$NON-NLS-1$
                    + " - " //$NON-NLS-1$
                    + breakPoint.getDisplayName( );
        }
    }
    catch ( DebugException e )
    {
        // do nothing
    }
    return super.getText( element );
}
项目:vebugger    文件:VisualDetailPane.java   
@Override
public void display(IStructuredSelection selection) {
    try {
        // Clear the text for now
        browser.setText("");

        if (!selection.isEmpty() || !(selection instanceof TreeSelection)) {

            Object firstElement = selection.getFirstElement();
            if (firstElement != null && firstElement instanceof IDebugElement) {

                IDebugElement element = (IDebugElement) firstElement;

                if (element instanceof IVariable) {
                    displayVariable(selection, element);
                } else if (element instanceof IExpression) {
                    displayExpression(element);
                } else {
                    // FIXME we don't treat other selection types yet
                    throw new DebugException(null);
                }

            }
        }
    } catch (DebugException e) {
        setBrowserTextToString("Could not parse " + selection + "\n\n<pre>" + e.getMessage() + "</pre>", "Error");
        e.printStackTrace();
    }
}
项目:vebugger    文件:VisualDetailPane.java   
/**
 * Render a watch expression.
 * 
 * FIXME we don't treat watch expression yet, this will just render their
 * {@link String} value.
 * 
 * @param element
 *            the expression element
 */
private void displayExpression(IDebugElement element) {
    IValue value = ((IExpression) element).getValue();
    if (value instanceof IJavaPrimitiveValue) {
        setBrowserTextToPrimitive((IJavaPrimitiveValue) value);
    } else if (value instanceof IJavaObject) {
        setBrowserTextToString(value.toString());
    } else if (value != null) {
        setBrowserTextToString(value.toString(), "Error!");
    }
}