当前位置: 首页>>代码示例>>Java>>正文


Java DebugUITools.getDebugContext方法代码示例

本文整理汇总了Java中org.eclipse.debug.ui.DebugUITools.getDebugContext方法的典型用法代码示例。如果您正苦于以下问题:Java DebugUITools.getDebugContext方法的具体用法?Java DebugUITools.getDebugContext怎么用?Java DebugUITools.getDebugContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.debug.ui.DebugUITools的用法示例。


在下文中一共展示了DebugUITools.getDebugContext方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getHoverText

import org.eclipse.debug.ui.DebugUITools; //导入方法依赖的package包/类
@Override
public String getHoverText(Annotation annotation, ITextViewer textViewer, IRegion hoverRegion) {
	if (!BfDebugModelPresentation.INSTRUCTION_POINTER_ANNOTATION_TYPE.equals(annotation.getType())) {
		return null;
	}
	IAdaptable adaptable = DebugUITools.getDebugContext();
	if (adaptable instanceof BfStackFrame) {
		BfStackFrame stackFrame = (BfStackFrame) adaptable;
		try {
			int instructionPointer = stackFrame.getCharStart();
			String text = "Instruction Pointer: [<b>" + instructionPointer + "</b>]";
			int memoryPointer = stackFrame.getMemoryPointer();
			IMemoryBlock memoryBlock = stackFrame.getDebugTarget().getMemoryBlock(memoryPointer, 1);
			byte value = memoryBlock.getBytes()[0];
			text = text + "<br>Memory Value: [<b>0x" + Integer.toHexString(memoryPointer).toUpperCase() + "</b>]=<b>0x" + Integer.toHexString((value & 0xFF)) + "</b>";
			return text;
		} 
		catch (DebugException ex) {
			DbgActivator.getDefault().logError("Memory Block could not be evaluated", ex);
		}
	}
	return null;
}
 
开发者ID:RichardBirenheide,项目名称:brainfuck,代码行数:24,代码来源:InstructionPointerAnnotationHover.java

示例2: run

import org.eclipse.debug.ui.DebugUITools; //导入方法依赖的package包/类
public void run(IAction action) {
  IAdaptable context = DebugUITools.getDebugContext();
  if (context == null) { // debugger not active
    return;
  }
  EvaluateContext evaluateContext = (EvaluateContext) context.getAdapter(EvaluateContext.class);
  if (evaluateContext == null) {
    return;
  }
  IEditorPart editorPart = activeEditorPart;
  String currentSelectedText = retrieveSelection(editorPart);
  EvaluateCallbackImpl callback =
      new EvaluateCallbackImpl(evaluateContext, editorPart, currentSelectedText);
  evaluateContext.getJsEvaluateContext().evaluateAsync(currentSelectedText, null,
      callback, null);
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:17,代码来源:JsInspectSnippetAction.java

示例3: checkFinishedLine

import org.eclipse.debug.ui.DebugUITools; //导入方法依赖的package包/类
/**
 * Checks if the last thing entered was a new line, and if it was, notifies clients about it.
 */
private void checkFinishedLine() {
    String s = this.toString();
    this.reset();
    char c;
    if (s.length() > 0 && ((c = s.charAt(s.length() - 1)) == '\n' || c == '\r')) {
        IAdaptable context = DebugUITools.getDebugContext();
        if (context != null) {
            s = StringUtils.rightTrim(s);
            Object adapter = context.getAdapter(IDebugTarget.class);
            if (adapter instanceof AbstractDebugTarget) {
                AbstractDebugTarget target = (AbstractDebugTarget) adapter;

                for (IConsoleInputListener listener : participants) {
                    listener.newLineReceived(s, target);
                }
            }
        }
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:23,代码来源:ProcessServerOutputStream.java

示例4: getStackFrame

import org.eclipse.debug.ui.DebugUITools; //导入方法依赖的package包/类
/**
 * Returns the current stack frame context, or <code>null</code> if none.
 * 
 * @return the current stack frame context, or <code>null</code> if none
 */
public static IJavaStackFrame getStackFrame() {
    IAdaptable adaptable = DebugUITools.getDebugContext();
    if (adaptable != null) {
    	Object x = adaptable.getAdapter(IJavaStackFrame.class);
    	if (x != null)
    		return (IJavaStackFrame)x;
    }
    try {
		for (ILaunch launch: DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
			for (IThread thread: launch.getDebugTarget().getThreads()) {
				IStackFrame[] frames = thread.getStackFrames();
				if (frames.length > 0)
					return (IJavaStackFrame)frames[0];
			}
		}
    } catch (DebugException e) {
    	throw new RuntimeException(e);
    }
	return null;
}
 
开发者ID:jgalenson,项目名称:codehint,代码行数:26,代码来源:EclipseUtils.java

示例5: setActiveSession

import org.eclipse.debug.ui.DebugUITools; //导入方法依赖的package包/类
protected void setActiveSession() {
	// if a simulation session is running, we should initialize with its
	// content
	IAdaptable debugContext = DebugUITools.getDebugContext();
	if (debugContext != null) {
		IDebugTarget debugTarget = (IDebugTarget) debugContext.getAdapter(IDebugTarget.class);
		if (debugTarget != null) {
			if (!debugTarget.isTerminated()) {
				this.debugTarget = (IDebugTarget) debugTarget;
				activeTargetChanged(this.debugTarget);
			}
		}
	}
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:15,代码来源:AbstractDebugTargetView.java

示例6: getHoverInfo

import org.eclipse.debug.ui.DebugUITools; //导入方法依赖的package包/类
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
  IDocument doc = textViewer.getDocument();
  String expression = JavascriptUtil.extractSurroundingJsIdentifier(doc, hoverRegion.getOffset());
  if (expression == null) {
    return null;
  }

  IAdaptable context = DebugUITools.getDebugContext();
  if (context == null) { // debugger not active
    return null;
  }

  EvaluateContext evaluateContext = (EvaluateContext) context.getAdapter(EvaluateContext.class);
  if (evaluateContext == null) {
    return null;
  }

  final JsValue[] result = new JsValue[1];
  evaluateContext.getJsEvaluateContext().evaluateSync(expression, null,
      new JsEvaluateContext.EvaluateCallback() {
        @Override
        public void success(ResultOrException valueOrException) {
          result[0] = valueOrException.accept(new ResultOrException.Visitor<JsValue>() {
                @Override public JsValue visitResult(JsValue value) {
                  return value;
                }
                @Override public JsValue visitException(JsValue exception) {
                  return null;
                }
              });
        }
        public void failure(Exception cause) {
        }
      });
  if (result[0] == null) {
    return null;
  }

  return STRINGIFIER.render(result[0]);
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:41,代码来源:JsDebugTextHover.java

示例7: getFrame

import org.eclipse.debug.ui.DebugUITools; //导入方法依赖的package包/类
private ScriptStackFrame getFrame( )
{
	IAdaptable adaptable = DebugUITools.getDebugContext( );
	if ( adaptable != null )
	{
		return (ScriptStackFrame) adaptable.getAdapter( ScriptStackFrame.class );
	}
	return null;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:10,代码来源:ScriptDebugHover.java

示例8: newLineReceived

import org.eclipse.debug.ui.DebugUITools; //导入方法依赖的package包/类
@Override
public void newLineReceived(String lineReceived, AbstractDebugTarget target) {
    boolean evaluateNow = !lineReceived.startsWith(" ") && !lineReceived.startsWith("\t")
            && !lineReceived.endsWith(":") && !lineReceived.endsWith("\\");

    if (DEBUG) {
        System.out.println("line: '" + lineReceived + "'");
    }
    buf.append(lineReceived);
    if (lineReceived.length() > 0) {
        buf.append("@[email protected]");
    }

    if (evaluateNow) {
        final String toEval = buf.toString();
        if (toEval.trim().length() > 0) {
            IAdaptable context = DebugUITools.getDebugContext();
            if (DEBUG) {
                System.out.println("Evaluating:\n" + toEval);
            }
            if (context instanceof PyStackFrame) {
                final PyStackFrame frame = (PyStackFrame) context;
                target.postCommand(new EvaluateExpressionCommand(target, toEval, frame
                        .getLocalsLocator().getPyDBLocation(), true) {
                    @Override
                    public void processOKResponse(int cmdCode, String payload) {
                        frame.forceGetNewVariables();
                        super.processOKResponse(cmdCode, payload);
                    }
                });
            }
        }
        buf = new StringBuffer();
    }

}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:37,代码来源:EvaluationConsoleInputListener.java

示例9: getSuspendedFrame

import org.eclipse.debug.ui.DebugUITools; //导入方法依赖的package包/类
/**
 * Determine if any frame is selected in the Launch view
 * 
 * @return
 */
private PyStackFrame getSuspendedFrame() {
    IAdaptable context = DebugUITools.getDebugContext();
    if (context instanceof PyStackFrame) {
        if (context instanceof PyStackFrameConsole) {
            // We already have a real console opened on the Interactive Console, we don't support
            // opening a special debug console on it
            return null;
        }
        return (PyStackFrame) context;
    }
    return null;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:18,代码来源:ChooseProcessTypeDialog.java

示例10: getDelegate

import org.eclipse.debug.ui.DebugUITools; //导入方法依赖的package包/类
private ICEditorTextHover getDelegate() {
    IAdaptable context = DebugUITools.getDebugContext();
    if (context != null) {
        ICEditorTextHover hover = context.getAdapter(ICEditorTextHover.class);
        if (hover != null) {
            hover.setEditor(fEditor);
        }
        return hover;
    }
    return null;
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:12,代码来源:DelegatingDebugTextHover.java


注:本文中的org.eclipse.debug.ui.DebugUITools.getDebugContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。