Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 201062 Details for
Bug 138377
[patch] [console] [source lookup] Clicking on Java stack trace hyperlink in console is unusably slow again
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch 3
patch138377.txt (text/plain), 9.57 KB, created by
Markus Keller
on 2011-08-08 06:01:58 EDT
(
hide
)
Description:
patch 3
Filename:
MIME Type:
Creator:
Markus Keller
Created:
2011-08-08 06:01:58 EDT
Size:
9.57 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.debug.ui >Index: ui/org/eclipse/jdt/internal/debug/ui/actions/OpenTypeAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/OpenTypeAction.java,v >retrieving revision 1.27 >diff -u -r1.27 OpenTypeAction.java >--- ui/org/eclipse/jdt/internal/debug/ui/actions/OpenTypeAction.java 30 Nov 2009 16:38:02 -0000 1.27 >+++ ui/org/eclipse/jdt/internal/debug/ui/actions/OpenTypeAction.java 8 Aug 2011 09:58:06 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -16,8 +16,10 @@ > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.OperationCanceledException; > import org.eclipse.core.runtime.Status; >- >+import org.eclipse.debug.core.DebugException; >+import org.eclipse.debug.core.model.IDebugElement; > import org.eclipse.jdt.core.IJavaElement; > import org.eclipse.jdt.core.IType; > import org.eclipse.jdt.core.JavaModelException; >@@ -25,23 +27,15 @@ > import org.eclipse.jdt.core.search.SearchEngine; > import org.eclipse.jdt.core.search.TypeNameMatch; > import org.eclipse.jdt.core.search.TypeNameMatchRequestor; >- > import org.eclipse.jdt.debug.core.IJavaArrayType; > import org.eclipse.jdt.debug.core.IJavaType; > import org.eclipse.jdt.debug.ui.IJavaDebugUIConstants; >- >-import org.eclipse.jface.action.IAction; >-import org.eclipse.jface.viewers.IStructuredSelection; >- >-import org.eclipse.debug.core.DebugException; >-import org.eclipse.debug.core.model.IDebugElement; >- > import org.eclipse.jdt.internal.debug.core.JavaDebugUtils; > import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; >- > import org.eclipse.jdt.internal.ui.util.OpenTypeHierarchyUtil; >- > import org.eclipse.jdt.ui.JavaUI; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.viewers.IStructuredSelection; > > public abstract class OpenTypeAction extends ObjectActionDelegate { > >@@ -102,7 +96,7 @@ > if (source == null) { > //resort to looking through the workspace projects for the > //type as the source locators failed. >- source = findTypeInWorkspace(type.getName()); >+ source = findTypeInWorkspace(type.getName(), false); > } > } > } >@@ -140,10 +134,15 @@ > * or <code>null</code> if none. > * > * @param typeName fully qualified type name >+ * @param findOnlyUniqueMatch >+ * if <code>true</code>, this method only returns a type iff >+ * there's only a single match in the workspace, and >+ * <code>null</code> otherwise. If <code>false</code>, it returns >+ * the first match. > * @return type or <code>null</code> >- * @throws JavaModelException >+ * @throws CoreException if search failed > */ >- public static IType findTypeInWorkspace(String typeName) throws CoreException { >+ public static IType findTypeInWorkspace(String typeName, boolean findOnlyUniqueMatch) throws CoreException { > int dot= typeName.lastIndexOf('.'); > char[][] qualifications; > String simpleName; >@@ -156,6 +155,14 @@ > } > char[][] typeNames= new char[][] { simpleName.toCharArray() }; > >+ if (findOnlyUniqueMatch) >+ return findUniqueTypeInWorkspace(qualifications, typeNames); >+ else >+ return findAnyTypeInWorkspace(qualifications, typeNames); >+ } >+ >+ private static IType findAnyTypeInWorkspace(char[][] qualifications, >+ char[][] typeNames) throws JavaModelException { > class ResultException extends RuntimeException { > private static final long serialVersionUID= 1L; > private final IType fType; >@@ -176,6 +183,26 @@ > return null; > } > >+ private static IType findUniqueTypeInWorkspace(char[][] qualifications, >+ char[][] typeNames) throws JavaModelException { >+ final IType[] result = { null }; >+ TypeNameMatchRequestor requestor= new TypeNameMatchRequestor() { >+ public void acceptTypeNameMatch(TypeNameMatch match) { >+ if (result[0] == null) { >+ result[0]= match.getType(); >+ } else { >+ throw new OperationCanceledException(); >+ } >+ } >+ }; >+ try { >+ new SearchEngine().searchAllTypeNames(qualifications, typeNames, SearchEngine.createWorkspaceScope(), requestor, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null); >+ } catch (OperationCanceledException e) { >+ return null; >+ } >+ return result[0]; >+ } >+ > > protected void typeHierarchyError() { > showErrorMessage(ActionMessages.ObjectActionDelegate_Unable_to_display_type_hierarchy__The_selected_source_element_is_not_contained_in_the_workspace__1); >Index: ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceHyperlink.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceHyperlink.java,v >retrieving revision 1.38 >diff -u -r1.38 JavaStackTraceHyperlink.java >--- ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceHyperlink.java 27 Apr 2007 18:24:48 -0000 1.38 >+++ ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceHyperlink.java 8 Aug 2011 09:58:06 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -40,14 +40,15 @@ > import com.ibm.icu.text.MessageFormat; > > /** >- * A hyperlink from a stack trace line of the form "*(*.java:*)" >+ * A hyper-link from a stack trace line of the form "*(*.java:*)" > */ > public class JavaStackTraceHyperlink implements IHyperlink { > > private TextConsole fConsole; > > /** >- * Constructor for JavaStackTraceHyperlink. >+ * Constructor >+ * @param console the {@link TextConsole} this link detector is attached to > */ > public JavaStackTraceHyperlink(TextConsole console) { > fConsole = console; >@@ -91,6 +92,7 @@ > * Starts a search for the type with the given name. Reports back to 'searchCompleted(...)'. > * > * @param typeName the type to search for >+ * @param lineNumber the line number to open the editor on > */ > protected void startSourceSearch(final String typeName, final int lineNumber) { > Job search = new Job(ConsoleMessages.JavaStackTraceHyperlink_2) { >@@ -98,12 +100,14 @@ > ILaunch launch = getLaunch(); > Object result = null; > try { >- if (launch != null) { >+ // search for the type in the workspace >+ result = OpenTypeAction.findTypeInWorkspace(typeName, true); >+ if (result == null && launch != null) { > result = JavaDebugUtils.resolveSourceElement(JavaDebugUtils.generateSourceName(typeName), getLaunch()); > } > if (result == null) { >- // search for the type in the workspace >- result = OpenTypeAction.findTypeInWorkspace(typeName); >+ // search for any type in the workspace >+ result = OpenTypeAction.findTypeInWorkspace(typeName, false); > } > searchCompleted(result, typeName, lineNumber, null); > } catch (CoreException e) { >@@ -116,6 +120,14 @@ > search.schedule(); > } > >+ /** >+ * Reported back to from {@link JavaStackTraceHyperlink#startSourceSearch(String, int)} when results are found >+ * >+ * @param source the source object >+ * @param typeName the fully qualified type name >+ * @param lineNumber the line number in the type >+ * @param status the error status or <code>null</code> if none >+ */ > protected void searchCompleted(final Object source, final String typeName, final int lineNumber, final IStatus status) { > UIJob job = new UIJob("link search complete") { //$NON-NLS-1$ > public IStatus runInUIThread(IProgressMonitor monitor) { >@@ -172,10 +184,10 @@ > } > > /** >- * Returns the launch associated with this hyperlink, or >+ * Returns the launch associated with this hyper-link, or > * <code>null</code> if none > * >- * @return the launch associated with this hyperlink, or >+ * @return the launch associated with this hyper-link, or > * <code>null</code> if none > */ > private ILaunch getLaunch() { >@@ -188,7 +200,8 @@ > > /** > * Returns the fully qualified name of the type to open >- * >+ * >+ * @param linkText the complete text of the link to be parsed > * @return fully qualified type name > * @exception CoreException if unable to parse the type name > */ >@@ -233,6 +246,8 @@ > /** > * Returns the line number associated with the stack trace or -1 if none. > * >+ * @param linkText the complete text of the link to be parsed >+ * @return the line number for the stack trace or -1 if one cannot be computed or has not been provided > * @exception CoreException if unable to parse the number > */ > protected int getLineNumber(String linkText) throws CoreException { >@@ -266,6 +281,7 @@ > /** > * Returns this link's text > * >+ * @return the complete text of the link, never <code>null</code> > * @exception CoreException if unable to retrieve the text > */ > protected String getLinkText() throws CoreException {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 138377
:
39474
|
194615
|
194625
| 201062