@Nonnull protected Editor createEditor(@Nullable Project project, Document document, VirtualFile file) { EditorEx editor = (EditorEx)EditorFactory.getInstance().createViewer(document, project); final EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme(); EditorHighlighter highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(file, scheme, project); editor.setFile(file); editor.setHighlighter(highlighter); EditorSettings settings = editor.getSettings(); settings.setAnimatedScrolling(false); settings.setRefrainFromScrolling(false); settings.setLineNumbersShown(true); settings.setFoldingOutlineShown(false); if (settings instanceof SettingsImpl) { ((SettingsImpl)settings).setSoftWrapAppliancePlace(SoftWrapAppliancePlaces.PREVIEW); } editor.getFoldingModel().setFoldingEnabled(false); return editor; }
protected void customizeEditorSettings(EditorSettings settings) { settings.setLineMarkerAreaShown(myIsEditor); settings.setFoldingOutlineShown(false); settings.setAdditionalColumnsCount(0); settings.setAdditionalLinesCount(0); settings.setAnimatedScrolling(false); if (settings instanceof SettingsImpl) { ((SettingsImpl)settings).setSoftWrapAppliancePlace(SoftWrapAppliancePlaces.PREVIEW); } }
@Override public void update(@Nonnull AnActionEvent e) { if (myGlobal) { Editor editor = getEditor(e); if (editor != null) { EditorSettings settings = editor.getSettings(); if (settings instanceof SettingsImpl && ((SettingsImpl)settings).getSoftWrapAppliancePlace() != myAppliancePlace) { e.getPresentation().setEnabledAndVisible(false); return; } } } super.update(e); }