StackTracePanelpublic final class StackTracePanel extends Object Stack Trace Panel.
This is not a panel in the regular sense. Instead this is just an object around the creation
and management of a Stack Trace display.
UI creation is done through
{@link #createPanel(Composite, String, String, String, String, String, IPreferenceStore)}. |
Fields Summary |
---|
private static ISourceRevealer | sSourceRevealer | private org.eclipse.swt.widgets.Table | mStackTraceTable | private org.eclipse.jface.viewers.TableViewer | mStackTraceViewer | private com.android.ddmlib.Client | mCurrentClient |
Methods Summary |
---|
public org.eclipse.swt.widgets.Table | createPanel(org.eclipse.swt.widgets.Composite parent, java.lang.String prefs_stack_col_class, java.lang.String prefs_stack_col_method, java.lang.String prefs_stack_col_file, java.lang.String prefs_stack_col_line, java.lang.String prefs_stack_col_native, org.eclipse.jface.preference.IPreferenceStore store)Creates the controls for the StrackTrace display.
This method will set the parent {@link Composite} to use a {@link GridLayout} with
2 columns.
mStackTraceTable = new Table(parent, SWT.MULTI | SWT.FULL_SELECTION);
mStackTraceTable.setHeaderVisible(true);
mStackTraceTable.setLinesVisible(true);
TableHelper.createTableColumn(
mStackTraceTable,
"Class",
SWT.LEFT,
"SomeLongClassName", //$NON-NLS-1$
prefs_stack_col_class, store);
TableHelper.createTableColumn(
mStackTraceTable,
"Method",
SWT.LEFT,
"someLongMethod", //$NON-NLS-1$
prefs_stack_col_method, store);
TableHelper.createTableColumn(
mStackTraceTable,
"File",
SWT.LEFT,
"android/somepackage/someotherpackage/somefile.class", //$NON-NLS-1$
prefs_stack_col_file, store);
TableHelper.createTableColumn(
mStackTraceTable,
"Line",
SWT.RIGHT,
"99999", //$NON-NLS-1$
prefs_stack_col_line, store);
TableHelper.createTableColumn(
mStackTraceTable,
"Native",
SWT.LEFT,
"Native", //$NON-NLS-1$
prefs_stack_col_native, store);
mStackTraceViewer = new TableViewer(mStackTraceTable);
mStackTraceViewer.setContentProvider(new StackTraceContentProvider());
mStackTraceViewer.setLabelProvider(new StackTraceLabelProvider());
mStackTraceViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
if (sSourceRevealer != null && mCurrentClient != null) {
// get the selected stack trace element
ISelection selection = mStackTraceViewer.getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection)selection;
Object object = structuredSelection.getFirstElement();
if (object instanceof StackTraceElement) {
StackTraceElement traceElement = (StackTraceElement)object;
if (traceElement.isNativeMethod() == false) {
sSourceRevealer.reveal(
mCurrentClient.getClientData().getClientDescription(),
traceElement.getClassName(),
traceElement.getLineNumber());
}
}
}
}
}
});
return mStackTraceTable;
| public void | setCurrentClient(com.android.ddmlib.Client currentClient)Sets the current client running the stack trace.
mCurrentClient = currentClient;
| public static void | setSourceRevealer(com.android.ddmuilib.StackTracePanel$ISourceRevealer revealer)Sets the {@link ISourceRevealer} object able to reveal source code in a source editor.
sSourceRevealer = revealer;
| public void | setViewerInput(com.android.ddmlib.IStackTraceInfo input)Sets the input for the {@link TableViewer}.
mStackTraceViewer.setInput(input);
mStackTraceViewer.refresh();
|
|