Source Code Cross Referenced for ConnectionFileWizardPage.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » ui » ide » wizards » 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 » ESB » cbesb 1.2 » com.bostechcorp.cbesb.ui.ide.wizards 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ChainBuilder ESB
003:         *          Visual Enterprise Integration
004:         * 
005:         * Copyright (C) 2006 Bostech Corporation
006:         * 
007:         * This program is free software; you can redistribute it and/or modify it 
008:         * under the terms of the GNU General Public License as published by the 
009:         * Free Software Foundation; either version 2 of the License, or (at your option) 
010:         * 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 MERCHANTABILITY 
014:         * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
015:         * for more details.
016:         * 
017:         * You should have received a copy of the GNU General Public License along with 
018:         * this program; if not, write to the Free Software Foundation, Inc., 
019:         * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020:         *
021:         *
022:         * $Id$
023:         */
024:        package com.bostechcorp.cbesb.ui.ide.wizards;
025:
026:        import java.io.InputStream;
027:
028:        import org.eclipse.core.resources.IFile;
029:        import org.eclipse.jface.viewers.IStructuredSelection;
030:        import org.eclipse.swt.SWT;
031:        import org.eclipse.swt.widgets.Button;
032:        import org.eclipse.swt.widgets.Composite;
033:        import org.eclipse.swt.widgets.Event;
034:        import org.eclipse.ui.IWorkbench;
035:        import org.eclipse.ui.IWorkbenchPage;
036:        import org.eclipse.ui.IWorkbenchWindow;
037:        import org.eclipse.ui.PartInitException;
038:        import org.eclipse.ui.ide.IDE;
039:
040:        import com.bostechcorp.cbesb.common.i18n.I18N;
041:        import com.bostechcorp.cbesb.common.i18n.Messages;
042:        import com.bostechcorp.cbesb.common.util.etl.model.ConnectionModel;
043:        import com.bostechcorp.cbesb.common.util.etl.util.SystemUnavailableException;
044:        import com.bostechcorp.cbesb.common.util.etl.xml.ConnectionFileGenerator;
045:
046:        public class ConnectionFileWizardPage extends WizardNewFileCreationPage {
047:            private IWorkbench workbench;
048:
049:            // widgets
050:            private Button openFileCheckbox;
051:
052:            // constants
053:            private static int nameCounter = 1;
054:
055:            private String selectProjectName = "";
056:
057:            /**
058:             * Creates the page for the readme creation wizard.
059:             * 
060:             * @param workbench
061:             *            the workbench on which the page should be created
062:             * @param selection
063:             *            the current selection
064:             */
065:            public ConnectionFileWizardPage(IWorkbench workbench,
066:                    IStructuredSelection selection) {
067:                super ("NewConnectionWizard", selection); //$NON-NLS-1$
068:                this .setTitle(I18N.getString(Messages.NEW_CONNECTION_FILE));
069:                this .setDescription(I18N
070:                        .getString(Messages.NEW_CONNECTION_FILE_DES));
071:                this .workbench = workbench;
072:            }
073:
074:            /**
075:             * (non-Javadoc) Method declared on IDialogPage.
076:             */
077:            public void createControl(Composite parent) {
078:                // inherit default container and name specification widgets
079:                super .createControl(parent);
080:                Composite composite = (Composite) getControl();
081:
082:                this .setFileName("ConnectionFile" + nameCounter, "dbc"); //$NON-NLS-1$ //$NON-NLS-2$
083:                // open file for editing checkbox
084:                openFileCheckbox = new Button(composite, SWT.CHECK);
085:                openFileCheckbox.setText(I18N
086:                        .getString(Messages.IDE_OPEN_FILE_EDITOR));
087:                openFileCheckbox.setSelection(true);
088:                setPageComplete(validatePage(this .getContainerFullPath()
089:                        .toString(), "src/database/connections"));
090:
091:            }
092:
093:            /**
094:             * Creates a new file resource as requested by the user. If everything is OK
095:             * then answer true. If not, false will cause the dialog to stay open.
096:             * 
097:             * @return whether creation was successful
098:             * @see MessageFormatCreationWizard#performFinish()
099:             */
100:            public boolean finish() {
101:                // create the new file resource
102:                IFile newFile = createNewFile("dbc");
103:
104:                if (newFile == null)
105:                    return false; // ie.- creation was unsuccessful
106:
107:                ConnectionModel connectionModel = new ConnectionModel();
108:
109:                // Since the file resource was created fine, open it for editing
110:                // if requested by the user
111:                try {
112:                    ConnectionFileGenerator connectionFileGenerator = new ConnectionFileGenerator(
113:                            connectionModel, newFile.getLocation().toOSString());
114:                    connectionFileGenerator.write();
115:                    if (openFileCheckbox.getSelection()) {
116:                        IWorkbenchWindow dwindow = workbench
117:                                .getActiveWorkbenchWindow();
118:                        IWorkbenchPage page = dwindow.getActivePage();
119:                        if (page != null) {
120:                            IDE.openEditor(page, newFile, true);
121:                        }
122:                    }
123:                } catch (PartInitException e) {
124:                    e.printStackTrace();
125:                    return false;
126:                } catch (SystemUnavailableException e) {
127:                    e.printStackTrace();
128:                }
129:                nameCounter++;
130:                return true;
131:            }
132:
133:            /**
134:             * The <code>MessageFormatCreationWizardPage</code> implementation of this
135:             * <code>WizardNewFileCreationPage</code> method generates sample headings
136:             * for sections and subsections in the newly-created Readme file according
137:             * to the selections of self's checkbox widgets
138:             */
139:            protected InputStream getInitialContents() {
140:                return null;
141:            }
142:
143:            /**
144:             * (non-Javadoc) Method declared on WizardNewFileCreationPage.
145:             */
146:            protected String getNewFileLabel() {
147:                // Messages.IDE_MSGDEF_NAME
148:                return "Connection file name"; //$NON-NLS-1$
149:            }
150:
151:            public void handleEvent(Event event) {
152:                String containerPath = this .getContainerFullPath().toString();
153:                setPageComplete(validatePage(containerPath,
154:                        "src/database/connections"));
155:                if (containerPath.lastIndexOf("/") == 0) {
156:                    selectProjectName = containerPath.substring(1);
157:                } else {
158:                    selectProjectName = containerPath.substring(1,
159:                            containerPath.indexOf("/", 1));
160:                }
161:
162:            }
163:
164:            public String getSelectProjectName() {
165:                return selectProjectName;
166:            }
167:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.