diff --git a/com.minres.rdl.parent/com.minres.rdl.ui/plugin.xml b/com.minres.rdl.parent/com.minres.rdl.ui/plugin.xml index 9d2d6fc..c19ed96 100644 --- a/com.minres.rdl.parent/com.minres.rdl.ui/plugin.xml +++ b/com.minres.rdl.parent/com.minres.rdl.ui/plugin.xml @@ -97,6 +97,16 @@ name="Templates"> + + + + + + + diff --git a/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/preferences/RdlPreferencePage.xtend b/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/preferences/RdlPreferencePage.xtend new file mode 100644 index 0000000..45da980 --- /dev/null +++ b/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/preferences/RdlPreferencePage.xtend @@ -0,0 +1,29 @@ +package com.minres.rdl.ui.preferences + +import org.eclipse.jface.preference.FieldEditorPreferencePage +import org.eclipse.ui.IWorkbenchPreferencePage +import org.eclipse.ui.IWorkbench +import org.eclipse.jface.preference.BooleanFieldEditor +import com.minres.rdl.preferences.PreferenceConstants +import org.eclipse.ui.preferences.ScopedPreferenceStore +import org.eclipse.core.runtime.preferences.InstanceScope +import org.eclipse.jface.preference.ComboFieldEditor + +class RdlPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { + + new() { + super(GRID) + val store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "com.minres.rdl.rdl"); + setPreferenceStore(store); + setDescription("Code generator configuration options"); + } + + override createFieldEditors() { + addField(new BooleanFieldEditor(PreferenceConstants.P_GENERATE_CSV, "Generate CSV:", getFieldEditorParent())); + addField(new ComboFieldEditor(PreferenceConstants.P_ADDRESSUNIT, "Address unit size", #[#["Byte (8bit)","byte"], #["Word (16bit)","word"], #["DWord (32bit)","dword"]], getFieldEditorParent())) + } + + override init(IWorkbench workbench) { + } + +} \ No newline at end of file diff --git a/com.minres.rdl.parent/com.minres.rdl.ui/xtend-gen/com/minres/rdl/ui/preferences/RdlPreferencePage.java b/com.minres.rdl.parent/com.minres.rdl.ui/xtend-gen/com/minres/rdl/ui/preferences/RdlPreferencePage.java new file mode 100644 index 0000000..f386630 --- /dev/null +++ b/com.minres.rdl.parent/com.minres.rdl.ui/xtend-gen/com/minres/rdl/ui/preferences/RdlPreferencePage.java @@ -0,0 +1,35 @@ +package com.minres.rdl.ui.preferences; + +import com.minres.rdl.preferences.PreferenceConstants; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.jface.preference.ComboFieldEditor; +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.preferences.ScopedPreferenceStore; + +@SuppressWarnings("all") +public class RdlPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { + public RdlPreferencePage() { + super(FieldEditorPreferencePage.GRID); + final ScopedPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "com.minres.rdl.rdl"); + this.setPreferenceStore(store); + this.setDescription("Code generator configuration options"); + } + + @Override + public void createFieldEditors() { + Composite _fieldEditorParent = this.getFieldEditorParent(); + BooleanFieldEditor _booleanFieldEditor = new BooleanFieldEditor(PreferenceConstants.P_GENERATE_CSV, "Generate CSV:", _fieldEditorParent); + this.addField(_booleanFieldEditor); + Composite _fieldEditorParent_1 = this.getFieldEditorParent(); + ComboFieldEditor _comboFieldEditor = new ComboFieldEditor(PreferenceConstants.P_ADDRESSUNIT, "Address unit size", new String[][] { new String[] { "Byte (8bit)", "byte" }, new String[] { "Word (16bit)", "word" }, new String[] { "DWord (32bit)", "dword" } }, _fieldEditorParent_1); + this.addField(_comboFieldEditor); + } + + @Override + public void init(final IWorkbench workbench) { + } +} diff --git a/com.minres.rdl.parent/com.minres.rdl/META-INF/MANIFEST.MF b/com.minres.rdl.parent/com.minres.rdl/META-INF/MANIFEST.MF index 9d568f2..9928230 100644 --- a/com.minres.rdl.parent/com.minres.rdl/META-INF/MANIFEST.MF +++ b/com.minres.rdl.parent/com.minres.rdl/META-INF/MANIFEST.MF @@ -16,15 +16,16 @@ Require-Bundle: org.eclipse.xtext, org.eclipse.emf.common, org.eclipse.equinox.preferences Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Export-Package: com.minres.rdl.parser.antlr, - com.minres.rdl, - com.minres.rdl.rdl.util, - com.minres.rdl.rdl, - com.minres.rdl.serializer, +Export-Package: com.minres.rdl, + com.minres.rdl.generator, + com.minres.rdl.parser.antlr, com.minres.rdl.parser.antlr.internal, - com.minres.rdl.scoping, + com.minres.rdl.preferences, + com.minres.rdl.rdl, com.minres.rdl.rdl.impl, - com.minres.rdl.validation, + com.minres.rdl.rdl.util, + com.minres.rdl.scoping, + com.minres.rdl.serializer, com.minres.rdl.services, - com.minres.rdl.generator + com.minres.rdl.validation Import-Package: org.apache.log4j diff --git a/com.minres.rdl.parent/com.minres.rdl/model/generated/RDL.genmodel b/com.minres.rdl.parent/com.minres.rdl/model/generated/RDL.genmodel index 9370c9f..c6cabcc 100644 --- a/com.minres.rdl.parent/com.minres.rdl/model/generated/RDL.genmodel +++ b/com.minres.rdl.parent/com.minres.rdl/model/generated/RDL.genmodel @@ -3,7 +3,7 @@ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="generated by Xtext 2.12.0" modelDirectory="/com.minres.rdl/src-gen" modelPluginID="com.minres.rdl" forceOverwrite="true" modelName="RDL" updateClasspath="false" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" complianceLevel="6.0" - copyrightFields="false" runtimeVersion="2.13"> + copyrightFields="false" runtimeVersion="2.12"> diff --git a/com.minres.rdl.parent/com.minres.rdl/plugin.xml b/com.minres.rdl.parent/com.minres.rdl/plugin.xml index ae28d82..06e1e1b 100644 --- a/com.minres.rdl.parent/com.minres.rdl/plugin.xml +++ b/com.minres.rdl.parent/com.minres.rdl/plugin.xml @@ -7,4 +7,8 @@ class = "com.minres.rdl.rdl.RdlPackage" genModel = "model/generated/RDL.genmodel" /> + + + +