Source Code Cross Referenced for DataSourceMapperMainPage.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.IOException;
027:        import java.io.InputStream;
028:
029:        import org.eclipse.core.resources.IFile;
030:        import org.eclipse.jface.dialogs.IDialogPage;
031:        import org.eclipse.jface.viewers.IStructuredSelection;
032:        import org.eclipse.swt.SWT;
033:        import org.eclipse.swt.widgets.Button;
034:        import org.eclipse.swt.widgets.Composite;
035:        import org.eclipse.swt.widgets.Event;
036:        import org.eclipse.ui.IWorkbench;
037:        import org.eclipse.ui.IWorkbenchPage;
038:        import org.eclipse.ui.IWorkbenchWindow;
039:        import org.eclipse.ui.PartInitException;
040:        import org.eclipse.ui.ide.IDE;
041:
042:        import com.bostechcorp.cbesb.common.util.etl.xml.DSMWriter;
043:        import com.bostechcorp.cbesb.common.i18n.I18N;
044:        import com.bostechcorp.cbesb.common.i18n.Messages;
045:        import com.bostechcorp.cbesb.common.util.etl.model.AbstractMessageModel.DataSourceModelTypeEnum;
046:        import com.bostechcorp.cbesb.ui.util.MsgUtil;
047:
048:        /**
049:         * The "New" wizard page allows setting the container for the new file as well
050:         * as the file name. The page will only accept file name without the extension
051:         * OR with the extension that matches the expected one (mpe).
052:         */
053:
054:        public class DataSourceMapperMainPage extends WizardNewFileCreationPage {
055:            private IWorkbench workbench;
056:
057:            // widgets
058:            private Button openFileCheckbox;
059:
060:            // constants
061:            private static int nameCounter = 1;
062:
063:            String selectProjectName = "";
064:
065:            /*
066:             * private Text targetfileNameText; private Text sourcefileNameText; private
067:             * IFile file; private ISelection selection; private String sourcefilePath =
068:             * ""; private String targetfilePath = "";
069:             */
070:            /**
071:             * Creates the page for the readme creation wizard.
072:             * 
073:             * @param workbench
074:             *            the workbench on which the page should be created
075:             * @param selection
076:             *            the current selection
077:             */
078:            public DataSourceMapperMainPage(IWorkbench workbench,
079:                    IStructuredSelection selection) {
080:                super ("NewDataSourceMapperWizard", selection);
081:                setTitle(I18N.getString(Messages.NEW_DATA_SOURCE_MAPPER_FILE));
082:                setDescription(I18N
083:                        .getString(Messages.NEW_DATA_SOURCE_MAPPER_FILE_DES));
084:                this .workbench = workbench;
085:            }
086:
087:            /**
088:             * @see IDialogPage#createControl(Composite)
089:             */
090:            public void createControl(Composite parent) {
091:                // inherit default container and name specification widgets
092:                super .createControl(parent);
093:                Composite composite = (Composite) getControl();
094:
095:                this .setFileName("DataSourceMapper" + nameCounter, "dsm"); //$NON-NLS-1$ //$NON-NLS-2$
096:
097:                // open file for editing checkbox
098:                openFileCheckbox = new Button(composite, SWT.CHECK);
099:                openFileCheckbox.setText(I18N
100:                        .getString(Messages.IDE_OPEN_FILE_DONE)); //$NON-NLS-1$
101:                openFileCheckbox.setSelection(true);
102:
103:                setPageComplete(validatePage(this .getContainerFullPath()
104:                        .toString(), "src/database/dataSourceMaps"));
105:            }
106:
107:            /**
108:             * Creates a new file resource as requested by the user. If everything is OK
109:             * then answer true. If not, false will cause the dialog to stay open.
110:             * @param name 
111:             * @param dbfile 
112:             * 
113:             * @return whether creation was successful
114:             * @see MessageFormatCreationWizard#performFinish()
115:             */
116:            //
117:            public boolean finish(String connectionFile, String modelType,
118:                    String name) {
119:                // create the new file resource
120:                IFile newFile = createNewFile("dsm");
121:                if (newFile == null)
122:                    return false; // ie.- creation was unsuccessful
123:
124:                String fileDsmName = newFile.getLocation().toString().replace(
125:                        "\\", "/");
126:
127:                // TODO:Fill the default text
128:                try {
129:                    if (openFileCheckbox.getSelection()) {
130:                        IWorkbenchWindow dwindow = this .workbench
131:                                .getActiveWorkbenchWindow();
132:                        IWorkbenchPage page = dwindow.getActivePage();
133:                        String dbfile = connectionFile.replace(".dbc", ".dbd");
134:                        if (page != null) {
135:                            DSMWriter.createNewDSMFile(fileDsmName,
136:                                    connectionFile, dbfile,
137:                                    DataSourceModelTypeEnum.valueOf(modelType),
138:                                    name);
139:                            IDE.openEditor(page, newFile, true);
140:                        }
141:                    }
142:                } catch (PartInitException e) {
143:                    MsgUtil.warningMsg(e.toString());
144:                    e.printStackTrace();
145:                    return false;
146:                } catch (IOException e) {
147:                    MsgUtil.warningMsg(e.toString());
148:                    e.printStackTrace();
149:                    return false;
150:                }
151:                nameCounter++;
152:                return true;
153:            }
154:
155:            /**
156:             * The <code>MessageFormatCreationWizardPage</code> implementation of this
157:             * <code>WizardNewFileCreationPage</code> method generates sample headings
158:             * for sections and subsections in the newly-created Readme file according
159:             * to the selections of self's checkbox widgets
160:             */
161:            protected InputStream getInitialContents() {
162:                return null;
163:            }
164:
165:            @Override
166:            public boolean canFlipToNextPage() {
167:                // TODO Auto-generated method stub
168:                return super 
169:                        .canFlipToNextPagebyName("src/database/dataSourceMaps");
170:            }
171:
172:            public void handleEvent(Event event) {
173:                String containerPath = this .getContainerFullPath().toString();
174:                setPageComplete(validatePage(containerPath,
175:                        "src/database/dataSourceMaps"));
176:                if (((DataSourceMapperSecondPage) this .getNextPage())
177:                        .getTextName() != null)
178:                    ((DataSourceMapperSecondPage) this .getNextPage())
179:                            .getTextName().setText(this .getFileName());
180:                if (containerPath.lastIndexOf("/") == 0) {
181:                    selectProjectName = containerPath.substring(1);
182:                } else {
183:                    selectProjectName = containerPath.substring(1,
184:                            containerPath.indexOf("/", 1));
185:                }
186:            }
187:
188:            public String getSelectProjectName() {
189:                return selectProjectName;
190:            }
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.