本文整理汇总了Java中com.intellij.debugger.engine.DebuggerUtils类的典型用法代码示例。如果您正苦于以下问题:Java DebuggerUtils类的具体用法?Java DebuggerUtils怎么用?Java DebuggerUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DebuggerUtils类属于com.intellij.debugger.engine包,在下文中一共展示了DebuggerUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createContentDescriptor
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
@Override
@Nullable
protected RunContentDescriptor createContentDescriptor(RunProfileState state, ExecutionEnvironment env)
throws ExecutionException {
// Now we figure out if it the Debug button has been hit
Executor executor = env.getExecutor();
// If was the debug, then we do some extra magic
if (executor instanceof DefaultDebugExecutor) {
// Get hold of the JavaParameters
JavaCommandLine javaCommandLine = (JavaCommandLine) state;
JavaParameters javaParameters = javaCommandLine.getJavaParameters();
// Making the assumption that it's JVM 7 onwards
javaParameters.getVMParametersList().addParametersString(XDEBUG);
// Debugger port
String debuggerPort = DebuggerUtils.getInstance().findAvailableDebugAddress(true);
String remotePort = JDWP + debuggerPort;
javaParameters.getVMParametersList().addParametersString(remotePort);
// Creating a 'Remote' configuration on the fly
RemoteConnection connection = new RemoteConnection(true, LOCALHOST, debuggerPort, false);
// Attaches the remote configuration to the VM and then starts it up
return super.attachVirtualMachine(state, env, connection, true);
} else {
// If it was something else then we don't do anything special
return super.createContentDescriptor(state, env);
}
}
开发者ID:vitorzachi,项目名称:tomcat-runner,代码行数:27,代码来源:TomcatProgramDebugger.java
示例2: build
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
public static ExpressionEvaluator build(final TextWithImports text, @Nullable PsiElement contextElement, final SourcePosition position) throws EvaluateException {
if (contextElement == null) {
throw EvaluateExceptionUtil.CANNOT_FIND_SOURCE_CLASS;
}
final Project project = contextElement.getProject();
CodeFragmentFactory factory = DebuggerUtilsEx.findAppropriateCodeFragmentFactory(text, contextElement);
PsiCodeFragment codeFragment = factory.createCodeFragment(text, contextElement, project);
if (codeFragment == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.invalid.expression", text.getText()));
}
codeFragment.forceResolveScope(GlobalSearchScope.allScope(project));
DebuggerUtils.checkSyntax(codeFragment);
return factory.getEvaluatorBuilder().build(codeFragment, position);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:EvaluatorBuilderImpl.java
示例3: evaluate
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
myEvaluatedIndex = 0;
myEvaluatedArrayReference = null;
Value indexValue = (Value)myIndexEvaluator.evaluate(context);
Value arrayValue = (Value)myArrayReferenceEvaluator.evaluate(context);
if (!(arrayValue instanceof ArrayReference)) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.array.reference.expected"));
}
myEvaluatedArrayReference = (ArrayReference)arrayValue;
if (!DebuggerUtils.isInteger(indexValue)) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.invalid.index.expression"));
}
myEvaluatedIndex = ((PrimitiveValue)indexValue).intValue();
try {
return myEvaluatedArrayReference.getValue(myEvaluatedIndex);
}
catch (Exception e) {
throw EvaluateExceptionUtil.createEvaluateException(e);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ArrayAccessEvaluator.java
示例4: initEvaluatorAndChildrenExpression
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
protected Cache initEvaluatorAndChildrenExpression(final Project project) {
final Cache cache = new Cache();
try {
final PsiClass contextClass = DebuggerUtils.findClass(getClassName(), project, GlobalSearchScope.allScope(project));
if(contextClass == null) {
throw EvaluateExceptionUtil.CANNOT_FIND_SOURCE_CLASS;
}
final PsiType contextType = DebuggerUtils.getType(getClassName(), project);
cache.myPsiChildrenExpression = null;
JavaCodeFragment codeFragment = myDefaultFragmentFactory.createCodeFragment(myReferenceExpression, contextClass, project);
codeFragment.forceResolveScope(GlobalSearchScope.allScope(project));
codeFragment.setThisType(contextType);
DebuggerUtils.checkSyntax(codeFragment);
cache.myPsiChildrenExpression = ((PsiExpressionCodeFragment)codeFragment).getExpression();
cache.myEvaluator = myDefaultFragmentFactory.getEvaluatorBuilder().build(cache.myPsiChildrenExpression, null);
}
catch (EvaluateException e) {
cache.myException = e;
}
myCache = new SoftReference<Cache>(cache);
return cache;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:CachedEvaluator.java
示例5: getEvaluationCode
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
protected PsiCodeFragment getEvaluationCode(final StackFrameContext context) throws EvaluateException {
Value value = myParentDescriptor.getValue();
if(value instanceof ObjectReference) {
final String typeName = value.type().name();
final PsiClass psiClass = DebuggerUtils.findClass(myTypeName, myProject, context.getDebugProcess().getSearchScope());
if (psiClass == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.invalid.type.name", typeName));
}
return createCodeFragment(psiClass);
}
else {
throw EvaluateExceptionUtil.createEvaluateException(
DebuggerBundle.message("evaluation.error.objref.expected", myParentDescriptor.getName())
);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:UserExpressionDescriptorImpl.java
示例6: suggestAvailablePortIfNotSpecified
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
private void suggestAvailablePortIfNotSpecified() {
String port = getPort();
boolean portSpecified = !StringUtil.isEmpty(port);
boolean isSocketTransport = getTransport() == DebuggerSettings.SOCKET_TRANSPORT;
if (isSocketTransport) {
try {
Integer.parseInt(port);
}
catch (NumberFormatException ignored) {
portSpecified = false;
}
}
if (!portSpecified) {
try {
setPort(DebuggerUtils.getInstance().findAvailableDebugAddress(isSocketTransport));
}
catch (ExecutionException e) {
LOG.info(e);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GenericDebuggerParametersRunnerConfigurable.java
示例7: createScaledBitmap
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
@Nullable
private static Value createScaledBitmap(@NotNull EvaluationContextImpl context,
@NotNull ObjectReference bitmap,
@NotNull Dimension currentDimensions) throws EvaluateException {
DebugProcessImpl debugProcess = context.getDebugProcess();
Method createScaledBitmapMethod = DebuggerUtils
.findMethod(bitmap.referenceType(), "createScaledBitmap", "(Landroid/graphics/Bitmap;IIZ)Landroid/graphics/Bitmap;");
if (createScaledBitmapMethod == null) {
return null;
}
double s = Math.max(currentDimensions.getHeight(), currentDimensions.getWidth()) / MAX_DIMENSION;
VirtualMachineProxyImpl vm = context.getDebugProcess().getVirtualMachineProxy();
Value dstWidth = DebuggerUtilsEx.createValue(vm, "int", (int)(currentDimensions.getWidth() / s));
Value dstHeight = DebuggerUtilsEx.createValue(vm, "int", (int)(currentDimensions.getHeight() / s));
Value filter = DebuggerUtilsEx.createValue(vm, "boolean", Boolean.FALSE);
return debugProcess.invokeMethod(context, bitmap, createScaledBitmapMethod,
Arrays.asList(bitmap, dstWidth, dstHeight, filter));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:BitmapEvaluator.java
示例8: build
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
public static ExpressionEvaluator build(final TextWithImports text, final PsiElement contextElement, final SourcePosition position) throws EvaluateException {
if (contextElement == null) {
throw EvaluateExceptionUtil.CANNOT_FIND_SOURCE_CLASS;
}
final Project project = contextElement.getProject();
CodeFragmentFactory factory = DebuggerEditorImpl.findAppropriateFactory(text, contextElement);
PsiCodeFragment codeFragment = new CodeFragmentFactoryContextWrapper(factory).createCodeFragment(text, contextElement, project);
if(codeFragment == null) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.invalid.expression", text.getText()));
}
codeFragment.forceResolveScope(GlobalSearchScope.allScope(project));
DebuggerUtils.checkSyntax(codeFragment);
EvaluatorBuilder evaluatorBuilder = factory.getEvaluatorBuilder();
return evaluatorBuilder.build(codeFragment, position);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:EvaluatorBuilderImpl.java
示例9: isEnabled
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
public boolean isEnabled(final @NotNull Project project, final AnActionEvent event) {
Editor editor = event.getData(PlatformDataKeys.EDITOR);
if (editor == null) {
return false;
}
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
FileTypeManager fileTypeManager = FileTypeManager.getInstance();
if (file == null) {
return false;
}
final VirtualFile virtualFile = file.getVirtualFile();
FileType fileType = virtualFile != null ? virtualFile.getFileType() : null;
if (DebuggerUtils.supportsJVMDebugging(fileType) || DebuggerUtils.supportsJVMDebugging(file)) {
DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(project).getContext().getDebuggerSession();
return debuggerSession != null && debuggerSession.isPaused();
}
return false;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:RunToCursorActionHandler.java
示例10: isEnabled
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
public boolean isEnabled(@NotNull final Project project, final AnActionEvent event) {
PlaceInDocument place = getPlace(project, event);
if (place != null) {
final Document document = place.getDocument();
final int offset = place.getOffset();
int line = document.getLineNumber(offset);
VirtualFile file = FileDocumentManager.getInstance().getFile(document);
PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
if (DebuggerUtils.supportsJVMDebugging(file.getFileType()) || DebuggerUtils.supportsJVMDebugging(psiFile)) {
final BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(project).getBreakpointManager();
return breakpointManager.findBreakpoint(document, offset, LineBreakpoint.CATEGORY) != null ||
LineBreakpoint.canAddLineBreakpoint(project, document, line);
}
}
return false;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:ToggleLineBreakpointActionHandler.java
示例11: TestNGRunnableState
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
public TestNGRunnableState(ExecutionEnvironment environment, TestNGConfiguration config) {
super(environment);
this.runnerSettings = environment.getRunnerSettings();
this.config = config;
//TODO need to narrow this down a bit
//setModulesToCompile(ModuleManager.getInstance(config.getProject()).getModules());
client = new IDEARemoteTestRunnerClient();
// Want debugging?
if (runnerSettings instanceof DebuggingRunnerData) {
DebuggingRunnerData debuggingRunnerData = ((DebuggingRunnerData)runnerSettings);
debugPort = debuggingRunnerData.getDebugPort();
if (debugPort.length() == 0) {
try {
debugPort = DebuggerUtils.getInstance().findAvailableDebugAddress(true);
}
catch (ExecutionException e) {
LOG.error(e);
}
debuggingRunnerData.setDebugPort(debugPort);
}
debuggingRunnerData.setLocal(true);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:TestNGRunnableState.java
示例12: createContentDescriptor
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
@Override
@Nullable
protected RunContentDescriptor createContentDescriptor(RunProfileState state, ExecutionEnvironment env)
throws ExecutionException {
// Now we figure out if it the Debug button has been hit
Executor executor = env.getExecutor();
// If was the debug, then we do some extra magic
if(executor instanceof DefaultDebugExecutor) {
// Get hold of the JavaParameters
JavaCommandLine javaCommandLine = (JavaCommandLine) state;
JavaParameters javaParameters = javaCommandLine.getJavaParameters();
// Making the assumption that it's JVM 7 onwards
javaParameters.getVMParametersList().addParametersString(XDEBUG);
// Debugger port
String debuggerPort = DebuggerUtils.getInstance().findAvailableDebugAddress(true);
String remotePort = JDWP + debuggerPort;
javaParameters.getVMParametersList().addParametersString(remotePort);
// Creating a 'Remote' configuration on the fly
RemoteConnection connection = new RemoteConnection(true, LOCALHOST, debuggerPort, false);
// Attaches the remote configuration to the VM and then starts it up
return super.attachVirtualMachine(state, env, connection, true);
}else{
// If it was something else then we don't do anything special
return super.createContentDescriptor(state, env);
}
}
开发者ID:guikeller,项目名称:jetty-runner,代码行数:27,代码来源:JettyProgramDebugger.java
示例13: getPsiClass
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
@Nullable
private PsiClass getPsiClass(AnActionEvent e)
{
final ReferenceType selectedClass = getSelectedClass(e);
final Project project = e.getProject();
if(selectedClass == null || project == null)
{
return null;
}
final ReferenceType targetClass = getObjectType(selectedClass);
if(targetClass != null)
{
return DebuggerUtils.findClass(targetClass.name(), project, GlobalSearchScope.allScope(project));
}
return null;
}
开发者ID:consulo,项目名称:consulo-java,代码行数:19,代码来源:JumpToTypeSourceAction.java
示例14: readExternal
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
@Override
public void readExternal(Element element) throws InvalidDataException
{
super.readExternal(element);
myChildren.clear();
myAppendDefaultChildren = Boolean.parseBoolean(JDOMExternalizerUtil.readField(element, APPEND_DEFAULT_NAME));
List<Element> children = element.getChildren(CHILDREN_EXPRESSION);
for(Element item : children)
{
String name = item.getAttributeValue(CHILD_NAME);
TextWithImports text = DebuggerUtils.getInstance().readTextWithImports(item.getChildren().get(0));
boolean onDemand = Boolean.parseBoolean(item.getAttributeValue(CHILD_ONDEMAND));
myChildren.add(new ChildInfo(name, text, onDemand));
}
}
开发者ID:consulo,项目名称:consulo-java,代码行数:20,代码来源:EnumerationChildrenRenderer.java
示例15: writeExternal
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
@Override
public void writeExternal(Element element) throws WriteExternalException
{
super.writeExternal(element);
if(myAppendDefaultChildren)
{
JDOMExternalizerUtil.writeField(element, APPEND_DEFAULT_NAME, "true");
}
for(ChildInfo childInfo : myChildren)
{
Element child = new Element(CHILDREN_EXPRESSION);
child.setAttribute(CHILD_NAME, childInfo.myName);
if(childInfo.myOnDemand)
{
child.setAttribute(CHILD_ONDEMAND, "true");
}
child.addContent(DebuggerUtils.getInstance().writeTextWithImports(childInfo.myExpression));
element.addContent(child);
}
}
开发者ID:consulo,项目名称:consulo-java,代码行数:24,代码来源:EnumerationChildrenRenderer.java
示例16: readExternal
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
public void readExternal(Element element) throws InvalidDataException
{
super.readExternal(element);
DefaultJDOMExternalizer.readExternal(this, element);
TextWithImports childrenExpression = DebuggerUtils.getInstance().readTextWithImports(element, "CHILDREN_EXPRESSION");
if(childrenExpression != null)
{
setChildrenExpression(childrenExpression);
}
TextWithImports childrenExpandable = DebuggerUtils.getInstance().readTextWithImports(element, "CHILDREN_EXPANDABLE");
if(childrenExpandable != null)
{
myChildrenExpandable.setReferenceExpression(childrenExpandable);
}
}
开发者ID:consulo,项目名称:consulo-java,代码行数:18,代码来源:ExpressionChildrenRenderer.java
示例17: getChildValueExpression
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
@Override
public PsiElement getChildValueExpression(DebuggerTreeNode node, DebuggerContext context) throws EvaluateException
{
FieldDescriptor fieldDescriptor = (FieldDescriptor) node.getDescriptor();
PsiElementFactory elementFactory = JavaPsiFacade.getInstance(node.getProject()).getElementFactory();
try
{
return elementFactory.createExpressionFromText(fieldDescriptor.getField().name(), DebuggerUtils.findClass(fieldDescriptor.getObject().referenceType().name(), context.getProject(),
context.getDebugProcess().getSearchScope()));
}
catch(IncorrectOperationException e)
{
throw new EvaluateException(DebuggerBundle.message("error.invalid.field.name", fieldDescriptor.getField().name()), null);
}
}
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:ClassRenderer.java
示例18: isPrimitive
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
@Override
public boolean isPrimitive()
{
if(myIsPrimitive == null)
{
final Value value = getValue();
if(value != null)
{
myIsPrimitive = super.isPrimitive();
}
else
{
myIsPrimitive = DebuggerUtils.isPrimitiveType(myField.typeName());
}
}
return myIsPrimitive.booleanValue();
}
开发者ID:consulo,项目名称:consulo-java,代码行数:18,代码来源:FieldDescriptorImpl.java
示例19: findPsiType
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
private static PsiType findPsiType(Project project, Type type) {
AccessToken token = ReadAction.start();
try {
return DebuggerUtils.getType(type.name().replace('$', '.'), project);
}
finally {
token.finish();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:RuntimeTypeEvaluator.java
示例20: evaluate
import com.intellij.debugger.engine.DebuggerUtils; //导入依赖的package包/类
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
DebugProcessImpl debugProcess = context.getDebugProcess();
Object obj = myClassTypeEvaluator.evaluate(context);
if (!(obj instanceof ClassType)) {
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.evaluate.class.type"));
}
ClassType classType = (ClassType)obj;
// find constructor
Method method = DebuggerUtils.findMethod(classType, JVMNameUtil.CONSTRUCTOR_NAME, myConstructorSignature.getName(debugProcess));
if (method == null) {
throw EvaluateExceptionUtil.createEvaluateException(
DebuggerBundle.message("evaluation.error.cannot.resolve.constructor", myConstructorSignature.getDisplayName(debugProcess)));
}
// evaluate arguments
List<Object> arguments;
if (myParamsEvaluators != null) {
arguments = new ArrayList<Object>(myParamsEvaluators.length);
for (Evaluator evaluator : myParamsEvaluators) {
arguments.add(evaluator.evaluate(context));
}
}
else {
arguments = Collections.emptyList();
}
ObjectReference objRef;
try {
objRef = debugProcess.newInstance(context, classType, method, arguments);
}
catch (EvaluateException e) {
throw EvaluateExceptionUtil.createEvaluateException(e);
}
return objRef;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:NewClassInstanceEvaluator.java
注:本文中的com.intellij.debugger.engine.DebuggerUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论