Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b9f3071bf3295b5979018c7efed320968793e398 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*******************************************************************************
 * Copyright (c) 2000, 2009 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.ui.console;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.internal.console.IOConsolePage;
import org.eclipse.ui.part.IPageBookViewPage;

/**
 * A console that displays messages. A message console may have one or
 * more streams connected to it (<code>MessageConsoleStream</code>).
 * Text written to streams is buffered and processed in a Job by the 
 * console's document partitioner.
 * <p>
 * Clients may instantiate this class.
 * </p>
 * @since 3.0
 * @noextend This class is not intended to be subclassed by clients.
 */
public class MessageConsole extends IOConsole {
	
	/**
	 * Property constant indicating the font of this console has changed. 
	 * 
	 * @deprecated use {@link IConsoleConstants#P_FONT} 
	 */
	public static final String P_FONT = IConsoleConstants.P_FONT;
	
	/**
	 * Property constant indicating the color of a stream has changed. 
	 * 
	 * @deprecated use {@link IConsoleConstants#P_STREAM_COLOR} 
	 */
	public static final String P_STREAM_COLOR = IConsoleConstants.P_STREAM_COLOR;
	
	/**
	 * Property constant indicating tab size has changed
	 * 
	 * @deprecated use {@link IConsoleConstants#P_TAB_SIZE}
	 */
	public static final String P_TAB_SIZE = IConsoleConstants.P_TAB_SIZE;
	
	/**
	 * The default tab size
	 * 
	 * @deprecated use {@link IConsoleConstants#DEFAULT_TAB_SIZE}
	 */
	public static final int DEFAULT_TAB_SIZE = IConsoleConstants.DEFAULT_TAB_SIZE;	

    /**
     * Constructs a message console with the given name and image.
     * 
     * @param name console name
     * @param imageDescriptor console image descriptor or <code>null</code>
     */
	public MessageConsole(String name, ImageDescriptor imageDescriptor) {
		this(name, imageDescriptor, true);
	}
	
	/**
	 * Constructs a message console.
	 * 
	 * @param name console name
	 * @param imageDescriptor console image descriptor or <code>null</code>
	 * @param autoLifecycle whether lifecycle methods should be called automatically
	 *  when added and removed from the console manager
	 * @since 3.1
	 */
	public MessageConsole(String name, ImageDescriptor imageDescriptor, boolean autoLifecycle) {
		this(name, IConsoleConstants.MESSAGE_CONSOLE_TYPE, imageDescriptor, autoLifecycle);
	}
	
    /**
     * Constructs a message console with the given name, type, image, and lifecycle.
     * 
     * @param name console name
     * @param consoleType console type identifier or <code>null</code>
     * @param imageDescriptor console image descriptor or <code>null</code>
     * @param autoLifecycle whether lifecycle methods should be called automatically
	 *  when added and removed from the console manager
	 *  
     * @since 3.4
     */
	public MessageConsole(String name, String consoleType, ImageDescriptor imageDescriptor, boolean autoLifecycle) {
		this(name, consoleType, imageDescriptor, null, autoLifecycle);
	}
	
    /**
     * Constructs a message console with the given name, type, image, encoding, and lifecycle specification.
     * 
     * @param name the name to display for this console
     * @param consoleType console type identifier or <code>null</code>
     * @param imageDescriptor console image descriptor or <code>null</code>
     * @param encoding the encoding that should be used to render the text, or <code>null</code>
     * 	if the system default encoding should be used
     * @param autoLifecycle whether lifecycle methods should be called automatically
	 *  when added and removed from the console manager
	 * @since 3.5
     */
	public MessageConsole(String name, String consoleType, ImageDescriptor imageDescriptor, String encoding, boolean autoLifecycle) {
		super(name, consoleType, imageDescriptor, encoding, autoLifecycle);
	}
		
	/**
	 * Returns a new message stream connected to this console.
	 * <p>
     * Clients should avoid writing large amounts of output to this stream in the UI
     * thread. The console needs to process the output in the UI thread and if the client
     * hogs the UI thread writing output to the console, the console will not be able
     * to process the output.
     * </p>
	 * @return a new message stream connected to this console
	 */
	public MessageConsoleStream newMessageStream() {
		return new MessageConsoleStream(this);
	}

    /* (non-Javadoc)
     * @see org.eclipse.ui.console.IConsole#createPage(org.eclipse.ui.console.IConsoleView)
     */
    public IPageBookViewPage createPage(IConsoleView view) {
        IOConsolePage page = (IOConsolePage) super.createPage(view);
        page.setReadOnly();
        return page;
    }
    
    /* (non-Javadoc)
     * @see org.eclipse.ui.console.IOConsole#getInputStream()
     */
    public IOConsoleInputStream getInputStream() {
        throw new UnsupportedOperationException("Message Console does not support user input"); //$NON-NLS-1$
    }
    
	
	/** 
	 * Appends the given message to this console, from the specified stream.
	 * 
	 * @param text message
	 * @param stream stream the message belongs to
	 * @deprecated since 3.1, this method should no longer be called, and has no effect.
	 * Writing to a message console stream updates the document
	 */
	protected void appendToDocument(String text, MessageConsoleStream stream) {
	}    
}

Back to the top