Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan E. Jensen2013-07-18 13:28:08 -0400
committerRoberto E. Escobar2013-08-19 18:20:29 -0400
commitc23f7fe4768efea083c4635a646f381c1d92d0a9 (patch)
treee7b6a05163160699a9a57ddd90184e07a3cc0e7a
parentf2a5a0bddddb70a67cd084720ee7bc422a323f6d (diff)
downloadorg.eclipse.osee-c23f7fe4768efea083c4635a646f381c1d92d0a9.tar.gz
org.eclipse.osee-c23f7fe4768efea083c4635a646f381c1d92d0a9.tar.xz
org.eclipse.osee-c23f7fe4768efea083c4635a646f381c1d92d0a9.zip
feature[ats_7HBF1]: DSL Editor Pre and Post Process
Add ability to pre and post process stored data for edit in the Embedded DSL Editor. Change-Id: Ie37872f74e0d0b0d86244f8be70800754dc925d7 Signed-off-by: Jonathan E. Jensen <jonathan.e.jensen2@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/internal/AtsDslGrammar.java6
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeDslGrammar.java6
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/DslGrammar.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/DslGrammarStorageAdapter.java39
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDslEditorWidget.java25
5 files changed, 75 insertions, 3 deletions
diff --git a/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/internal/AtsDslGrammar.java b/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/internal/AtsDslGrammar.java
index b49a830dd8..412ebef659 100644
--- a/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/internal/AtsDslGrammar.java
+++ b/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/internal/AtsDslGrammar.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.ats.dsl.ui.internal;
import org.eclipse.osee.framework.ui.skynet.DslGrammar;
+import org.eclipse.osee.framework.ui.skynet.DslGrammarStorageAdapter;
/**
* @author Roberto E. Escobar
@@ -32,4 +33,9 @@ public class AtsDslGrammar implements DslGrammar {
return AtsDslActivator.getInstance().getInjector(getGrammarId()).getProvider(clazz).get();
}
+ @Override
+ public DslGrammarStorageAdapter getStorageAdapter() {
+ return null;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeDslGrammar.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeDslGrammar.java
index 8d04edbb94..24247993f2 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeDslGrammar.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeDslGrammar.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.framework.core.dsl.ui.integration.internal;
import org.eclipse.osee.framework.core.dsl.ui.OseeDslAccess;
import org.eclipse.osee.framework.ui.skynet.DslGrammar;
+import org.eclipse.osee.framework.ui.skynet.DslGrammarStorageAdapter;
/**
* @author Roberto E. Escobar
@@ -33,4 +34,9 @@ public class OseeDslGrammar implements DslGrammar {
return OseeDslAccess.getInjector().getProvider(clazz).get();
}
+ @Override
+ public DslGrammarStorageAdapter getStorageAdapter() {
+ return null;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/DslGrammar.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/DslGrammar.java
index eac129210f..9abc6e56ab 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/DslGrammar.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/DslGrammar.java
@@ -20,4 +20,6 @@ public interface DslGrammar {
String getGrammarId();
<T> T getObject(Class<? extends T> clazz);
+
+ DslGrammarStorageAdapter getStorageAdapter();
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/DslGrammarStorageAdapter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/DslGrammarStorageAdapter.java
new file mode 100644
index 0000000000..f2eedfa472
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/DslGrammarStorageAdapter.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet;
+
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+
+/**
+ * @author Jonathan E. Jensen
+ */
+public interface DslGrammarStorageAdapter {
+
+ /**
+ * This function processes the data from the editor prior to it being stored in the data store. This works in
+ * conjunction with preProcess() to allow the presented text to be independent of the data stored.
+ *
+ * @param serializedModel
+ * @return
+ */
+ String postProcess(Artifact artifact, String serializedModel);
+
+ /**
+ * This function processes the data from the data store prior to it being viewed by the user in the editor. This
+ * works in conjunction with postProcess() to allow the presented text to be independent of the data stored.
+ *
+ * @param artifact
+ * @param storedValue
+ * @return a valid text for consumption by the editor.
+ */
+ String preProcess(Artifact artifact, String storedValue);
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDslEditorWidget.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDslEditorWidget.java
index e65adc50d1..04f89cde65 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDslEditorWidget.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/XDslEditorWidget.java
@@ -27,6 +27,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.validation.IOseeValidator;
import org.eclipse.osee.framework.skynet.core.validation.OseeValidator;
import org.eclipse.osee.framework.ui.skynet.DslGrammar;
+import org.eclipse.osee.framework.ui.skynet.DslGrammarStorageAdapter;
import org.eclipse.osee.framework.ui.skynet.internal.DslGrammarManager;
import org.eclipse.osee.framework.ui.swt.ALayout;
import org.eclipse.osee.framework.ui.swt.Displays;
@@ -208,7 +209,7 @@ public class XDslEditorWidget extends XLabel implements IAttributeWidget {
}
public String get() {
- return model != null ? model.getSerializedModel() : "";
+ return model != null ? getStorageAdapter().postProcess(getArtifact(), model.getSerializedModel()) : "";
}
@Override
@@ -242,8 +243,7 @@ public class XDslEditorWidget extends XLabel implements IAttributeWidget {
String storedValue;
try {
storedValue = getArtifact().getSoleAttributeValue(getAttributeType(), "");
- model.updateModel("", storedValue, "");
-
+ model.updateModel("", getStorageAdapter().preProcess(getArtifact(), storedValue), "");
// Re-enable Listeners
validate();
} catch (OseeCoreException ex) {
@@ -254,6 +254,25 @@ public class XDslEditorWidget extends XLabel implements IAttributeWidget {
}
}
+ private DslGrammarStorageAdapter getStorageAdapter() {
+ DslGrammarStorageAdapter storageAdapter = grammar.getStorageAdapter();
+ if (storageAdapter == null) {
+ storageAdapter = new DslGrammarStorageAdapter() {
+
+ @Override
+ public String preProcess(Artifact artifact, String storedValue) {
+ return storedValue;
+ }
+
+ @Override
+ public String postProcess(Artifact artifact, String serializedModel) {
+ return serializedModel;
+ }
+ };
+ }
+ return storageAdapter;
+ }
+
@Override
public void refresh() {
updateTextWidget();

Back to the top