Example usage for com.intellij.openapi.fileEditor TextEditorLocation TextEditorLocation

List of usage examples for com.intellij.openapi.fileEditor TextEditorLocation TextEditorLocation

Introduction

In this page you can find the example usage for com.intellij.openapi.fileEditor TextEditorLocation TextEditorLocation.

Prototype

public TextEditorLocation(@NotNull LogicalPosition position, @NotNull TextEditor editor) 

Source Link

Usage

From source file:com.intellij.usages.UsageInfo2UsageAdapter.java

License:Apache License

@Override
@Nullable/*w  ww.  j a v  a 2 s  .c o  m*/
public FileEditorLocation getLocation() {
    VirtualFile virtualFile = getFile();
    if (virtualFile == null)
        return null;
    FileEditor editor = FileEditorManager.getInstance(getProject()).getSelectedEditor(virtualFile);
    if (!(editor instanceof TextEditor))
        return null;

    Segment segment = getUsageInfo().getSegment();
    if (segment == null)
        return null;
    return new TextEditorLocation(segment.getStartOffset(), (TextEditor) editor);
}