Skip to content
Snippets Groups Projects
Commit f59acb4f authored by Simon Barner's avatar Simon Barner
Browse files

Refresh kernel model resource right before writing the contents to disk

Issue-Ref: 4166
Issue-Url: af3#4166



Signed-off-by: default avatarSimon Barner <barner@fortiss.org>
parent 52d02ef6
No related branches found
No related tags found
1 merge request!1524166: Avoid exceptions/hangs when saving/importing model files
This commit is part of merge request !152. Comments created here will be created in the context of that merge request.
AutoUndoCommandStack.java fc326adf66c6cea2354884cdc240da5f2f82689a GREEN AutoUndoCommandStack.java fc326adf66c6cea2354884cdc240da5f2f82689a GREEN
EMFTransactionalCommand.java ba4b5bead9768b6ce6c955b9238cd96cb722533c GREEN EMFTransactionalCommand.java ba4b5bead9768b6ce6c955b9238cd96cb722533c GREEN
EclipseResourceStorageService.java e917c822c53eacada70188e66215d91241a29a5c GREEN EclipseResourceStorageService.java e917c822c53eacada70188e66215d91241a29a5c GREEN
ModelContext.java efa60d240cd7bd8900685c35afcc87f56e6995fb GREEN ModelContext.java 76eeaef7f56da5f0e288cf96792850be606b7757 YELLOW
NonDirtyingEMFTransactionalCommand.java d288ebe35d22442c603496b0c917fb99a8febeea GREEN NonDirtyingEMFTransactionalCommand.java d288ebe35d22442c603496b0c917fb99a8febeea GREEN
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package org.fortiss.tooling.kernel.internal.storage.eclipse; package org.fortiss.tooling.kernel.internal.storage.eclipse;
import static java.lang.Math.max; import static java.lang.Math.max;
import static org.eclipse.core.resources.IResource.DEPTH_ZERO;
import static org.eclipse.emf.common.util.URI.createPlatformResourceURI; import static org.eclipse.emf.common.util.URI.createPlatformResourceURI;
import static org.fortiss.tooling.kernel.utils.EMFResourceUtils.buildOptionsMap; import static org.fortiss.tooling.kernel.utils.EMFResourceUtils.buildOptionsMap;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.error; import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
...@@ -316,6 +317,7 @@ class ModelContext implements ITopLevelElement, CommandStackListener { ...@@ -316,6 +317,7 @@ class ModelContext implements ITopLevelElement, CommandStackListener {
try { try {
// Step 3: write file content to disk (for resource managed by kernel) // Step 3: write file content to disk (for resource managed by kernel)
ByteArrayInputStream stream = new ByteArrayInputStream(bytes.toByteArray()); ByteArrayInputStream stream = new ByteArrayInputStream(bytes.toByteArray());
file.refreshLocal(DEPTH_ZERO, monitor);
file.setContents(stream, false, true, monitor); file.setContents(stream, false, true, monitor);
} catch(CoreException e) { } catch(CoreException e) {
if(exception == null) { if(exception == null) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment