Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2013-05-02 20:11:14 +0000
committerRoberto E. Escobar2013-05-15 20:13:33 +0000
commit061817c454dc4f6f02394d43369c0ab230440b5b (patch)
tree56a1f0bc120d24b71de8e923f8671a0132f4727b /plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee
parent25c67dffd9b7801af4ce4d129478957a53990004 (diff)
downloadorg.eclipse.osee-061817c454dc4f6f02394d43369c0ab230440b5b.tar.gz
org.eclipse.osee-061817c454dc4f6f02394d43369c0ab230440b5b.tar.xz
org.eclipse.osee-061817c454dc4f6f02394d43369c0ab230440b5b.zip
refactor: Change ModelUtil to OseeDslResourceUtil
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee')
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeTypeModifier.java28
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/AbstractOseeDslProvider.java9
2 files changed, 27 insertions, 10 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeTypeModifier.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeTypeModifier.java
index a16c4e9e5e4..d3bbb1783c6 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeTypeModifier.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeTypeModifier.java
@@ -17,12 +17,13 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.osee.framework.core.dsl.integration.util.ModelUtil;
+import org.eclipse.osee.framework.core.dsl.OseeDslResourceUtil;
import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDsl;
import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeType;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.core.util.Conditions;
import org.eclipse.osee.framework.core.util.HexUtil;
import org.eclipse.osee.framework.jdk.core.util.Lib;
@@ -34,8 +35,13 @@ import org.eclipse.osee.framework.ui.skynet.render.AttributeModifier;
public class OseeTypeModifier implements AttributeModifier {
@Override
- public InputStream modifyForSave(Artifact owner, File file) throws OseeCoreException, IOException {
- String value = Lib.fileToString(file);
+ public InputStream modifyForSave(Artifact owner, File file) throws OseeCoreException {
+ String value = null;
+ try {
+ value = Lib.fileToString(file);
+ } catch (IOException ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
List<Artifact> artifacts =
ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.OseeTypeDefinition, BranchManager.getCommonBranch());
@@ -49,7 +55,12 @@ public class OseeTypeModifier implements AttributeModifier {
}
combinedSheets.append(sheetData.replaceAll("import\\s+\"", "// import \""));
}
- OseeDsl oseeDsl = ModelUtil.loadModel("osee:/TypeModel.osee", combinedSheets.toString());
+ OseeDsl oseeDsl = null;
+ try {
+ oseeDsl = OseeDslResourceUtil.loadModel("osee:/TypeModel.osee", combinedSheets.toString()).getModel();
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
Set<Long> uuids = new HashSet<Long>();
for (EObject object : oseeDsl.eContents()) {
@@ -58,7 +69,14 @@ public class OseeTypeModifier implements AttributeModifier {
}
}
Conditions.checkExpressionFailOnTrue(uuids.contains(0L), "Uuid of 0L is not allowed");
- return Lib.stringToInputStream(value);
+
+ InputStream inputStream = null;
+ try {
+ inputStream = Lib.stringToInputStream(value);
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ return inputStream;
}
private void addUuid(Set<Long> set, OseeType type) throws OseeCoreException {
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/AbstractOseeDslProvider.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/AbstractOseeDslProvider.java
index 915d15a0325..8edc8cb3870 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/AbstractOseeDslProvider.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/operations/AbstractOseeDslProvider.java
@@ -11,9 +11,8 @@
package org.eclipse.osee.framework.core.dsl.ui.integration.operations;
import java.io.ByteArrayOutputStream;
-import java.io.IOException;
+import org.eclipse.osee.framework.core.dsl.OseeDslResourceUtil;
import org.eclipse.osee.framework.core.dsl.integration.OseeDslProvider;
-import org.eclipse.osee.framework.core.dsl.integration.util.ModelUtil;
import org.eclipse.osee.framework.core.dsl.oseeDsl.OseeDsl;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
@@ -44,7 +43,7 @@ public abstract class AbstractOseeDslProvider implements OseeDslProvider {
Operations.executeWorkAndCheckStatus(operation);
try {
outputStream.write(accessModel.getBytes("utf-8"));
- oseeDsl = ModelUtil.loadModel(locationUri, outputStream.toString("utf-8"));
+ oseeDsl = OseeDslResourceUtil.loadModel(locationUri, outputStream.toString("utf-8")).getModel();
} catch (Exception ex) {
OseeExceptions.wrapAndThrow(ex);
}
@@ -62,10 +61,10 @@ public abstract class AbstractOseeDslProvider implements OseeDslProvider {
public void storeDsl(OseeDsl dsl) throws OseeCoreException {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
- ModelUtil.saveModel(dsl, locationUri, outputStream, false);
+ OseeDslResourceUtil.saveModel(dsl, locationUri, outputStream, false);
saveModelToStorage(outputStream.toString("UTF-8"));
loadDsl();
- } catch (IOException ex) {
+ } catch (Exception ex) {
OseeExceptions.wrapAndThrow(ex);
}
}

Back to the top