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 88765 Details for
Bug 217630
[performance] Java StackTrace hyperlink detection could be improved
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
patch.txt (text/plain), 7.61 KB, created by
Jacek Pospychala
on 2008-02-04 08:23:54 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Jacek Pospychala
Created:
2008-02-04 08:23:54 EST
Size:
7.61 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.java.ui >Index: src/org/eclipse/mylyn/internal/java/ui/JavaStackTraceHyperlinkDetector.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.java.ui/src/org/eclipse/mylyn/internal/java/ui/JavaStackTraceHyperlinkDetector.java,v >retrieving revision 1.7 >diff -u -r1.7 JavaStackTraceHyperlinkDetector.java >--- src/org/eclipse/mylyn/internal/java/ui/JavaStackTraceHyperlinkDetector.java 14 Aug 2007 20:55:37 -0000 1.7 >+++ src/org/eclipse/mylyn/internal/java/ui/JavaStackTraceHyperlinkDetector.java 4 Feb 2008 12:56:23 -0000 >@@ -24,7 +24,7 @@ > */ > public class JavaStackTraceHyperlinkDetector extends AbstractHyperlinkDetector { > >- private static final Pattern stackTracePattern = Pattern.compile("\\S*.{1}java:\\d*\\){1}", >+ private static final Pattern stackTracePattern = Pattern.compile("\\S*\\.java:\\d*\\)", > Pattern.CASE_INSENSITIVE); > > public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { >Index: src/org/eclipse/mylyn/internal/java/ui/JavaStackTraceFileHyperlink.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.java.ui/src/org/eclipse/mylyn/internal/java/ui/JavaStackTraceFileHyperlink.java,v >retrieving revision 1.6 >diff -u -r1.6 JavaStackTraceFileHyperlink.java >--- src/org/eclipse/mylyn/internal/java/ui/JavaStackTraceFileHyperlink.java 26 Jun 2007 01:16:49 -0000 1.6 >+++ src/org/eclipse/mylyn/internal/java/ui/JavaStackTraceFileHyperlink.java 4 Feb 2008 12:56:23 -0000 >@@ -9,6 +9,10 @@ > package org.eclipse.mylyn.internal.java.ui; > > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.core.runtime.jobs.Job; > import org.eclipse.debug.ui.IDebugModelPresentation; > import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; > import org.eclipse.jdt.internal.debug.ui.actions.OpenTypeAction; >@@ -20,6 +24,7 @@ > import org.eclipse.ui.IEditorInput; > import org.eclipse.ui.IEditorPart; > import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.progress.UIJob; > import org.eclipse.ui.texteditor.IDocumentProvider; > import org.eclipse.ui.texteditor.ITextEditor; > >@@ -53,46 +58,18 @@ > > public void open() { > >- int lineNumber; > try { > > String typeName = getTypeName(); >- lineNumber = getLineNumber(); >+ int lineNumber = getLineNumber(); > > // documents start at 0 > if (lineNumber > 0) { > lineNumber--; > } >- Object sourceElement = getSourceElement(typeName); >- if (sourceElement != null) { >- IDebugModelPresentation presentation = JDIDebugUIPlugin.getDefault().getModelPresentation(); >- IEditorInput editorInput = presentation.getEditorInput(sourceElement); >- if (editorInput != null) { >- String editorId = presentation.getEditorId(editorInput, sourceElement); >- if (editorId != null) { >- IEditorPart editorPart = JDIDebugUIPlugin.getActivePage().openEditor(editorInput, editorId); >- if (editorPart instanceof ITextEditor && lineNumber >= 0) { >- ITextEditor textEditor = (ITextEditor) editorPart; >- IDocumentProvider provider = textEditor.getDocumentProvider(); >- provider.connect(editorInput); >- IDocument document = provider.getDocument(editorInput); >- try { >- IRegion line = document.getLineInformation(lineNumber); >- textEditor.selectAndReveal(line.getOffset(), line.getLength()); >- } catch (BadLocationException e1) { >- MessageDialog.openInformation(PlatformUI.getWorkbench() >- .getActiveWorkbenchWindow() >- .getShell(), "Open Type", "Line not found in type."); >- } >- provider.disconnect(editorInput); >- } >- return; >- } >- } >- } >- // did not find source >- MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Open Type", >- "Type could not be located."); >+ >+ startSourceSearch(typeName, lineNumber); >+ > } catch (CoreException e1) { > MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Open Type", > "Failed to open type."); >@@ -100,13 +77,82 @@ > } > > } >+ >+ /** >+ * Starts a search for the type with the given name. Reports back to 'searchCompleted(...)'. >+ * >+ * @param typeName the type to search for >+ */ >+ protected void startSourceSearch(final String typeName, final int lineNumber) { >+ Job search = new Job("Searching...") { >+ protected IStatus run(IProgressMonitor monitor) { >+ try { >+ // search for the type in the workspace >+ Object result = OpenTypeAction.findTypeInWorkspace(typeName); >+ searchCompleted(result, typeName, lineNumber, null); >+ } catch (CoreException e) { >+ searchCompleted(null, typeName, lineNumber, e.getStatus()); >+ } >+ return Status.OK_STATUS; >+ } > >- // adapted from JavaStackTraceHyperlink >- private Object getSourceElement(String typeName) throws CoreException { >- Object result = null; >- result = OpenTypeAction.findTypeInWorkspace(typeName); >- // } >- return result; >+ }; >+ search.schedule(); >+ } >+ >+ 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) { >+ if (source == null) { >+ // did not find source >+ MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Open Type", >+ "Type could not be located."); >+ } else { >+ processSearchResult(source, typeName, lineNumber); >+ } >+ return Status.OK_STATUS; >+ } >+ }; >+ job.setSystem(true); >+ job.schedule(); >+ } >+ >+ /** >+ * The search succeeded with the given result >+ * >+ * @param source resolved source object for the search >+ * @param typeName type name searched for >+ * @param lineNumber line number on link >+ */ >+ protected void processSearchResult(Object source, String typeName, int lineNumber) { >+ IDebugModelPresentation presentation = JDIDebugUIPlugin.getDefault().getModelPresentation(); >+ IEditorInput editorInput = presentation.getEditorInput(source); >+ if (editorInput != null) { >+ String editorId = presentation.getEditorId(editorInput, source); >+ if (editorId != null) { >+ try { >+ IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(editorInput, editorId); >+ if (editorPart instanceof ITextEditor && lineNumber >= 0) { >+ ITextEditor textEditor = (ITextEditor) editorPart; >+ IDocumentProvider provider = textEditor.getDocumentProvider(); >+ provider.connect(editorInput); >+ IDocument document = provider.getDocument(editorInput); >+ try { >+ IRegion line = document.getLineInformation(lineNumber); >+ textEditor.selectAndReveal(line.getOffset(), line.getLength()); >+ } catch (BadLocationException e) { >+ MessageDialog.openInformation(PlatformUI.getWorkbench() >+ .getActiveWorkbenchWindow() >+ .getShell(), "Open Type", "Line not found in type."); >+ } >+ provider.disconnect(editorInput); >+ } >+ } catch (CoreException e) { >+ MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Open Type", >+ "Failed to open type."); >+ } >+ } >+ } > } > > // adapted from JavaStackTraceHyperlink
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 217630
: 88765