KickJava   Java API By Example, From Geeks To Geeks.

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


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

11 package org.eclipse.jdt.internal.debug.ui.console;
12
13
14 import org.eclipse.core.runtime.CoreException;
15 import org.eclipse.core.runtime.IStatus;
16 import org.eclipse.core.runtime.Status;
17 import org.eclipse.debug.ui.console.IConsole;
18 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
19
20 /**
21  * A hyperlink from a J9 stack trace line of the form "*.*(*)*"
22  */

23 public class J9StackTraceHyperlink extends JavaStackTraceHyperlink {
24
25     /**
26      * @see JavaStackTraceHyperlink#JavaStackTraceHyperlink(IConsole, int, int)
27      */

28     public J9StackTraceHyperlink(IConsole console) {
29         super(console);
30     }
31
32     /**
33      * @see JavaStackTraceHyperlink#getTypeName()
34      */

35     protected String JavaDoc getTypeName() throws CoreException {
36         String JavaDoc linkText = getLinkText();
37         int index = linkText.lastIndexOf('(');
38         if (index >= 0) {
39             String JavaDoc typeName = linkText.substring(0, index);
40             // remove the method name
41
index = typeName.lastIndexOf('.');
42             if (index >= 0) {
43                 typeName = typeName.substring(0, index);
44             }
45             // replace slashes with dots
46
return typeName.replace('/', '.');
47         } else {
48             IStatus status = new Status(IStatus.ERROR, JDIDebugUIPlugin.getUniqueIdentifier(), 0, ConsoleMessages.getString("J9StackTraceHyperlink.Unable_to_parse_type_name_from_hyperlink._1"), null); //$NON-NLS-1$
49
throw new CoreException(status);
50         }
51     }
52     
53     /**
54      * @see org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceHyperlink#getLineNumber()
55      */

56     protected int getLineNumber() {
57         return -1;
58     }
59
60 }
61
Popular Tags