void goToErrorLine(String choice) {
    try {
      String msg = mLogPanel.getSelectedErrorLineMessage();
      if (msg != null) {
        String error_line_matcher_string = "\\s*at\\ (.*)\\((.*)\\.java\\:(\\d+)\\)";
        Matcher error_line_matcher = Pattern.compile(error_line_matcher_string).matcher(msg);

        if (error_line_matcher.find()) {
          String class_name_method = error_line_matcher.group(1);

          // TODO: Search currently only matches the class declaration (using
          // IJavaSearchConstants.DECLARATIONS). We may want to jump to the
          // "reference" of the class instead (IJavaSearchConstants.REFERENCES)
          // using the filename and line number to disambiguate the search results.
          String class_name_line = error_line_matcher.group(2);
          int line_number = Integer.parseInt(error_line_matcher.group(3));

          SearchEngine se = new SearchEngine();
          if (CHOICE_ERROR_LINE.equals(choice)) {
            se.search(
                SearchPattern.createPattern(
                    class_name_line,
                    IJavaSearchConstants.CLASS,
                    IJavaSearchConstants.DECLARATIONS,
                    SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE),
                new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()},
                SearchEngine.createWorkspaceScope(),
                new LogCatViewSearchRequestor(CHOICE_ERROR_LINE, line_number),
                new NullProgressMonitor());
          } else if (CHOICE_METHOD_DECLARATION.equals(choice)) {
            se.search(
                SearchPattern.createPattern(
                    class_name_method,
                    IJavaSearchConstants.METHOD,
                    IJavaSearchConstants.DECLARATIONS,
                    SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE),
                new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()},
                SearchEngine.createWorkspaceScope(),
                new LogCatViewSearchRequestor(CHOICE_METHOD_DECLARATION, 0),
                new NullProgressMonitor());
          }
        }
      }
    } catch (Exception e) {
      Status s = new Status(Status.ERROR, DdmsPlugin.PLUGIN_ID, e.getMessage(), e);
      DdmsPlugin.getDefault().getLog().log(s);
    }
  }
 @Override
 public void dispose() {
   mLogPanel.stopLogCat(true);
   mClipboard.dispose();
 }
 @Override
 public void setFocus() {
   mLogPanel.setFocus();
 }
  @Override
  public void createPartControl(Composite parent) {
    Display d = parent.getDisplay();
    LogColors colors = new LogColors();

    ImageLoader loader = ImageLoader.getDdmUiLibLoader();

    colors.infoColor = new Color(d, 0, 127, 0);
    colors.debugColor = new Color(d, 0, 0, 127);
    colors.errorColor = new Color(d, 255, 0, 0);
    colors.warningColor = new Color(d, 255, 127, 0);
    colors.verboseColor = new Color(d, 0, 0, 0);

    mCreateFilterAction =
        new CommonAction("Create Filter") {
          @Override
          public void run() {
            mLogPanel.addFilter();
          }
        };
    mCreateFilterAction.setToolTipText("Create Filter");
    mCreateFilterAction.setImageDescriptor(loader.loadDescriptor("add.png"));

    mEditFilterAction =
        new CommonAction("Edit Filter") {
          @Override
          public void run() {
            mLogPanel.editFilter();
          }
        };
    mEditFilterAction.setToolTipText("Edit Filter");
    mEditFilterAction.setImageDescriptor(loader.loadDescriptor("edit.png")); // $NON-NLS-1$

    mDeleteFilterAction =
        new CommonAction("Delete Filter") {
          @Override
          public void run() {
            mLogPanel.deleteFilter();
          }
        };
    mDeleteFilterAction.setToolTipText("Delete Filter");
    mDeleteFilterAction.setImageDescriptor(loader.loadDescriptor("delete.png")); // $NON-NLS-1$

    mExportAction =
        new CommonAction("Export Selection As Text...") {
          @Override
          public void run() {
            mLogPanel.save();
          }
        };
    mExportAction.setToolTipText("Export Selection As Text...");
    mExportAction.setImageDescriptor(loader.loadDescriptor("save.png")); // $NON-NLS-1$

    mGotoMethodDeclarationAction =
        new CommonAction("Go to Problem (method declaration)") {
          @Override
          public void run() {
            goToErrorLine(CHOICE_METHOD_DECLARATION);
          }
        };

    mGotoErrorLineAction =
        new CommonAction("Go to Problem (error line)") {
          @Override
          public void run() {
            goToErrorLine(CHOICE_ERROR_LINE);
          }
        };

    LogLevel[] levels = LogLevel.values();
    mLogLevelActions = new CommonAction[mLogLevelIcons.length];
    for (int i = 0; i < mLogLevelActions.length; i++) {
      String name = levels[i].getStringValue();
      mLogLevelActions[i] =
          new CommonAction(name, IAction.AS_CHECK_BOX) {
            @Override
            public void run() {
              // disable the other actions and record current index
              for (int i = 0; i < mLogLevelActions.length; i++) {
                Action a = mLogLevelActions[i];
                if (a == this) {
                  a.setChecked(true);

                  // set the log level
                  mLogPanel.setCurrentFilterLogLevel(i + 2);
                } else {
                  a.setChecked(false);
                }
              }
            }
          };

      mLogLevelActions[i].setToolTipText(name);
      mLogLevelActions[i].setImageDescriptor(loader.loadDescriptor(mLogLevelIcons[i]));
    }

    mClearAction =
        new Action("Clear Log") {
          @Override
          public void run() {
            mLogPanel.clear();
          }
        };
    mClearAction.setImageDescriptor(loader.loadDescriptor("clear.png")); // $NON-NLS-1$

    // now create the log view
    mLogPanel = new LogPanel(colors, new FilterStorage(), LogPanel.FILTER_MANUAL);
    mLogPanel.setLogCatViewInterface(this);
    mLogPanel.setActions(mDeleteFilterAction, mEditFilterAction, mLogLevelActions);

    // get the font
    String fontStr =
        DdmsPlugin.getDefault()
            .getPreferenceStore()
            .getString(PreferenceInitializer.ATTR_LOGCAT_FONT);
    if (fontStr != null) {
      FontData data = new FontData(fontStr);

      if (fontStr != null) {
        mLogPanel.setFont(new Font(parent.getDisplay(), data));
      }
    }

    mLogPanel.createPanel(parent);
    setSelectionDependentPanel(mLogPanel);

    // place the actions.
    placeActions();

    // setup the copy action
    mClipboard = new Clipboard(d);
    IActionBars actionBars = getViewSite().getActionBars();
    actionBars.setGlobalActionHandler(
        ActionFactory.COPY.getId(),
        new Action("Copy") {
          @Override
          public void run() {
            mLogPanel.copy(mClipboard);
          }
        });

    // setup the select all action
    actionBars.setGlobalActionHandler(
        ActionFactory.SELECT_ALL.getId(),
        new Action("Select All") {
          @Override
          public void run() {
            mLogPanel.selectAll();
          }
        });
  }