KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > debugger > jpda > SourcePathProvider


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 Micro//S ystems, Inc. Portions Copyright 1997-2006 Sun
17  * Micro//S ystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.spi.debugger.jpda;
20
21 import java.beans.PropertyChangeListener JavaDoc;
22 import java.io.File JavaDoc;
23 import java.util.Set JavaDoc;
24
25 /**
26  * Defines source path for debugger. It translates relative path
27  * (like "java/lang/Thread.java", or class name) to url
28  * ("file:///C:/Sources/java/lang/Thread.java"). It allows to define
29  * and modify source path.
30  * All instances of this class should be registerred in
31  * "Meta-inf/debugger/<DebuggerEngine ID>/org.netbeans.spi.debugger.jpda.EngineContextProvider"
32  * files. There should be at least one instance installed.
33  *
34  * @author Maros Sandor, Jan Jancura
35  */

36 public abstract class SourcePathProvider {
37
38     /** Property name constant. */
39     public static final String JavaDoc PROP_SOURCE_ROOTS = "sourceRoots";
40     
41     /**
42      * Returns relative path (java/lang/Thread.java) for given url
43      * ("file:///C:/Sources/java/lang/Thread.java").
44      *
45      * @param url a url of resource file
46      * @param directorySeparator a directory separator character
47      * @param includeExtension whether the file extension should be included
48      * in the result
49      *
50      * @return relative path
51      */

52     public abstract String JavaDoc getRelativePath (
53         String JavaDoc url,
54         char directorySeparator,
55         boolean includeExtension
56      );
57
58     /**
59      * Translates a relative path ("java/lang/Thread.java") to url
60      * ("file:///C:/Sources/java/lang/Thread.java"). Uses GlobalPathRegistry
61      * if global == true.
62      *
63      * @param relativePath a relative path (java/lang/Thread.java)
64      * @param global true if global path should be used
65      * @return url
66      */

67     public abstract String JavaDoc getURL (String JavaDoc relativePath, boolean global);
68     
69     /**
70      * Returns the source root (if any) for given url.
71      *
72      * @param url a url of resource file
73      *
74      * @return the source root or <code>null</code> when no source root was found.
75      * @since 2.6
76      */

77     public String JavaDoc getSourceRoot(String JavaDoc url) {
78         return null;
79     }
80         
81     /**
82      * Returns array of source roots.
83      */

84     public abstract String JavaDoc[] getSourceRoots ();
85     
86     /**
87      * Sets array of source roots.
88      *
89      * @param sourceRoots a new array of sourceRoots
90      */

91     public abstract void setSourceRoots (String JavaDoc[] sourceRoots);
92     
93     /**
94      * Returns set of original source roots.
95      *
96      * @return set of original source roots
97      */

98     public abstract String JavaDoc[] getOriginalSourceRoots ();
99     
100     /**
101      * Adds property change listener.
102      *
103      * @param l new listener.
104      */

105     public abstract void addPropertyChangeListener (PropertyChangeListener JavaDoc l);
106
107     /**
108      * Removes property change listener.
109      *
110      * @param l removed listener.
111      */

112     public abstract void removePropertyChangeListener (
113         PropertyChangeListener JavaDoc l
114     );
115 }
116
117
Popular Tags