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


001:        package net.sourceforge.squirrel_sql.plugins.refactoring;
002:
003:        /*
004:         * Copyright (C) 2006 Rob Manning
005:         * manningr@users.sourceforge.net
006:         *
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License
009:         * as published by the Free Software Foundation; either version 2
010:         * of the License, or any later version.
011:         *
012:         * This program is distributed in the hope that it will be useful,
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015:         * GNU General Public License for more details.
016:         *
017:         * You should have received a copy of the GNU General Public License
018:         * along with this program; if not, write to the Free Software
019:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
020:         */
021:        import javax.swing.JMenu;
022:        import javax.swing.JMenuItem;
023:
024:        import net.sourceforge.squirrel_sql.client.IApplication;
025:        import net.sourceforge.squirrel_sql.client.action.ActionCollection;
026:        import net.sourceforge.squirrel_sql.client.gui.session.ObjectTreeInternalFrame;
027:        import net.sourceforge.squirrel_sql.client.gui.session.SQLInternalFrame;
028:        import net.sourceforge.squirrel_sql.client.plugin.DefaultSessionPlugin;
029:        import net.sourceforge.squirrel_sql.client.plugin.PluginException;
030:        import net.sourceforge.squirrel_sql.client.plugin.PluginResources;
031:        import net.sourceforge.squirrel_sql.client.plugin.PluginSessionCallback;
032:        import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI;
033:        import net.sourceforge.squirrel_sql.client.session.ISession;
034:        import net.sourceforge.squirrel_sql.fw.gui.GUIUtils;
035:        import net.sourceforge.squirrel_sql.fw.sql.DatabaseObjectType;
036:        import net.sourceforge.squirrel_sql.plugins.refactoring.actions.AddColumnAction;
037:        import net.sourceforge.squirrel_sql.plugins.refactoring.actions.AddPrimaryKeyAction;
038:        import net.sourceforge.squirrel_sql.plugins.refactoring.actions.DropPrimaryKeyAction;
039:        import net.sourceforge.squirrel_sql.plugins.refactoring.actions.DropSelectedTablesAction;
040:        import net.sourceforge.squirrel_sql.plugins.refactoring.actions.ModifyColumnAction;
041:        import net.sourceforge.squirrel_sql.plugins.refactoring.actions.RemoveColumnAction;
042:
043:        /**
044:         * The Refactoring plugin class.
045:         */
046:        public class RefactoringPlugin extends DefaultSessionPlugin {
047:            private interface IMenuResourceKeys {
048:                String REFACTORING = "refactoring";
049:            }
050:
051:            private PluginResources _resources;
052:
053:            /**
054:             * Return the internal name of this plugin.
055:             *
056:             * @return  the internal name of this plugin.
057:             */
058:            public String getInternalName() {
059:                return "refactoring";
060:            }
061:
062:            /**
063:             * Return the descriptive name of this plugin.
064:             *
065:             * @return  the descriptive name of this plugin.
066:             */
067:            public String getDescriptiveName() {
068:                return "Refactoring Plugin";
069:            }
070:
071:            /**
072:             * Returns the current version of this plugin.
073:             *
074:             * @return  the current version of this plugin.
075:             */
076:            public String getVersion() {
077:                return "0.12";
078:            }
079:
080:            /**
081:             * Returns the authors name.
082:             *
083:             * @return  the authors name.
084:             */
085:            public String getAuthor() {
086:                return "Rob Manning";
087:            }
088:
089:            /**
090:             * Returns the name of the change log for the plugin. This should
091:             * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
092:             * directory.
093:             *
094:             * @return	the changelog file name or <TT>null</TT> if plugin doesn't have
095:             * 			a change log.
096:             */
097:            public String getChangeLogFileName() {
098:                return "changes.txt";
099:            }
100:
101:            /**
102:             * Returns the name of the Help file for the plugin. This should
103:             * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
104:             * directory.
105:             *
106:             * @return	the Help file name or <TT>null</TT> if plugin doesn't have
107:             * 			a help file.
108:             */
109:            public String getHelpFileName() {
110:                return "readme.html";
111:            }
112:
113:            /**
114:             * Returns the name of the Licence file for the plugin. This should
115:             * be a text or HTML file residing in the <TT>getPluginAppSettingsFolder</TT>
116:             * directory.
117:             *
118:             * @return	the Licence file name or <TT>null</TT> if plugin doesn't have
119:             * 			a licence file.
120:             */
121:            public String getLicenceFileName() {
122:                return "licence.txt";
123:            }
124:
125:            /**
126:             * @return	Comma separated list of contributors.
127:             */
128:            public String getContributors() {
129:                return "";
130:            }
131:
132:            /**
133:             * Create preferences panel for the Global Preferences dialog.
134:             *
135:             * @return  Preferences panel.
136:             */
137:            /*
138:            public IGlobalPreferencesPanel[] getGlobalPreferencePanels() {
139:                SQLScriptPreferencesTab tab = new SQLScriptPreferencesTab();
140:                return new IGlobalPreferencesPanel[] {tab};
141:            }
142:             */
143:
144:            /**
145:             * Initialize this plugin.
146:             */
147:            public synchronized void initialize() throws PluginException {
148:                super .initialize();
149:                IApplication app = getApplication();
150:
151:                _resources = new SQLPluginResources(
152:                        "net.sourceforge.squirrel_sql.plugins.refactoring.refactoring",
153:                        this );
154:
155:                ActionCollection coll = app.getActionCollection();
156:                coll.add(new AddColumnAction(app, _resources));
157:                coll.add(new ModifyColumnAction(app, _resources));
158:                coll.add(new RemoveColumnAction(app, _resources));
159:                coll.add(new AddPrimaryKeyAction(app, _resources));
160:                coll.add(new DropPrimaryKeyAction(app, _resources));
161:                coll.add(new DropSelectedTablesAction(app, _resources));
162:            }
163:
164:            public boolean allowsSessionStartedInBackground() {
165:                return true;
166:            }
167:
168:            /**
169:             * Called when a session started. Add commands to popup menu
170:             * in object tree.
171:             *
172:             * @param   session	 The session that is starting.
173:             *
174:             * @return  <TT>true</TT> to indicate that this plugin is
175:             *		  applicable to passed session.
176:             */
177:            public PluginSessionCallback sessionStarted(final ISession session) {
178:
179:                GUIUtils.processOnSwingEventThread(new Runnable() {
180:                    public void run() {
181:                        addActionsToPopup(session);
182:                    }
183:                });
184:
185:                PluginSessionCallback ret = new PluginSessionCallback() {
186:                    public void sqlInternalFrameOpened(
187:                            SQLInternalFrame sqlInternalFrame, ISession sess) {
188:                        //ActionCollection coll = sess.getApplication().getActionCollection();
189:                        //sqlInternalFrame.addSeparatorToToolbar();
190:                        //sqlInternalFrame.addToToolbar(coll.get(CreateTableOfCurrentSQLAction.class));
191:
192:                        //sqlInternalFrame.addToToolsPopup("sql2table", coll.get(CreateTableOfCurrentSQLAction.class));
193:                        //sqlInternalFrame.addToToolsPopup("sql2ins", coll.get(CreateDataScriptOfCurrentSQLAction.class));
194:                    }
195:
196:                    public void objectTreeInternalFrameOpened(
197:                            ObjectTreeInternalFrame objectTreeInternalFrame,
198:                            ISession sess) {
199:                        //ActionCollection coll = sess.getApplication().getActionCollection();
200:                        //objectTreeInternalFrame.getObjectTreeAPI().addToPopup(DatabaseObjectType.TABLE, coll.get(CreateTableScriptAction.class));
201:                        //objectTreeInternalFrame.getObjectTreeAPI().addToPopup(DatabaseObjectType.TABLE, coll.get(CreateSelectScriptAction.class));
202:                        //objectTreeInternalFrame.getObjectTreeAPI().addToPopup(DatabaseObjectType.TABLE, coll.get(DropTableScriptAction.class));
203:                        //objectTreeInternalFrame.getObjectTreeAPI().addToPopup(DatabaseObjectType.TABLE, coll.get(CreateDataScriptAction.class));
204:                        //objectTreeInternalFrame.getObjectTreeAPI().addToPopup(DatabaseObjectType.TABLE, coll.get(CreateTemplateDataScriptAction.class));
205:                    }
206:                };
207:
208:                return ret;
209:            }
210:
211:            private void addActionsToPopup(ISession session) {
212:                ActionCollection coll = getApplication().getActionCollection();
213:
214:                IObjectTreeAPI api = session
215:                        .getObjectTreeAPIOfActiveSessionWindow();
216:
217:                //session.getApplication().addToMenu(MainFrameMenuBar, menu)
218:                JMenu tableObjectMenu = _resources
219:                        .createMenu(IMenuResourceKeys.REFACTORING);
220:                JMenu columnMenu = new JMenu("Column");
221:                JMenuItem addColItem = new JMenuItem("Add Column");
222:                addColItem.setAction(coll.get(AddColumnAction.class));
223:                JMenuItem removeColItem = new JMenuItem("Drop Column");
224:                removeColItem.setAction(coll.get(RemoveColumnAction.class));
225:                JMenuItem modifyMenuItem = new JMenuItem("Modify Column");
226:                modifyMenuItem.setAction(coll.get(ModifyColumnAction.class));
227:
228:                columnMenu.add(addColItem);
229:                columnMenu.add(modifyMenuItem);
230:                columnMenu.add(removeColItem);
231:
232:                JMenuItem dropTableItem = new JMenuItem("Drop Table");
233:                dropTableItem.setAction(coll
234:                        .get(DropSelectedTablesAction.class));
235:                // Not yet implemented
236:                //JMenuItem addIndexItem = new JMenuItem("Add Index");
237:                //JMenuItem dropIndexItem = new JMenuItem("Drop Index");
238:                JMenuItem addPrimaryKeyItem = new JMenuItem("Add Primary Key");
239:                addPrimaryKeyItem
240:                        .setAction(coll.get(AddPrimaryKeyAction.class));
241:                JMenuItem dropPrimaryKeyItem = new JMenuItem("Drop Primary Key");
242:                dropPrimaryKeyItem.setAction(coll
243:                        .get(DropPrimaryKeyAction.class));
244:                // Not yet implemented
245:                //JMenuItem addForeignKeyItem = new JMenuItem("Add Foreign Key");
246:                //JMenuItem dropForeignKeyItem = new JMenuItem("Drop Foreign Key");
247:                //JMenuItem enableConstraintsItem = new JMenuItem("Enable Constraints");
248:                //JMenuItem disableConstraintsItem = new JMenuItem("Disable Constraints");
249:
250:                JMenu tableMenu = new JMenu("Table");
251:
252:                tableMenu.add(dropTableItem);
253:                tableMenu.add(addPrimaryKeyItem);
254:                tableMenu.add(dropPrimaryKeyItem);
255:                // Not yet implemented
256:                //tableMenu.add(addIndexItem);
257:                //tableMenu.add(dropIndexItem);
258:                //tableMenu.add(addForeignKeyItem);
259:                //tableMenu.add(dropForeignKeyItem);
260:                //tableMenu.add(enableConstraintsItem);
261:                //tableMenu.add(disableConstraintsItem);
262:
263:                tableObjectMenu.add(tableMenu);
264:                tableObjectMenu.add(columnMenu);
265:
266:                api.addToPopup(DatabaseObjectType.TABLE, tableObjectMenu);
267:            }
268:
269:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.