KickJava   Java API By Example, From Geeks To Geeks.

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


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
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.jdt.internal.debug.ui.JDIDebugUIPlugin;
18 import org.eclipse.ui.console.TextConsole;
19
20 /**
21  * A hyperlink from a stack trace line of the form "*(Native Method)"
22  */

23 public class JavaNativeStackTraceHyperlink extends JavaStackTraceHyperlink {
24
25     public JavaNativeStackTraceHyperlink(TextConsole console) {
26         super(console);
27     }
28
29     /**
30      * @see org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceHyperlink#getLineNumber()
31      */

32     protected int getLineNumber(String JavaDoc linkText) {
33         return -1;
34     }
35
36     protected String JavaDoc getTypeName(String JavaDoc linkText) throws CoreException {
37         String JavaDoc typeName;
38         int index = linkText.indexOf('(');
39         if (index >= 0) {
40             typeName = linkText.substring(0, index);
41             // remove the method name
42
index = typeName.lastIndexOf('.');
43             int innerClassIndex = typeName.lastIndexOf('$', index);
44             if (innerClassIndex != -1)
45                 index = innerClassIndex;
46             if (index >= 0) {
47                 typeName = typeName.substring(0, index);
48             }
49             return typeName;
50         }
51         
52         IStatus status = new Status(IStatus.ERROR, JDIDebugUIPlugin.getUniqueIdentifier(), 0, ConsoleMessages.JavaStackTraceHyperlink_Unable_to_parse_type_name_from_hyperlink__5, null);
53         throw new CoreException(status);
54     }
55 }
56
Popular Tags