mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -136,7 +136,7 @@ open class FileBasedStorage(file: File,
|
||||
|
||||
private fun processReadException(e: Exception?) {
|
||||
val contentTruncated = e == null
|
||||
blockSavingTheContent = !contentTruncated && (isProjectOrModuleFile(fileSpec) || fileSpec == StoragePathMacros.WORKSPACE_FILE)
|
||||
blockSavingTheContent = !contentTruncated && (PROJECT_FILE == fileSpec || fileSpec.startsWith(PROJECT_CONFIG_DIR) || fileSpec == StoragePathMacros.MODULE_FILE || fileSpec == StoragePathMacros.WORKSPACE_FILE)
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode && !ApplicationManager.getApplication().isHeadlessEnvironment) {
|
||||
if (e != null) {
|
||||
LOG.info(e)
|
||||
@@ -225,15 +225,13 @@ private fun doWrite(requestor: Any, file: VirtualFile, content: Any, lineSeparat
|
||||
}
|
||||
}
|
||||
|
||||
fun Parent.toBufferExposingByteArray(lineSeparator: String = "\n"): BufferExposingByteArrayOutputStream {
|
||||
internal fun Parent.toBufferExposingByteArray(lineSeparator: String = "\n"): BufferExposingByteArrayOutputStream {
|
||||
val out = BufferExposingByteArrayOutputStream(512)
|
||||
JDOMUtil.writeParent(this, out, lineSeparator)
|
||||
return out
|
||||
}
|
||||
|
||||
fun isProjectOrModuleFile(fileSpec: String): Boolean = PROJECT_FILE == fileSpec || fileSpec.startsWith(PROJECT_CONFIG_DIR) || fileSpec == StoragePathMacros.MODULE_FILE
|
||||
|
||||
fun detectLineSeparators(chars: CharSequence, defaultSeparator: LineSeparator?): LineSeparator {
|
||||
internal fun detectLineSeparators(chars: CharSequence, defaultSeparator: LineSeparator?): LineSeparator {
|
||||
for (c in chars) {
|
||||
if (c == '\r') {
|
||||
return LineSeparator.CRLF
|
||||
|
||||
@@ -41,6 +41,8 @@ import java.util.concurrent.locks.ReentrantLock
|
||||
import java.util.regex.Pattern
|
||||
import kotlin.concurrent.withLock
|
||||
|
||||
private val MACRO_PATTERN = Pattern.compile("(\\$[^\\$]*\\$)")
|
||||
|
||||
/**
|
||||
* If componentManager not specified, storage will not add file tracker (see VirtualFileTracker)
|
||||
*/
|
||||
@@ -61,9 +63,7 @@ open class StateStorageManagerImpl(private val rootTagName: String,
|
||||
get() = true
|
||||
|
||||
companion object {
|
||||
private val MACRO_PATTERN = Pattern.compile("(\\$[^\\$]*\\$)")
|
||||
|
||||
fun createDefaultVirtualTracker(componentManager: ComponentManager?) = when (componentManager) {
|
||||
private fun createDefaultVirtualTracker(componentManager: ComponentManager?) = when (componentManager) {
|
||||
null -> {
|
||||
null
|
||||
}
|
||||
@@ -401,5 +401,5 @@ private fun String.startsWithMacro(macro: String): Boolean {
|
||||
fun removeMacroIfStartsWith(path: String, macro: String) = if (path.startsWithMacro(macro)) path.substring(macro.length + 1) else path
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
val Storage.path: String
|
||||
internal val Storage.path: String
|
||||
get() = if (value.isNullOrEmpty()) file else value
|
||||
Reference in New Issue
Block a user