Source Code Cross Referenced for ExamplePlugin.java in  » Database-Client » squirrel-sql-2.6.5a » net » sourceforge » squirrel_sql » plugins » example » 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 » net.sourceforge.squirrel_sql.plugins.example 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.sourceforge.squirrel_sql.plugins.example;
002:
003:        import net.sourceforge.squirrel_sql.client.action.ActionCollection;
004:        import net.sourceforge.squirrel_sql.client.gui.session.ObjectTreeInternalFrame;
005:        import net.sourceforge.squirrel_sql.client.gui.session.SQLInternalFrame;
006:        import net.sourceforge.squirrel_sql.client.plugin.DefaultSessionPlugin;
007:        import net.sourceforge.squirrel_sql.client.plugin.PluginException;
008:        import net.sourceforge.squirrel_sql.client.plugin.PluginResources;
009:        import net.sourceforge.squirrel_sql.client.plugin.PluginSessionCallback;
010:        import net.sourceforge.squirrel_sql.client.preferences.IGlobalPreferencesPanel;
011:        import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI;
012:        import net.sourceforge.squirrel_sql.client.session.ISession;
013:        import net.sourceforge.squirrel_sql.fw.sql.DatabaseObjectType;
014:
015:        /**
016:         * The Example plugin class.
017:         */
018:        public class ExamplePlugin extends DefaultSessionPlugin {
019:            private PluginResources _resources;
020:
021:            /**
022:             * Return the internal name of this plugin.
023:             *
024:             * @return  the internal name of this plugin.
025:             */
026:            public String getInternalName() {
027:                return "example";
028:            }
029:
030:            /**
031:             * Return the descriptive name of this plugin.
032:             *
033:             * @return  the descriptive name of this plugin.
034:             */
035:            public String getDescriptiveName() {
036:                return "Example Plugin";
037:            }
038:
039:            /**
040:             * Returns the current version of this plugin.
041:             *
042:             * @return  the current version of this plugin.
043:             */
044:            public String getVersion() {
045:                return "0.01";
046:            }
047:
048:            /**
049:             * Returns the authors name.
050:             *
051:             * @return  the authors name.
052:             */
053:            public String getAuthor() {
054:                return "Gerd Wagner";
055:            }
056:
057:            /**
058:             * Returns the name of the change log for the plugin. This should
059:             * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
060:             * directory.
061:             *
062:             * @return	the changelog file name or <TT>null</TT> if plugin doesn't have
063:             * 			a change log.
064:             */
065:            public String getChangeLogFileName() {
066:                return "changes.txt";
067:            }
068:
069:            /**
070:             * Returns the name of the Help file for the plugin. This should
071:             * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
072:             * directory.
073:             *
074:             * @return	the Help file name or <TT>null</TT> if plugin doesn't have
075:             * 			a help file.
076:             */
077:            public String getHelpFileName() {
078:                return "readme.txt";
079:            }
080:
081:            /**
082:             * Returns the name of the Licence file for the plugin. This should
083:             * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
084:             * directory.
085:             *
086:             * @return	the Licence file name or <TT>null</TT> if plugin doesn't have
087:             * 			a licence file.
088:             */
089:            public String getLicenceFileName() {
090:                return "licence.txt";
091:            }
092:
093:            /**
094:             * @return	Comma separated list of contributors.
095:             */
096:            public String getContributors() {
097:                return "";
098:            }
099:
100:            /**
101:             * Create preferences panel for the Global Preferences dialog.
102:             *
103:             * @return  Preferences panel.
104:             */
105:            public IGlobalPreferencesPanel[] getGlobalPreferencePanels() {
106:                return new IGlobalPreferencesPanel[0];
107:            }
108:
109:            /**
110:             * Initialize this plugin.
111:             */
112:            public synchronized void initialize() throws PluginException {
113:                _resources = new PluginResources(
114:                        "net.sourceforge.squirrel_sql.plugins.example.example",
115:                        this );
116:            }
117:
118:            /**
119:             * Called when a session started. Add commands to popup menu
120:             * in object tree.
121:             *
122:             * @param   session	 The session that is starting.
123:             *
124:             * @return An implementation of PluginSessionCallback or null to indicate
125:             * the plugin does not work with this session
126:             */
127:            public PluginSessionCallback sessionStarted(ISession session) {
128:                try {
129:                    String driverName = session.getSQLConnection()
130:                            .getConnection().getMetaData().getDriverName();
131:                    if (false == driverName.toUpperCase().startsWith(
132:                            "IBM DB2 JDBC")) {
133:                        // Plugin knows only how to script Views and Stored Procedures on DB2.
134:                        // So if it's not a DB2 Session we tell SQuirreL the Plugin should not be used.
135:                        return null;
136:                    }
137:
138:                    // Add context menu items to the object tree's view and procedure nodes.
139:                    IObjectTreeAPI otApi = session.getSessionInternalFrame()
140:                            .getObjectTreeAPI();
141:                    otApi.addToPopup(DatabaseObjectType.VIEW,
142:                            new ScriptDB2ViewAction(getApplication(),
143:                                    _resources, session));
144:                    otApi.addToPopup(DatabaseObjectType.PROCEDURE,
145:                            new ScriptDB2ProcedureAction(getApplication(),
146:                                    _resources, session));
147:
148:                    return new PluginSessionCallback() {
149:                        public void sqlInternalFrameOpened(
150:                                SQLInternalFrame sqlInternalFrame, ISession sess) {
151:                            //plugin supports Session main window only
152:                        }
153:
154:                        public void objectTreeInternalFrameOpened(
155:                                ObjectTreeInternalFrame objectTreeInternalFrame,
156:                                ISession sess) {
157:                            //plugin supports Session main window only
158:                        }
159:                    };
160:                } catch (Exception e) {
161:                    throw new RuntimeException(e);
162:                }
163:            }
164:
165:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.