01: package net.sourceforge.squirrel_sql.plugins.hibernate;
02:
03: import net.sourceforge.squirrel_sql.client.session.ISQLEntryPanel;
04: import net.sourceforge.squirrel_sql.client.session.ISession;
05: import net.sourceforge.squirrel_sql.fw.util.StringManager;
06: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
07:
08: import javax.swing.*;
09:
10: public class EditExtrasAccessor {
11:
12: private static final StringManager s_stringMgr = StringManagerFactory
13: .getStringManager(EditExtrasAccessor.class);
14:
15: public static void quoteHQL(ISQLEntryPanel entryPanel,
16: ISession session) {
17: EditExtrasExternalService si = getService(session);
18:
19: if (null != si) {
20: si.quoteSQL(entryPanel);
21: }
22: }
23:
24: public static void quoteHQLSb(ISQLEntryPanel entryPanel,
25: ISession session) {
26: EditExtrasExternalService si = getService(session);
27:
28: if (null != si) {
29: si.quoteSQLSb(entryPanel);
30: }
31: }
32:
33: private static EditExtrasExternalService getService(ISession session) {
34: EditExtrasExternalService si = (EditExtrasExternalService) session
35: .getApplication().getPluginManager()
36: .bindExternalPluginService("editextras",
37: EditExtrasExternalService.class);
38: if (null == si) {
39: // i18n[EditExtrasAccessor.editextrasPluginNeeded=Quoting is only available with the Edit Extras Plugin.\nGet the plugin from www.squirrelsql.org. It's free.]
40: String msg = s_stringMgr
41: .getString("EditExtrasAccessor.editextrasPluginNeeded");
42: JOptionPane.showMessageDialog(session.getApplication()
43: .getMainFrame(), msg);
44: return null;
45: }
46: return si;
47: }
48:
49: public static void unquoteHQL(ISQLEntryPanel entryPanel,
50: ISession session) {
51: EditExtrasExternalService si = getService(session);
52: if (null != si) {
53: si.unquoteSQL(entryPanel);
54: }
55: }
56: }
|