Source Code Cross Referenced for ProjectWizardPage.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:        package com.bostechcorp.cbesb.ui.ide.wizards;
002:
003:        import java.io.File;
004:        import java.io.FileOutputStream;
005:        import java.io.IOException;
006:        import java.io.OutputStream;
007:        import java.lang.reflect.InvocationTargetException;
008:        import java.util.ArrayList;
009:        import java.util.List;
010:
011:        import org.eclipse.core.resources.IContainer;
012:        import org.eclipse.core.resources.IFile;
013:        import org.eclipse.core.resources.IFolder;
014:        import org.eclipse.core.resources.IProject;
015:        import org.eclipse.core.resources.ResourcesPlugin;
016:        import org.eclipse.core.runtime.CoreException;
017:        import org.eclipse.core.runtime.IPath;
018:        import org.eclipse.core.runtime.IProgressMonitor;
019:        import org.eclipse.core.runtime.NullProgressMonitor;
020:        import org.eclipse.core.runtime.Platform;
021:        import org.eclipse.core.runtime.SubProgressMonitor;
022:        import org.eclipse.jdt.core.IClasspathEntry;
023:        import org.eclipse.jdt.core.IJavaProject;
024:        import org.eclipse.jdt.core.JavaCore;
025:        import org.eclipse.jdt.core.JavaModelException;
026:        import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
027:        import org.eclipse.jdt.internal.ui.wizards.ClassPathDetector;
028:        import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages;
029:        import org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage;
030:        import org.eclipse.jface.operation.IRunnableWithProgress;
031:
032:        import com.bostechcorp.cbesb.common.util.EsbPathHelper;
033:        import com.bostechcorp.cbesb.common.util.FileUtil;
034:        import com.bostechcorp.cbesb.common.util.project.ProjectBean;
035:        import com.bostechcorp.cbesb.common.util.project.ProjectInfoDocument;
036:        import com.bostechcorp.cbesb.common.util.project.ProjectInfoParser;
037:        import com.bostechcorp.cbesb.ui.ide.Activator;
038:        import com.bostechcorp.cbesb.ui.util.tagged.mdl.TaggedMDLFileDocument;
039:        import com.bostechcorp.cbesb.ui.util.tagged.mdl.TagggedMDLListBean;
040:
041:        /**
042:         * Base class for New Project creation wizards. Derived from
043:         * org.eclipse.jdt.internal.ui.wizards.NewProjectCreationWizardPage
044:         * 
045:         */
046:        public abstract class ProjectWizardPage extends
047:                JavaCapabilityConfigurationPage {
048:            /** Description of the Field */
049:            protected boolean fCanRemoveContent;
050:
051:            /** Description of the Field */
052:            protected IProject fCurrProject;
053:
054:            /** Description of the Field */
055:            protected IPath fCurrProjectLocation;
056:
057:            /** Description of the Field */
058:            protected WizardNewProjectCreationPage fMainPage;
059:
060:            public static String IDE_PACK = "com.bostechcorp.cbesb.ui.ide";
061:
062:            public static String X12_BUILD_PACK = "cbesb.build/installDir/formats/x12";
063:
064:            public static String HL7_BUILD_PACK = "cbesb.build/installDir/formats/hl7";
065:
066:            protected JBISAProjectCreationWizardSecondPage secondPage = null;
067:
068:            /**
069:             * Constructor for the ProjectWizardPage object
070:             * 
071:             * @param mainPage
072:             *            Description of the Parameter
073:             */
074:            public ProjectWizardPage(WizardNewProjectCreationPage mainPage) {
075:                super ();
076:                this .fMainPage = mainPage;
077:                this .fCurrProjectLocation = null;
078:                this .fCurrProject = null;
079:                this .fCanRemoveContent = false;
080:            }
081:
082:            /** Called from the wizard on cancel. */
083:            public void performCancel() {
084:                this .removeProject();
085:            }
086:
087:            /**
088:             * Called from the wizard on finish.
089:             * 
090:             * @param monitor
091:             *            Description of the Parameter
092:             * @exception CoreException
093:             *                Description of the Exception
094:             * @exception InterruptedException
095:             *                Description of the Exception
096:             */
097:            public void performFinish(IProgressMonitor monitor)
098:                    throws CoreException, InterruptedException {
099:                try {
100:                    monitor
101:                            .beginTask(
102:                                    NewWizardMessages.JavaProjectWizardSecondPage_operation_create,
103:                                    3);//$NON-NLS-1$
104:                    if (fCurrProject == null) {
105:                        updateProject(true, new SubProgressMonitor(monitor, 1));
106:                    }
107:                    configureJavaProject(new SubProgressMonitor(monitor, 2));
108:                    if (secondPage != null)
109:                        secondPage.createJBIProjectInfoFile(fCurrProject);
110:
111:                } catch (IOException ex) {
112:                    //TODO
113:                } finally {
114:                    monitor.done();
115:                    fCurrProject = null;
116:                }
117:            }
118:
119:            /**
120:             * Sets the visible attribute of the ProjectWizardPage object
121:             * 
122:             * @param visible
123:             *            The new visible value
124:             */
125:            public void setVisible(boolean visible) {
126:                if (visible) {
127:                    this .changeToNewProject();
128:                } else {
129:                    // this.removeProject();
130:                }
131:                super .setVisible(visible);
132:            }
133:
134:            /** Description of the Method */
135:            protected void changeToNewProject() {
136:                IProject newProjectHandle = fMainPage.getProjectHandle();
137:                IPath newProjectLocation = fMainPage.getLocationPath();
138:
139:                if (fMainPage.useDefaults()) {
140:                    fCanRemoveContent = !newProjectLocation.append(
141:                            fMainPage.getProjectName()).toFile().exists();
142:                } else {
143:                    fCanRemoveContent = !newProjectLocation.toFile().exists();
144:                }
145:
146:                final boolean initialize = !(newProjectHandle
147:                        .equals(fCurrProject) && newProjectLocation
148:                        .equals(fCurrProjectLocation));
149:
150:                IRunnableWithProgress op = new IRunnableWithProgress() {
151:                    public void run(IProgressMonitor monitor)
152:                            throws InvocationTargetException,
153:                            InterruptedException {
154:                        try {
155:                            updateProject(initialize, monitor);
156:                        } catch (CoreException e) {
157:                            throw new InvocationTargetException(e);
158:                        }
159:                    }
160:                };
161:
162:                try {
163:                    this .getContainer().run(false, true, op);
164:                } catch (InvocationTargetException e) {
165:                    String title = NewWizardMessages.JavaProjectWizard_op_error_title;//$NON-NLS-1$
166:                    String message = NewWizardMessages.JavaProjectWizard_op_error_create_message;//$NON-NLS-1$
167:                    ExceptionHandler.handle(e, getShell(), title, message);
168:                } catch (InterruptedException e) {
169:                    //TODO
170:                    // cancel pressed
171:                }
172:            }
173:
174:            /**
175:             * Add necessary source and libraries
176:             * 
177:             * @param entries
178:             * @return
179:             * @throws CoreException
180:             */
181:            protected abstract IClasspathEntry[] checkEntries(
182:                    IClasspathEntry[] entries) throws CoreException;
183:
184:            protected abstract String[] getBuilders();
185:
186:            /** Description of the Method */
187:            protected void removeProject() {
188:                if (fCurrProject == null || !fCurrProject.exists()) {
189:                    return;
190:                }
191:
192:                IRunnableWithProgress op = new IRunnableWithProgress() {
193:                    public void run(IProgressMonitor monitor)
194:                            throws InvocationTargetException,
195:                            InterruptedException {
196:                        boolean noProgressMonitor = Platform.getLocation()
197:                                .equals(fCurrProjectLocation);
198:                        if (monitor == null || noProgressMonitor) {
199:                            monitor = new NullProgressMonitor();
200:                        }
201:                        monitor
202:                                .beginTask(
203:                                        NewWizardMessages.JavaProjectWizardSecondPage_operation_remove,
204:                                        3);//$NON-NLS-1$
205:
206:                        try {
207:                            fCurrProject.delete(fCanRemoveContent, false,
208:                                    monitor);
209:                        } catch (CoreException e) {
210:                            throw new InvocationTargetException(e);
211:                        } finally {
212:                            monitor.done();
213:                            fCurrProject = null;
214:                            fCanRemoveContent = false;
215:                        }
216:                    }
217:                };
218:
219:                try {
220:                    this .getContainer().run(false, true, op);
221:                } catch (InvocationTargetException e) {
222:                    String title = NewWizardMessages.JavaProjectWizardSecondPage_error_remove_title;//$NON-NLS-1$
223:                    String message = NewWizardMessages.JavaProjectWizardSecondPage_error_remove_message;//$NON-NLS-1$
224:                    ExceptionHandler.handle(e, getShell(), title, message);
225:                } catch (InterruptedException e) {
226:                    //TODO
227:                    // cancel pressed
228:                }
229:            }
230:
231:            /**
232:             * Description of the Method
233:             * 
234:             * @param initialize
235:             *            Description of the Parameter
236:             * @param monitor
237:             *            Description of the Parameter
238:             * @exception CoreException
239:             *                Description of the Exception
240:             * @exception InterruptedException
241:             *                Description of the Exception
242:             */
243:            protected void updateProject(boolean initialize,
244:                    IProgressMonitor monitor) throws CoreException,
245:                    InterruptedException {
246:                fCurrProject = fMainPage.getProjectHandle();
247:                fCurrProjectLocation = fMainPage.getLocationPath();
248:                boolean noProgressMonitor = !initialize && fCanRemoveContent;
249:
250:                if (monitor == null || noProgressMonitor) {
251:                    monitor = new NullProgressMonitor();
252:                }
253:                try {
254:                    monitor
255:                            .beginTask(
256:                                    NewWizardMessages.JavaProjectWizardSecondPage_operation_initialize,
257:                                    2);//$NON-NLS-1$
258:
259:                    createProject(fCurrProject, fCurrProjectLocation,
260:                            new SubProgressMonitor(monitor, 1));
261:
262:                    if (initialize) {
263:                        IClasspathEntry[] entries = null;
264:                        IPath outputPath = null;
265:                        IJavaProject javaProject = JavaCore
266:                                .create(fCurrProject);
267:
268:                        if (fCurrProjectLocation.toFile().exists()
269:                                && !Platform.getLocation().equals(
270:                                        fCurrProjectLocation)) {
271:                            // detect classpath
272:                            if (!fCurrProject.getFile(".classpath").exists()//$NON-NLS-1$
273:                            ) {
274:                                // if .classpath exists noneed to look for files
275:                                ClassPathDetector detector = new ClassPathDetector(
276:                                        fCurrProject.getProject(), monitor);
277:                                entries = detector.getClasspath();
278:                                outputPath = detector.getOutputLocation();
279:                            }
280:                        }
281:
282:                        entries = this .checkEntries(entries);
283:                        // make "bin" as output Location
284:                        IFolder outputFolder = javaProject.getProject()
285:                                .getFolder("/bin");
286:                        if (!outputFolder.exists()) {
287:                            outputFolder.create(true, true, null);
288:                        }
289:                        outputPath = outputFolder.getFullPath();
290:
291:                        ArrayList cpEntries = new ArrayList();
292:                        ArrayList srcEntries = customizePreDefinedResourceStructure(
293:                                fCurrProject,
294:                                new SubProgressMonitor(monitor, 1));
295:                        if (srcEntries != null)
296:                            cpEntries.addAll(srcEntries);
297:                        for (int i = 0; i < entries.length; i++) {
298:                            IClasspathEntry entry = entries[i];
299:                            cpEntries.add(entry);
300:                        }
301:                        IClasspathEntry[] cpe = (IClasspathEntry[]) cpEntries
302:                                .toArray(new IClasspathEntry[cpEntries.size()]);
303:                        //
304:                        init(javaProject, outputPath, cpe, false);
305:
306:                    }
307:                    monitor.worked(1);
308:                } finally {
309:                    monitor.done();
310:                }
311:            }
312:
313:            /*
314:             * To customize your own page behavor
315:             * 
316:             * @param monitor parent's monitor. @exception CoreException Description of
317:             * the Exception @exception InterruptedException Description of the
318:             * Exception
319:             */
320:            protected ArrayList customizePreDefinedResourceStructure(
321:                    IProject javaProject, IProgressMonitor monitor)
322:                    throws CoreException, InterruptedException {
323:                return null;
324:            }
325:
326:            protected void createInitialContent(IProject project,
327:                    IProgressMonitor monitor) throws CoreException,
328:                    JavaModelException, IOException {
329:                // createJBIXMLfile(project);
330:                createFolder(project.getFolder("/build/"));
331:                createFolder(project.getFolder("/build/fsm/"));
332:                createFolder(project.getFolder("/build/generated/"));
333:                createFolder(project.getFolder("/build/generated/fsm/"));
334:                createFolder(project.getFolder("/build/generated/map/"));
335:                createFolder(project.getFolder("/dist/"));
336:                createFolder(project.getFolder("/lib/"));
337:                createFolder(project.getFolder("/lib/generated"));
338:                createFolder(project.getFolder("/lib/optional"));
339:                // createFolder(project.getFolder("/src/java/ucm"));
340:                createBuildMapFile(project, monitor);
341:                createBuildUcmFile(project, monitor);
342:                createBuildMdlFile(project, monitor);
343:                createBuildFile(project, monitor);
344:                // createX12zipFile(project,monitor);
345:                project.refreshLocal(2, new SubProgressMonitor(monitor, 1));
346:
347:            }
348:
349:            protected void createFolder(IFolder folder) throws CoreException {
350:                IContainer parent = folder.getParent();
351:                if (parent != null && !parent.exists()
352:                        && parent instanceof  IFolder) {
353:                    createFolder((IFolder) parent);
354:                }
355:                folder.create(true, true, null);
356:            }
357:
358:            protected void createBuildMapFile(IProject project,
359:                    IProgressMonitor monitor) throws CoreException,
360:                    JavaModelException, IOException {
361:                String buildMapFilePath = project.getProject().getLocation()
362:                        .append("/build/").append("build_map.xml").toOSString();
363:                File buildMapFile = new File(buildMapFilePath);
364:                if (!buildMapFile.exists())
365:                    buildMapFile.createNewFile();
366:                String baseDir = getConfigBaseDir();
367:                File tempFile = new File(baseDir
368:                        + "/template/map/build_map.xml");
369:                FileUtil.copy(tempFile, buildMapFile);
370:                // project.refreshLocal(2, new SubProgressMonitor(monitor, 1));
371:
372:            }
373:
374:            protected void createBuildUcmFile(IProject project,
375:                    IProgressMonitor monitor) throws CoreException,
376:                    JavaModelException, IOException {
377:                String buildFilePath = project.getProject().getLocation()
378:                        .append("/src/java").append("build.xml").toOSString();
379:                File buildFile = new File(buildFilePath);
380:                if (!buildFile.exists())
381:                    buildFile.createNewFile();
382:                String baseDir = getConfigBaseDir();
383:                File tempFile = new File(baseDir + "/template/ucm/build.xml");
384:                FileUtil.copy(tempFile, buildFile);
385:                // project.refreshLocal(2, new SubProgressMonitor(monitor, 1));
386:
387:            }
388:
389:            protected void createBuildMdlFile(IProject project,
390:                    IProgressMonitor monitor) throws CoreException,
391:                    JavaModelException, IOException {
392:                String buildFilePath = project.getProject().getLocation()
393:                        .append("/build/").append("build_mdl.xml").toOSString();
394:                File buildFile = new File(buildFilePath);
395:                if (!buildFile.exists())
396:                    buildFile.createNewFile();
397:                String baseDir = getConfigBaseDir();
398:                File tempFile = new File(baseDir
399:                        + "/template/fsm/build_mdl.xml");
400:                FileUtil.copy(tempFile, buildFile);
401:                // project.refreshLocal(2, new SubProgressMonitor(monitor, 1));
402:
403:            }
404:
405:            protected void createBuildFile(IProject project,
406:                    IProgressMonitor monitor) throws CoreException,
407:                    JavaModelException, IOException {
408:                String buildFilePath = project.getProject().getLocation()
409:                        .append("/build/").append("build.xml").toOSString();
410:                File buildFile = new File(buildFilePath);
411:                if (!buildFile.exists())
412:                    buildFile.createNewFile();
413:                String baseDir = getConfigBaseDir();
414:                File tempFile = new File(baseDir + "/template/build.xml");
415:                FileUtil.copy(tempFile, buildFile);
416:                // project.refreshLocal(2, new SubProgressMonitor(monitor, 1));
417:
418:            }
419:
420:            protected void createX12zipFile(IProject project,
421:                    IProgressMonitor monitor) throws CoreException,
422:                    JavaModelException, IOException {
423:                String tempDir = getX12BaseDir();
424:                String zipFilePath = project.getProject().getLocation().append(
425:                        "/src/formats/x12/").toOSString();
426:                File dir = new File(tempDir);
427:                File[] files = dir.listFiles();
428:                for (int i = 0; i < files.length; i++) {
429:                    File tempFile = files[i];
430:                    if (tempFile.isFile()
431:                            && tempFile.getName().endsWith(".zip")) {
432:                        String fileName = tempFile.getName();
433:                        File zipFile = new File(zipFilePath + fileName);
434:                        if (!zipFile.exists())
435:                            zipFile.createNewFile();
436:                        FileUtil.copy(tempFile, zipFile);
437:                    }
438:                }
439:
440:                // project.refreshLocal(2, new SubProgressMonitor(monitor, 1));
441:
442:            }
443:
444:            protected void createHL7zipFile(IProject project,
445:                    IProgressMonitor monitor) throws CoreException,
446:                    JavaModelException, IOException {
447:                String tempDir = getHL7BaseDir();
448:                String zipFilePath = project.getProject().getLocation().append(
449:                        "/src/formats/hl7/").toOSString();
450:                File dir = new File(tempDir);
451:                File[] files = dir.listFiles();
452:                for (int i = 0; i < files.length; i++) {
453:                    File tempFile = files[i];
454:                    if (tempFile.isFile()
455:                            && tempFile.getName().endsWith(".zip")) {
456:                        String fileName = tempFile.getName();
457:                        File zipFile = new File(zipFilePath + fileName);
458:                        if (!zipFile.exists())
459:                            zipFile.createNewFile();
460:                        FileUtil.copy(tempFile, zipFile);
461:                    }
462:                }
463:
464:                // project.refreshLocal(2, new SubProgressMonitor(monitor, 1));
465:
466:            }
467:
468:            protected void createDerbyUserDBFile(IProject project,
469:                    IProgressMonitor monitor) throws CoreException,
470:                    JavaModelException, IOException {
471:                String tempDir = getConfigBaseDir();
472:                // for java
473:                String srcDir = tempDir + "/template/database";
474:                String destDir = project.getProject().getLocation().append(
475:                        "/src/database/").toOSString();
476:                File srcDirFile = new File(srcDir);
477:                File destDirFile = new File(destDir);
478:                FileUtil.buildDirectory(destDirFile);
479:                if (srcDirFile.exists()) {
480:                    copyDir(srcDirFile, destDirFile, ".drv");
481:                    copyDir(srcDirFile, destDirFile, ".dbc");
482:
483:                }
484:
485:                File debrbyJarFile = new File(EsbPathHelper.getCbesbHomeDir()
486:                        + "/db/derby.jar");
487:
488:                File destDebrbyJarFile = new File(project.getProject()
489:                        .getLocation().append("/lib/optional").toOSString()
490:                        + "/derby.jar");
491:
492:                FileUtil.copy(debrbyJarFile, destDebrbyJarFile);
493:
494:            }
495:
496:            protected void createCommonCustomCodeFile(IProject project,
497:                    IProgressMonitor monitor) throws CoreException,
498:                    JavaModelException, IOException {
499:                String tempDir = getCustomCodeDir();
500:                // for java
501:                String javaDir = tempDir + "/java";
502:                String destDir = project.getProject().getLocation().append(
503:                        "/src/java/").toOSString();
504:                File javaDirFile = new File(javaDir);
505:                File destDirFile = new File(destDir);
506:                FileUtil.buildDirectory(destDirFile);
507:                if (javaDirFile.exists())
508:                    copyDir(javaDirFile, destDirFile, ".java");
509:
510:                // for groovy
511:
512:                String groovyDir = tempDir + "/groovy";
513:                String destScriptDir = project.getProject().getLocation()
514:                        .append("/src/script/").toOSString();
515:                File groovyDirFile = new File(groovyDir);
516:                File destScriptDirFile = new File(destScriptDir);
517:                FileUtil.buildDirectory(destScriptDirFile);
518:
519:                if (groovyDirFile.exists())
520:                    copyDir(groovyDirFile, destScriptDirFile, ".groovy");
521:
522:                // project.refreshLocal(2, new SubProgressMonitor(monitor, 1));
523:
524:            }
525:
526:            private void copyDir(File srcDir, File destDir, String fileEndPorfix)
527:                    throws IOException {
528:                File[] files = srcDir.listFiles();
529:                for (int i = 0; i < files.length; i++) {
530:                    File tempFile = files[i];
531:                    String fileName = tempFile.getName();
532:                    // System.out.println(fileName);
533:                    File destFile = new File(destDir.getAbsolutePath() + "/"
534:                            + fileName);
535:                    if (tempFile.isFile()
536:                            && tempFile.getName().endsWith(fileEndPorfix)) {
537:                        if (!destFile.exists())
538:                            destFile.createNewFile();
539:                        FileUtil.copy(tempFile, destFile);
540:                    } else if (tempFile.isDirectory()) {
541:                        if (!destFile.exists())
542:                            destFile.mkdirs();
543:                        copyDir(tempFile, destFile, fileEndPorfix);
544:                    }
545:                }
546:            }
547:
548:            protected void addSourceFolder(IProject project, ArrayList entries,
549:                    String srcPath) throws CoreException {
550:                IFolder folder = project.getProject().getFolder(srcPath);
551:                createFolder(folder);
552:                entries.add(JavaCore.newSourceEntry(project.getFullPath()
553:                        .append(srcPath)));
554:            }
555:
556:            protected void createESBProjectInfoFile(IProject project,
557:                    IProgressMonitor monitor) throws CoreException,
558:                    JavaModelException, IOException {
559:                String buildFilePath = project.getProject().getLocation()
560:                        .append("/projectinfo.xml").toOSString();
561:                File buildFile = new File(buildFilePath);
562:                if (!buildFile.exists())
563:                    buildFile.createNewFile();
564:                ProjectInfoDocument document = new ProjectInfoDocument();
565:                ProjectBean projectBean = new ProjectBean(project.getName(),
566:                        "ESB");
567:                document.setProject(projectBean);
568:                OutputStream out = new FileOutputStream(buildFile);
569:                document.serialize(out);
570:                // project.refreshLocal(2, new SubProgressMonitor(monitor, 1));
571:
572:            }
573:
574:            protected void createJBIProjectInfoFile(IProject project,
575:                    IProgressMonitor monitor, List list) throws CoreException,
576:                    JavaModelException, IOException {
577:                String buildFilePath = project.getProject().getLocation()
578:                        .append("/projectinfo.xml").toOSString();
579:                File buildFile = new File(buildFilePath);
580:                if (!buildFile.exists())
581:                    buildFile.createNewFile();
582:                ProjectInfoDocument document = new ProjectInfoDocument();
583:                ProjectBean projectBean = new ProjectBean(project.getName(),
584:                        "JBI");
585:                document.setProject(projectBean);
586:
587:                if (list != null) {
588:
589:                    for (int i = 0; i < list.size(); i++) {
590:                        ProjectInfoDocument doc = null;
591:                        File infoFile = null;
592:                        IProject supProject = ResourcesPlugin.getWorkspace()
593:                                .getRoot().getProject(list.get(i).toString());
594:                        IFile file = supProject.getFile("projectinfo.xml");
595:                        if (file.exists()) {
596:                            infoFile = file.getLocation().toFile();
597:                            doc = ProjectInfoParser.load(infoFile);
598:                            doc.getProject().addNewSubProject(
599:                                    project.getName(), "JBI");
600:                            document.getProject().addNewSubProject(
601:                                    supProject.getName(), "ESB");
602:                        }
603:                        OutputStream out = new FileOutputStream(infoFile);
604:                        doc.serialize(out);
605:                        out.close();
606:                    }
607:
608:                }
609:                OutputStream out = new FileOutputStream(buildFile);
610:                document.serialize(out);
611:                // project.refreshLocal(2, new SubProgressMonitor(monitor, 1));
612:
613:            }
614:
615:            private String getConfigBaseDir() {
616:                String baseDir = EsbPathHelper.getCbesbHomeDir();
617:                if (baseDir != null) {
618:                    baseDir = baseDir + "/config";
619:                } else {
620:                    baseDir = Activator.getDefault().getBaseDir();
621:                }
622:                return baseDir;
623:            }
624:
625:            private String getX12BaseDir() {
626:                String baseDir = EsbPathHelper.getCbesbHomeDir();
627:                if (baseDir != null) {
628:                    baseDir = baseDir + "/formats/x12/";
629:                } else {
630:                    baseDir = Activator.getDefault().getBaseDir();
631:                    int index = baseDir.indexOf(IDE_PACK);
632:                    baseDir = baseDir.substring(0, index);
633:                    baseDir = baseDir + X12_BUILD_PACK;
634:                }
635:                return baseDir;
636:            }
637:
638:            private String getHL7BaseDir() {
639:                String baseDir = EsbPathHelper.getCbesbHomeDir();
640:                if (baseDir != null) {
641:                    baseDir = baseDir + "/formats/hl7/";
642:                } else {
643:                    baseDir = Activator.getDefault().getBaseDir();
644:                    int index = baseDir.indexOf(IDE_PACK);
645:                    baseDir = baseDir.substring(0, index);
646:                    baseDir = baseDir + HL7_BUILD_PACK;
647:                }
648:                return baseDir;
649:            }
650:
651:            private String getCustomCodeDir() {
652:                String baseDir = EsbPathHelper.getCbesbHomeDir();
653:                if (baseDir != null) {
654:                    baseDir = baseDir + "/customcode";
655:                } else {
656:                    baseDir = Activator.getDefault().getBaseDir()
657:                            + "/../com.bostechcorp.cbesb.custom/src";
658:                }
659:                return baseDir;
660:            }
661:
662:            protected void createTaggedMDLFile(IProject project,
663:                    IProgressMonitor monitor) throws CoreException,
664:                    JavaModelException, IOException {
665:                String buildFilePath = project.getProject().getLocation()
666:                        .append("/src/formats/taggedMDL.xml").toOSString();
667:                File buildFile = new File(buildFilePath);
668:                if (!buildFile.exists())
669:                    buildFile.createNewFile();
670:                TaggedMDLFileDocument document = new TaggedMDLFileDocument();
671:                TagggedMDLListBean MDLList = new TagggedMDLListBean();
672:                document.setMDLList(MDLList);
673:                OutputStream out = new FileOutputStream(buildFile);
674:                document.serialize(out);
675:                // project.refreshLocal(2, new SubProgressMonitor(monitor, 1));
676:
677:            }
678:
679:            public JBISAProjectCreationWizardSecondPage getSecondPage() {
680:                return secondPage;
681:            }
682:
683:            public void setSecondPage(
684:                    JBISAProjectCreationWizardSecondPage secondPage) {
685:                this.secondPage = secondPage;
686:            }
687:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.