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

Style fixes (no functional change)


Issue-Ref: 3369
Signed-off-by: default avatarSimon Barner <barner@fortiss.org>
parent 105c658c
No related branches found
No related tags found
1 merge request!23369 fix missing ids no command
AutoUndoCommandStack.java 6aa645a9ed6e6547539c376fda97284928c4f9d4 GREEN
EMFTransactionalCommand.java ba4b5bead9768b6ce6c955b9238cd96cb722533c GREEN
EclipseResourceStorageService.java 1b9722e31a5ec33e4c3f7bb171fc2ce587729bf8 GREEN
ModelContext.java 9b0ae3e9ffbe2604be2631b44d94dcba9bd9ff99 YELLOW
ModelContext.java 85ede185d4b232221a96d0bf37a4c676b105dc00 YELLOW
NonDirtyingEMFTransactionalCommand.java ec5f282603891096b09f2628155dd27e3a21c588 GREEN
......@@ -15,10 +15,13 @@
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.internal.storage.eclipse;
import static java.lang.Math.max;
import static org.eclipse.emf.common.util.URI.createPlatformResourceURI;
import static org.eclipse.emf.ecore.util.EcoreUtil.resolveAll;
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.warning;
import static org.fortiss.tooling.kernel.utils.UniqueIDUtils.generateMissingIDs;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
......@@ -111,7 +114,7 @@ class ModelContext implements ITopLevelElement, CommandStackListener {
editingDomain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain();
rset = editingDomain.getResourceSet();
URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
URI uri = createPlatformResourceURI(file.getFullPath().toString(), true);
resource = getResourceSet().createResource(uri);
resource.load(buildOptionsMap());
......@@ -202,28 +205,22 @@ class ModelContext implements ITopLevelElement, CommandStackListener {
// which is why special care must be taken to ensure uniqueness.
if(ids.contains(id)) {
hadDuplicates = true;
runAsNonDirtyingCommand(new Runnable() {
@Override
public void run() {
element.setId(0);
}
runAsNonDirtyingCommand(() -> {
element.setId(0);
});
} else {
ids.add(id);
}
}
maxId = Math.max(maxId, id);
maxId = max(maxId, id);
}
}
maxId = Math.max(0, maxId);
maxId = max(0, maxId);
if(hadMissing || hadDuplicates) {
runAsNonDirtyingCommand(new Runnable() {
@Override
public void run() {
maxId = UniqueIDUtils.generateMissingIDs(getRootModelElement(), maxId);
}
runAsNonDirtyingCommand(() -> {
maxId = generateMissingIDs(getRootModelElement(), maxId);
});
try {
doSave(new NullProgressMonitor());
......
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