KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > antlr > works > debugger > panels > DBInputTokenPanel


1 package org.antlr.works.debugger.panels;
2
3 import org.antlr.runtime.Token;
4 import org.antlr.works.debugger.Debugger;
5 import org.antlr.works.debugger.input.DBInputProcessor;
6 import org.antlr.works.debugger.input.DBInputProcessorToken;
7 import org.antlr.works.debugger.input.DBInputTextTokenInfo;
8 import org.antlr.works.prefs.AWPrefs;
9 import org.antlr.works.utils.TextPane;
10 import org.antlr.works.utils.TextUtils;
11
12 import javax.swing.*;
13 import java.awt.*;
14 /*
15
16 [The "BSD licence"]
17 Copyright (c) 2005-2006 Jean Bovet
18 All rights reserved.
19
20 Redistribution and use in source and binary forms, with or without
21 modification, are permitted provided that the following conditions
22 are met:
23
24 1. Redistributions of source code must retain the above copyright
25 notice, this list of conditions and the following disclaimer.
26 2. Redistributions in binary form must reproduce the above copyright
27 notice, this list of conditions and the following disclaimer in the
28 documentation and/or other materials provided with the distribution.
29 3. The name of the author may not be used to endorse or promote products
30 derived from this software without specific prior written permission.
31
32 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
33 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
34 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
35 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
36 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
37 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
41 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42
43 */

44
45 public class DBInputTokenPanel implements DBInputConcretePanel {
46
47     protected TextPane inputTextPane;
48     protected JScrollPane textScrollPane;
49     protected DBInputProcessorToken processorToken;
50
51     public DBInputTokenPanel(Debugger debugger) {
52         inputTextPane = new TextPane();
53         inputTextPane.setBackground(Color.white);
54         inputTextPane.setBorder(null);
55         inputTextPane.setFont(new Font(AWPrefs.getEditorFont(), Font.PLAIN, AWPrefs.getEditorFontSize()));
56         inputTextPane.setText("");
57         inputTextPane.setEditable(false);
58
59         TextUtils.createTabs(inputTextPane);
60
61         processorToken = new DBInputProcessorToken(debugger, inputTextPane);
62
63         textScrollPane = new JScrollPane(inputTextPane);
64         textScrollPane.setWheelScrollingEnabled(true);
65     }
66
67     public void close() {
68         processorToken.close();
69     }
70
71     public void stop() {
72         processorToken.stop();
73     }
74
75     public JComponent getComponent() {
76         return textScrollPane;
77     }
78
79     public DBInputProcessor getInputProcessor() {
80         return processorToken;
81     }
82
83     public void toggleInputTextTokensBox() {
84         processorToken.setDrawTokensBox(!processorToken.isTokensBoxVisible());
85     }
86
87     public boolean isInputTokensBoxVisible() {
88         return processorToken.isTokensBoxVisible();
89     }
90
91     public boolean isBreakpointAtToken(Token token) {
92         return processorToken.isBreakpointAtToken(token);
93     }
94
95     public void selectToken(Token token) {
96         processorToken.selectToken(token);
97     }
98
99     public DBInputTextTokenInfo getTokenInfoForToken(Token token) {
100         return processorToken.getTokenInfoForToken(token);
101     }
102
103     public void updateOnBreakEvent() {
104         processorToken.updateOnBreakEvent();
105     }
106
107 }
108
Popular Tags