Java Code Examples for com.intellij.testFramework.LightVirtualFile#setWritable()
The following examples show how to use
com.intellij.testFramework.LightVirtualFile#setWritable() .
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: DiffContentFactoryImpl.java From consulo with Apache License 2.0 | 6 votes |
@Nullable private static Document createPsiDocument(@Nonnull Project project, @Nonnull String content, @Nonnull FileType fileType, @Nonnull String fileName, boolean readOnly) { ThrowableComputable<Document,RuntimeException> action = () -> { LightVirtualFile file = new LightVirtualFile(fileName, fileType, content); file.setWritable(!readOnly); file.putUserData(DiffPsiFileSupport.KEY, true); Document document = FileDocumentManager.getInstance().getDocument(file); if (document == null) return null; PsiDocumentManager.getInstance(project).getPsiFile(document); return document; }; return AccessRule.read(action); }
Example 2
Source File: ObservatoryFile.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Nullable private static LightVirtualFile createSnapshot(@NotNull Script script) { // LightVirtualFiles have no parent directory, so just use the filename. final String filename = PathUtil.getFileName(script.getUri()); final String scriptSource = script.getSource(); if (scriptSource == null) { return null; } final LightVirtualFile snapshot = new LightVirtualFile(filename, DartFileType.INSTANCE, scriptSource); snapshot.setWritable(false); return snapshot; }
Example 3
Source File: ObservatoryFile.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Nullable private static LightVirtualFile createSnapshot(@NotNull Script script) { // LightVirtualFiles have no parent directory, so just use the filename. final String filename = PathUtil.getFileName(script.getUri()); final String scriptSource = script.getSource(); if (scriptSource == null) { return null; } final LightVirtualFile snapshot = new LightVirtualFile(filename, DartFileType.INSTANCE, scriptSource); snapshot.setWritable(false); return snapshot; }