use of com.intellij.openapi.editor.textarea.TextComponentEditorImpl in project intellij-community by JetBrains.
the class TextComponentEditorAction method getEditorFromContext.
@Nullable
public static Editor getEditorFromContext(@NotNull DataContext dataContext) {
final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
if (editor != null)
return editor;
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
final Object data = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
if (data instanceof JTextComponent) {
return new TextComponentEditorImpl(project, (JTextComponent) data);
}
if (data instanceof JComponent) {
final JTextField field = findActiveSpeedSearchTextField((JComponent) data);
if (field != null) {
return new TextComponentEditorImpl(project, field);
}
}
return null;
}
Aggregations