Java Code Examples for com.intellij.util.FileContentUtilCore#reparseFiles()
The following examples show how to use
com.intellij.util.FileContentUtilCore#reparseFiles() .
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: CsvChangeSeparatorAction.java From intellij-csv-validator with Apache License 2.0 | 6 votes |
@Override public void setSelected(@NotNull AnActionEvent anActionEvent, boolean selected) { PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE); if (psiFile == null) { return; } Language language = psiFile.getLanguage(); if (!language.isKindOf(CsvLanguage.INSTANCE) || language instanceof CsvSeparatorHolder) { return; } CsvFileAttributes csvFileAttributes = ServiceManager.getService(psiFile.getProject(), CsvFileAttributes.class); csvFileAttributes.setFileSeparator(psiFile, this.mySeparator); FileContentUtilCore.reparseFiles(psiFile.getVirtualFile()); FileEditor fileEditor = anActionEvent.getData(PlatformDataKeys.FILE_EDITOR); if (fileEditor != null) { fileEditor.selectNotify(); } }
Example 2
Source File: WeaveEditor.java From mule-intellij-plugins with Apache License 2.0 | 6 votes |
private void updateTab(@NotNull JBTabsPaneImpl tabsPane, int index, WeaveIdentifier identifier, @NotNull WeaveDataType dataType) { Icon icon = iconsMap.containsKey(dataType.getText()) ? iconsMap.get(dataType.getText()) : AllIcons.FileTypes.Any_type; String title = (identifier == null ? "output" : identifier.getName()); tabsPane.setTitleAt(index, title); tabsPane.setIconAt(index, icon); contentTypes.put(title, dataType.getText()); VirtualFile vfile = inputOutputFiles.get(title); if (vfile != null) { vfile.putUserData(newFileDataTypeKey, dataType.getText()); FileContentUtilCore.reparseFiles(vfile); } Editor oldEditor = editors.get(title); FileType newType = fileTypes.containsKey(dataType.getText()) ? fileTypes.get(dataType.getText()) : FileTypes.UNKNOWN; ((EditorEx) oldEditor).setHighlighter(EditorHighlighterFactory.getInstance().createEditorHighlighter(project, newType)); }
Example 3
Source File: CsvChangeEscapeCharacterAction.java From intellij-csv-validator with Apache License 2.0 | 5 votes |
@Override public void setSelected(@NotNull AnActionEvent anActionEvent, boolean selected) { PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE); if (psiFile == null) { return; } CsvFileAttributes.getInstance(psiFile.getProject()).setEscapeCharacter(psiFile, this.myEscapeCharacter); FileContentUtilCore.reparseFiles(psiFile.getVirtualFile()); FileEditor fileEditor = anActionEvent.getData(PlatformDataKeys.FILE_EDITOR); if (fileEditor != null) { fileEditor.selectNotify(); } }
Example 4
Source File: CsvDefaultSeparatorAction.java From intellij-csv-validator with Apache License 2.0 | 5 votes |
@Override public void setSelected(@NotNull AnActionEvent anActionEvent, boolean selected) { PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE); if (psiFile == null) { return; } CsvFileAttributes.getInstance(psiFile.getProject()).resetValueSeparator(psiFile); FileContentUtilCore.reparseFiles(psiFile.getVirtualFile()); FileEditor fileEditor = anActionEvent.getData(PlatformDataKeys.FILE_EDITOR); if (fileEditor != null) { fileEditor.selectNotify(); } }
Example 5
Source File: CsvDefaultEscapeCharacterAction.java From intellij-csv-validator with Apache License 2.0 | 5 votes |
@Override public void setSelected(@NotNull AnActionEvent anActionEvent, boolean selected) { PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE); if (psiFile == null) { return; } CsvFileAttributes.getInstance(psiFile.getProject()).resetEscapeSeparator(psiFile); FileContentUtilCore.reparseFiles(psiFile.getVirtualFile()); FileEditor fileEditor = anActionEvent.getData(PlatformDataKeys.FILE_EDITOR); if (fileEditor != null) { fileEditor.selectNotify(); } }
Example 6
Source File: CsvCustomSeparatorAction.java From intellij-csv-validator with Apache License 2.0 | 5 votes |
@Override public void setSelected(@NotNull AnActionEvent anActionEvent, boolean selected) { PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE); if (psiFile == null) { return; } FileEditor fileEditor = anActionEvent.getData(PlatformDataKeys.FILE_EDITOR); CsvValueSeparator currentSeparator = CsvHelper.getValueSeparator(psiFile); String customValueSeparator = JOptionPane.showInputDialog(fileEditor == null ? null : fileEditor.getComponent(), "Value separator", currentSeparator.getCharacter()); if (customValueSeparator == null) { return; } if (customValueSeparator.length() == 0 || customValueSeparator.contains(" ")) { JOptionPane.showMessageDialog(fileEditor == null ? null : fileEditor.getComponent(), "Value separator must have at least one character and no spaces!"); return; } CsvFileAttributes csvFileAttributes = ServiceManager.getService(psiFile.getProject(), CsvFileAttributes.class); csvFileAttributes.setFileSeparator(psiFile, new CsvValueSeparator(customValueSeparator)); FileContentUtilCore.reparseFiles(psiFile.getVirtualFile()); if (fileEditor != null) { fileEditor.selectNotify(); } }
Example 7
Source File: CsvFile.java From intellij-csv-validator with Apache License 2.0 | 5 votes |
@Override public void propertyChange(PropertyChangeEvent evt) { switch (evt.getPropertyName()) { case "defaultEscapeCharacter": case "defaultValueSeparator": FileContentUtilCore.reparseFiles(CsvFile.this.getVirtualFile()); break; default: // does not influence file break; } }
Example 8
Source File: LatteIndexUtil.java From intellij-latte with MIT License | 4 votes |
private static void reparseFiles(@NotNull Project project) { Collection<VirtualFile> virtualFiles = FileTypeIndex.getFiles(LatteFileType.INSTANCE, GlobalSearchScope.allScope(project)); FileContentUtilCore.reparseFiles(virtualFiles); //FileContentUtil.reparseFiles(project, virtualFiles, false); }