01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.console;
11:
12: import java.util.EventObject;
13:
14: /**
15: * An event describing a pattern match in a text console. The source of the event
16: * is a <code>TextConsole</code>.
17: * <p>
18: * Clients may instantiate this class; not intended to be subclassed.
19: * </p>
20: * @see org.eclipse.ui.console.IPatternMatchListener
21: * @see org.eclipse.ui.console.TextConsole
22: * @since 3.1
23: */
24: public class PatternMatchEvent extends EventObject {
25: /*
26: * required by EventObject for ObjectSerialization.
27: */
28: private static final long serialVersionUID = 876890383326854537L;
29:
30: /**
31: * The offset of the match within the console's document.
32: */
33: private int offset;
34:
35: /**
36: * The length of the matched string
37: */
38: private int length;
39:
40: /**
41: * Constructs a new pattern match event.
42: *
43: * @param console the console in which the match was found
44: * @param matchOffset the offset at which the match was found
45: * @param matchLength the length of the text that matched
46: */
47: public PatternMatchEvent(TextConsole console, int matchOffset,
48: int matchLength) {
49: super (console);
50: offset = matchOffset;
51: length = matchLength;
52: }
53:
54: /**
55: * Returns the length of the matched string.
56: *
57: * @return the length of the matched string
58: */
59: public int getLength() {
60: return length;
61: }
62:
63: /**
64: * Returns the offset of the match within the document.
65: *
66: * @return the offset of the match within the document
67: */
68: public int getOffset() {
69: return offset;
70: }
71:
72: }
|