Skip to main content
summaryrefslogtreecommitdiffstats
blob: e4ddd2071ed6c66b5c19ff55b88b8e8597161ac4 (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
/*******************************************************************************
 * Copyright (c) 2009 Avaloq Evolution AG 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:
 *     Tom Eicher (Avaloq Evolution AG) - initial API and implementation
 *******************************************************************************/
package org.eclipse.jface.text;

/**
 * A rectangular selection in a text document. A column selection spans the visually identical range
 * of columns on a contiguous range of lines. The character count of the same visually perceived
 * column may not be equal for two different lines, therefore computing the set of disjunct
 * character ranges covered by a column selection is influenced by the used font and tabulator
 * width. Using column selections with proportional fonts may render unexpected results.
 *
 * <h5><a name="virtual">Virtual Spaces</a></h5>
 * The {@linkplain #getStartColumn() start column} and {@linkplain #getEndColumn() end column} may
 * refer to &quot;virtual offsets&quot; in the white space beyond the end of the line. Such an
 * offset can be realized by inserting a space for each missing character.
 * <p>
 * The {@linkplain ITextSelection#getOffset() offset} and
 * {@linkplain ITextSelection#getLength() length} of an {@link IBlockTextSelection} refer to the
 * smallest non-virtual range that comprises the entire rectangular selection.
 * </p>
 * <p>
 * Clients may implement this interface or use the default implementation provided by
 * {@link org.eclipse.jface.text.BlockTextSelection}.
 * </p>
 *
 * @see org.eclipse.jface.text.BlockTextSelection
 * @since 3.5
 */
public interface IBlockTextSelection extends ITextSelection {
	/**
	 * Returns the column on the {@linkplain ITextSelection#getStartLine() start line} at which the
	 * selection starts. The returned column is a character count measured from the start of the
	 * line. It may be larger than the length of the line, in which case it is a <a
	 * href="IBlockTextSelection.html#virtual">virtual</a> offset.
	 *
	 * @return the start column measured from the line start
	 */
	int getStartColumn();
	/**
	 * Returns the exclusive column on the {@linkplain ITextSelection#getEndLine() end line} at which the
	 * selection ends. The returned column is a character count measured from the start of the
	 * line. It may be larger than the length of the line, in which case it is a <a
	 * href="IBlockTextSelection.html#virtual">virtual</a> offset.
	 *
	 * @return the end column measured from the line start
	 */
	int getEndColumn();
	/**
	 * {@inheritDoc}
	 * <p>
	 * The returned text does not necessarily correspond to the total
	 * {@linkplain ITextSelection#getOffset() offset} and {@link ITextSelection#getLength() length},
	 * as only the text within the selected columns is returned.
	 * <p>
	 * Any <a href="IBlockTextSelection.html#virtual">virtual</a> spaces beyond the end of the selected lines are
	 * materialized and returned as text.
	 * </p>
	 *
	 * @see org.eclipse.jface.text.ITextSelection#getText()
	 */
	@Override
	String getText();
	/**
	 * Returns a non-empty array containing the selected text range for each line covered by the
	 * selection.
	 *
	 * @return an array containing a the covered text range for each line covered by the receiver
	 */
	IRegion[] getRegions();
}

Back to the top