com.intellij.openapi.editor.EditorFactory Java Examples
The following examples show how to use
com.intellij.openapi.editor.EditorFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CodeFoldingManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
private void initFolding(@Nonnull final Editor editor) { final Document document = editor.getDocument(); editor.getFoldingModel().runBatchFoldingOperation(() -> { DocumentFoldingInfo documentFoldingInfo = getDocumentFoldingInfo(document); Editor[] editors = EditorFactory.getInstance().getEditors(document, myProject); for (Editor otherEditor : editors) { if (otherEditor == editor || !isFoldingsInitializedInEditor(otherEditor)) continue; documentFoldingInfo.loadFromEditor(otherEditor); break; } documentFoldingInfo.setToEditor(editor); documentFoldingInfo.clear(); editor.putUserData(FOLDING_STATE_KEY, Boolean.TRUE); }); }
Example #2
Source File: TestEditorManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public void closeFile(@Nonnull final VirtualFile file) { Editor editor = myVirtualFile2Editor.remove(file); if (editor != null){ TextEditorProvider editorProvider = TextEditorProvider.getInstance(); editorProvider.disposeEditor(editorProvider.getTextEditor(editor)); EditorFactory.getInstance().releaseEditor(editor); } if (Comparing.equal(file, myActiveFile)) { myActiveFile = null; } modifyTabWell(new Runnable() { @Override public void run() { myTestEditorSplitter.closeFile(file); } }); }
Example #3
Source File: ParameterNameHintsConfigurable.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull private static EditorTextField createEditorField(@Nonnull String text, @Nullable TextRange rangeToSelect) { Document document = EditorFactory.getInstance().createDocument(text); EditorTextField field = new EditorTextField(document, null, PlainTextFileType.INSTANCE, false, false); field.setPreferredSize(new Dimension(200, 350)); field.addSettingsProvider(editor -> { editor.setVerticalScrollbarVisible(true); editor.setHorizontalScrollbarVisible(true); editor.getSettings().setAdditionalLinesCount(2); if (rangeToSelect != null) { editor.getCaretModel().moveToOffset(rangeToSelect.getStartOffset()); editor.getScrollingModel().scrollVertically(document.getTextLength() - 1); editor.getSelectionModel().setSelection(rangeToSelect.getStartOffset(), rangeToSelect.getEndOffset()); } }); return field; }
Example #4
Source File: PromptConsole.java From reasonml-idea-plugin with MIT License | 6 votes |
PromptConsole(@NotNull Project project, ConsoleViewImpl consoleView) { m_consoleView = consoleView; EditorFactory editorFactory = EditorFactory.getInstance(); PsiFileFactory fileFactory = PsiFileFactory.getInstance(project); Document outputDocument = ((EditorFactoryImpl) editorFactory).createDocument(true); UndoUtil.disableUndoFor(outputDocument); m_outputEditor = (EditorImpl) editorFactory.createViewer(outputDocument, project, CONSOLE); PsiFile file = fileFactory.createFileFromText("PromptConsoleDocument.ml", OclLanguage.INSTANCE, ""); Document promptDocument = file.getViewProvider().getDocument(); m_promptEditor = (EditorImpl) editorFactory.createEditor(promptDocument, project, CONSOLE); setupOutputEditor(); setupPromptEditor(); m_consoleView.print("(* ctrl+enter to send a command, ctrl+up/down to cycle through history *)\r\n", USER_INPUT); m_mainPanel.add(m_outputEditor.getComponent(), BorderLayout.CENTER); m_mainPanel.add(m_promptEditor.getComponent(), BorderLayout.SOUTH); }
Example #5
Source File: ContentChooser.java From consulo with Apache License 2.0 | 6 votes |
private void updateViewerForSelection() { if (myAllContents.isEmpty()) return; String fullString = getSelectedText(); if (myViewer != null) { EditorFactory.getInstance().releaseEditor(myViewer); } if (myUseIdeaEditor) { myViewer = createIdeaEditor(fullString); JComponent component = myViewer.getComponent(); component.setPreferredSize(new Dimension(300, 500)); mySplitter.setSecondComponent(component); } else { final JTextArea textArea = new JTextArea(fullString); textArea.setRows(3); textArea.setWrapStyleWord(true); textArea.setLineWrap(true); textArea.setSelectionStart(0); textArea.setSelectionEnd(textArea.getText().length()); textArea.setEditable(false); mySplitter.setSecondComponent(ScrollPaneFactory.createScrollPane(textArea)); } mySplitter.revalidate(); }
Example #6
Source File: BinaryContent.java From consulo with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings({"EmptyCatchBlock"}) @Nullable public Document getDocument() { if (myDocument == null) { if (isBinary()) return null; String text = null; try { Charset charset = ObjectUtil .notNull(myCharset, EncodingProjectManager.getInstance(myProject).getDefaultCharset()); text = CharsetToolkit.bytesToString(myBytes, charset); } catch (IllegalCharsetNameException e) { } // Still NULL? only if not supported or an exception was thrown. // Decode a string using the truly default encoding. if (text == null) text = new String(myBytes); text = LineTokenizer.correctLineSeparators(text); myDocument = EditorFactory.getInstance().createDocument(text); myDocument.setReadOnly(true); } return myDocument; }
Example #7
Source File: TemplateEditorUtil.java From consulo with Apache License 2.0 | 6 votes |
private static Editor createEditor(boolean isReadOnly, final Document document, final Project project) { EditorFactory editorFactory = EditorFactory.getInstance(); Editor editor = (isReadOnly ? editorFactory.createViewer(document, project) : editorFactory.createEditor(document, project)); EditorSettings editorSettings = editor.getSettings(); editorSettings.setVirtualSpace(false); editorSettings.setLineMarkerAreaShown(false); editorSettings.setIndentGuidesShown(false); editorSettings.setLineNumbersShown(false); editorSettings.setFoldingOutlineShown(false); EditorColorsScheme scheme = editor.getColorsScheme(); scheme.setColor(EditorColors.CARET_ROW_COLOR, null); VirtualFile file = FileDocumentManager.getInstance().getFile(document); if (file != null) { EditorHighlighter highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(file, scheme, project); ((EditorEx) editor).setHighlighter(highlighter); } return editor; }
Example #8
Source File: NewClassDialog.java From json2java4idea with Apache License 2.0 | 6 votes |
private void createUIComponents() { final EditorFactory editorFactory = EditorFactory.getInstance(); jsonDocument = editorFactory.createDocument(EMPTY_TEXT); jsonEditor = editorFactory.createEditor(jsonDocument, project, JsonFileType.INSTANCE, false); final EditorSettings settings = jsonEditor.getSettings(); settings.setWhitespacesShown(true); settings.setLineMarkerAreaShown(false); settings.setIndentGuidesShown(false); settings.setLineNumbersShown(true); settings.setFoldingOutlineShown(false); settings.setRightMarginShown(false); settings.setVirtualSpace(false); settings.setWheelFontChangeEnabled(false); settings.setUseSoftWraps(false); settings.setAdditionalColumnsCount(0); settings.setAdditionalLinesCount(1); final EditorColorsScheme colorsScheme = jsonEditor.getColorsScheme(); colorsScheme.setColor(EditorColors.CARET_ROW_COLOR, null); jsonEditor.getContentComponent().setFocusable(true); jsonPanel = (JPanel) jsonEditor.getComponent(); }
Example #9
Source File: DocumentWindowImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public int injectedToHost(int offset) { int offsetInLeftFragment = injectedToHost(offset, true, false); int offsetInRightFragment = injectedToHost(offset, false, false); if (offsetInLeftFragment == offsetInRightFragment) return offsetInLeftFragment; // heuristics: return offset closest to the caret Editor[] editors = EditorFactory.getInstance().getEditors(getDelegate()); Editor editor = editors.length == 0 ? null : editors[0]; if (editor != null) { if (editor instanceof EditorWindow) editor = ((EditorWindow)editor).getDelegate(); int caret = editor.getCaretModel().getOffset(); return Math.abs(caret - offsetInLeftFragment) < Math.abs(caret - offsetInRightFragment) ? offsetInLeftFragment : offsetInRightFragment; } return offsetInLeftFragment; }
Example #10
Source File: LafManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
private static void fireUpdate() { UISettings.getInstance().fireUISettingsChanged(); EditorFactory.getInstance().refreshAllEditors(); Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); for (Project openProject : openProjects) { FileStatusManager.getInstance(openProject).fileStatusesChanged(); DaemonCodeAnalyzer.getInstance(openProject).restart(); } for (IdeFrame frame : WindowManagerEx.getInstanceEx().getAllProjectFrames()) { if (frame instanceof IdeFrameEx) { ((IdeFrameEx)frame).updateView(); } } ActionToolbarImpl.updateAllToolbarsImmediately(); }
Example #11
Source File: EditorPositionService.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
public EditorPositionService(Project project) { super(project); eventMulticaster = EditorFactory.getInstance().getEventMulticaster(); visibleAreaListener = (VisibleAreaEvent event) -> { invokeAll(listener -> listener.updateVisibleArea(event.getNewRectangle()), event.getEditor()); }; eventMulticaster.addVisibleAreaListener(visibleAreaListener); eventMulticaster.addCaretListener(new CaretListener() { @Override public void caretPositionChanged(@NotNull CaretEvent e) { invokeAll(listener -> listener.updateSelected(e.getCaret()), e.getEditor()); } }, this); // TODO(jacobr): listen for when editors are disposed? }
Example #12
Source File: WakaTime.java From jetbrains-wakatime with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void setupEventListeners() { ApplicationManager.getApplication().invokeLater(new Runnable(){ public void run() { // save file MessageBus bus = ApplicationManager.getApplication().getMessageBus(); connection = bus.connect(); connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new CustomSaveListener()); // edit document EditorFactory.getInstance().getEventMulticaster().addDocumentListener(new CustomDocumentListener()); // mouse press EditorFactory.getInstance().getEventMulticaster().addEditorMouseListener(new CustomEditorMouseListener()); // scroll document EditorFactory.getInstance().getEventMulticaster().addVisibleAreaListener(new CustomVisibleAreaListener()); } }); }
Example #13
Source File: TogglePresentationModeAction.java From consulo with Apache License 2.0 | 6 votes |
private static void tweakEditorAndFireUpdateUI(UISettings settings, boolean inPresentation) { EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme(); int fontSize = inPresentation ? settings.PRESENTATION_MODE_FONT_SIZE : globalScheme.getEditorFontSize(); if (inPresentation) { ourSavedConsoleFontSize = globalScheme.getConsoleFontSize(); globalScheme.setConsoleFontSize(fontSize); } else { globalScheme.setConsoleFontSize(ourSavedConsoleFontSize); } for (Editor editor : EditorFactory.getInstance().getAllEditors()) { if (editor instanceof EditorEx) { ((EditorEx)editor).setFontSize(fontSize); } } UISettings.getInstance().fireUISettingsChanged(); LafManager.getInstance().updateUI(); EditorUtil.reinitSettings(); }
Example #14
Source File: Inspect.java From neovim-intellij-complete with MIT License | 6 votes |
/** * Invokes action in intentionActionDescriptor on file found in path and writes the file to disk. * * @param path * @param fileContent * @param intentionActionDescriptor * @return */ public static String doFix(String path, @Nullable String fileContent, HighlightInfo.IntentionActionDescriptor intentionActionDescriptor) { UIUtil.invokeAndWaitIfNeeded((Runnable)() -> { PsiFile psiFile = EmbeditorUtil.findTargetFile(path); Project project = psiFile.getProject(); PsiFile fileCopy = fileContent != null ? EmbeditorUtil.createDummyPsiFile(project, fileContent, psiFile) : EmbeditorUtil.createDummyPsiFile(project, psiFile.getText(), psiFile); VirtualFile targetVirtualFile = psiFile.getVirtualFile(); Document document = fileCopy.getViewProvider().getDocument(); Editor editor = EditorFactory.getInstance().createEditor(document, project, targetVirtualFile, false); intentionActionDescriptor.getAction().invoke(project, editor, fileCopy); FileDocumentManager.getInstance().saveDocument(psiFile.getViewProvider().getDocument()); }); return null; }
Example #15
Source File: ExportToFileUtil.java From consulo with Apache License 2.0 | 6 votes |
@Override protected JComponent createCenterPanel() { final Document document = ((EditorFactoryImpl)EditorFactory.getInstance()).createDocument(true); ((DocumentImpl)document).setAcceptSlashR(true); myTextArea = EditorFactory.getInstance().createEditor(document, myProject, PlainTextFileType.INSTANCE, true); final EditorSettings settings = myTextArea.getSettings(); settings.setLineNumbersShown(false); settings.setLineMarkerAreaShown(false); settings.setFoldingOutlineShown(false); settings.setRightMarginShown(false); settings.setAdditionalLinesCount(0); settings.setAdditionalColumnsCount(0); settings.setAdditionalPageAtBottom(false); ((EditorEx)myTextArea).setBackgroundColor(UIUtil.getInactiveTextFieldBackgroundColor()); return myTextArea.getComponent(); }
Example #16
Source File: PowerMode.java From power-mode-intellij-plugin with Apache License 2.0 | 6 votes |
@Override public void initComponent() { final EditorActionManager editorActionManager = EditorActionManager.getInstance(); final EditorFactory editorFactory = EditorFactory.getInstance(); particleContainerManager = new ParticleContainerManager(); editorFactory.addEditorFactoryListener(particleContainerManager, new Disposable() { @Override public void dispose() { } }); final TypedAction typedAction = editorActionManager.getTypedAction(); final TypedActionHandler rawHandler = typedAction.getRawHandler(); typedAction.setupRawHandler(new TypedActionHandler() { @Override public void execute(@NotNull final Editor editor, final char c, @NotNull final DataContext dataContext) { updateEditor(editor); rawHandler.execute(editor, c, dataContext); } }); }
Example #17
Source File: IntellijLanguageClient.java From lsp4intellij with Apache License 2.0 | 6 votes |
@Override public void initComponent() { try { // Adds project listener. ApplicationManager.getApplication().getMessageBus().connect().subscribe(ProjectManager.TOPIC, new LSPProjectManagerListener()); // Adds editor listener. EditorFactory.getInstance().addEditorFactoryListener(new LSPEditorListener(), this); // Adds VFS listener. VirtualFileManager.getInstance().addVirtualFileListener(new VFSListener()); // Adds document event listener. ApplicationManager.getApplication().getMessageBus().connect().subscribe(AppTopics.FILE_DOCUMENT_SYNC, new LSPFileDocumentManagerListener()); // in case if JVM forcefully exit. Runtime.getRuntime().addShutdownHook(new Thread(() -> projectToLanguageWrappers.values().stream() .flatMap(Collection::stream).filter(RUNNING).forEach(s -> s.stop(true)))); LOG.info("Intellij Language Client initialized successfully"); } catch (Exception e) { LOG.warn("Fatal error occurred when initializing Intellij language client.", e); } }
Example #18
Source File: LineStatusTrackerManager.java From consulo with Apache License 2.0 | 6 votes |
@Override public void projectOpened() { StartupManager.getInstance(myProject).registerPreStartupActivity(new Runnable() { @Override public void run() { final MyFileStatusListener fileStatusListener = new MyFileStatusListener(); final EditorFactoryListener editorFactoryListener = new MyEditorFactoryListener(); final MyVirtualFileListener virtualFileListener = new MyVirtualFileListener(); final FileStatusManager fsManager = FileStatusManager.getInstance(myProject); fsManager.addFileStatusListener(fileStatusListener, myDisposable); final EditorFactory editorFactory = EditorFactory.getInstance(); editorFactory.addEditorFactoryListener(editorFactoryListener, myDisposable); final VirtualFileManager virtualFileManager = VirtualFileManager.getInstance(); virtualFileManager.addVirtualFileListener(virtualFileListener, myDisposable); } }); }
Example #19
Source File: CreateUserTemplateAction.java From idea-gitignore with MIT License | 6 votes |
/** * Handles an action of adding new template. * Ignores action if selected file is not a {@link IgnoreFile} instance, otherwise shows GeneratorDialog. * * @param e action event */ @Override public void actionPerformed(@NotNull AnActionEvent e) { final Project project = e.getData(CommonDataKeys.PROJECT); final PsiFile file = e.getData(CommonDataKeys.PSI_FILE); if (project == null || !(file instanceof IgnoreFile)) { return; } String content = file.getText(); Document document = file.getViewProvider().getDocument(); if (document != null) { Editor[] editors = EditorFactory.getInstance().getEditors(document); if (editors.length > 0) { String selectedText = editors[0].getSelectionModel().getSelectedText(); if (!StringUtil.isEmpty(selectedText)) { content = selectedText; } } } new UserTemplateDialog(project, content).show(); }
Example #20
Source File: PsiDocumentManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
public PsiDocumentManagerImpl(@Nonnull Project project, @Nonnull DocumentCommitProcessor documentCommitProcessor) { super(project, documentCommitProcessor); EditorFactory.getInstance().getEventMulticaster().addDocumentListener(this, this); ((EditorEventMulticasterImpl)EditorFactory.getInstance().getEventMulticaster()).addPrioritizedDocumentListener(new PriorityEventCollector(), this); MessageBusConnection connection = project.getMessageBus().connect(this); connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerListener() { @Override public void fileContentLoaded(@Nonnull final VirtualFile virtualFile, @Nonnull Document document) { PsiFile psiFile = ReadAction.compute(() -> myProject.isDisposed() || !virtualFile.isValid() ? null : getCachedPsiFile(virtualFile)); fireDocumentCreated(document, psiFile); } }); Disposer.register(this, () -> ((DocumentCommitThread)myDocumentCommitProcessor).cancelTasksOnProjectDispose(project)); }
Example #21
Source File: TemplateEditorUtil.java From consulo with Apache License 2.0 | 5 votes |
private static Document createDocument(CharSequence text, @Nullable Map<TemplateContextType, Boolean> context, Project project) { if (context != null) { for (Map.Entry<TemplateContextType, Boolean> entry : context.entrySet()) { if (entry.getValue()) { return entry.getKey().createDocument(text, project); } } } return EditorFactory.getInstance().createDocument(text); }
Example #22
Source File: QueryPanel.java From nosql4idea with Apache License 2.0 | 5 votes |
protected 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; }
Example #23
Source File: CoverageDataManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public void projectOpened() { EditorFactory.getInstance().addEditorFactoryListener(new CoverageEditorFactoryListener(), myProject); ProjectManagerAdapter projectManagerListener = new ProjectManagerAdapter() { @Override public void projectClosing(Project project) { synchronized (myLock) { myIsProjectClosing = true; } } }; ProjectManager.getInstance().addProjectManagerListener(myProject, projectManagerListener); }
Example #24
Source File: TemplateConfigurable.java From android-codegenerator-plugin-intellij with Apache License 2.0 | 5 votes |
@Override public void disposeUIResources() { if (editor != null) { EditorFactory.getInstance().releaseEditor(editor); editor = null; } templateSettings = null; }
Example #25
Source File: BackgroundChibiCharaPlugin.java From intellij-background-chibichara with MIT License | 5 votes |
@Override public void initComponent() { applicationSettings = ServiceManager.getService(BackgroundChibiCharaApplicationSettings.class); BackgroundChibiCharaSettings settings = applicationSettings.getState(); backgroundListener = new EditorBackgroundListener(settings); applicationSettings.addSettingChangeListener(backgroundListener); EditorFactory.getInstance().addEditorFactoryListener(backgroundListener, new Disposable() { @Override public void dispose() { } }); }
Example #26
Source File: JumpToAttachPointAction.java From needsmoredojo with Apache License 2.0 | 5 votes |
private void jumpToElementInTemplate(PsiFile templateFile, PsiElement sourceElement) { if(!AMDValidator.elementIsAttachPoint(sourceElement)) { Notifications.Bus.notify(new Notification("needsmoredojo", "Jump To Attach Point", "Element is not an attach point or is in an invalid statement with an attach point: '" + sourceElement.getText() + "'", NotificationType.INFORMATION)); return; } FileEditorManager.getInstance(templateFile.getProject()).openFile(templateFile.getVirtualFile(), true, true); Editor editor = EditorFactory.getInstance().getEditors(PsiDocumentManager.getInstance(templateFile.getProject()).getDocument(templateFile))[0]; PsiElement templateElement = TemplatedWidgetUtil.getAttachPointElementInHtmlFile(sourceElement, templateFile); if(templateElement == null) { Notifications.Bus.notify(new Notification("needsmoredojo", "Jump To Attach Point", "Attach point not found in " + templateFile.getVirtualFile().getName() + ": '" + sourceElement.getText() + "'", NotificationType.INFORMATION)); } int index = templateElement.getTextOffset(); editor.getCaretModel().moveToOffset(index); editor.getScrollingModel().scrollToCaret(ScrollType.CENTER); List<PsiElement> elementsToHighlight = new ArrayList<PsiElement>(); elementsToHighlight.add(templateElement); if(templateElement.getNextSibling() != null) { elementsToHighlight.add(templateElement.getNextSibling()); if(templateElement.getNextSibling().getNextSibling() != null) { elementsToHighlight.add(templateElement.getNextSibling().getNextSibling()); } } HighlightingUtil.highlightElement(editor, templateFile.getProject(), elementsToHighlight.toArray(new PsiElement[0])); }
Example #27
Source File: WindowEditorOps.java From KodeBeagle with Apache License 2.0 | 5 votes |
public final void releaseEditor(final Project project, final Editor editor) { if (editor != null) { Disposer.register(project, new Disposable() { public void dispose() { EditorFactory.getInstance().releaseEditor(editor); } }); } }
Example #28
Source File: FileDocumentManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private static Document createDocument(@Nonnull CharSequence text, @Nonnull VirtualFile file) { boolean acceptSlashR = file instanceof LightVirtualFile && StringUtil.indexOf(text, '\r') >= 0; boolean freeThreaded = Boolean.TRUE.equals(file.getUserData(AbstractFileViewProvider.FREE_THREADED)); DocumentImpl document = (DocumentImpl)((EditorFactoryImpl)EditorFactory.getInstance()).createDocument(text, acceptSlashR, freeThreaded); document.documentCreatedFrom(file); return document; }
Example #29
Source File: FragmentContent.java From consulo with Apache License 2.0 | 5 votes |
@Override protected Document createCopy() { final Document originalDocument = myRangeMarker.getDocument(); String textInRange = originalDocument.getCharsSequence().subSequence(myRangeMarker.getStartOffset(), myRangeMarker.getEndOffset()).toString(); final Document result = EditorFactory.getInstance().createDocument(textInRange); result.setReadOnly(!originalDocument.isWritable()); result.putUserData(ORIGINAL_DOCUMENT, originalDocument); return result; }
Example #30
Source File: DiffUtil.java From consulo with Apache License 2.0 | 5 votes |
public static EditorEx createEditor(Document document, Project project, boolean isViewer, @Nullable FileType fileType) { EditorFactory factory = EditorFactory.getInstance(); EditorEx editor = (EditorEx)(isViewer ? factory.createViewer(document, project) : factory.createEditor(document, project)); editor.putUserData(DiffManagerImpl.EDITOR_IS_DIFF_KEY, Boolean.TRUE); editor.getGutterComponentEx().revalidateMarkup(); if (fileType != null && project != null && !project.isDisposed()) { CodeStyleFacade codeStyleFacade = CodeStyleFacade.getInstance(project); editor.getSettings().setTabSize(codeStyleFacade.getTabSize(fileType)); editor.getSettings().setUseTabCharacter(codeStyleFacade.useTabCharacter(fileType)); } return editor; }