aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins/com.android.ide.eclipse.traceview/src/com
diff options
context:
space:
mode:
authorSiva Velusamy <vsiva@google.com>2011-12-20 14:40:22 -0800
committerSiva Velusamy <vsiva@google.com>2011-12-20 15:29:57 -0800
commite22acd391ef9c71c86a348e8491d8b1c9c1eac1d (patch)
treee1af68986efc92bffffaafee8ab5e11c9f7b4c7f /eclipse/plugins/com.android.ide.eclipse.traceview/src/com
parent3d73211da767ae07698d12db1f6d6f8a0b0ed7bd (diff)
downloadsdk-e22acd391ef9c71c86a348e8491d8b1c9c1eac1d.zip
sdk-e22acd391ef9c71c86a348e8491d8b1c9c1eac1d.tar.gz
sdk-e22acd391ef9c71c86a348e8491d8b1c9c1eac1d.tar.bz2
Remove JDT dependency from DDMS & TraceView.
Currently, there are three locations that require the ability to open a Java file containing a particular method: DDMS stack trace, logcat and traceview. The logcat and traceview panels use JDT to open up a Java editor on a method. As a result, these plugins have a dependency on JDT. The stack trace panel uses the DDMS plugin's sourceRevealer extension point to achieve the same purpose. ADT plugin provides an implementation of the sourceRevealer plugin. As a result, this introduces a JDT dependency only on the ADT plugin. This patch makes both the logcat & trace view code to use the same sourceRevealer extension point. As a result, all source code involved in revealing the source of a Java method is present in a single place, and DDMS & Traceview plugins don't depend on JDT anymore. Change-Id: I5b840dc4d6ad45e5611a80cff740101c484a99dd
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.traceview/src/com')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.traceview/src/com/android/ide/eclipse/traceview/editors/TraceviewEditor.java52
1 files changed, 2 insertions, 50 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.traceview/src/com/android/ide/eclipse/traceview/editors/TraceviewEditor.java b/eclipse/plugins/com.android.ide.eclipse.traceview/src/com/android/ide/eclipse/traceview/editors/TraceviewEditor.java
index 3ac5bcc..13f8d0f 100644
--- a/eclipse/plugins/com.android.ide.eclipse.traceview/src/com/android/ide/eclipse/traceview/editors/TraceviewEditor.java
+++ b/eclipse/plugins/com.android.ide.eclipse.traceview/src/com/android/ide/eclipse/traceview/editors/TraceviewEditor.java
@@ -15,6 +15,7 @@
*/
package com.android.ide.eclipse.traceview.editors;
+import com.android.ide.eclipse.ddms.JavaSourceRevealer;
import com.android.ide.eclipse.traceview.TraceviewPlugin;
import com.android.traceview.ColorController;
import com.android.traceview.DmTraceReader;
@@ -37,16 +38,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.core.search.SearchMatch;
-import org.eclipse.jdt.core.search.SearchParticipant;
-import org.eclipse.jdt.core.search.SearchPattern;
-import org.eclipse.jdt.core.search.SearchRequestor;
-import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -311,52 +303,12 @@ public class TraceviewEditor extends EditorPart implements MethodHandler {
mParent.setFocus();
}
- private static class TraceSearchRequestor extends SearchRequestor {
- private MethodData mMethod;
-
- public TraceSearchRequestor(MethodData method) {
- mMethod = method;
- }
-
- @Override
- public void acceptSearchMatch(SearchMatch match) throws CoreException {
- Object element = match.getElement();
- if (element instanceof IMethod) {
- IMethod method = (IMethod) element;
- if (method.getSignature().equals(mMethod.getSignature())) {
- JavaUI.openInEditor(method);
- }
- }
- }
- }
-
// ---- MethodHandler methods
-
public void handleMethod(MethodData method) {
- // it's a bit complicated to convert the signature we have with what the
- // search engine require, so we'll search by name only and test the signature
- // when we get the result(s).
String methodName = method.getMethodName();
String className = method.getClassName().replaceAll("/", "."); //$NON-NLS-1$ //$NON-NLS-21$
String fqmn = className + "." + methodName; //$NON-NLS-1$
- try {
- SearchEngine se = new SearchEngine();
- se.search(SearchPattern.createPattern(
- fqmn,
- IJavaSearchConstants.METHOD,
- IJavaSearchConstants.DECLARATIONS,
- SearchPattern.R_EXACT_MATCH
- | SearchPattern.R_CASE_SENSITIVE),
- new SearchParticipant[] { SearchEngine .getDefaultSearchParticipant() },
- SearchEngine.createWorkspaceScope(),
- new TraceSearchRequestor(method),
- new NullProgressMonitor());
- } catch (CoreException e) {
-
- }
+ JavaSourceRevealer.revealMethod(fqmn);
}
-
- // -----
-
}