15
15
*/
16
16
package org.utplsql.sqldev.model.preference
17
17
18
+ import java.io.File
18
19
import oracle.javatools.data.HashStructure
19
20
import oracle.javatools.data.HashStructureAdapter
20
21
import oracle.javatools.data.PropertyStorage
21
22
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder
22
23
23
24
class PreferenceModel extends HashStructureAdapter {
25
+ public static final String DEFAULT_OUTPUT_DIRECTORY = ' ' ' «System.getProperty("user.home")»«File.separator»utplsql«File.separator»generated' ' '
24
26
static final String DATA_KEY = " utplsql"
25
27
26
28
private new (HashStructure hash) {
@@ -42,7 +44,14 @@ class PreferenceModel extends HashStructureAdapter {
42
44
static final String KEY_TEST_UNIT_SUFFIX = " testUnitSuffix"
43
45
static final String KEY_NUMBER_OF_TESTS_PER_UNIT = " numberOfTestsPerUnit"
44
46
static final String KEY_CHECK_GENERATE_UTPLSQL_TEST = " checkGenerateUtplsqlTest"
45
-
47
+ static final String KEY_GENERATE_COMMENTS = " generateComments"
48
+ static final String KEY_DISABLE_TESTS = " disableTests"
49
+ static final String KEY_SUITE_PATH = " suitePath"
50
+ static final String KEY_INDENT_SPACES = " indentSpaces"
51
+ static final String KEY_GENERATE_FILES = " generateFiles"
52
+ static final String KEY_OUTPUT_DIRECTORY = " outputDirectory"
53
+ static final String KEY_ROOT_FOLDER_IN_ODDGEN_VIEW = " rootFolderInOddgenView"
54
+
46
55
def isUnsharedWorksheet () {
47
56
return getHashStructure. getBoolean(PreferenceModel . KEY_UNSHARED_WORKSHEET , true )
48
57
}
@@ -131,6 +140,64 @@ class PreferenceModel extends HashStructureAdapter {
131
140
getHashStructure. putBoolean(PreferenceModel . KEY_CHECK_GENERATE_UTPLSQL_TEST , checkGenerateUtplsqlTest)
132
141
}
133
142
143
+ def isGenerateComments () {
144
+ return getHashStructure. getBoolean(PreferenceModel . KEY_GENERATE_COMMENTS , true )
145
+ }
146
+
147
+ def setGenerateComments (boolean generateComments ) {
148
+ getHashStructure. putBoolean(PreferenceModel . KEY_GENERATE_COMMENTS , generateComments)
149
+ }
150
+
151
+ def isDisableTests () {
152
+ return getHashStructure. getBoolean(PreferenceModel . KEY_DISABLE_TESTS , false )
153
+ }
154
+
155
+ def setDisableTests (boolean disableTests ) {
156
+ getHashStructure. putBoolean(PreferenceModel . KEY_DISABLE_TESTS , disableTests)
157
+ }
158
+
159
+ def getSuitePath () {
160
+ return getHashStructure. getString(PreferenceModel . KEY_SUITE_PATH , " alltests" )
161
+ }
162
+
163
+ def setSuitePath (String suitePath ) {
164
+ getHashStructure. putString(PreferenceModel . KEY_SUITE_PATH , suitePath)
165
+ }
166
+
167
+ def getIndentSpaces () {
168
+ return getHashStructure. getInt(PreferenceModel . KEY_INDENT_SPACES , 3 )
169
+ }
170
+
171
+ def setIndentSpaces (int indentSpaces ) {
172
+ getHashStructure. putInt(PreferenceModel . KEY_INDENT_SPACES , indentSpaces)
173
+ }
174
+
175
+ def isGenerateFiles () {
176
+ return getHashStructure. getBoolean(PreferenceModel . KEY_GENERATE_FILES , true )
177
+ }
178
+
179
+ def setGenerateFiles (boolean generateFiles ) {
180
+ getHashStructure. putBoolean(PreferenceModel . KEY_GENERATE_FILES , generateFiles)
181
+ }
182
+
183
+ def getOutputDirectory () {
184
+ return getHashStructure. getString(PreferenceModel . KEY_OUTPUT_DIRECTORY , DEFAULT_OUTPUT_DIRECTORY )
185
+ }
186
+
187
+ def setOutputDirectory (String outputDirectory ) {
188
+ val dir = if (outputDirectory. empty) {DEFAULT_OUTPUT_DIRECTORY } else {outputDirectory}
189
+ getHashStructure. putString(PreferenceModel . KEY_OUTPUT_DIRECTORY , dir)
190
+ }
191
+
192
+ def getRootFolderInOddgenView () {
193
+ return getHashStructure. getString(PreferenceModel . KEY_ROOT_FOLDER_IN_ODDGEN_VIEW , " utPLSQL" )
194
+ }
195
+
196
+ def setRootFolderInOddgenView (String rootFolder ) {
197
+ val folder = if (rootFolder. empty) {" utPLSQL" } else {rootFolder}
198
+ getHashStructure. putString(PreferenceModel . KEY_ROOT_FOLDER_IN_ODDGEN_VIEW , folder)
199
+ }
200
+
134
201
override toString () {
135
202
new ToStringBuilder (this ). addAllFields. toString
136
203
}
0 commit comments