private void treeView4_DoubleClick(object sender, EventArgs e)
        {
            if (treeView4.SelectedNode == null)
            {
                MessageBox.Show("Please, select an item of the tree view");
                return;
            }

            log.Debug(" double click on treeview to navigate");

            KnowledgeController instance = KnowledgeController.instance();

            if (instance == null)
            {
                log.Debug(" controller is null ");
                return;
            }

            if (treeView4.SelectedNode.Tag == null)
            {
                log.Debug(" tag is null ");
                return;
            }

            string filepath = KnowledgeAdapter.getCurrentFilepath();

            log.Debug(" filepath = " + filepath);
            TextEditorHelper.navigate(instance, treeView4.SelectedNode.Tag, filepath);
        }
Example #2
0
        public KnowledgeCsView(KnowledgeController controller,
                               KnowledgeModel model)
        {
            log.Debug(" cs observer ctor ... ");

            this.controller = controller;
            this.model      = model;
        }
        public KnowledgeTreeView(KnowledgeController controller,
                                 KnowledgeModel model,
                                 KnowledgeControl control)
        {
            log.Debug(" tree view ctor ... ");

            this.controller = controller;
            this.model      = model;
            this.control    = control;

            // TODO: disable all tabs initially
            this.control.Enabled = false;
        }
        private void toolStripButton18_Click(object sender, EventArgs e)
        {
            log.Debug(" click on button to convert");

            KnowledgeController instance = KnowledgeController.instance();

            if (instance == null)
            {
                log.Debug(" controller is null ");
            }

            instance.convert();
        }
Example #5
0
        public static void navigate(KnowledgeController controller, Object tag, String sourceFile)
        {
            try
            {
                log.Debug(" navigation ... ");

                string regExpression = getRegExpr(tag);
                if (regExpression == null)
                {
                    return;
                }
                string actualString = getActualString(sourceFile, regExpression);
                if (actualString == null)
                {
                    return;
                }

                Window        textEditor    = controller.environment.ApplicationObject.OpenFile(Constants.vsViewKindCode, sourceFile);
                TextSelection textSelection = (TextSelection)textEditor.Document.Selection;
                textSelection.StartOfDocument(false);
                textSelection.EndOfDocument(false);

                // TODO: textSelection.findPattern doesn't work for some reason
                if (textSelection.FindText(actualString, (int)vsFindOptions.vsFindOptionsFromStart))
                {
                    textSelection.SelectLine();
                }
                else
                {
                    log.Debug("log. actualString is not found in text file, actualString=" + actualString);
                }

                textEditor.Visible = true;
                textEditor.Activate();
                // TODO: save of the document
            }
            catch (Exception e0)
            {
                MessageBox.Show(e0.Message);
            }
        }
Example #6
0
        private bool showAddin()
        {
            log.Debug("show addin... ");

            if (addinWindow != null)
            {
                if (addinWindow.Visible)
                {
                    log.Debug(" return");
                    return(false);
                }
            }

            try
            {
                // addinWindow stuff

                //string guid = "{453A83DA-6EA6-42b7-A681-83A6A4A9E5A4}";
                string   guid    = "{48FC1ED2-1C5B-47e5-A83A-A6D33B316624}";
                object   tempdoc = null;
                Assembly asm     = Assembly.GetExecutingAssembly();

                addinWindow = ((Windows2)app.Windows).CreateToolWindow2(
                    addin,
                    asm.Location,
                    "Knowledge.Editor.View.KnowledgeControl",
                    "Knowledge.NET Framework",
                    guid,
                    ref tempdoc
                    );

                log.Debug(" addinWindow: " + addinWindow);
                addinWindow.Visible = true;
                addinWindow.Activate();
                // TODO
                //addinWindow.SetTabPicture(Knowledge.Editor.CommandBar.an_ico.GetHbitmap());
                control = (Knowledge.Editor.View.KnowledgeControl)tempdoc;

                // outputWindowPane stuff

                OutputWindow     outputWindow     = (OutputWindow)app.Windows.Item(Constants.vsWindowKindOutput).Object;
                OutputWindowPane outputWindowPane = null;
                if (outputWindow.OutputWindowPanes != null)
                {
                    for (int i = 1; i <= outputWindow.OutputWindowPanes.Count; i++)
                    {
                        if (outputWindow.OutputWindowPanes.Item(i).Name == "Knowledge.NET Framework Console")
                        {
                            outputWindowPane = outputWindow.OutputWindowPanes.Item(i);
                            break;
                        }
                    }
                }

                if (outputWindowPane == null)
                {
                    outputWindowPane = outputWindow.OutputWindowPanes.Add("Knowledge.NET Framework Console");
                }

                // TODO: refactoring required
                Environment environment = new Environment();
                environment.KnowledgeNetFrameworkBaseDir = asm.Location.Substring(0, asm.Location.LastIndexOf("\\") + 1);
                environment.ApplicationObject            = app;
                environment.OutputWindowPane             = outputWindowPane;

                controller = KnowledgeController.instance(environment,
                                                          control);

                // on vs startup open event is not coming for some reason
                // TODO: get rid of this
                controller.opened();
            }
            catch (Exception e)
            {
                log.Debug("showing tool window failed.", e);
                MessageBox.Show(e.ToString());
            }

            return(true);
        }
        private void convertButton_Click(object sender, EventArgs e)
        {
            ConvForm convForm = new ConvForm(KnowledgeAdapter.getCurrentFilepath(), KnowledgeController.instance().environment.ApplicationObject);//TODO:

            convForm.ShowDialog();
        }