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


Java XSourcePosition类代码示例

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


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

示例1: getEditorsProvider

import com.intellij.xdebugger.XSourcePosition; //导入依赖的package包/类
@Override
public XDebuggerEditorsProvider getEditorsProvider(@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint, @NotNull Project project)
{
    final XSourcePosition position = breakpoint.getSourcePosition();
    if (position == null)
    {
        return null;
    }

    final PsiFile file = PsiManager.getInstance(project).findFile(position.getFile());
    if (file == null)
    {
        return null;
    }

    return new MuleDebuggerEditorsProvider();
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:18,代码来源:MuleBreakpointType.java

示例2: findXmlTag

import com.intellij.xdebugger.XSourcePosition; //导入依赖的package包/类
private static XmlTag findXmlTag(XSourcePosition sourcePosition, XmlTag rootTag) {
    final XmlTag[] subTags = rootTag.getSubTags();
    for (int i = 0; i < subTags.length; i++) {
        XmlTag subTag = subTags[i];
        final int subTagLineNumber = getLineNumber(sourcePosition.getFile(), subTag);
        if (subTagLineNumber == sourcePosition.getLine()) {
            return subTag;
        } else if (subTagLineNumber > sourcePosition.getLine() && i > 0 && subTags[i - 1].getSubTags().length > 0) {
            return findXmlTag(sourcePosition, subTags[i - 1]);
        }
    }
    if (subTags.length > 0) {
        final XmlTag lastElement = subTags[subTags.length - 1];
        return findXmlTag(sourcePosition, lastElement);
    } else {
        return null;
    }
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:19,代码来源:MuleConfigUtils.java

示例3: getEditorsProvider

import com.intellij.xdebugger.XSourcePosition; //导入依赖的package包/类
@Override
public XDebuggerEditorsProvider getEditorsProvider(@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint, @NotNull Project project)
{
    final XSourcePosition position = breakpoint.getSourcePosition();
    if (position == null)
    {
        return null;
    }

    final PsiFile file = PsiManager.getInstance(project).findFile(position.getFile());
    if (file == null)
    {
        return null;
    }

    return new WeaveDebuggerEditorsProvider();
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:18,代码来源:WeaveBreakpointType.java

示例4: getSourcePosition

import com.intellij.xdebugger.XSourcePosition; //导入依赖的package包/类
@Nullable
@Override
public XSourcePosition getSourcePosition(@NotNull XBreakpoint<T> breakpoint) {
  Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint);
  if (javaBreakpoint != null) {
    final PsiClass aClass = javaBreakpoint.getPsiClass();
    if (aClass != null) {
      return ApplicationManager.getApplication().runReadAction(new Computable<XSourcePosition>() {
        @Override
        public XSourcePosition compute() {
          PsiFile containingFile = aClass.getContainingFile();
          if (containingFile != null && aClass.getTextOffset() >= 0) {
            return XDebuggerUtil.getInstance().createPositionByOffset(containingFile.getVirtualFile(), aClass.getTextOffset());
          }
          return null;
        }
      });
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:JavaBreakpointTypeBase.java

示例5: visit

import com.intellij.xdebugger.XSourcePosition; //导入依赖的package包/类
/**
 * Read action will be taken automatically
 */
public static <RESULT> RESULT visit(@NotNull XSourcePosition position, @NotNull Project project, @NotNull Visitor<RESULT> visitor, RESULT defaultResult) {
  AccessToken token = ReadAction.start();
  try {
    Document document = FileDocumentManager.getInstance().getDocument(position.getFile());
    PsiFile file = document == null || document.getTextLength() == 0 ? null : PsiDocumentManager.getInstance(project).getPsiFile(document);
    if (file == null) {
      return defaultResult;
    }

    int positionOffset;
    int column = position instanceof SourceInfo ? Math.max(((SourceInfo)position).getColumn(), 0) : 0;
    try {
      positionOffset = column == 0 ? DocumentUtil.getFirstNonSpaceCharOffset(document, position.getLine()) : document.getLineStartOffset(position.getLine()) + column;
    }
    catch (IndexOutOfBoundsException ignored) {
      return defaultResult;
    }

    PsiElement element = file.findElementAt(positionOffset);
    return element == null ? defaultResult : visitor.visit(element, positionOffset, document);
  }
  finally {
    token.finish();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:PsiVisitors.java

示例6: MyTableEditor

import com.intellij.xdebugger.XSourcePosition; //导入依赖的package包/类
public MyTableEditor(Project project,
                     XDebuggerEditorsProvider debuggerEditorsProvider,
                     @Nullable @NonNls String historyId,
                     @Nullable XSourcePosition sourcePosition, @NotNull XExpression text, @NotNull final KeyAdapter actionAdapter) {
  super(project, debuggerEditorsProvider, EvaluationMode.CODE_FRAGMENT, historyId, sourcePosition);
  myExpression = XExpressionImpl.changeMode(text, getMode());
  myEditorTextField = new EditorTextField(createDocument(myExpression), project, debuggerEditorsProvider.getFileType()) {
    @Override
    protected EditorEx createEditor() {
      final EditorEx editor = super.createEditor();
      editor.setVerticalScrollbarVisible(false);
      editor.setOneLineMode(true);
      editor.getContentComponent().addKeyListener(actionAdapter);
      return editor;
    }

    @Override
    protected boolean isOneLineMode() {
      return true;
    }
  };
  myEditorTextField.setFontInheritedFromLAF(false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ArrayTableCellEditor.java

示例7: CodeFragmentInputComponent

import com.intellij.xdebugger.XSourcePosition; //导入依赖的package包/类
public CodeFragmentInputComponent(final @NotNull Project project,
                                  @NotNull XDebuggerEditorsProvider editorsProvider,
                                  final @Nullable XSourcePosition sourcePosition,
                                  @Nullable XExpression statements,
                                  String splitterProportionKey,
                                  Disposable parentDisposable) {
  super(XDebuggerBundle.message("dialog.title.evaluate.code.fragment"));
  myMultilineEditor = new XDebuggerExpressionEditor(project, editorsProvider, "evaluateCodeFragment", sourcePosition,
                                                    statements != null ? statements : XExpressionImpl.EMPTY_CODE_FRAGMENT, true);
  myMainPanel = new JPanel(new BorderLayout());
  JPanel editorPanel = new JPanel(new BorderLayout());
  editorPanel.add(myMultilineEditor.getComponent(), BorderLayout.CENTER);
  DefaultActionGroup group = new DefaultActionGroup();
  group.add(new HistoryNavigationAction(false, IdeActions.ACTION_PREVIOUS_OCCURENCE, parentDisposable));
  group.add(new HistoryNavigationAction(true, IdeActions.ACTION_NEXT_OCCURENCE, parentDisposable));
  editorPanel.add(ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, false).getComponent(), BorderLayout.EAST);
  //myMainPanel.add(new JLabel(XDebuggerBundle.message("xdebugger.label.text.code.fragment")), BorderLayout.NORTH);
  myMainPanel.add(editorPanel, BorderLayout.CENTER);
  if (statements != null) {
    myMultilineEditor.setExpression(statements);
  }
  mySplitterProportionKey = splitterProportionKey;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:CodeFragmentInputComponent.java

示例8: getEditorsProvider

import com.intellij.xdebugger.XSourcePosition; //导入依赖的package包/类
@Override
public XDebuggerEditorsProvider getEditorsProvider(@NotNull XLineBreakpoint<XBreakpointProperties> breakpoint, @NotNull Project project) {
  final XSourcePosition position = breakpoint.getSourcePosition();
  if (position == null) {
    return null;
  }

  final PsiFile file = PsiManager.getInstance(project).findFile(position.getFile());
  if (file == null) {
    return null;
  }

  final XsltChecker.LanguageLevel level = XsltSupport.getXsltLanguageLevel(file);
  if (level == XsltChecker.LanguageLevel.V1) {
    return myMyEditorsProvider1;
  } else if (level == XsltChecker.LanguageLevel.V2) {
    return myMyEditorsProvider2;
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:XsltBreakpointType.java

示例9: findContextElement

import com.intellij.xdebugger.XSourcePosition; //导入依赖的package包/类
@Nullable
public static PsiElement findContextElement(Project project, @Nullable XSourcePosition position) {
  if (position == null) {
    return null;
  }

  final PsiFile file = PsiManager.getInstance(project).findFile(position.getFile());
  if (file == null) {
    return null;
  }

  int offset = -1;
  final Document document = PsiDocumentManager.getInstance(project).getDocument(file);
  if (document != null && document.getLineCount() > position.getLine() && position.getLine() >= 0) {
    offset = document.getLineStartOffset(position.getLine());
  }
  if (offset < 0) {
    offset = position.getOffset();
  }

  PsiElement contextElement = file.findElementAt(offset);
  while (contextElement != null && !(contextElement instanceof XmlElement)) {
    contextElement = PsiTreeUtil.nextLeaf(contextElement);
  }
  return contextElement;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:XsltBreakpointHandler.java

示例10: getGroup

import com.intellij.xdebugger.XSourcePosition; //导入依赖的package包/类
public XBreakpointFileGroup getGroup(@NotNull final B breakpoint, @NotNull final Collection<XBreakpointFileGroup> groups) {
  if (!(breakpoint instanceof XLineBreakpoint)) {
    return null;
  }
  XSourcePosition position = ((XLineBreakpoint)breakpoint).getSourcePosition();

  if (position == null) return null;

  VirtualFile file = position.getFile();
  for (XBreakpointFileGroup group : groups) {
    if (group.getFile().equals(file)) {
      return group;
    }
  }

  return new XBreakpointFileGroup(file);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:XBreakpointFileGroupingRule.java

示例11: buildTreeAndRestoreState

import com.intellij.xdebugger.XSourcePosition; //导入依赖的package包/类
protected void buildTreeAndRestoreState(@NotNull final XStackFrame stackFrame) {
  XDebuggerTree tree = myDebuggerTreePanel.getTree();
  final XSourcePosition position = stackFrame.getSourcePosition();
  tree.setSourcePosition(position);
  tree.setRoot(new XStackFrameNode(tree, stackFrame), false);
  final Project project = tree.getProject();
  project.putUserData(XVariablesView.DEBUG_VARIABLES, new XVariablesView.InlineVariablesInfo());
  project.putUserData(XVariablesView.DEBUG_VARIABLES_TIMESTAMPS, new ObjectLongHashMap<VirtualFile>());
  Object newEqualityObject = stackFrame.getEqualityObject();
  if (myFrameEqualityObject != null && newEqualityObject != null && myFrameEqualityObject.equals(newEqualityObject)
      && myTreeState != null) {
    disposeTreeRestorer();
    myTreeRestorer = myTreeState.restoreState(tree);
  }
  if (position != null && Registry.is("debugger.valueTooltipAutoShowOnSelection")) {
    registerInlineEvaluator(stackFrame, position, project);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:XVariablesViewBase.java

示例12: evaluate

import com.intellij.xdebugger.XSourcePosition; //导入依赖的package包/类
@Override
public void evaluate(@NotNull String script, @NotNull final XEvaluationCallback xEvaluationCallback, @Nullable XSourcePosition xSourcePosition) {
    final String melExpression = MuleConfigUtils.asMelScript(script);
    session.eval(melExpression, new ScriptEvaluationCallback() {
        @Override
        public void onScriptEvaluationException(RemoteDebugException exception) {
            xEvaluationCallback.evaluated(new ObjectFieldDefinitionValue(session, exception.getException(), AllIcons.General.Error));
        }

        @Override
        public void onScriptEvaluation(ScriptResultInfo info) {
            xEvaluationCallback.evaluated(new ObjectFieldDefinitionValue(session, info.getResult(), AllIcons.Nodes.Function));
        }
    });
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:16,代码来源:MuleScriptEvaluator.java

示例13: createDocument

import com.intellij.xdebugger.XSourcePosition; //导入依赖的package包/类
@NotNull
@Override
public Document createDocument(@NotNull Project project, @NotNull String text, @Nullable XSourcePosition sourcePosition, @NotNull EvaluationMode evaluationMode) {
    final PsiFile psiFile = PsiFileFactory.getInstance(project)
            .createFileFromText("MelExpr." + getFileType().getDefaultExtension(), getFileType(), text, LocalTimeCounter.currentTime(), true);
    final Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
    assert document != null;
    return document;
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:10,代码来源:MuleDebuggerEditorProperties.java

示例14: runToPosition

import com.intellij.xdebugger.XSourcePosition; //导入依赖的package包/类
@Override
public void runToPosition(@NotNull XSourcePosition position) {
  final PsiFile psiFile = PsiManager.getInstance(getSession().getProject()).findFile(position.getFile());
  assert psiFile != null;
  if (myDebuggerSession.canRunTo(position)) {
    myDebuggerSession.runTo(psiFile, position);
  } else {
    StatusBar.Info.set("Not a valid position in file '" + psiFile.getName() + "'", psiFile.getProject());
    final Debugger c = myDebuggerSession.getClient();
    getSession().positionReached(new MySuspendContext(myDebuggerSession, c.getCurrentFrame(), c.getSourceFrame()));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:XsltDebugProcess.java

示例15: createXSourcePosition

import com.intellij.xdebugger.XSourcePosition; //导入依赖的package包/类
@Nullable
protected static XSourcePosition createXSourcePosition(@Nullable VirtualFile vFile, int line) {
  if (vFile != null) {
    return XDebuggerUtil.getInstance().createPosition(vFile, convertRemoteLineToLocal(vFile, line));
  }
  else {
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PyLocalPositionConverter.java


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