Exemplo n.º 1
0
        private Document OpenDocument(DotaDataObject ddo)
        {
            Document doc = DocumentRegistry.GetDocumentFor(ddo);

            if (doc == null)
            {
                //If we don't have this document open, create it and add it to the registry
                doc = new DotaObjectDocument(ddo);
                DocumentRegistry.OpenDocument(ddo, doc);
            }

            return(doc);
        }
Exemplo n.º 2
0
        private void OpenTextEditor(DotaDataObject ddo)
        {
            Document doc = DocumentRegistry.GetDocumentFor(ddo);

            if (doc == null)
            {
                //If we don't have this document open, create it and add it to the registry
                doc = new DotaObjectDocument(ddo);
                DocumentRegistry.OpenDocument(ddo, doc);
            }

            (doc as DotaObjectDocument).OpenTextEditor();
        }
Exemplo n.º 3
0
        private void treeView1_DoubleClick(object sender, EventArgs e)
        {
            TreeNode selectedNode = treeView1.SelectedNode;

            //The path of the file double clicked is stored in the treenode's tag
            string path = selectedNode.Tag as string;

            if (!CanOpenDocument(path))
            {
                return;
            }
            TreeNode root    = GetRootNode(selectedNode);
            bool     FromVPK = root.Name == "vpk";

            TextDocument document = DocumentRegistry.GetDocumentFor(path) as TextDocument;

            if (document == null)
            {
                document = new TextDocument(path, FromVPK);
                DocumentRegistry.OpenDocument(path, document);
            }

            document.OpenDefaultEditor();
        }