mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -57,6 +57,9 @@
|
||||
<item name='org.jdom.Element org.jdom.Element getChild(java.lang.String)'>
|
||||
<annotation name='org.jetbrains.annotations.Nullable'/>
|
||||
</item>
|
||||
<item name='org.jdom.Element org.jdom.Element setAttribute(java.lang.String, java.lang.String)'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='org.jdom.Element org.jdom.Element setAttribute(java.lang.String, java.lang.String) 0'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
|
||||
@@ -44,7 +44,8 @@ open class FileBasedStorage(file: Path,
|
||||
protected var lineSeparator: LineSeparator? = null
|
||||
protected var blockSavingTheContent = false
|
||||
|
||||
@Volatile var file = file
|
||||
@Volatile
|
||||
var file = file
|
||||
private set
|
||||
|
||||
init {
|
||||
@@ -99,7 +100,10 @@ open class FileBasedStorage(file: Path,
|
||||
deleteFile(storage.file, this, virtualFile)
|
||||
storage.cachedVirtualFile = null
|
||||
}
|
||||
else if (!isUseVfs) {
|
||||
else if (isUseVfs) {
|
||||
storage.cachedVirtualFile = writeFile(storage.file, this, virtualFile, dataWriter, lineSeparator, storage.isUseXmlProlog)
|
||||
}
|
||||
else {
|
||||
val file = storage.file
|
||||
LOG.debugOrInfoIfTestMode { "Save $file" }
|
||||
try {
|
||||
@@ -109,9 +113,6 @@ open class FileBasedStorage(file: Path,
|
||||
throw RuntimeException("Cannot write ${file}", e)
|
||||
}
|
||||
}
|
||||
else {
|
||||
storage.cachedVirtualFile = writeFile(storage.file, this, virtualFile, dataWriter, lineSeparator, storage.isUseXmlProlog)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +217,7 @@ internal fun writeFile(file: Path?,
|
||||
lineSeparator: LineSeparator,
|
||||
prependXmlProlog: Boolean): VirtualFile {
|
||||
val result = if (file != null && (virtualFile == null || !virtualFile.isValid)) {
|
||||
getOrCreateVirtualFile(requestor, file)
|
||||
getOrCreateVirtualFile(file, requestor)
|
||||
}
|
||||
else {
|
||||
virtualFile!!
|
||||
|
||||
@@ -116,7 +116,7 @@ private fun collect(componentManager: ComponentManager,
|
||||
substitutorToStore.put(substitutor, store)
|
||||
}
|
||||
|
||||
fun getOrCreateVirtualFile(requestor: Any?, file: Path): VirtualFile {
|
||||
fun getOrCreateVirtualFile(file: Path, requestor: Any?): VirtualFile {
|
||||
val virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByPath(file.systemIndependentPath)
|
||||
if (virtualFile != null) {
|
||||
return virtualFile
|
||||
|
||||
@@ -101,7 +101,7 @@ final class ClasspathSaveSession implements SaveSessionProducer, SaveSession, Sa
|
||||
ThrowableRunnable<IOException> runnable = () -> {
|
||||
for (String key : modifiedContent.keySet()) {
|
||||
Element content = modifiedContent.get(key);
|
||||
VirtualFile virtualFile = StorageUtilKt.getOrCreateVirtualFile(this, Paths.get(fileSet.getParent(key) + '/' + key));
|
||||
VirtualFile virtualFile = StorageUtilKt.getOrCreateVirtualFile(Paths.get(fileSet.getParent(key) + '/' + key), this);
|
||||
try (Writer writer = new OutputStreamWriter(virtualFile.getOutputStream(this), StandardCharsets.UTF_8)) {
|
||||
EclipseJDOMUtil.output(content, writer, module.getProject());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user