本文整理汇总了Java中org.eclipse.debug.core.model.IDebugElement类的典型用法代码示例。如果您正苦于以下问题:Java IDebugElement类的具体用法?Java IDebugElement怎么用?Java IDebugElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDebugElement类属于org.eclipse.debug.core.model包,在下文中一共展示了IDebugElement类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: castElement
import org.eclipse.debug.core.model.IDebugElement; //导入依赖的package包/类
@Override public VariableWrapper castElement(Object element) {
if (element instanceof Variable == false) {
return null;
}
final Variable variable = (Variable) element;
return new VariableWrapper() {
@Override public Value getValue() {
return variable.getValue().asRealValue();
}
@Override public Variable getVariable() {
return variable;
}
@Override public IDebugElement getDebugElement() {
return variable;
}
@Override public ConnectedTargetData getConnectedTargetData() {
return variable.getConnectedData();
}
};
}
示例2: handleDebugEvents
import org.eclipse.debug.core.model.IDebugElement; //导入依赖的package包/类
public void handleDebugEvents(DebugEvent[] events) {
for (DebugEvent event : events) {
switch (event.getKind()) {
case DebugEvent.TERMINATE:
if (event.getSource().equals(getDebugTarget())) {
DebugPlugin.getDefault().getExpressionManager().removeExpression(this);
}
break;
case DebugEvent.SUSPEND:
if (event.getDetail() != DebugEvent.EVALUATION_IMPLICIT &&
event.getSource() instanceof IDebugElement) {
IDebugElement source = (IDebugElement) event.getSource();
if (source.getDebugTarget().equals(getDebugTarget())) {
DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {
new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT) });
}
}
break;
}
}
}
示例3: getConnectionTargetData
import org.eclipse.debug.core.model.IDebugElement; //导入依赖的package包/类
public static ConnectedTargetData getConnectionTargetData(Object element) {
IDebugTarget debugTarget;
if (element instanceof ILaunch) {
ILaunch launch = (ILaunch) element;
debugTarget = launch.getDebugTarget();
} else if (element instanceof IDebugElement) {
IDebugElement debugElement = (IDebugElement) element;
debugTarget = debugElement.getDebugTarget();
} else {
return null;
}
if (debugTarget instanceof DebugTargetImpl == false) {
return null;
}
DebugTargetImpl debugTargetImpl = (DebugTargetImpl) debugTarget;
return debugTargetImpl.getConnectedOrNull();
}
示例4: displayVariable
import org.eclipse.debug.core.model.IDebugElement; //导入依赖的package包/类
/**
* Render a selected variable.
*
* @param selection
* the selection object
* @param element
* the variable element
* @throws DebugException
*/
private void displayVariable(IStructuredSelection selection, IDebugElement element) throws DebugException {
IValue value = ((IVariable) element).getValue();
if (value instanceof IJavaPrimitiveValue) {
setBrowserTextToPrimitive((IJavaPrimitiveValue) value);
} else {
TreePath firstElementTreePath = ((TreeSelection) selection).getPaths()[0];
String watchExpression = generateWatchExpression(firstElementTreePath);
String messageExpression = generateMessageExpression(watchExpression);
// Iterate all threads and run our rendering
// expression in them in the hopes that we can find
// the relevant selection in only one thread
// FIXME find a better way to derive the correct thread!
IWatchExpressionDelegate delegate = DebugPlugin.getDefault().getExpressionManager()
.newWatchExpressionDelegate(element.getModelIdentifier());
for (IThread thread : element.getDebugTarget().getThreads()) {
delegate.evaluateExpression(messageExpression, thread, this);
}
}
}
示例5: evaluateExpression
import org.eclipse.debug.core.model.IDebugElement; //导入依赖的package包/类
@Override
public void evaluateExpression(String expression, IDebugElement context, IWatchExpressionListener listener) {
this.expression = expression;
this.context = context;
this.listener = listener;
if (context instanceof PyStackFrame) {
AbstractDebugTarget target = (AbstractDebugTarget) context.getDebugTarget();
if (target == null) {
return; //disposed
}
// send the command, and then busy-wait
EvaluateExpressionCommand cmd = new EvaluateExpressionCommand(target, expression, ((PyStackFrame) context)
.getLocalsLocator().getPyDBLocation(), false);
cmd.setCompletionListener(this);
target.postCommand(cmd);
} else {
addError("unknown expression context");
listener.watchEvaluationFinished(this);
}
}
示例6: getAdapter
import org.eclipse.debug.core.model.IDebugElement; //导入依赖的package包/类
@Override
public Object getAdapter(Class adapter) {
if (adapter == IDebugElement.class) {
return this;
}
return super.getAdapter(adapter);
}
示例7: getAdapter
import org.eclipse.debug.core.model.IDebugElement; //导入依赖的package包/类
public Object getAdapter( Class adapter )
{
if ( adapter == IDebugElement.class || adapter==ScriptDebugElement.class)
{
return this;
}
else if ( adapter == IDebugTarget.class )
{
return getDebugTarget( );
}
return super.getAdapter( adapter );
}
示例8: canRunToLine
import org.eclipse.debug.core.model.IDebugElement; //导入依赖的package包/类
public boolean canRunToLine( IWorkbenchPart part, ISelection selection,
ISuspendResume target )
{
if ( target instanceof ScriptDebugElement )
{
IDebugElement element = (IDebugElement) target;
ScriptDebugTarget adapter = (ScriptDebugTarget) element.getDebugTarget( )
.getAdapter( IDebugTarget.class );
return adapter != null;
}
return false;
}
示例9: display
import org.eclipse.debug.core.model.IDebugElement; //导入依赖的package包/类
@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();
}
}
示例10: displayExpression
import org.eclipse.debug.core.model.IDebugElement; //导入依赖的package包/类
/**
* 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!");
}
}
示例11: evaluateExpression
import org.eclipse.debug.core.model.IDebugElement; //导入依赖的package包/类
public void evaluateExpression(final String expression, final IDebugElement context,
final IWatchExpressionListener listener) {
final DebugElementImpl contextImpl = (DebugElementImpl) context;
if (!contextImpl.getDebugTarget().isSuspended()) {
// can only evaluate while suspended. Notify empty result.
listener.watchEvaluationFinished(new IWatchExpressionResult() {
public String[] getErrorMessages() {
return EMPTY_STRINGS;
}
public DebugException getException() {
return null;
}
public String getExpressionText() {
return expression;
}
public IValue getValue() {
return null;
}
public boolean hasErrors() {
return false;
}
});
return;
}
final EvaluateContext evaluateContext =
(EvaluateContext) contextImpl.getAdapter(EvaluateContext.class);
if (evaluateContext == null) {
listener.watchEvaluationFinished(new BadWatchExpressionResult(
new DebugException(new Status(Status.ERROR,
ChromiumDebugUIPlugin.PLUGIN_ID,"Bad debug context")), //$NON-NLS-1$
expression));
return;
}
evaluateContext.getJsEvaluateContext().evaluateAsync(
expression, null,
new JsEvaluateContext.EvaluateCallback() {
@Override
public void success(ResultOrException result) {
ValueBase valueBase = result.accept(new ResultOrException.Visitor<ValueBase>() {
@Override public ValueBase visitResult(JsValue value) {
return Value.create(evaluateContext, value,
ExpressionTracker.createExpressionNode(expression));
}
@Override
public ValueBase visitException(JsValue exception) {
return new ValueBase.ErrorMessageValue(evaluateContext, "<abnormal return>",
exception);
}
});
listener.watchEvaluationFinished(new GoodWatchExpressionResult(valueBase, expression));
}
@Override
public void failure(Exception cause) {
String message = cause.getMessage();
listener.watchEvaluationFinished(new BadWatchExpressionResult(new DebugException(
createErrorStatus(message == null
? Messages.JsWatchExpressionDelegate_ErrorEvaluatingExpression
: message, null)), expression));
return;
}
},
null);
}
示例12: getDebugElement
import org.eclipse.debug.core.model.IDebugElement; //导入依赖的package包/类
IDebugElement getDebugElement();