Source Code Cross Referenced for EclipseImport.java in  » IDE » tIDE » tide » importtools » 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 » IDE » tIDE » tide.importtools 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package tide.importtools;
002:
003:        import java.io.*;
004:        import java.util.*;
005:        import tide.project.ProjectSettings;
006:        import org.xml.sax.helpers.*;
007:        import org.xml.sax.*;
008:
009:        public final class EclipseImport extends DefaultHandler {
010:            public static String fileNameEnding = ".classpath";
011:            final File base;
012:
013:            final private Set<String> usedKeys = new HashSet<String>();
014:            final ProjectSettings proj;
015:            final private List<File> libs = new ArrayList<File>();
016:
017:            public EclipseImport(File propFile, ProjectSettings proj)
018:                    throws Exception {
019:                super ();
020:
021:                this .proj = proj;
022:                this .base = propFile.getParentFile();
023:
024:                System.out.println("Importing eclipse project "
025:                        + base.getName());
026:                if (proj != null) {
027:                    proj.setProjectName(base.getName());
028:                }
029:
030:                XMLReader xr = XMLReaderFactory.createXMLReader();
031:                xr.setContentHandler(this );
032:                xr.setErrorHandler(this );
033:
034:                // Important: since 1.6, crashes if inputsource made with string path (unknown protocol "c") !!
035:                xr.parse(new InputSource(new FileInputStream(propFile)));
036:
037:            }
038:
039:            @Override
040:            public void startElement(String uri, String name, String qName,
041:                    Attributes atts) {
042:                if ("".equals(uri))
043:                    System.out.println("Start element: " + qName);
044:                else
045:                    System.out.println("Start element: {" + uri + "}" + name);
046:
047:                if (qName.equals("classpathentry")) {
048:                    if (atts.getValue("kind").equals("src")) {
049:                        System.out.println("### Source path = "
050:                                + getFile(atts.getValue("path")));
051:                        if (proj != null) {
052:                            proj
053:                                    .setSources_Home(getFile(atts
054:                                            .getValue("path")));
055:                        }
056:                    }
057:
058:                    if (atts.getValue("kind").equals("lib")) {
059:                        File path = getFile(atts.getValue("path"));
060:                        libs.add(path);
061:                    }
062:
063:                    if (atts.getValue("kind").equals("output")) {
064:                        if (proj != null) {
065:                            proj
066:                                    .setClasses_Home(new File(atts
067:                                            .getValue("path")));
068:                        }
069:                    }
070:
071:                }
072:
073:                for (int i = 0; i < atts.getLength(); i++) {
074:                    System.out.println("  " + atts.getLocalName(i) + " = "
075:                            + atts.getValue(i));
076:                }
077:            }
078:
079:            @Override
080:            public void endElement(String uri, String name, String qName) {
081:                if ("".equals(uri))
082:                    System.out.println("End element: " + qName);
083:                else
084:                    System.out.println("End element:   {" + uri + "}" + name);
085:
086:            }
087:
088:            @Override
089:            public void characters(char[] ch, int start, int length) {
090:
091:                //System.out.println("chars: '"+new String(ch, start, length)+"'");
092:            }
093:
094:            @Override
095:            public void endDocument() {
096:                System.out.println("Classpath=" + libs);
097:                if (proj != null) {
098:                    proj.setExternalJars(libs);
099:                }
100:            }
101:
102:            /** files are relative to the base => this gives the absolute file path
103:             *   if not existing, try directly the file without base
104:             */
105:            private File getFile(String name) {
106:                File fn = new File(name);
107:                if (fn.isAbsolute() && fn.exists())
108:                    return fn;
109:
110:                File f = new File(base, name);
111:                try {
112:                    return f.getCanonicalFile();
113:                } catch (Exception e) {
114:                    return f;
115:                }
116:            }
117:
118:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.