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


Java DebuggerUtilsEx类代码示例

本文整理汇总了Java中com.intellij.debugger.impl.DebuggerUtilsEx的典型用法代码示例。如果您正苦于以下问题:Java DebuggerUtilsEx类的具体用法?Java DebuggerUtilsEx怎么用?Java DebuggerUtilsEx使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createExpressionCodeFragment

import com.intellij.debugger.impl.DebuggerUtilsEx; //导入依赖的package包/类
@Override
protected PsiFile createExpressionCodeFragment(@NotNull Project project,
                                               @NotNull XExpression expression,
                                               @Nullable PsiElement context,
                                               boolean isPhysical) {
  TextWithImports text = TextWithImportsImpl.fromXExpression(expression);
  if (text != null && context != null) {
    CodeFragmentFactory factory = DebuggerUtilsEx.findAppropriateCodeFragmentFactory(text, context);
    JavaCodeFragment codeFragment = factory.createPresentationCodeFragment(text, context, project);
    codeFragment.forceResolveScope(GlobalSearchScope.allScope(project));

    final PsiClass contextClass = PsiTreeUtil.getNonStrictParentOfType(context, PsiClass.class);
    if (contextClass != null) {
      final PsiClassType contextType =
        JavaPsiFacade.getInstance(codeFragment.getProject()).getElementFactory().createType(contextClass);
      codeFragment.setThisType(contextType);
    }
    return codeFragment;
  }
  else {
    return super.createExpressionCodeFragment(project, expression, context, isPhysical);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:JavaDebuggerEditorsProvider.java

示例2: evaluate

import com.intellij.debugger.impl.DebuggerUtilsEx; //导入依赖的package包/类
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
  Value value = (Value)myOperandEvaluator.evaluate(context);
  if (value == null) {
    return DebuggerUtilsEx.createValue(context.getDebugProcess().getVirtualMachineProxy(), PsiType.BOOLEAN.getPresentableText(), false);
  }
  if (!(value instanceof ObjectReference)) {
    throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.object.reference.expected"));
  }
  try {
    ReferenceType refType = (ReferenceType)myTypeEvaluator.evaluate(context);
    ClassObjectReference classObject = refType.classObject();
    ClassType classRefType = (ClassType)classObject.referenceType();
    //noinspection HardCodedStringLiteral
    Method method = classRefType.concreteMethodByName("isAssignableFrom", "(Ljava/lang/Class;)Z");
    List args = new LinkedList();
    args.add(((ObjectReference)value).referenceType().classObject());
    return context.getDebugProcess().invokeMethod(context, classObject, method, args);
  }
  catch (Exception e) {
    if (LOG.isDebugEnabled()) {
      LOG.debug(e);
    }
    throw EvaluateExceptionUtil.createEvaluateException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:InstanceofEvaluator.java

示例3: build

import com.intellij.debugger.impl.DebuggerUtilsEx; //导入依赖的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

示例4: evaluate

import com.intellij.debugger.impl.DebuggerUtilsEx; //导入依赖的package包/类
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
  if (myValue == null) {
    return null;
  }
  VirtualMachineProxyImpl vm = context.getDebugProcess().getVirtualMachineProxy();
  if (myValue instanceof Boolean) {
    return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Boolean)myValue).booleanValue());
  }
  if (myValue instanceof Character) {
    return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Character)myValue).charValue());
  }
  if (myValue instanceof Double) {
    return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Number)myValue).doubleValue());
  }
  if (myValue instanceof Float) {
    return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Number)myValue).floatValue());
  }
  if (myValue instanceof Number) {
    return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Number)myValue).longValue());
  }
  if (myValue instanceof String) {
    return vm.mirrorOf((String)myValue);
  }
  throw EvaluateExceptionUtil
    .createEvaluateException(DebuggerBundle.message("evaluation.error.unknown.expression.type", myExpectedType));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:LiteralEvaluator.java

示例5: resume

import com.intellij.debugger.impl.DebuggerUtilsEx; //导入依赖的package包/类
protected void resume(){
  assertNotResumed();
  if (isEvaluating()) {
    LOG.error("Resuming context while evaluating", ThreadDumper.dumpThreadsToString());
  }
  DebuggerManagerThreadImpl.assertIsManagerThread();
  try {
    if (!Patches.IBM_JDK_DISABLE_COLLECTION_BUG) {
      for (ObjectReference objectReference : myKeptReferences) {
        DebuggerUtilsEx.enableCollection(objectReference);
      }
      myKeptReferences.clear();
    }

    for(SuspendContextCommandImpl cmd = pollPostponedCommand(); cmd != null; cmd = pollPostponedCommand()) {
      cmd.notifyCancelled();
    }

    resumeImpl();
  }
  finally {
    myIsResumed = true;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SuspendContextImpl.java

示例6: computeTypeSourcePosition

import com.intellij.debugger.impl.DebuggerUtilsEx; //导入依赖的package包/类
@Override
public void computeTypeSourcePosition(@NotNull final XNavigatable navigatable) {
  if (myEvaluationContext.getSuspendContext().isResumed()) return;
  DebugProcessImpl debugProcess = myEvaluationContext.getDebugProcess();
  debugProcess.getManagerThread().schedule(new JumpToObjectAction.NavigateCommand(getDebuggerContext(), myValueDescriptor, debugProcess, null) {
    @Override
    public Priority getPriority() {
      return Priority.HIGH;
    }

    @Override
    protected void doAction(@Nullable final SourcePosition sourcePosition) {
      if (sourcePosition != null) {
        ApplicationManager.getApplication().runReadAction(new Runnable() {
          @Override
          public void run() {
            navigatable.setSourcePosition(DebuggerUtilsEx.toXSourcePosition(sourcePosition));
          }
        });
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:JavaValue.java

示例7: remapElement

import com.intellij.debugger.impl.DebuggerUtilsEx; //导入依赖的package包/类
private PsiElement remapElement(PsiElement element) {
  String name = JVMNameUtil.getClassVMName(getEnclosingClass(element));
  if (name != null && !name.equals(myExpectedClassName)) {
    return null;
  }
  PsiElement method = DebuggerUtilsEx.getContainingMethod(element);
  if (!StringUtil.isEmpty(myExpectedMethodName)) {
    if (method == null) {
      return null;
    }
    else if ((method instanceof PsiMethod && myExpectedMethodName.equals(((PsiMethod)method).getName()))) {
      if (insideBody(element, ((PsiMethod)method).getBody())) return element;
    }
    else if (method instanceof PsiLambdaExpression && LambdaMethodFilter.isLambdaName(myExpectedMethodName)) {
      if (insideBody(element, ((PsiLambdaExpression)method).getBody())) return element;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PositionManagerImpl.java

示例8: getExpressionRangeAtOffset

import com.intellij.debugger.impl.DebuggerUtilsEx; //导入依赖的package包/类
@Nullable
@Override
public TextRange getExpressionRangeAtOffset(final Project project, final Document document, final int offset, final boolean sideEffectsAllowed) {
  final Ref<TextRange> currentRange = Ref.create(null);
  PsiDocumentManager.getInstance(project).commitAndRunReadAction(new Runnable() {
    @Override
    public void run() {
      try {
        PsiElement elementAtCursor = DebuggerUtilsEx.findElementAt(PsiDocumentManager.getInstance(project).getPsiFile(document), offset);
        if (elementAtCursor == null) {
          return;
        }
        Pair<PsiElement, TextRange> pair = findExpression(elementAtCursor, sideEffectsAllowed);
        if (pair != null) {
          currentRange.set(pair.getSecond());
        }
      } catch (IndexNotReadyException ignored) {}
    }
  });
  return currentRange.get();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:JavaDebuggerEvaluator.java

示例9: findOwnerMethod

import com.intellij.debugger.impl.DebuggerUtilsEx; //导入依赖的package包/类
@Nullable
private static String findOwnerMethod(final PsiFile file, final int offset) {
  if (offset < 0 || file instanceof JspFile) {
    return null;
  }
  if (file instanceof PsiClassOwner) {
    return ApplicationManager.getApplication().runReadAction(new Computable<String>() {
      @Override
      public String compute() {
        final PsiMethod method = DebuggerUtilsEx.findPsiMethod(file, offset);
        return method != null? method.getName() : null;
      }
    });
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:LineBreakpoint.java

示例10: readExternal

import com.intellij.debugger.impl.DebuggerUtilsEx; //导入依赖的package包/类
public void readExternal(Element parentNode) throws InvalidDataException {
  DefaultJDOMExternalizer.readExternal(this, parentNode);
  if (DebuggerSettings.SUSPEND_NONE.equals(SUSPEND_POLICY)) { // compatibility with older format
    SUSPEND = false;
    SUSPEND_POLICY = DebuggerSettings.SUSPEND_ALL;
  }
  String condition = JDOMExternalizerUtil.readField(parentNode, CONDITION_OPTION_NAME);
  if (condition != null) {
    setCondition(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, condition));
  }

  myClassFilters = DebuggerUtilsEx.readFilters(parentNode.getChildren(FILTER_OPTION_NAME));
  myClassExclusionFilters = DebuggerUtilsEx.readFilters(parentNode.getChildren(EXCLUSION_FILTER_OPTION_NAME));

  final ClassFilter [] instanceFilters = DebuggerUtilsEx.readFilters(parentNode.getChildren(INSTANCE_ID_OPTION_NAME));
  final List<InstanceFilter> iFilters = new ArrayList<InstanceFilter>(instanceFilters.length);

  for (ClassFilter instanceFilter : instanceFilters) {
    try {
      iFilters.add(InstanceFilter.create(instanceFilter));
    }
    catch (Exception e) {
    }
  }
  myInstanceFilters = iFilters.isEmpty() ? InstanceFilter.EMPTY_ARRAY : iFilters.toArray(new InstanceFilter[iFilters.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:FilteredRequestorImpl.java

示例11: getContainingMethod

import com.intellij.debugger.impl.DebuggerUtilsEx; //导入依赖的package包/类
@Nullable
public PsiElement getContainingMethod(@NotNull LineBreakpoint<?> breakpoint) {
  SourcePosition position = breakpoint.getSourcePosition();
  if (position == null) return null;

  JavaBreakpointProperties properties = breakpoint.getProperties();
  if (properties instanceof JavaLineBreakpointProperties && !(breakpoint instanceof RunToCursorBreakpoint)) {
    Integer ordinal = ((JavaLineBreakpointProperties)properties).getLambdaOrdinal();
    if (ordinal > -1) {
      List<PsiLambdaExpression> lambdas = DebuggerUtilsEx.collectLambdas(position, true);
      if (ordinal < lambdas.size()) {
        return lambdas.get(ordinal);
      }
    }
  }
  return DebuggerUtilsEx.getContainingMethod(position);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JavaLineBreakpointType.java

示例12: calcRepresentation

import com.intellij.debugger.impl.DebuggerUtilsEx; //导入依赖的package包/类
protected String calcRepresentation(EvaluationContextImpl context, DescriptorLabelListener labelListener) throws EvaluateException {
  DebuggerManagerThreadImpl.assertIsManagerThread();
  ThreadReferenceProxyImpl thread = getThreadReference();
  try {
    myName = thread.name();
    ThreadGroupReferenceProxyImpl gr = getThreadReference().threadGroupProxy();
    final String grname = (gr != null)? gr.name() : null;
    final String threadStatusText = DebuggerUtilsEx.getThreadStatusText(getThreadReference().status());
    //noinspection HardCodedStringLiteral
    if (grname != null && !"SYSTEM".equalsIgnoreCase(grname)) {
      return DebuggerBundle.message("label.thread.node.in.group", myName, thread.uniqueID(), threadStatusText, grname);
    }
    return DebuggerBundle.message("label.thread.node", myName, thread.uniqueID(), threadStatusText);
  }
  catch (ObjectCollectedException e) {
    return myName != null ? DebuggerBundle.message("label.thread.node.thread.collected", myName) : "";
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ThreadDescriptorImpl.java

示例13: createLanguagePopup

import com.intellij.debugger.impl.DebuggerUtilsEx; //导入依赖的package包/类
private ListPopup createLanguagePopup() {
  DefaultActionGroup actions = new DefaultActionGroup();
  for (final CodeFragmentFactory fragmentFactory : DebuggerUtilsEx.getCodeFragmentFactories(myContext)) {
    actions.add(new AnAction(fragmentFactory.getFileType().getLanguage().getDisplayName(), null, fragmentFactory.getFileType().getIcon()) {
      @Override
      public void actionPerformed(AnActionEvent e) {
        setFactory(fragmentFactory);
        setText(getText());
        IdeFocusManager.getInstance(getProject()).requestFocus(DebuggerEditorImpl.this, true);
      }
    });
  }

  DataContext dataContext = DataManager.getInstance().getDataContext(this);
  return JBPopupFactory.getInstance().createActionGroupPopup("Choose Language", actions, dataContext,
                                                             JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
                                                             false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:DebuggerEditorImpl.java

示例14: setContext

import com.intellij.debugger.impl.DebuggerUtilsEx; //导入依赖的package包/类
@Override
public void setContext(@Nullable PsiElement context) {
  myContext = context;

  List<CodeFragmentFactory> factories = DebuggerUtilsEx.getCodeFragmentFactories(context);
  boolean many = factories.size() > 1;
  if (myInitialFactory) {
    myInitialFactory = false;
    setFactory(factories.get(0));
    myChooseFactory.setVisible(many);
  }
  myChooseFactory.setVisible(myChooseFactory.isVisible() || many);
  myChooseFactory.setEnabled(many && factories.contains(myFactory));

  updateEditorUi();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:DebuggerEditorImpl.java

示例15: AlternativeSourceNotificationPanel

import com.intellij.debugger.impl.DebuggerUtilsEx; //导入依赖的package包/类
public AlternativeSourceNotificationPanel(ComboBoxClassElement[] alternatives,
                                          final PsiClass aClass,
                                          final Project project,
                                          final VirtualFile file) {
  setText(DebuggerBundle.message("editor.notification.alternative.source", aClass.getQualifiedName()));
  final ComboBox switcher = new ComboBox(alternatives);
  switcher.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      FileEditorManager.getInstance(project).closeFile(file);
      PsiClass item = ((ComboBoxClassElement)switcher.getSelectedItem()).myClass;
      item = (PsiClass)item.getNavigationElement(); // go through compiled
      DebuggerUtilsEx.setAlternativeSource(file, item.getContainingFile().getVirtualFile());
      item.navigate(true);
      XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
      if (session != null) {
        session.updateExecutionPosition();
      }
    }
  });
  myLinksPanel.add(switcher);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AlternativeSourceNotificationProvider.java


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