01: package net.sourceforge.squirrel_sql.plugins.codecompletion.prefs;
02:
03: import net.sourceforge.squirrel_sql.fw.util.StringManager;
04: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
05:
06: class ConfigCboItem {
07: private static final StringManager s_stringMgr = StringManagerFactory
08: .getStringManager(ConfigCboItem.class);
09:
10: static final ConfigCboItem[] items = new ConfigCboItem[] {
11: new ConfigCboItem(
12: CodeCompletionPreferences.CONFIG_SP_WITH_PARARMS),
13: new ConfigCboItem(
14: CodeCompletionPreferences.CONFIG_SP_WITHOUT_PARARMS),
15: new ConfigCboItem(
16: CodeCompletionPreferences.CONFIG_UDF_WITH_PARARMS),
17: new ConfigCboItem(
18: CodeCompletionPreferences.CONFIG_UDF_WITHOUT_PARARMS) };
19:
20: static ConfigCboItem getItemForConfig(int completionConfig) {
21: switch (completionConfig) {
22: case CodeCompletionPreferences.CONFIG_SP_WITH_PARARMS:
23: return items[0];
24: case CodeCompletionPreferences.CONFIG_SP_WITHOUT_PARARMS:
25: return items[1];
26: case CodeCompletionPreferences.CONFIG_UDF_WITH_PARARMS:
27: return items[2];
28: case CodeCompletionPreferences.CONFIG_UDF_WITHOUT_PARARMS:
29: return items[3];
30: default:
31: throw new IllegalArgumentException(
32: "Unknown completionConfig " + completionConfig);
33: }
34: }
35:
36: private String _toString;
37:
38: private int _completionConfig;
39:
40: private ConfigCboItem(int completionConfig) {
41: _completionConfig = completionConfig;
42: switch (completionConfig) {
43: case CodeCompletionPreferences.CONFIG_SP_WITH_PARARMS:
44: // i18n[codecompletion.prefs.table.spWithParams=SP with params]
45: _toString = s_stringMgr
46: .getString("codecompletion.prefs.table.spWithParams");
47: break;
48: case CodeCompletionPreferences.CONFIG_SP_WITHOUT_PARARMS:
49: // i18n[codecompletion.prefs.table.spWithoutParams=SP without params]
50: _toString = s_stringMgr
51: .getString("codecompletion.prefs.table.spWithoutParams");
52: break;
53: case CodeCompletionPreferences.CONFIG_UDF_WITH_PARARMS:
54: // i18n[codecompletion.prefs.table.udfWithParams=UDF with params]
55: _toString = s_stringMgr
56: .getString("codecompletion.prefs.table.udfWithParams");
57: break;
58: case CodeCompletionPreferences.CONFIG_UDF_WITHOUT_PARARMS:
59: // i18n[codecompletion.prefs.table.udfWithoutParams=UDF without params]
60: _toString = s_stringMgr
61: .getString("codecompletion.prefs.table.udfWithoutParams");
62: break;
63: }
64: }
65:
66: public String toString() {
67: return _toString;
68: }
69:
70: public int getCompletionConfig() {
71: return _completionConfig;
72: }
73: }
|