Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 4467836ae6ca0418d41657be271c240aad8fa882 (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
/*******************************************************************************
 * Copyright (c) 2000, 2008 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 java.util.EventObject;

/**
 * An event describing a pattern match in a text console. The source of the event
 * is a <code>TextConsole</code>.
 * <p>
 * Clients may instantiate this class.
 * </p>
 * @see org.eclipse.ui.console.IPatternMatchListener
 * @see org.eclipse.ui.console.TextConsole
 * @since 3.1
 * @noextend This class is not intended to be subclassed by clients.
 */
public class PatternMatchEvent extends EventObject {
	/*
	 * required by EventObject for ObjectSerialization.
	 */
	private static final long serialVersionUID = 876890383326854537L;

	/**
	 * The offset of the match within the console's document.
	 */
	private int offset;

	/**
	 * The length of the matched string
	 */
	private int length;

	/**
	 * Constructs a new pattern match event.
	 *
	 * @param console the console in which the match was found
	 * @param matchOffset the offset at which the match was found
	 * @param matchLength the length of the text that matched
	 */
	public PatternMatchEvent(TextConsole console, int matchOffset, int matchLength) {
		super(console);
		offset = matchOffset;
		length = matchLength;
	}

	/**
	 * Returns the length of the matched string.
	 *
	 * @return the length of the matched string
	 */
	public int getLength() {
		return length;
	}

	/**
	 * Returns the offset of the match within the document.
	 *
	 * @return the offset of the match within the document
	 */
	public int getOffset() {
		return offset;
	}

}

Back to the top