KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > console > PatternMatchEvent


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.console;
12
13 import java.util.EventObject JavaDoc;
14
15 /**
16  * An event describing a pattern match in a text console. The source of the event
17  * is a <code>TextConsole</code>.
18  * <p>
19  * Clients may instantiate this class; not intended to be subclassed.
20  * </p>
21  * @see org.eclipse.ui.console.IPatternMatchListener
22  * @see org.eclipse.ui.console.TextConsole
23  * @since 3.1
24  */

25 public class PatternMatchEvent extends EventObject JavaDoc {
26     /*
27      * required by EventObject for ObjectSerialization.
28      */

29     private static final long serialVersionUID = 876890383326854537L;
30     
31     /**
32      * The offset of the match within the console's document.
33      */

34     private int offset;
35     
36     /**
37      * The length of the matched string
38      */

39     private int length;
40
41     /**
42      * Constructs a new pattern match event.
43      *
44      * @param console the console in which the match was found
45      * @param matchOffset the offset at which the match was found
46      * @param matchLength the length of the text that matched
47      */

48     public PatternMatchEvent(TextConsole console, int matchOffset, 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 }
73
Popular Tags