Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Ladenberger2012-04-18 14:06:01 +0000
committerLukas Ladenberger2012-04-18 14:06:01 +0000
commitff57c8a3280fea22c9ce1d600fea27fcb1c9f705 (patch)
tree360481ac3552328439d51532c053fa22386b6e47
parent22ed93953fb7cd729bda03c3ef06c69c58cc667f (diff)
downloadorg.eclipse.rmf-ff57c8a3280fea22c9ce1d600fea27fcb1c9f705.tar.gz
org.eclipse.rmf-ff57c8a3280fea22c9ce1d600fea27fcb1c9f705.tar.xz
org.eclipse.rmf-ff57c8a3280fea22c9ce1d600fea27fcb1c9f705.zip
added question to the start up phase of the editor, asking the user
whenever he wants to restore the isSimplified original values
-rw-r--r--org.eclipse.rmf.pror.reqif10.editor/plugin.properties1
-rw-r--r--org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/Reqif10Editor.java39
2 files changed, 39 insertions, 1 deletions
diff --git a/org.eclipse.rmf.pror.reqif10.editor/plugin.properties b/org.eclipse.rmf.pror.reqif10.editor/plugin.properties
index 08455a04..708a5ab8 100644
--- a/org.eclipse.rmf.pror.reqif10.editor/plugin.properties
+++ b/org.eclipse.rmf.pror.reqif10.editor/plugin.properties
@@ -113,6 +113,7 @@ _UI_DefaultProblem_message = Problems encountered. The recovered content can be
_UI_Reqif10XhtmlIsSimplifiedTrue = Please note: A simplified attribute value representation is displayed.\n This can lead to potential information loss. However, the original value\n can be restored when reopening the ReqIF model.
_UI_Reqif10XhtmlIsSimplifiedFalse = Please note: A simplified attribute value representation is\n displayed. This can lead to potential information loss.
_UI_Reqif10XhtmlIsSimplifiedWarning = Please note: A simplified attribute value representation will be created and displayed. This can lead to potential information loss. However, the original value will be remembered and can be restored when reopening the ReqIF model.\n\nYou can disable this warning by setting the "Stop warning when setting isSimplified=true for all ReqIF models." preference in Windows -> Preferences -> ProR.
+_UI_Reqif10XhtmlRestoreIsSimplified = Your ReqIF model contains simplified attribute values (isSimplified = true). Do you want to restore the original attribute values?
_UI_PreferencesIsSimplified = ProR Settings
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/Reqif10Editor.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/Reqif10Editor.java
index 955116f3..455a0e1c 100644
--- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/Reqif10Editor.java
+++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/Reqif10Editor.java
@@ -46,6 +46,7 @@ import org.eclipse.emf.common.ui.editor.ProblemEditorPart;
import org.eclipse.emf.common.ui.viewer.IViewerProvider;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EValidator;
@@ -99,11 +100,15 @@ import org.eclipse.rmf.pror.reqif10.provider.ReqIF10ItemProviderAdapterFactory;
import org.eclipse.rmf.pror.reqif10.provider.VirtualDatatypeDefinitionItemProvider;
import org.eclipse.rmf.pror.reqif10.provider.VirtualSpecTypeItemProvider;
import org.eclipse.rmf.pror.reqif10.xhtml.provider.XhtmlItemProviderAdapterFactory;
+import org.eclipse.rmf.reqif10.AttributeValue;
+import org.eclipse.rmf.reqif10.AttributeValueXHTML;
import org.eclipse.rmf.reqif10.ReqIF;
import org.eclipse.rmf.reqif10.ReqIF10Factory;
import org.eclipse.rmf.reqif10.ReqIF10Package;
import org.eclipse.rmf.reqif10.ReqIFContent;
+import org.eclipse.rmf.reqif10.SpecObject;
import org.eclipse.rmf.reqif10.Specification;
+import org.eclipse.rmf.reqif10.XhtmlContent;
import org.eclipse.rmf.serialization.ReqIFResourceSetImpl;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
@@ -1084,7 +1089,39 @@ public class Reqif10Editor extends MultiPageEditorPart implements
reqif = (ReqIF) resource.getContents().get(0);
// Handle isSimplified = true values
-
+ boolean askedToRestore = false;
+ boolean restoreSimplifiedValues = false;
+ EList<SpecObject> specObjects = reqif.getCoreContent().getSpecObjects();
+ for (SpecObject specObject : specObjects) {
+ EList<AttributeValue> values = specObject.getValues();
+ for (AttributeValue atrVal : values) {
+ if (atrVal instanceof AttributeValueXHTML) {
+ AttributeValueXHTML atrXhtml = (AttributeValueXHTML) atrVal;
+ if (atrXhtml.isSimplified()) {
+
+ if (!askedToRestore) {
+ restoreSimplifiedValues = MessageDialog
+ .openQuestion(
+ Display.getDefault()
+ .getActiveShell(),
+ "Please choose",
+ Reqif10EditorPlugin.INSTANCE
+ .getString("_UI_Reqif10XhtmlRestoreIsSimplified"));
+ askedToRestore = true;
+ }
+
+ if(restoreSimplifiedValues) {
+ // Restore value
+ XhtmlContent theOriginalValue = atrXhtml.getTheOriginalValue();
+ atrXhtml.setTheValue(theOriginalValue);
+ atrXhtml.setTheOriginalValue(null);
+ atrXhtml.setSimplified(false);
+ }
+
+ }
+ }
+ }
+ }
// TODO there must be a better place?
PresentationEditorManager.notifiyOpenReqif(reqif, editingDomain);

Back to the top