Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: c92b878e7ca478b7cde9a315d62b5f3ab9a493bc (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
/*******************************************************************************
 * Copyright (c) 2000, 2019 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.ui.console;

import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.swt.custom.StyleRange;

/**
 * A document partitioner for a text console.
 * <p>
 * In addition to regular partitioner duties, a console document partitioner
 * dictates which regions in its document are read-only and provides style
 * ranges.
 * </p>
 * <p>
 * Clients may implement this interface.
 * </p>
 * <p>
 * In order to provided backward compatibility for clients of
 * <code>IConsoleDocumentPartitioner</code>, extension interfaces are used to
 * provide a means of evolution. The following extension interfaces exist:
 * <ul>
 * <li>{@link org.eclipse.ui.console.IConsoleDocumentPartitionerExtension} since
 * version 3.9 adding more possibilities to query read-only regions.</li>
 * </ul>
 * </p>
 *
 * @see org.eclipse.ui.console.TextConsole
 * @see org.eclipse.ui.console.IConsoleDocumentPartitionerExtension
 * @since 3.1
 */
public interface IConsoleDocumentPartitioner extends IDocumentPartitioner {

	/**
	 * Returns whether this partitioner's document is read-only at the specified
	 * offset. The user is not allowed to type in read-only locations.
	 *
	 * @param offset document offset
	 * @return whether this partitioner's document is read-only at the specified
	 * offset
	 */
	boolean isReadOnly(int offset);

	/**
	 * Returns style ranges for the specified region of this partitioner's document
	 * to use when rendering, or <code>null</code> if none.
	 *
	 * @param offset beginning offset for which style ranges are requested
	 * @param length the length of text for which style ranges are requested
	 * @return style ranges for the specified region of this partitioner's document
	 * to use when rendering, or <code>null</code> if none
	 */
	StyleRange[] getStyleRanges(int offset, int length);
}

Back to the top