01: package org.osbl.client.wings.devtools.hibernate;
02:
03: import org.osbl.plugin.PluginManager;
04: import org.osbl.plugin.Extension;
05: import org.osbl.client.ClientServiceProvider;
06: import org.osbl.client.web.spring.SpringWebModule;
07: import org.osbl.client.wings.action.ShowViewerAction;
08: import org.osbl.client.wings.action.ShowApplicationAction;
09: import org.osbl.client.wings.form.Viewers;
10: import org.osbl.client.action.ActionRegistry;
11: import org.osbl.ItemRegistry;
12:
13: import javax.swing.*;
14: import java.awt.event.ActionEvent;
15:
16: public class HibernateQueryWebModule extends SpringWebModule {
17: PluginManager pluginManager;
18:
19: public void setPluginManager(PluginManager pluginManager) {
20: this .pluginManager = pluginManager;
21: }
22:
23: public void initialize() {
24: Viewers.registerViewer(Bean.class, HibernateQueryViewer.class);
25: ActionRegistry.registerAction(new ShowViewerAction(Bean.class,
26: "org.osbl.hibernate.hibernate.actions.query"));
27: ActionRegistry.registerAction(new ShowApplicationAction(
28: HibernateReferences.class,
29: "org.osbl.hibernate.hibernate.actions.references"));
30:
31: pluginManager.registerExtension(new Extension(
32: "Hibernate Query Tool",
33: "org.osbl.client.wings.devtools",
34: HibernateQueryDevTool.class));
35: pluginManager.registerExtension(new Extension(
36: "Hibernate References Tool",
37: "org.osbl.client.wings.devtools",
38: HibernateReferencesDevTool.class));
39: }
40:
41: public static class HibernateQueryDevTool extends AbstractAction {
42: public HibernateQueryDevTool() {
43: putValue(Action.NAME, "Hibernate Query Tool");
44: }
45:
46: public void actionPerformed(ActionEvent e) {
47: Action action = ActionRegistry
48: .getAction("org.osbl.hibernate.hibernate.actions.query");
49: action
50: .actionPerformed(new ActionEvent(
51: this ,
52: 0,
53: (String) action
54: .getValue(Action.ACTION_COMMAND_KEY)));
55: }
56: }
57:
58: public static class HibernateReferencesDevTool extends
59: AbstractAction {
60: public HibernateReferencesDevTool() {
61: putValue(Action.NAME, "Hibernate References Tool");
62: }
63:
64: public void actionPerformed(ActionEvent e) {
65: Action action = ActionRegistry
66: .getAction("org.osbl.hibernate.hibernate.actions.references");
67: action
68: .actionPerformed(new ActionEvent(
69: this ,
70: 0,
71: (String) action
72: .getValue(Action.ACTION_COMMAND_KEY)));
73: }
74: }
75: }
|