mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 16:58:56 +00:00
Merge "[performance] some more small performance improvements."
This commit is contained in:
commit
ba3364e0c5
1 changed files with 15 additions and 4 deletions
|
@ -20,6 +20,8 @@ import org.eclipse.emf.ecore.resource.impl.BinaryResourceImpl
|
|||
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
|
||||
import org.eclipse.xtext.nodemodel.impl.SerializableNodeModel
|
||||
import org.eclipse.xtext.nodemodel.serialization.SerializationConversionContext
|
||||
import org.eclipse.emf.ecore.resource.impl.BinaryResourceImpl.EObjectOutputStream
|
||||
import java.io.BufferedOutputStream
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
|
@ -54,25 +56,29 @@ import org.eclipse.xtext.nodemodel.serialization.SerializationConversionContext
|
|||
* Overriding methods should first delegate to super before adding their own entries.
|
||||
*/
|
||||
protected def void writeEntries(StorageAwareResource resource, ZipOutputStream zipOut) {
|
||||
val bufferedOutput = new BufferedOutputStream(zipOut)
|
||||
zipOut.putNextEntry(new ZipEntry("emf-contents"))
|
||||
try {
|
||||
writeContents(resource, zipOut)
|
||||
writeContents(resource, bufferedOutput)
|
||||
} finally {
|
||||
bufferedOutput.flush
|
||||
zipOut.closeEntry
|
||||
}
|
||||
|
||||
zipOut.putNextEntry(new ZipEntry("resource-description"))
|
||||
try {
|
||||
writeResourceDescription(resource, zipOut)
|
||||
writeResourceDescription(resource, bufferedOutput)
|
||||
} finally {
|
||||
bufferedOutput.flush
|
||||
zipOut.closeEntry
|
||||
}
|
||||
|
||||
if (storeNodeModel) {
|
||||
zipOut.putNextEntry(new ZipEntry("node-model"))
|
||||
try {
|
||||
writeNodeModel(resource, zipOut)
|
||||
writeNodeModel(resource, bufferedOutput)
|
||||
} finally {
|
||||
bufferedOutput.flush
|
||||
zipOut.closeEntry
|
||||
}
|
||||
}
|
||||
|
@ -89,11 +95,12 @@ import org.eclipse.xtext.nodemodel.serialization.SerializationConversionContext
|
|||
}
|
||||
|
||||
override saveEObject(InternalEObject internalEObject, Check check) throws IOException {
|
||||
beforeSaveEObject(internalEObject, this)
|
||||
super.saveEObject(internalEObject, check)
|
||||
handleSaveEObject(internalEObject, this)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
try {
|
||||
out.saveResource(storageAwareResource)
|
||||
|
@ -102,6 +109,10 @@ import org.eclipse.xtext.nodemodel.serialization.SerializationConversionContext
|
|||
}
|
||||
}
|
||||
|
||||
protected def beforeSaveEObject(InternalEObject object, EObjectOutputStream writable_1) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
protected def void handleSaveEObject(InternalEObject object, BinaryResourceImpl.EObjectOutputStream out) {
|
||||
// do nothing
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue