private void MenuToolsSelection(object userData, string[] options, int selected)
        {
            switch (selected)
            {
            case 0:
                AndroidLogcatScreenCaptureWindow.ShowWindow();
                break;

            case 1:
                AndroidLogcatUtilities.OpenTerminal(Path.GetDirectoryName(m_Runtime.Tools.ADB.GetADBPath()));
                break;

            case 2:
                AndroidLogcatStacktraceWindow.ShowStacktraceWindow();
                break;

            case 3:
                m_Runtime.ProjectSettings.MemoryViewerState.Behavior = MemoryViewerBehavior.Auto;
                break;

            case 4:
                m_Runtime.ProjectSettings.MemoryViewerState.Behavior = MemoryViewerBehavior.Manual;
                break;

            case 5:
                m_Runtime.ProjectSettings.MemoryViewerState.Behavior = MemoryViewerBehavior.Hidden;
                break;
            }
        }
        private void MenuToolsSelection(object userData, string[] options, int selected)
        {
            var contextMenu = (AndroidContextMenu <ToolsContextMenu>)userData;
            var item        = contextMenu.GetItemAt(selected);

            if (item == null)
            {
                return;
            }

            switch (item.Item)
            {
            case ToolsContextMenu.ScreenCapture:
                AndroidLogcatScreenCaptureWindow.ShowWindow();
                break;

            case ToolsContextMenu.OpenTerminal:
                AndroidLogcatUtilities.OpenTerminal(Path.GetDirectoryName(m_Runtime.Tools.ADB.GetADBPath()));
                break;

            case ToolsContextMenu.StacktraceUtility:
                AndroidLogcatStacktraceWindow.ShowStacktraceWindow();
                break;

            case ToolsContextMenu.MemoryBehaviorAuto:
                m_Runtime.UserSettings.MemoryViewerState.Behavior = MemoryViewerBehavior.Auto;
                break;

            case ToolsContextMenu.MemoryBehaviorManual:
                m_Runtime.UserSettings.MemoryViewerState.Behavior = MemoryViewerBehavior.Manual;
                break;

            case ToolsContextMenu.MemoryBehaviorHidden:
                m_Runtime.UserSettings.MemoryViewerState.Behavior = MemoryViewerBehavior.Hidden;
                break;
            }
        }
        internal void OnGUI()
        {
            if (m_ApplySettings)
            {
                ApplySettings(m_Runtime.Settings);
                m_ApplySettings = false;
            }

            EditorGUILayout.BeginVertical();
            EditorGUILayout.BeginHorizontal(AndroidLogcatStyles.toolbar);
            {
                ShowDuringBuildRun = GUILayout.Toggle(ShowDuringBuildRun, kAutoRunText, AndroidLogcatStyles.toolbarButton);

                HandleSelectedDeviceField();

                EditorGUI.BeginDisabledGroup(!m_StatusBar.Connected);
                HandleSelectedPackage();

                HandleSearchField();

                SetRegex(GUILayout.Toggle(m_FilterIsRegularExpression, kRegexText, AndroidLogcatStyles.toolbarButton));

                EditorGUI.EndDisabledGroup();

                GUILayout.Space(kSpace);

                if (GUILayout.Button(kReconnect, AndroidLogcatStyles.toolbarButton))
                {
                    RestartLogCat();
                }
                if (GUILayout.Button(kDisconnect, AndroidLogcatStyles.toolbarButton))
                {
                    StopLogCat();
                }

                GUILayout.Space(kSpace);
                if (GUILayout.Button(kClearButtonText, AndroidLogcatStyles.toolbarButton))
                {
                    ClearLogCat();
                    Repaint();
                }

                GUILayout.Space(kSpace);
                if (GUILayout.Button(kCaptureScreenText, AndroidLogcatStyles.toolbarButton))
                {
                    var screenFilePath = AndroidLogcatUtilities.CaptureScreen(GetCachedAdb(), m_SelectedDeviceId);
                    if (!string.IsNullOrEmpty(screenFilePath))
                    {
                        AndroidLogcatScreenCaptureWindow.Show(screenFilePath);
                    }
                    Repaint();
                }

                GUILayout.Space(kSpace);
                if (GUILayout.Button(kOpenTerminal, AndroidLogcatStyles.toolbarButton))
                {
                    AndroidLogcatUtilities.OpenTerminal(Path.GetDirectoryName(GetCachedAdb().GetADBPath()));
                }
                GUILayout.Space(kSpace);
                if (GUILayout.Button(kStacktraceUtility, AndroidLogcatStyles.toolbarButton))
                {
                    AndroidLogcatStacktraceWindow.ShowStacktraceWindow();
                }
            }
            EditorGUILayout.EndHorizontal();

            if (Unsupported.IsDeveloperMode())
            {
                DoDebuggingGUI();
            }

            if (DoMessageView())
            {
                Repaint();
            }

            if (m_StatusBar != null)
            {
                m_StatusBar.DoGUI();
            }

            EditorGUILayout.EndVertical();
        }