Source Code Cross Referenced for FirebirdPlugin.java in  » Database-Client » squirrel-sql-2.6.5a » org » firebirdsql » squirrel » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » squirrel sql 2.6.5a » org.firebirdsql.squirrel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.firebirdsql.squirrel;
002:
003:        import javax.swing.JMenu;
004:
005:        import net.sourceforge.squirrel_sql.client.IApplication;
006:        import net.sourceforge.squirrel_sql.client.action.ActionCollection;
007:        import net.sourceforge.squirrel_sql.client.gui.session.ObjectTreeInternalFrame;
008:        import net.sourceforge.squirrel_sql.client.gui.session.SQLInternalFrame;
009:        import net.sourceforge.squirrel_sql.client.plugin.DefaultSessionPlugin;
010:        import net.sourceforge.squirrel_sql.client.plugin.PluginException;
011:        import net.sourceforge.squirrel_sql.client.plugin.PluginResources;
012:        import net.sourceforge.squirrel_sql.client.plugin.PluginSessionCallback;
013:        import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI;
014:        import net.sourceforge.squirrel_sql.client.session.ISession;
015:        import net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.expanders.TableWithChildNodesExpander;
016:        import net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.tabs.DatabaseObjectInfoTab;
017:        import net.sourceforge.squirrel_sql.fw.dialects.DialectFactory;
018:        import net.sourceforge.squirrel_sql.fw.gui.GUIUtils;
019:        import net.sourceforge.squirrel_sql.fw.sql.DatabaseObjectType;
020:        import net.sourceforge.squirrel_sql.fw.util.StringManager;
021:        import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
022:
023:        import org.firebirdsql.squirrel.act.ActivateIndexAction;
024:        import org.firebirdsql.squirrel.act.DeactivateIndexAction;
025:        import org.firebirdsql.squirrel.exp.DatabaseExpander;
026:        import org.firebirdsql.squirrel.exp.FirebirdTableIndexExtractorImpl;
027:        import org.firebirdsql.squirrel.exp.FirebirdTableTriggerExtractorImpl;
028:        import org.firebirdsql.squirrel.exp.AllIndexesParentExpander;
029:        import org.firebirdsql.squirrel.tab.DomainDetailsTab;
030:        import org.firebirdsql.squirrel.tab.GeneratorDetailsTab;
031:        import org.firebirdsql.squirrel.tab.IndexInfoTab;
032:        import org.firebirdsql.squirrel.tab.ProcedureSourceTab;
033:        import org.firebirdsql.squirrel.tab.TriggerDetailsTab;
034:        import org.firebirdsql.squirrel.tab.TriggerSourceTab;
035:        import org.firebirdsql.squirrel.tab.ViewSourceTab;
036:
037:        public class FirebirdPlugin extends DefaultSessionPlugin {
038:
039:            private static final StringManager s_stringMgr = StringManagerFactory
040:                    .getStringManager(FirebirdPlugin.class);
041:
042:            /** API for the Obejct Tree. */
043:            private IObjectTreeAPI _treeAPI;
044:
045:            /** Plugin resources. */
046:            private PluginResources _resources;
047:
048:            /** Firebird menu. */
049:            private JMenu _firebirdMenu;
050:
051:            /**
052:             * Return the internal name of this plugin.
053:             *
054:             * @return  the internal name of this plugin.
055:             */
056:            public String getInternalName() {
057:                return "firebird";
058:            }
059:
060:            /**
061:             * Return the descriptive name of this plugin.
062:             *
063:             * @return  the descriptive name of this plugin.
064:             */
065:            public String getDescriptiveName() {
066:                return "Firebird Plugin";
067:            }
068:
069:            /**
070:             * Returns the current version of this plugin.
071:             *
072:             * @return  the current version of this plugin.
073:             */
074:            public String getVersion() {
075:                return "0.02";
076:            }
077:
078:            /**
079:             * Returns the authors name.
080:             *
081:             * @return  the authors name.
082:             */
083:            public String getAuthor() {
084:                return "Roman Rokytskyy";
085:            }
086:
087:            /**
088:             * @see net.sourceforge.squirrel_sql.client.plugin.IPlugin#getChangeLogFileName()
089:             */
090:            public String getChangeLogFileName() {
091:                return "changes.txt";
092:            }
093:
094:            /**
095:             * @see net.sourceforge.squirrel_sql.client.plugin.IPlugin#getHelpFileName()
096:             */
097:            public String getHelpFileName() {
098:                return "readme.html";
099:            }
100:
101:            /**
102:             * @see net.sourceforge.squirrel_sql.client.plugin.IPlugin#getLicenceFileName()
103:             */
104:            public String getLicenceFileName() {
105:                return "licence.txt";
106:            }
107:
108:            /**
109:             * Load this plugin.
110:             *
111:             * @param	app	 Application API.
112:             */
113:            public synchronized void load(IApplication app)
114:                    throws PluginException {
115:                super .load(app);
116:                _resources = new FirebirdResources(getClass().getName(), this );
117:            }
118:
119:            /**
120:             * Initialize this plugin.
121:             */
122:            public synchronized void initialize() throws PluginException {
123:                super .initialize();
124:                final IApplication app = getApplication();
125:                final ActionCollection coll = app.getActionCollection();
126:
127:                coll.add(new ActivateIndexAction(app, _resources, this ));
128:                coll.add(new DeactivateIndexAction(app, _resources, this ));
129:
130:                _firebirdMenu = createFirebirdMenu();
131:                app
132:                        .addToMenu(IApplication.IMenuIDs.SESSION_MENU,
133:                                _firebirdMenu);
134:                super .registerSessionMenu(_firebirdMenu);
135:            }
136:
137:            /**
138:             * Application is shutting down so save preferences.
139:             */
140:            public void unload() {
141:                super .unload();
142:            }
143:
144:            public boolean allowsSessionStartedInBackground() {
145:                return true;
146:            }
147:
148:            /**
149:             * Session has been started. If this is an Oracle session then
150:             * register an extra expander for the Schema nodes to show
151:             * Oracle Packages.
152:             *
153:             * @param   session     Session that has started.
154:             *
155:             * @return  <TT>true</TT> if session is Oracle in which case this plugin
156:             *                          is interested in it.
157:             */
158:            public PluginSessionCallback sessionStarted(final ISession session) {
159:                if (!isPluginSession(session)) {
160:                    return null;
161:                }
162:                GUIUtils.processOnSwingEventThread(new Runnable() {
163:                    public void run() {
164:                        updateTreeApi(session);
165:                    }
166:                });
167:                return new PluginSessionCallback() {
168:                    public void sqlInternalFrameOpened(
169:                            SQLInternalFrame sqlInternalFrame, ISession sess) {
170:                        // Supports Session main window only
171:                    }
172:
173:                    public void objectTreeInternalFrameOpened(
174:                            ObjectTreeInternalFrame objectTreeInternalFrame,
175:                            ISession sess) {
176:                        // Supports Session main window only
177:                    }
178:                };
179:            }
180:
181:            @Override
182:            protected boolean isPluginSession(ISession session) {
183:                return DialectFactory.isFirebird(session.getMetaData());
184:            }
185:
186:            private void updateTreeApi(ISession session) {
187:                _treeAPI = session.getSessionInternalFrame().getObjectTreeAPI();
188:
189:                // Tabs to add to the database node.
190:                _treeAPI.addDetailTab(DatabaseObjectType.SEQUENCE,
191:                        new DatabaseObjectInfoTab());
192:                _treeAPI.addDetailTab(DatabaseObjectType.TRIGGER,
193:                        new DatabaseObjectInfoTab());
194:                _treeAPI.addDetailTab(DatabaseObjectType.TRIGGER_TYPE_DBO,
195:                        new DatabaseObjectInfoTab());
196:                _treeAPI.addDetailTab(DatabaseObjectType.INDEX,
197:                        new DatabaseObjectInfoTab());
198:                _treeAPI.addDetailTab(DatabaseObjectType.INDEX,
199:                        new IndexInfoTab());
200:
201:                // Expanders.
202:                _treeAPI.addExpander(IObjectTypes.INDEX_PARENT,
203:                        new AllIndexesParentExpander());
204:
205:                _treeAPI.addExpander(DatabaseObjectType.SESSION,
206:                        new DatabaseExpander(this ));
207:
208:                TableWithChildNodesExpander tableExp = new TableWithChildNodesExpander();
209:                tableExp
210:                        .setTableTriggerExtractor(new FirebirdTableTriggerExtractorImpl());
211:                tableExp
212:                        .setTableIndexExtractor(new FirebirdTableIndexExtractorImpl());
213:                _treeAPI.addExpander(DatabaseObjectType.TABLE, tableExp);
214:
215:                _treeAPI.addDetailTab(DatabaseObjectType.SEQUENCE,
216:                        new GeneratorDetailsTab());
217:                _treeAPI.addDetailTab(DatabaseObjectType.DATATYPE,
218:                        new DomainDetailsTab());
219:                _treeAPI.addDetailTab(DatabaseObjectType.TRIGGER,
220:                        new TriggerDetailsTab());
221:                // i18n[firebird.showTrigger=Show trigger source]
222:                _treeAPI.addDetailTab(DatabaseObjectType.TRIGGER,
223:                        new TriggerSourceTab(s_stringMgr
224:                                .getString("firebird.showTrigger")));
225:                // i18n[firebird.showProcedureSource=Show procedure source]
226:                _treeAPI.addDetailTab(DatabaseObjectType.PROCEDURE,
227:                        new ProcedureSourceTab(s_stringMgr
228:                                .getString("firebird.showProcedureSource")));
229:                // i18n[firebird.showView=Show view source]
230:                _treeAPI.addDetailTab(DatabaseObjectType.VIEW,
231:                        new ViewSourceTab(s_stringMgr
232:                                .getString("firebird.showView")));
233:
234:                final ActionCollection coll = getApplication()
235:                        .getActionCollection();
236:                _treeAPI.addToPopup(DatabaseObjectType.INDEX, coll
237:                        .get(ActivateIndexAction.class));
238:                _treeAPI.addToPopup(DatabaseObjectType.INDEX, coll
239:                        .get(DeactivateIndexAction.class));
240:            }
241:
242:            /**
243:             * Create menu containing all Firebird actions.
244:             *
245:             * @return	The menu object.
246:             */
247:            private JMenu createFirebirdMenu() {
248:                final IApplication app = getApplication();
249:                final ActionCollection coll = app.getActionCollection();
250:
251:                final JMenu firebirdMenu = _resources
252:                        .createMenu(FirebirdResources.IMenuResourceKeys.FIREBIRD);
253:
254:                _resources.addToMenu(coll.get(ActivateIndexAction.class),
255:                        firebirdMenu);
256:                _resources.addToMenu(coll.get(DeactivateIndexAction.class),
257:                        firebirdMenu);
258:
259:                return firebirdMenu;
260:            }
261:
262:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.