Source Code Cross Referenced for BrowserConfig.java in  » Byte-Code » jclasslib » org » gjt » jclasslib » browser » config » 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 » Byte Code » jclasslib » org.gjt.jclasslib.browser.config 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:            This library is free software; you can redistribute it and/or
003:            modify it under the terms of the GNU General Public
004:            License as published by the Free Software Foundation; either
005:            version 2 of the license, or (at your option) any later version.
006:         */
007:
008:        package org.gjt.jclasslib.browser.config;
009:
010:        import org.gjt.jclasslib.browser.config.classpath.*;
011:        import org.gjt.jclasslib.mdi.MDIConfig;
012:
013:        import javax.swing.tree.DefaultTreeModel;
014:        import java.io.File;
015:        import java.util.*;
016:        import java.util.regex.Matcher;
017:        import java.util.regex.Pattern;
018:
019:        /**
020:         Workspace configuration object.
021:
022:         @author <a href="mailto:jclasslib@ej-technologies.com">Ingo Kegel</a>
023:         @version $Revision: 1.2 $ $Date: 2003/08/21 14:40:45 $
024:         */
025:        public class BrowserConfig implements  ClasspathComponent {
026:
027:            private MDIConfig mdiConfig;
028:            private List classpath = new ArrayList();
029:            private Set mergedEntries = new HashSet();
030:            private Set changeListeners = new HashSet();
031:
032:            /**
033:             * Get the associated MDI configuration object.
034:             * @return the <tt>MDIConfig</tt> object.
035:             */
036:            public MDIConfig getMDIConfig() {
037:                return mdiConfig;
038:            }
039:
040:            /**
041:             * Set the associated MDI configuration object.
042:             * @param mdiConfig the <tt>MDIConfig</tt> object.
043:             */
044:            public void setMDIConfig(MDIConfig mdiConfig) {
045:                this .mdiConfig = mdiConfig;
046:            }
047:
048:            /**
049:             * Get the list of <tt>ClasspathEntry</tt> objects that define the classpath.
050:             * @return the list
051:             */
052:            public List getClasspath() {
053:                return classpath;
054:            }
055:
056:            /**
057:             * Set the list of <tt>ClasspathEntry</tt> objects that define the classpath.
058:             * @param classpath the list
059:             */
060:            public void setClasspath(List classpath) {
061:                this .classpath = classpath;
062:            }
063:
064:            public void addClasspathChangeListener(
065:                    ClasspathChangeListener listener) {
066:                changeListeners.add(listener);
067:            }
068:
069:            public void removeClasspathChangeListener(
070:                    ClasspathChangeListener listener) {
071:                changeListeners.remove(listener);
072:            }
073:
074:            /**
075:             * Add a classpath entry for a directory.
076:             * Has no effect of the classpath entry is already present.
077:             * @param directoryName the name of the directory.
078:             */
079:            public void addClasspathDirectory(String directoryName) {
080:                ClasspathDirectoryEntry entry = new ClasspathDirectoryEntry();
081:                entry.setFileName(directoryName);
082:                if (classpath.indexOf(entry) < 0) {
083:                    classpath.add(entry);
084:                    fireClasspathChanged(false);
085:                }
086:            }
087:
088:            /**
089:             * Add a classpath entry for an archive.
090:             * Has no effect of the classpath entry is already present.
091:             * @param archiveName the path of he archive.
092:             */
093:            public void addClasspathArchive(String archiveName) {
094:                ClasspathArchiveEntry entry = new ClasspathArchiveEntry();
095:                entry.setFileName(archiveName);
096:                if (classpath.indexOf(entry) < 0) {
097:                    classpath.add(entry);
098:                    fireClasspathChanged(false);
099:                }
100:            }
101:
102:            /**
103:             * Add a classpath entry.
104:             * Has no effect of the classpath entry is already present.
105:             * @param entry the entry.
106:             */
107:            public void addClasspathEntry(ClasspathEntry entry) {
108:                if (classpath.indexOf(entry) < 0) {
109:                    classpath.add(entry);
110:                    fireClasspathChanged(false);
111:                }
112:            }
113:
114:            /**
115:             * Remove a classpath entry.
116:             * @param entry the entry.
117:             */
118:            public void removeClasspathEntry(ClasspathEntry entry) {
119:                if (classpath.remove(entry)) {
120:                    fireClasspathChanged(true);
121:                }
122:            }
123:
124:            /**
125:             * Add the <tt>rt.jar</tt> archive of the JRE used by the bytecode browser to the classpath.
126:             */
127:            public void addRuntimeLib() {
128:
129:                String fileName = String.class.getResource("String.class")
130:                        .toExternalForm();
131:                Matcher matcher = Pattern.compile("jar:file:/(.*)!.*").matcher(
132:                        fileName);
133:                if (matcher.matches()) {
134:                    String path = matcher.group(1);
135:                    if (path.indexOf(':') == -1) {
136:                        path = "/" + path;
137:                    }
138:                    addClasspathArchive(new File(path).getPath());
139:                    fireClasspathChanged(false);
140:                }
141:            }
142:
143:            public FindResult findClass(String className) {
144:
145:                Iterator it = classpath.iterator();
146:                while (it.hasNext()) {
147:                    ClasspathEntry entry = (ClasspathEntry) it.next();
148:                    FindResult findResult = entry.findClass(className);
149:                    if (findResult != null) {
150:                        return findResult;
151:                    }
152:                }
153:                return null;
154:            }
155:
156:            public void mergeClassesIntoTree(DefaultTreeModel model,
157:                    boolean reset) {
158:
159:                Iterator it = classpath.iterator();
160:                while (it.hasNext()) {
161:                    ClasspathEntry entry = (ClasspathEntry) it.next();
162:                    if (reset || !mergedEntries.contains(entry)) {
163:                        entry.mergeClassesIntoTree(model, reset);
164:                        mergedEntries.add(entry);
165:                    }
166:                }
167:            }
168:
169:            private void fireClasspathChanged(boolean removal) {
170:                Iterator it = changeListeners.iterator();
171:                ClasspathChangeEvent event = new ClasspathChangeEvent(this ,
172:                        removal);
173:                while (it.hasNext()) {
174:                    ClasspathChangeListener listener = (ClasspathChangeListener) it
175:                            .next();
176:                    listener.classpathChanged(event);
177:                }
178:            }
179:
180:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.