use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class XEvaluateInConsoleFromEditorActionHandler method perform.
@Override
protected void perform(@NotNull XDebugSession session, DataContext dataContext) {
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
if (editor == null || !(editor instanceof EditorEx)) {
return;
}
int selectionStart = editor.getSelectionModel().getSelectionStart();
int selectionEnd = editor.getSelectionModel().getSelectionEnd();
Promise<Pair<TextRange, String>> rangeAndText = null;
if (selectionStart != selectionEnd) {
TextRange textRange = new TextRange(selectionStart, selectionEnd);
rangeAndText = Promise.resolve(Pair.create(textRange, editor.getDocument().getText(textRange)));
} else {
XDebuggerEvaluator evaluator = session.getDebugProcess().getEvaluator();
if (evaluator != null) {
Promise<ExpressionInfo> expressionInfoPromise = evaluator.getExpressionInfoAtOffsetAsync(session.getProject(), editor.getDocument(), selectionStart, true);
rangeAndText = expressionInfoPromise.then(expressionInfo -> {
if (expressionInfo == null) {
return null;
}
return Pair.create(expressionInfo.getTextRange(), XDebuggerEvaluateActionHandler.getExpressionText(expressionInfo, editor.getDocument()));
});
} else {
return;
}
}
rangeAndText.done(textRangeStringPair -> {
ApplicationManager.getApplication().invokeLater(() -> {
TextRange range = textRangeStringPair.getFirst();
String text = textRangeStringPair.getSecond();
if (text == null)
return;
ConsoleExecuteAction action = getConsoleExecuteAction(session);
if (action != null) {
action.execute(range, text, (EditorEx) editor);
}
});
});
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class EditBreakpointActionHandler method editBreakpoint.
public void editBreakpoint(@NotNull Project project, @NotNull Editor editor, @NotNull Object breakpoint, @NotNull GutterIconRenderer breakpointGutterRenderer) {
if (BreakpointsDialogFactory.getInstance(project).isBreakpointPopupShowing())
return;
EditorGutterComponentEx gutterComponent = ((EditorEx) editor).getGutterComponentEx();
Point point = gutterComponent.getCenterPoint(breakpointGutterRenderer);
if (point != null) {
doShowPopup(project, gutterComponent, point, breakpoint);
}
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class MultilinePopupBuilder method createTextField.
@NotNull
private static EditorTextField createTextField(@NotNull Project project, Collection<String> values, boolean supportsNegativeValues, @NotNull String initialValue) {
TextFieldWithCompletion textField = new TextFieldWithCompletion(project, new MyCompletionProvider(values, supportsNegativeValues), initialValue, false, true, false) {
@Override
protected EditorEx createEditor() {
EditorEx editor = super.createEditor();
SoftWrapsEditorCustomization.ENABLED.customize(editor);
return editor;
}
};
textField.setBorder(new CompoundBorder(JBUI.Borders.empty(2), textField.getBorder()));
return textField;
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class TextViewer method createEditor.
@Override
protected EditorEx createEditor() {
final EditorEx editor = super.createEditor();
editor.setHorizontalScrollbarVisible(true);
editor.setCaretEnabled(true);
editor.getScrollPane().setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
editor.setEmbeddedIntoDialogWrapper(myEmbeddedIntoDialogWrapper);
editor.getComponent().setPreferredSize(null);
editor.getSettings().setUseSoftWraps(true);
editor.setColorsScheme(DebuggerUIUtil.getColorScheme());
return editor;
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class TextEditorHolder method create.
//
// Build
//
@NotNull
public static TextEditorHolder create(@Nullable Project project, @NotNull DocumentContent content) {
EditorEx editor = DiffUtil.createEditor(content.getDocument(), project, false, true);
DiffUtil.configureEditor(editor, content, project);
return new TextEditorHolder(project, editor);
}
Aggregations