KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > debugger > ide > FullPathSourceShower


1 /* -*- Mode: JDE; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  *
3  * This file is part of the debugger and core tools for the AspectJ(tm)
4  * programming language; see http://aspectj.org
5  *
6  * The contents of this file are subject to the Mozilla Public License
7  * Version 1.1 (the "License"); you may not use this file except in
8  * compliance with the License. You may obtain a copy of the License at
9  * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the
14  * License.
15  *
16  * The Original Code is AspectJ.
17  *
18  * The Initial Developer of the Original Code is Xerox Corporation. Portions
19  * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
20  * All Rights Reserved.
21  */

22
23 package org.aspectj.debugger.ide;
24
25 import org.aspectj.debugger.base.*;
26 import org.aspectj.debugger.gui.*;
27 import org.aspectj.debugger.request.*;
28
29 import java.io.File JavaDoc;
30
31 /**
32  * FullPathSourceShower.java
33  *
34  *
35  * Created: Wed Sep 20 11:00:21 2000
36  *
37  * @author <a HREF="mailto:palm@parc.xerox.com"Jeffrey Palm</a>
38  */

39
40 public abstract class FullPathSourceShower implements SourceShower {
41
42     /**
43      * Displays the source file <code>fullPath</code> in a window.
44      * This will only get called is fullPath exists.
45      *
46      * @param fullPath The fully-qualified file name to display
47      */

48     public abstract void showSourceForFullPath(String JavaDoc fullPath);
49
50     /**
51      * Shows the line #<code>line</code> for the file currently being displayed.
52      * This method will <b>only</b> follow a call to <code>showSourceForFullPath</code>.
53      *
54      * @param line The line to display
55      * @param isAtBreakpoint <code>true</code> is this line is at a breakpoint
56      * @see #showSourceForFullPath
57      */

58     public abstract void showLineForCurrentModel(int line, boolean isAtBreakpoint);
59
60     /**
61      * Should return the name of the currently-displayed source.
62      *
63      * @return The name of the currently-display source.
64      */

65     public abstract String JavaDoc getSourceName();
66
67     /**
68      * Fufills the <code>showSource</code> method of the <code>SourceShower<code>
69      * interface, but turn sthe <code>relativePath</code> into a full path as needed
70      * by <code>showSourceForFullPath</code>.
71      *
72      * @param relativePath The relative (to the source path set in the debugger)
73      * path of the file to display
74      * @see #showSourceForFullPath
75      */

76     public boolean showSource(String JavaDoc relativePath) {
77         String JavaDoc fullPath = ComponentRepository.getAJDebugger().getFullSourcePath(relativePath);
78         File JavaDoc file = new File JavaDoc(fullPath);
79         if (file == null || file.isDirectory() || !file.exists()) {
80             return false;
81         }
82         showSourceForFullPath(fullPath);
83         return true;
84     }
85
86     /**
87      * See the description in org.aspectj.debugger.gui.AbstractSourcePane.
88      */

89     public /*abstract*/ void requestSet(String JavaDoc filename, int line,
90                                         BreakpointRequestAction ba) {}
91
92     /**
93      * See the description in org.aspectj.debugger.gui.AbstractSourcePane.
94      */

95     public /*abstract*/ void requestClear(String JavaDoc filename, int line,
96                                           BreakpointRequestAction ba) {}
97
98     /**
99      * See the description in org.aspectj.debugger.gui.AbstractSourcePane.
100      */

101     public /*abstract*/ void requestDeferred(String JavaDoc filename, int line,
102                                              BreakpointRequestAction ba) {}
103
104
105     /**
106      * A dummy prototype of the behavior of this class.
107      */

108     public final static SourceShower proto = new FullPathSourceShower() {
109         public void showSourceForFullPath(String JavaDoc fullPath) {
110             System.out.println("fullPath:" + fullPath);
111         }
112         public void showLineForCurrentModel(int line, boolean isAtBreakpoint) {
113             System.out.println("line:" + line + " isAtBreakpoint:" + isAtBreakpoint);
114         }
115         public String JavaDoc getSourceName() {
116             return "who knows?";
117         }
118         public void requestSet(String JavaDoc filename,
119                                int line,
120                                BreakpointRequestAction ba) {}
121         public void requestClear(String JavaDoc filename,
122                                  int line,
123                                  BreakpointRequestAction ba) {}
124         public void requestDeferred(String JavaDoc filename,
125                                     int line,
126                                     BreakpointRequestAction ba) {}
127     };
128 }
129
Popular Tags