本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}