01: package net.sourceforge.squirrel_sql.plugins.syntax.netbeans;
02:
03: import net.sourceforge.squirrel_sql.fw.id.IIdentifier;
04: import net.sourceforge.squirrel_sql.client.session.ISession;
05: import net.sourceforge.squirrel_sql.client.session.ISyntaxHighlightTokenMatcher;
06: import net.sourceforge.squirrel_sql.client.session.ISyntaxHighlightTokenMatcherFactory;
07: import net.sourceforge.squirrel_sql.client.session.parser.IParserEventsProcessor;
08: import net.sourceforge.squirrel_sql.client.session.parser.IParserEventsProcessorFactory;
09:
10: import java.util.HashMap;
11:
12: public class NetbeansPropertiesWrapper {
13: private HashMap<String, Object> _props;
14:
15: public NetbeansPropertiesWrapper(HashMap<String, Object> props) {
16: _props = props;
17: }
18:
19: public IParserEventsProcessor getParserEventsProcessor(
20: IIdentifier sqlEntryPanelIdentifier, ISession sess) {
21: if (false == _props
22: .containsKey(IParserEventsProcessorFactory.class
23: .getName())) {
24: return sess
25: .getParserEventsProcessor(sqlEntryPanelIdentifier);
26: } else if (null == _props
27: .get(IParserEventsProcessorFactory.class.getName())) {
28: return null;
29: } else {
30: IParserEventsProcessorFactory fact = (IParserEventsProcessorFactory) _props
31: .get(IParserEventsProcessorFactory.class.getName());
32: return fact.getParserEventsProcessor(
33: sqlEntryPanelIdentifier, sess);
34: }
35: }
36:
37: public ISyntaxHighlightTokenMatcher getSyntaxHighlightTokenMatcher(
38: ISession sess, NetbeansSQLEditorPane editorPane) {
39: if (false == _props
40: .containsKey(ISyntaxHighlightTokenMatcherFactory.class
41: .getName())) {
42: return new SqlSyntaxHighlightTokenMatcher(sess, editorPane);
43: } else {
44: ISyntaxHighlightTokenMatcherFactory fact = (ISyntaxHighlightTokenMatcherFactory) _props
45: .get(ISyntaxHighlightTokenMatcherFactory.class
46: .getName());
47: return fact
48: .getSyntaxHighlightTokenMatcher(sess, editorPane);
49: }
50: }
51: }
|