KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > debug > EngineContextProviderImpl


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.web.debug;
21
22 import java.beans.PropertyChangeListener JavaDoc;
23 import java.util.Arrays JavaDoc;
24 import java.util.HashSet JavaDoc;
25 import java.util.Set JavaDoc;
26 import org.netbeans.spi.debugger.jpda.SourcePathProvider;
27
28
29 /**
30  *
31  * @author Jan Jancura
32  */

33 public class EngineContextProviderImpl extends SourcePathProvider {
34
35     private static boolean verbose =
36         System.getProperty ("netbeans.debugger.enginecontextproviderimpl") != null;
37
38     private static final Set JavaDoc virtualFolders = new HashSet JavaDoc (Arrays.asList (
39         new String JavaDoc[] {
40             "org",
41             "org/apache",
42             "org/apache/jsp"
43         }
44     ));
45
46     
47     /**
48      * Translates a relative path ("java/lang/Thread.java") to url
49      * ("file:///C:/Sources/java/lang/Thread.java"). Uses GlobalPathRegistry
50      * if global == true.
51      *
52      * @param relativePath a relative path (java/lang/Thread.java)
53      * @param global true if global path should be used
54      * @return url
55      */

56     public String JavaDoc getURL (String JavaDoc relativePath, boolean global) {
57         if (verbose) System.out.println ("ECPI(JSP): getURL " + relativePath + " global " + global);
58         if ((relativePath == null) || (relativePath.endsWith(".java"))) {
59            return null;
60         }
61         if (virtualFolders.contains (relativePath) || relativePath.startsWith("org/apache/jsp")) {
62             if (verbose) System.out.println ("ECPI(JSP): fo virtual folder");
63             return "virtual folder";
64         }
65         return null;
66     }
67
68     
69     /**
70      * Returns relative path for given url.
71      *
72      * @param url a url of resource file
73      * @param directorySeparator a directory separator character
74      * @param includeExtension whether the file extension should be included
75      * in the result
76      *
77      * @return relative path
78      */

79     public String JavaDoc getRelativePath (
80         String JavaDoc url,
81         char directorySeparator,
82         boolean includeExtension
83     ) {
84         return null;
85     }
86     
87     /**
88      * Returns set of original source roots.
89      *
90      * @return set of original source roots
91      */

92     public String JavaDoc[] getOriginalSourceRoots () {
93         return new String JavaDoc [0];
94     }
95     
96     /**
97      * Returns array of source roots.
98      *
99      * @return array of source roots
100      */

101     public String JavaDoc[] getSourceRoots () {
102         return new String JavaDoc [0];
103     }
104     
105     /**
106      * Sets array of source roots.
107      *
108      * @param sourceRoots a new array of sourceRoots
109      */

110     public void setSourceRoots (String JavaDoc[] sourceRoots) {
111     }
112     
113     /**
114      * Adds property change listener.
115      *
116      * @param l new listener.
117      */

118     public void addPropertyChangeListener (PropertyChangeListener JavaDoc l) {
119     }
120
121     /**
122      * Removes property change listener.
123      *
124      * @param l removed listener.
125      */

126     public void removePropertyChangeListener (
127         PropertyChangeListener JavaDoc l
128     ) {
129     }
130 }
131
Popular Tags