Пример #1
0
        private void ShowForm()
        {
            CqaLabel.Heading2(DialogTitle);

            _scopeEnumFormGroup.Show();
            _nameStringFormGroup.Show();

            UpdateKeyFromNameIfUserDidNotSetIt();

            _keyStringFormGroup.Show();


            GUILayout.BeginHorizontal();
            EditorGUI.BeginDisabledGroup(!Valid());
            if (CqaButton.SmallButton("Save"))
            {
                Save();
            }

            EditorGUI.EndDisabledGroup();

            if (OldGroup != null && CqaButton.SmallButton("Delete"))
            {
                Delete();
            }

            GUILayout.EndHorizontal();

            if (CqaButton.SmallButton("Abort"))
            {
                Close();
            }
        }
Пример #2
0
        private void ShowForm()
        {
            CqaLabel.Heading2(DialogTitle);

            _groupDropdownFormGroup.Show();
            _keyStringFormGroup.Show();
            _ruleTypeFormGroup.Show();
            _descriptionStringFormGroup.Show();
            _cypherQueryTextAreaFormGroup.Show();

            GUILayout.BeginHorizontal();
            EditorGUI.BeginDisabledGroup(!Valid());
            if (CqaButton.SmallButton("Save"))
            {
                Save();
            }

            EditorGUI.EndDisabledGroup();

            if (OldRule != null && CqaButton.SmallButton("Delete"))
            {
                Delete();
            }

            GUILayout.EndHorizontal();

            if (CqaButton.SmallButton("Abort"))
            {
                Close();
            }

            GUILayout.Space(10);
        }
Пример #3
0
        public void Show()
        {
            CqaLabel.Heading1("Install & Uninstall");

            if (_jqaManager.CheckIfJqaIsInstalling())
            {
                CqaLabel.Bold("Status: Installing ...");
            }
            else if (JqaManager.CheckIfJqaIsInstalled())
            {
                CqaLabel.Success("Status: Installed");
            }
            else
            {
                CqaLabel.Error("Status: Not Installed");
            }

            if (!JqaManager.CheckIfJqaIsInstalled())
            {
                GUILayout.Label("CQA is not installed yet.");
                GUILayout.Label("To install it we need to download files from jqassistant.org and github.com.");
                GUILayout.Label("If you agree click the button below.");

                EditorGUILayout.Space();

                if (CqaButton.NormalButton("Install"))
                {
                    _jqaManager.InstallJqa();
                    Thread.Sleep(10);
                }

                return;
            }

            if (_jqaManager.CheckIfJqaIsInstalling())
            {
                GUILayout.Label("For more information have a look at the Unity console.");
                EditorGUILayout.Space();

                if (CqaButton.NormalButton("Abort Installation"))
                {
                    _jqaManager.AbortInstallation();

                    while (_jqaManager.CheckIfJqaIsInstalling())
                    {
                        Thread.Sleep(0);
                    }

                    JqaManager.UninstallJqa();
                }

                return;
            }

            EditorGUILayout.Space();
            if (CqaButton.NormalButton("Uninstall"))
            {
                JqaManager.UninstallJqa();
            }
        }
Пример #4
0
        private void CreateGroupCheckboxAndFoldout(Group group)
        {
            GUILayout.BeginHorizontal();
            if (CqaButton.EditButton())
            {
                CqaGroupEditWindow.Open(_dataScope, group);
            }

            _groupFoldout[group] = EditorGUILayout.Foldout(_groupFoldout[group], group.name);
            GUILayout.EndHorizontal();
        }
Пример #5
0
        public void Show()
        {
            CqaLabel.Heading1("Manage Custom Rules");

            ShowGlobalRuleEditor();
            ShowLocalRuleEditor();

            GUILayout.Space(10);

            if (CqaButton.NormalButton("Create Group"))
            {
                CqaGroupEditWindow.Open(DataScope.Local);
            }

            if ((_localRuleManager.DoGroupsExist() || _globalRuleManager.DoGroupsExist()) &&
                CqaButton.NormalButton("Create Rule"))
            {
                CqaRuleEditWindow.Open(DataScope.Local);
            }

            GUILayout.Space(10);
        }
Пример #6
0
        private void CreateRuleCheckboxesForGroup(Group group)
        {
            if (!_groupFoldout[group])
            {
                return;
            }

            foreach (Rule rule in group.rules)
            {
                // Set a horizontal offset.
                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(20);

                if (CqaButton.EditButton())
                {
                    CqaRuleEditWindow.Open(_dataScope, group, rule);
                }

                CqaLabel.FoldoutEntry(rule.description);
                EditorGUILayout.EndHorizontal();
            }
        }
Пример #7
0
        private void ShowReportButtons()
        {
            EditorGUI.BeginDisabledGroup(_jqaExecutor.IsAnyProcessRunning());
            GUILayout.Space(15);

            if (CqaButton.NormalButton("Create Report"))
            {
                _jqaExecutor.CheckAndReport();
            }

            FileInfo reportFileInfo = new FileInfo(JqaPaths.Instance.BuildJqaHtmlReportPath());

            EditorGUI.BeginDisabledGroup(!reportFileInfo.Exists);
            if (CqaButton.NormalButton("Open Report in Browser"))
            {
                Application.OpenURL(reportFileInfo.FullName);
            }

            EditorGUI.EndDisabledGroup();
            EditorGUI.EndDisabledGroup();

            GUILayout.Space(10);
        }
Пример #8
0
        public void Show()
        {
            CqaLabel.Heading1("Scan");

            if (!JqaManager.CheckIfJqaIsInstalled())
            {
                CqaLabel.Error("CQA is currently not installed.");
                return;
            }

            CqaLabel.Normal("CQA scans all scripts inside your Assets folder.");

            History.History history = _historyManager.LoadHistory();

            if (history != null)
            {
                CqaLabel.Normal("The last scan was at " + history.GetLastScan() + ".");
            }

            EditorGUI.BeginDisabledGroup(_jqaExecutor.IsAnyProcessRunning());
            if (CqaButton.NormalButton("Scan Assets"))
            {
                _jqaExecutor.ScanAssets();
            }

            if (Directory.Exists(JqaPaths.Instance.BuildJqaStorePath()) && CqaButton.NormalButton("Start Server"))
            {
                _jqaExecutor.StartServer();
            }

            EditorGUI.EndDisabledGroup();

            if (_jqaExecutor.IsScanProcessRunning())
            {
                CqaLabel.Bold("Status: Running ...");

                // FIXME: Stopping the process does currently not work.
                //
                // if (CqaButton.NormalButton("Stop Process"))
                // {
                //     _jqaExecutor.StopProcess();
                // }
            }

            GUILayout.Space(30);
            CqaLine.DrawHorizontalLine();

            CqaLabel.Heading1("Report");

            if (!JqaExecutor.DidFinishSuccessfullyOnce())
            {
                CqaLabel.Error("You must scan your project before you can create a report.");
                return;
            }

            CqaLabel.Normal("Select rules that you want to be checked in the report.");

            if (_jqaExecutor.IsReportProcessRunning())
            {
                CqaLabel.Bold("Status: Running ...");

                // FIXME: Stopping the process does currently not work.
                //
                // if (CqaButton.NormalButton("Stop Process"))
                // {
                //     _jqaExecutor.StopProcess();
                // }
            }

            _ruleSelector.OnGUI();

            ShowReportButtons();
        }