本文整理了Java中com.intellij.openapi.editor.Editor.getSettings()
方法的一些代码示例,展示了Editor.getSettings()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Editor.getSettings()
方法的具体详情如下:
包路径:com.intellij.openapi.editor.Editor
类名称:Editor
方法名:getSettings
暂无
代码示例来源:origin: JetBrains/ideavim
private void setAnimatedScrolling(boolean isOn) {
Editor[] editors = EditorFactory.getInstance().getAllEditors();
for (Editor editor : editors) {
editor.getSettings().setAnimatedScrolling(isOn);
}
}
代码示例来源:origin: JetBrains/ideavim
private void setRefrainFromScrolling(boolean isOn) {
Editor[] editors = EditorFactory.getInstance().getAllEditors();
for (Editor editor : editors) {
editor.getSettings().setRefrainFromScrolling(isOn);
}
}
代码示例来源:origin: JetBrains/ideavim
@Override
public void editorReleased(@NotNull EditorFactoryEvent event) {
final Editor editor = event.getEditor();
deinitLineNumbers(editor);
EditorData.unInitializeEditor(editor);
VimPlugin.getKey().unregisterShortcutKeys(editor);
editor.getSettings().setAnimatedScrolling(isAnimatedScrolling);
editor.getSettings().setRefrainFromScrolling(isRefrainFromScrolling);
DocumentManager.getInstance().removeListeners(editor.getDocument());
}
}, ApplicationManager.getApplication());
代码示例来源:origin: JetBrains/ideavim
private void setCursors(boolean isBlock) {
Editor[] editors = EditorFactory.getInstance().getAllEditors();
for (Editor editor : editors) {
// Vim plugin should be turned on in insert mode
((EditorEx)editor).setInsertMode(true);
editor.getSettings().setBlockCursor(isBlock);
}
}
代码示例来源:origin: JetBrains/ideavim
private void initLineNumbers(@NotNull final Editor editor) {
editor.getCaretModel().addCaretListener(myLineNumbersCaretListener);
EditorData.setEditorGroup(editor, true);
final EditorSettings settings = editor.getSettings();
EditorData.setLineNumbersShown(editor, settings.isLineNumbersShown());
updateLineNumbers(editor);
}
代码示例来源:origin: JetBrains/ideavim
private static void resetCursor(@NotNull Editor editor, boolean insert) {
Document doc = editor.getDocument();
VirtualFile vf = FileDocumentManager.getInstance().getFile(doc);
if (vf != null) {
resetCursor(vf, editor.getProject(), insert);
}
else {
editor.getSettings().setBlockCursor(!insert);
}
}
代码示例来源:origin: JetBrains/ideavim
@Override
public void editorCreated(@NotNull EditorFactoryEvent event) {
final Editor editor = event.getEditor();
isBlockCursor = editor.getSettings().isBlockCursor();
isAnimatedScrolling = editor.getSettings().isAnimatedScrolling();
isRefrainFromScrolling = editor.getSettings().isRefrainFromScrolling();
EditorData.initializeEditor(editor);
DocumentManager.getInstance().addListeners(editor.getDocument());
VimPlugin.getKey().registerRequiredShortcutKeys(editor);
if (VimPlugin.isEnabled()) {
initLineNumbers(editor);
// Turn on insert mode if editor doesn't have any file
if (!EditorData.isFileEditor(editor) && editor.getDocument().isWritable() &&
!CommandState.inInsertMode(editor)) {
KeyHandler.getInstance().handleKey(editor, KeyStroke.getKeyStroke('i'), new EditorDataContext(editor));
}
editor.getSettings().setBlockCursor(!CommandState.inInsertMode(editor));
editor.getSettings().setAnimatedScrolling(ANIMATED_SCROLLING_VIM_VALUE);
editor.getSettings().setRefrainFromScrolling(REFRAIN_FROM_SCROLLING_VIM_VALUE);
}
}
代码示例来源:origin: JetBrains/ideavim
private static void resetCursor(@NotNull VirtualFile virtualFile, Project proj, boolean insert) {
logger.debug("resetCursor");
Document doc = FileDocumentManager.getInstance().getDocument(virtualFile);
if (doc == null) return; // Must be no text editor (such as image)
Editor[] editors = EditorFactory.getInstance().getEditors(doc, proj);
if (logger.isDebugEnabled()) {
logger.debug("There are " + editors.length + " editors for virtual file " + virtualFile.getName());
}
for (Editor editor : editors) {
editor.getSettings().setBlockCursor(!insert);
}
}
代码示例来源:origin: JetBrains/ideavim
private void deinitLineNumbers(@NotNull Editor editor) {
editor.getCaretModel().removeCaretListener(myLineNumbersCaretListener);
EditorData.setEditorGroup(editor, false);
editor.getGutter().closeAllAnnotations();
final Project project = editor.getProject();
if (project == null || project.isDisposed()) return;
editor.getSettings().setLineNumbersShown(EditorData.isLineNumbersShown(editor));
}
代码示例来源:origin: JetBrains/ideavim
private void updateLineNumbers(@NotNull Editor editor) {
if (!EditorData.isFileEditor(editor)) {
return;
}
final Options options = Options.getInstance();
final boolean relativeLineNumber = options.isSet(Options.RELATIVE_NUMBER);
final boolean lineNumber = options.isSet(Options.NUMBER);
final EditorSettings settings = editor.getSettings();
final boolean showEditorLineNumbers = (EditorData.isLineNumbersShown(editor) || lineNumber) && !relativeLineNumber;
if (settings.isLineNumbersShown() ^ showEditorLineNumbers) {
// Update line numbers later since it may be called from a caret listener
// on the caret move and it may move the caret internally
ApplicationManager.getApplication().invokeLater(() -> {
if (editor.isDisposed()) return;
settings.setLineNumbersShown(showEditorLineNumbers);
});
}
if (relativeLineNumber) {
final EditorGutter gutter = editor.getGutter();
gutter.closeAllAnnotations();
gutter.registerTextAnnotation(myLineNumbersGutterProvider);
}
}
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
if (editor.getSettings().isVariableInplaceRenameEnabled()) {
代码示例来源:origin: dboissier/mongo4idea
Editor createEditor() {
EditorFactory editorFactory = EditorFactory.getInstance();
Document editorDocument = editorFactory.createDocument("");
Editor editor = editorFactory.createEditor(editorDocument, project);
fillEditorSettings(editor.getSettings());
EditorEx editorEx = (EditorEx) editor;
attachHighlighter(editorEx);
return editor;
}
代码示例来源:origin: qeesung/HighlightBracketPair
public boolean isBlockCaret() {
return this.editor.getSettings().isBlockCursor();
}
}
代码示例来源:origin: qeesung/HighlightBracketPair
@Override
public void keyTyped(KeyEvent e) {
// compatible the vim insert mode
// will trigger the highlight from normal mode to insert at caret mode
if (e.getKeyChar() != VIM_INSERT_KEY ||
this.editor.getSettings().isBlockCursor())
return;
this.highlightEditorComponent.highlightEditorCurrentPair(this.editor);
}
代码示例来源:origin: Camelcade/Perl5-IDEA
@Override
protected boolean isAvailable(PsiElement element, @NotNull Editor editor, @NotNull PsiFile file) {
return
editor.getSettings().isVariableInplaceRenameEnabled()
&& element instanceof PsiNameIdentifierOwner
&& !(element instanceof PerlRenameUsagesHelper)
&& element.getUseScope() instanceof LocalSearchScope
&& element.getLanguage() == PerlLanguage.INSTANCE
&& ((PsiNameIdentifierOwner)element).getNameIdentifier() instanceof PerlStringContentElement
&& element.getContainingFile().getViewProvider().getAllFiles().size() < 2
;
}
}
代码示例来源:origin: SeeSharpSoft/intellij-csv-validator
@Override
public FileEditor build() {
TextEditor textEditor = (TextEditor) TextEditorProvider.getInstance().createEditor(project, virtualFile);
applySettings(textEditor.getEditor().getSettings(), CsvEditorSettingsExternalizable.getInstance());
return textEditor;
}
};
代码示例来源:origin: Camelcade/Perl5-IDEA
@Override
protected boolean isAvailable(PsiElement element, @NotNull Editor editor, @NotNull PsiFile file) {
PsiElement nameSuggestionContext = file.findElementAt(editor.getCaretModel().getOffset());
if (nameSuggestionContext == null && editor.getCaretModel().getOffset() > 0) {
nameSuggestionContext = file.findElementAt(editor.getCaretModel().getOffset() - 1);
}
if (element == null && LookupManager.getActiveLookup(editor) != null) {
element = PsiTreeUtil.getParentOfType(nameSuggestionContext, PsiNamedElement.class);
}
final RefactoringSupportProvider
supportProvider = element == null ? null : LanguageRefactoringSupport.INSTANCE.forLanguage(element.getLanguage());
return editor.getSettings().isVariableInplaceRenameEnabled()
&& supportProvider instanceof PerlRefactoringSupportProvider &&
((PerlRefactoringSupportProvider)supportProvider).isPerlInplaceRenameAvailable(element, nameSuggestionContext);
}
}
代码示例来源:origin: t28hub/json2java4idea
private void createUIComponents() {
final EditorFactory editorFactory = EditorFactory.getInstance();
previewDocument = editorFactory.createDocument(EMPTY_TEXT);
previewEditor = editorFactory.createEditor(previewDocument, null, JavaFileType.INSTANCE, true);
final EditorSettings settings = previewEditor.getSettings();
settings.setWhitespacesShown(true);
settings.setLineMarkerAreaShown(false);
settings.setIndentGuidesShown(false);
settings.setLineNumbersShown(false);
settings.setFoldingOutlineShown(false);
settings.setRightMarginShown(false);
settings.setVirtualSpace(false);
settings.setWheelFontChangeEnabled(false);
settings.setUseSoftWraps(false);
settings.setAdditionalColumnsCount(0);
settings.setAdditionalLinesCount(1);
previewPanel = (JPanel) previewEditor.getComponent();
previewPanel.setName(PREVIEW_PANEL_NAME);
previewPanel.setPreferredSize(new Dimension(PREFERRED_PREVIEW_WIDTH, PREFERRED_PREVIEW_HEIGHT));
}
}
代码示例来源:origin: SeeSharpSoft/intellij-csv-validator
public void testCsvEditorSettingsAreApplied() {
CsvEditorSettingsExternalizable csvEditorSettingsExternalizable = CsvEditorSettingsExternalizable.getInstance();
csvEditorSettingsExternalizable.setCaretRowShown(false);
csvEditorSettingsExternalizable.setUseSoftWraps(true);
TextEditor textEditor = getCurrentTextEditor();
EditorSettings editorSettings = textEditor.getEditor().getSettings();
assertEquals(csvEditorSettingsExternalizable.isCaretRowShown(), editorSettings.isCaretRowShown());
assertEquals(csvEditorSettingsExternalizable.isUseSoftWraps(), editorSettings.isUseSoftWraps());
disposeTextEditor(textEditor);
}
代码示例来源:origin: SeeSharpSoft/intellij-csv-validator
public void testCsvEditorIsTextEditorWithInitialCsvEditorSettings() {
FileEditorProvider[] fileEditorProviders = FileEditorProviderManager.getInstance().getProviders(myFixture.getProject(), myFixture.getFile().getVirtualFile());
FileEditor fileEditor = fileEditorProviders[0].createEditor(myFixture.getProject(), myFixture.getFile().getVirtualFile());
assertInstanceOf(fileEditor, TextEditor.class);
TextEditor textEditor = (TextEditor)fileEditor;
CsvEditorSettingsExternalizable csvEditorSettingsExternalizable = CsvEditorSettingsExternalizable.getInstance();
EditorSettings editorSettings = textEditor.getEditor().getSettings();
assertEquals(csvEditorSettingsExternalizable.isCaretRowShown(), editorSettings.isCaretRowShown());
assertEquals(csvEditorSettingsExternalizable.isUseSoftWraps(), editorSettings.isUseSoftWraps());
disposeTextEditor(textEditor);
}
内容来源于网络,如有侵权,请联系作者删除!