KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > console > JavaExceptionConsoleTracker


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.jdt.internal.debug.ui.console;
12
13 import org.eclipse.jface.text.BadLocationException;
14 import org.eclipse.ui.console.IHyperlink;
15 import org.eclipse.ui.console.PatternMatchEvent;
16 import org.eclipse.ui.console.TextConsole;
17
18 /**
19  * creates JavaExceptionHyperLinks
20  *
21  * @since 3.1
22  */

23 public class JavaExceptionConsoleTracker extends JavaConsoleTracker {
24     
25     /* (non-Javadoc)
26      * @see org.eclipse.ui.console.IPatternMatchListenerDelegate#matchFound(org.eclipse.ui.console.PatternMatchEvent)
27      */

28     public void matchFound(PatternMatchEvent event) {
29         try {
30             int offset = event.getOffset();
31             int length = event.getLength();
32             TextConsole console = getConsole();
33             String JavaDoc exceptionName;
34             exceptionName = console.getDocument().get(offset, length - 1);
35             IHyperlink link = new JavaExceptionHyperLink(console, exceptionName);
36             getConsole().addHyperlink(link, offset, length - 1);
37         } catch (BadLocationException e) {
38         }
39     }
40 }
41
Popular Tags