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


001:        package net.sourceforge.squirrel_sql.plugins.SybaseASE;
002:
003:        import net.sourceforge.squirrel_sql.client.gui.session.ObjectTreeInternalFrame;
004:        import net.sourceforge.squirrel_sql.client.gui.session.SQLInternalFrame;
005:        import net.sourceforge.squirrel_sql.client.plugin.DefaultSessionPlugin;
006:        import net.sourceforge.squirrel_sql.client.plugin.PluginException;
007:        import net.sourceforge.squirrel_sql.client.plugin.PluginQueryTokenizerPreferencesManager;
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.plugin.gui.PluginGlobalPreferencesTab;
011:        import net.sourceforge.squirrel_sql.client.plugin.gui.PluginQueryTokenizerPreferencesPanel;
012:        import net.sourceforge.squirrel_sql.client.preferences.IGlobalPreferencesPanel;
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.preferences.IQueryTokenizerPreferenceBean;
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:        import net.sourceforge.squirrel_sql.fw.util.log.ILogger;
023:        import net.sourceforge.squirrel_sql.fw.util.log.LoggerController;
024:        import net.sourceforge.squirrel_sql.plugins.SybaseASE.exp.SybaseTableIndexExtractorImpl;
025:        import net.sourceforge.squirrel_sql.plugins.SybaseASE.exp.SybaseTableTriggerExtractorImpl;
026:        import net.sourceforge.squirrel_sql.plugins.SybaseASE.prefs.SybasePreferenceBean;
027:        import net.sourceforge.squirrel_sql.plugins.SybaseASE.tab.TriggerSourceTab;
028:        import net.sourceforge.squirrel_sql.plugins.SybaseASE.tab.ViewSourceTab;
029:        import net.sourceforge.squirrel_sql.plugins.SybaseASE.tokenizer.SybaseQueryTokenizer;
030:
031:        /**
032:         * The Example plugin class.
033:         */
034:        public class SybaseASEPlugin extends DefaultSessionPlugin {
035:            /**
036:             * Internationalized strings for this class.
037:             */
038:            private static final StringManager s_stringMgr = StringManagerFactory
039:                    .getStringManager(SybaseASEPlugin.class);
040:
041:            /** Logger for this class. */
042:            @SuppressWarnings("unused")
043:            private final static ILogger s_log = LoggerController
044:                    .createLogger(SybaseASEPlugin.class);
045:
046:            private PluginResources _resources;
047:
048:            /** manages our query tokenizing preferences */
049:            private PluginQueryTokenizerPreferencesManager _prefsManager = null;
050:
051:            /** The database name that appears in the border label of the pref panel */
052:            private static final String SCRIPT_SETTINGS_BORDER_LABEL_DBNAME = "Sybase";
053:
054:            static interface i18n {
055:                // i18n[SybaseASEPlugin.title=SybaseASE]
056:                String title = s_stringMgr.getString("SybaseASEPlugin.title");
057:
058:                // i18n[SybaseASEPlugin.hint=Preferences for SybaseASE]
059:                String hint = s_stringMgr.getString("SybaseASEPlugin.hint");
060:
061:                //i18n[SybaseASEPlugin.showViewSource=Show view source]
062:                String SHOW_VIEW_SOURCE = s_stringMgr
063:                        .getString("SybaseASEPlugin.showViewSource");
064:
065:                // i18n[SybaseASEPlugin.triggerHint=Show trigger source]
066:                String TRIGGER_HINT = s_stringMgr
067:                        .getString("SybaseASEPlugin.triggerHint");
068:
069:            }
070:
071:            /**
072:             * Return the internal name of this plugin.
073:             *
074:             * @return  the internal name of this plugin.
075:             */
076:            public String getInternalName() {
077:                return "sybase";
078:            }
079:
080:            /**
081:             * Return the descriptive name of this plugin.
082:             *
083:             * @return  the descriptive name of this plugin.
084:             */
085:            public String getDescriptiveName() {
086:                return "SybaseASE Plugin";
087:            }
088:
089:            /**
090:             * Returns the current version of this plugin.
091:             *
092:             * @return  the current version of this plugin.
093:             */
094:            public String getVersion() {
095:                return "0.02";
096:            }
097:
098:            /**
099:             * Returns the authors name.
100:             *
101:             * @return  the authors name.
102:             */
103:            public String getAuthor() {
104:                return "Ken McCullough";
105:            }
106:
107:            /**
108:             * Returns the name of the change log for the plugin. This should
109:             * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
110:             * directory.
111:             *
112:             * @return	the changelog file name or <TT>null</TT> if plugin doesn't have
113:             * 			a change log.
114:             */
115:            public String getChangeLogFileName() {
116:                return "changes.txt";
117:            }
118:
119:            /**
120:             * Returns the name of the Help file for the plugin. This should
121:             * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
122:             * directory.
123:             *
124:             * @return	the Help file name or <TT>null</TT> if plugin doesn't have
125:             * 			a help file.
126:             */
127:            public String getHelpFileName() {
128:                return "readme.txt";
129:            }
130:
131:            /**
132:             * Returns the name of the Licence file for the plugin. This should
133:             * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
134:             * directory.
135:             *
136:             * @return	the Licence file name or <TT>null</TT> if plugin doesn't have
137:             * 			a licence file.
138:             */
139:            public String getLicenceFileName() {
140:                return "licence.txt";
141:            }
142:
143:            /**
144:             * @return	Comma separated list of contributors.
145:             */
146:            public String getContributors() {
147:                return "";
148:            }
149:
150:            /**
151:             * Create preferences panel for the Global Preferences dialog.
152:             *
153:             * @return  Preferences panel.
154:             */
155:            public IGlobalPreferencesPanel[] getGlobalPreferencePanels() {
156:                boolean includeProcSepPref = false;
157:
158:                PluginQueryTokenizerPreferencesPanel _prefsPanel = new PluginQueryTokenizerPreferencesPanel(
159:                        _prefsManager, SCRIPT_SETTINGS_BORDER_LABEL_DBNAME,
160:                        includeProcSepPref);
161:
162:                PluginGlobalPreferencesTab tab = new PluginGlobalPreferencesTab(
163:                        _prefsPanel);
164:
165:                tab.setHint(i18n.hint);
166:                tab.setTitle(i18n.title);
167:
168:                return new IGlobalPreferencesPanel[] { tab };
169:            }
170:
171:            /**
172:             * Determines from the user's preference whether or not to install the 
173:             * custom query tokenizer, and if so configure installs it.
174:             * 
175:             * @param session the session to install the custom query tokenizer in.
176:             */
177:            private void installSybaseQueryTokenizer(ISession session) {
178:                IQueryTokenizerPreferenceBean _prefs = _prefsManager
179:                        .getPreferences();
180:
181:                if (_prefs.isInstallCustomQueryTokenizer()) {
182:                    session.setQueryTokenizer(new SybaseQueryTokenizer(_prefs));
183:                }
184:            }
185:
186:            /**
187:             * Initialize this plugin.
188:             */
189:            public synchronized void initialize() throws PluginException {
190:                _resources = new PluginResources(
191:                        "net.sourceforge.squirrel_sql.plugins.SybaseASE.SybaseASE",
192:                        this );
193:                _prefsManager = new PluginQueryTokenizerPreferencesManager();
194:                _prefsManager.initialize(this , new SybasePreferenceBean());
195:
196:            }
197:
198:            /**
199:             * Called when a session started. Add commands to popup menu
200:             * in object tree.
201:             *
202:             * @param   session	 The session that is starting.
203:             *
204:             * @return An implementation of PluginSessionCallback or null to indicate
205:             * the plugin does not work with this session
206:             */
207:            public PluginSessionCallback sessionStarted(ISession session) {
208:                if (!isPluginSession(session)) {
209:                    return null;
210:                }
211:                installSybaseQueryTokenizer(session);
212:                String stmtSep = session.getQueryTokenizer()
213:                        .getSQLStatementSeparator();
214:
215:                // Add context menu items to the object tree's view and procedure nodes.
216:                IObjectTreeAPI otApi = session.getSessionInternalFrame()
217:                        .getObjectTreeAPI();
218:                otApi.addToPopup(DatabaseObjectType.VIEW,
219:                        new ScriptSybaseASEViewAction(getApplication(),
220:                                _resources, session));
221:                otApi.addToPopup(DatabaseObjectType.PROCEDURE,
222:                        new ScriptSybaseASEProcedureAction(getApplication(),
223:                                _resources, session));
224:
225:                otApi.addDetailTab(DatabaseObjectType.VIEW, new ViewSourceTab(
226:                        i18n.SHOW_VIEW_SOURCE, stmtSep));
227:
228:                TableWithChildNodesExpander tableExp = new TableWithChildNodesExpander();
229:                tableExp
230:                        .setTableIndexExtractor(new SybaseTableIndexExtractorImpl());
231:                tableExp
232:                        .setTableTriggerExtractor(new SybaseTableTriggerExtractorImpl());
233:                otApi.addExpander(DatabaseObjectType.TABLE, tableExp);
234:
235:                otApi.addDetailTab(DatabaseObjectType.INDEX,
236:                        new DatabaseObjectInfoTab());
237:                //otApi.addDetailTab(DatabaseObjectType.INDEX, new IndexDetailsTab());        
238:                otApi.addDetailTab(DatabaseObjectType.TRIGGER,
239:                        new DatabaseObjectInfoTab());
240:                otApi.addDetailTab(DatabaseObjectType.TRIGGER_TYPE_DBO,
241:                        new DatabaseObjectInfoTab());
242:
243:                otApi.addDetailTab(DatabaseObjectType.TRIGGER,
244:                        new TriggerSourceTab(i18n.TRIGGER_HINT, stmtSep));
245:
246:                return new PluginSessionCallback() {
247:                    public void sqlInternalFrameOpened(
248:                            SQLInternalFrame sqlInternalFrame, ISession sess) {
249:                        //plugin supports Session main window only
250:                    }
251:
252:                    public void objectTreeInternalFrameOpened(
253:                            ObjectTreeInternalFrame objectTreeInternalFrame,
254:                            ISession sess) {
255:                        //plugin supports Session main window only
256:                    }
257:                };
258:            }
259:
260:            @Override
261:            protected boolean isPluginSession(ISession session) {
262:                return DialectFactory.isSyBase(session.getMetaData());
263:            }
264:
265:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.