當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。