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


Java EditorUtil.inVirtualSpace方法代码示例

本文整理汇总了Java中com.intellij.openapi.editor.ex.util.EditorUtil.inVirtualSpace方法的典型用法代码示例。如果您正苦于以下问题:Java EditorUtil.inVirtualSpace方法的具体用法?Java EditorUtil.inVirtualSpace怎么用?Java EditorUtil.inVirtualSpace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.editor.ex.util.EditorUtil的用法示例。


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

示例1: getLinkNavigationRunnable

import com.intellij.openapi.editor.ex.util.EditorUtil; //导入方法依赖的package包/类
@Nullable
public Runnable getLinkNavigationRunnable(final LogicalPosition logical) {
  if (EditorUtil.inVirtualSpace(myEditor, logical)) {
    return null;
  }

  final RangeHighlighter range = findLinkRangeAt(this.myEditor.logicalPositionToOffset(logical));
  if (range != null) {
    final HyperlinkInfo hyperlinkInfo = getHyperlinkInfo(range);
    if (hyperlinkInfo != null) {
      return new Runnable() {
        @Override
        public void run() {
          if (hyperlinkInfo instanceof HyperlinkInfoBase) {
            final Point point = myEditor.logicalPositionToXY(logical);
            final MouseEvent event = new MouseEvent(myEditor.getContentComponent(), 0, 0, 0, point.x, point.y, 1, false);
            ((HyperlinkInfoBase)hyperlinkInfo).navigate(myProject, new RelativePoint(event));
          }
          else {
            hyperlinkInfo.navigate(myProject);
          }
          linkFollowed(myEditor, getHyperlinks(0, myEditor.getDocument().getTextLength(),myEditor), range);
        }
      };
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:EditorHyperlinkSupport.java

示例2: getHyperlinkInfoByPoint

import com.intellij.openapi.editor.ex.util.EditorUtil; //导入方法依赖的package包/类
@Nullable
public HyperlinkInfo getHyperlinkInfoByPoint(final Point p) {
  final LogicalPosition pos = myEditor.xyToLogicalPosition(new Point(p.x, p.y));
  if (EditorUtil.inVirtualSpace(myEditor, pos)) {
    return null;
  }

  return getHyperlinkInfoByLineAndCol(pos.line, pos.column);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:EditorHyperlinkSupport.java

示例3: getColumnNumber

import com.intellij.openapi.editor.ex.util.EditorUtil; //导入方法依赖的package包/类
/**
 * @return 1-based column index where tabs are treated as single characters. External tools don't know about IDEA's tab size.
 */
protected static String getColumnNumber(Editor editor, LogicalPosition pos) {
  if (EditorUtil.inVirtualSpace(editor, pos)) {
    return String.valueOf(pos.column + 1);
  }

  int offset = editor.logicalPositionToOffset(pos);
  int lineStart = editor.getDocument().getLineStartOffset(editor.getDocument().getLineNumber(offset));
  return String.valueOf(offset - lineStart + 1);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:EditorMacro.java

示例4: update

import com.intellij.openapi.editor.ex.util.EditorUtil; //导入方法依赖的package包/类
@Override
public void update(final AnActionEvent event) {
  InputEvent inputEvent = event.getInputEvent();
  if (inputEvent instanceof MouseEvent) {
    Component component = inputEvent.getComponent();
    if (component != null) {
      Point point = ((MouseEvent)inputEvent).getPoint();
      Component componentAt = SwingUtilities.getDeepestComponentAt(component, point.x, point.y);
      Project project = event.getProject();
      if (project == null) {
        event.getPresentation().setEnabled(false);
        return;
      }

      Editor editor = getBaseEditor(event.getDataContext(), project);
      if (componentAt instanceof EditorGutterComponentEx) {
        event.getPresentation().setEnabled(false);
        return;
      }
      else if (editor != null && componentAt == editor.getContentComponent()) {
        LogicalPosition pos = editor.xyToLogicalPosition(SwingUtilities.convertPoint(component, point, componentAt));
        if (EditorUtil.inVirtualSpace(editor, pos)) {
          event.getPresentation().setEnabled(false);
          return;
        }
      }
    }
  }

  for (GotoDeclarationHandler handler : Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) {
    try {
      String text = handler.getActionText(event.getDataContext());
      if (text != null) {
        Presentation presentation = event.getPresentation();
        presentation.setText(text);
        break;
      }
    }
    catch (AbstractMethodError e) {
      LOG.error(handler.toString(), e);
    }
  }

  super.update(event);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:46,代码来源:GotoDeclarationAction.java

示例5: inVirtualSpace

import com.intellij.openapi.editor.ex.util.EditorUtil; //导入方法依赖的package包/类
public static boolean inVirtualSpace(@NotNull Editor editor, int offset) {
  return offset == editor.getCaretModel().getOffset()
         && EditorUtil.inVirtualSpace(editor, editor.getCaretModel().getLogicalPosition());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:TargetElementUtil.java


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