use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class EditorTextField method setDocument.
public void setDocument(Document document) {
if (myDocument != null) {
uninstallDocumentListener(true);
}
myDocument = document;
installDocumentListener();
if (myEditor != null) {
//MainWatchPanel watches the oldEditor's focus in order to remove debugger combobox when focus is lost
//we should first transfer focus to new oldEditor and only then remove current oldEditor
//MainWatchPanel check that oldEditor.getParent == newEditor.getParent and does not remove oldEditor in such cases
boolean isFocused = isFocusOwner();
EditorEx newEditor = createEditor();
releaseEditor(myEditor);
myEditor = newEditor;
add(myEditor.getComponent(), BorderLayout.CENTER);
validate();
if (isFocused) {
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
IdeFocusManager.getGlobalInstance().requestFocus(newEditor.getContentComponent(), true);
});
}
}
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class EditorTextField method releaseEditorLater.
void releaseEditorLater() {
// releasing an editor implies removing it from a component hierarchy
// invokeLater is required because releaseEditor() may be called from
// removeNotify(), so we need to let swing complete its removeNotify() chain
// and only then execute another removal from the hierarchy. Otherwise
// swing goes nuts because of nested removals and indices get corrupted
EditorEx editor = myEditor;
ApplicationManager.getApplication().invokeLater(() -> releaseEditor(editor));
myEditor = null;
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class ComboboxEditorTextField method createEditor.
@Override
protected EditorEx createEditor() {
final EditorEx result = super.createEditor();
result.addFocusListener(new FocusChangeListener() {
@Override
public void focusGained(Editor editor) {
repaintComboBox();
}
@Override
public void focusLost(Editor editor) {
repaintComboBox();
}
});
return result;
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class ApplyPatchChange method createOperation.
@Nullable
private MyGutterOperation createOperation(@NotNull OperationType type) {
if (isResolved())
return null;
EditorEx editor = myViewer.getPatchEditor();
Document document = editor.getDocument();
int line = getPatchRange().start;
int offset = line == DiffUtil.getLineCount(document) ? document.getTextLength() : document.getLineStartOffset(line);
RangeHighlighter highlighter = editor.getMarkupModel().addRangeHighlighter(offset, offset, HighlighterLayer.ADDITIONAL_SYNTAX, null, HighlighterTargetArea.LINES_IN_RANGE);
return new MyGutterOperation(highlighter, type);
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class ApplyPatchChange method createPatchHighlighters.
private void createPatchHighlighters() {
EditorEx patchEditor = myViewer.getPatchEditor();
myHighlighters.addAll(DiffDrawUtil.createUnifiedChunkHighlighters(patchEditor, myPatchDeletionRange, myPatchInsertionRange, myPatchInnerDifferences));
}
Aggregations