KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > views > console > ConsoleDocument


1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.views.console;
12
13
14 import org.eclipse.debug.ui.console.IConsoleColorProvider;
15 import org.eclipse.jface.text.AbstractDocument;
16 import org.eclipse.jface.text.DefaultLineTracker;
17 import org.eclipse.jface.text.ITextStore;
18
19 public class ConsoleDocument extends AbstractDocument {
20     
21     private IConsoleColorProvider fColorProvider;
22     
23     public ConsoleDocument(IConsoleColorProvider colorProvider) {
24         fColorProvider = colorProvider;
25         setTextStore(newTextStore());
26         setLineTracker(new DefaultLineTracker());
27         completeInitialization();
28     }
29         
30     /**
31      * Returns whether this document is read-only.
32      */

33     public boolean isReadOnly() {
34         return fColorProvider.isReadOnly();
35     }
36     
37     /**
38      * Creates a new text store for this document.
39      */

40     protected ITextStore newTextStore() {
41         return new ConsoleOutputTextStore(2500);
42     }
43 }
44
Popular Tags