KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > console > MessageConsole


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

11 package org.eclipse.ui.console;
12
13 import org.eclipse.jface.resource.ImageDescriptor;
14 import org.eclipse.ui.internal.console.IOConsolePage;
15 import org.eclipse.ui.part.IPageBookViewPage;
16
17 /**
18  * A console that displays messages. A message console may have one or
19  * more streams connected to it (<code>MessageConsoleStream</code>).
20  * Text written to streams is buffered and processed in a Job by the
21  * console's document partitioner.
22  * <p>
23  * Clients may instantiate this class; not intended to be subclassed.
24  * </p>
25  * @since 3.0
26  */

27 public class MessageConsole extends IOConsole {
28     
29     /**
30      * Property constant indicating the font of this console has changed.
31      *
32      * @deprecated use {@link IConsoleConstants#P_FONT}
33      */

34     public static final String JavaDoc P_FONT = IConsoleConstants.P_FONT;
35     
36     /**
37      * Property constant indicating the color of a stream has changed.
38      *
39      * @deprecated use {@link IConsoleConstants#P_STREAM_COLOR}
40      */

41     public static final String JavaDoc P_STREAM_COLOR = IConsoleConstants.P_STREAM_COLOR;
42     
43     /**
44      * Property constant indicating tab size has changed
45      *
46      * @deprecated use {@link IConsoleConstants#P_TAB_SIZE}
47      */

48     public static final String JavaDoc P_TAB_SIZE = IConsoleConstants.P_TAB_SIZE;
49     
50     /**
51      * The default tab size
52      *
53      * @deprecated use {@link IConsoleConstants#DEFAULT_TAB_SIZE}
54      */

55     public static final int DEFAULT_TAB_SIZE = IConsoleConstants.DEFAULT_TAB_SIZE;
56
57     /**
58      * Constructs a message console with the given name and image.
59      *
60      * @param name console name
61      * @param imageDescriptor console image descriptor or <code>null</code>
62      */

63     public MessageConsole(String JavaDoc name, ImageDescriptor imageDescriptor) {
64         this(name, imageDescriptor, true);
65     }
66     
67     /**
68      * Constructs a message console.
69      *
70      * @param name console name
71      * @param imageDescriptor console image descriptor or <code>null</code>
72      * @param autoLifecycle whether lifecycle methods should be called automatically
73      * when added and removed from the console manager
74      * @since 3.1
75      */

76     public MessageConsole(String JavaDoc name, ImageDescriptor imageDescriptor, boolean autoLifecycle) {
77         super(name, IConsoleConstants.MESSAGE_CONSOLE_TYPE, imageDescriptor, autoLifecycle);
78     }
79         
80     /**
81      * Returns a new message stream connected to this console.
82      * <p>
83      * Clients should avoid writing large amounts of output to this stream in the UI
84      * thread. The console needs to process the output in the UI thread and if the client
85      * hogs the UI thread writing output to the console, the console will not be able
86      * to process the output.
87      * </p>
88      * @return a new message stream connected to this console
89      */

90     public MessageConsoleStream newMessageStream() {
91         return new MessageConsoleStream(this);
92     }
93
94     /* (non-Javadoc)
95      * @see org.eclipse.ui.console.IConsole#createPage(org.eclipse.ui.console.IConsoleView)
96      */

97     public IPageBookViewPage createPage(IConsoleView view) {
98         IOConsolePage page = (IOConsolePage) super.createPage(view);
99         page.setReadOnly();
100         return page;
101     }
102     
103     /* (non-Javadoc)
104      * @see org.eclipse.ui.console.IOConsole#getInputStream()
105      */

106     public IOConsoleInputStream getInputStream() {
107         throw new UnsupportedOperationException JavaDoc("Message Console does not support user input"); //$NON-NLS-1$
108
}
109     
110     
111     /**
112      * Appends the given message to this console, from the specified stream.
113      *
114      * @param text message
115      * @param stream stream the message belongs to
116      * @deprecated since 3.1, this method should no longer be called, and has no effect.
117      * Writing to a message console stream updates the document
118      */

119     protected void appendToDocument(String JavaDoc text, MessageConsoleStream stream) {
120     }
121 }
122
Popular Tags