예제 #1
0
        private void radMenuItem13_Click(object sender, EventArgs e)
        {
            var np = new NewItemDialog();
            if (np.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var f = new File();
                f.Name = np.Filename;
                f.Src = np.Filename;
                f.ID = np.Type;

                Workspace.SelectedProject.Files.Add(f);

                radTreeView1.Nodes.Clear();
                radTreeView1.Nodes.Add(SolutionExplorer.Build(Workspace.Solution));

                Workspace.Solution.Save(Workspace.SolutionPath);
                var p = np.Template;

                var editor = EditorBuilder.Build(p.Extension, null, null, null);

                var doc = new DocumentWindow(f.Name);
                doc.Controls.Add(editor);

                radDock1.AddDocument(doc);
            }
        }
예제 #2
0
        private void radMenuItem13_Click(object sender, EventArgs e)
        {
            var np = new NewItemDialog();

            if (np.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var f = new Core.ProjectSystem.File();
                f.Name = np.Filename;
                f.Src  = np.Filename;
                f.ID   = np.Type;

                Workspace.SelectedProject.Files.Add(f);

                explorerTreeView.Nodes.Clear();
                explorerTreeView.Nodes.Add(SolutionExplorer.Build(Workspace.Solution, solutionContextMenu, projectContextMenu, fileContextMenu));

                Workspace.Solution.Save(Workspace.SolutionPath);
                var fi = new FileInfo(Workspace.SolutionPath).Directory.FullName + "\\" + f.Name;

                System.IO.File.WriteAllBytes(fi, np.Template.Raw);

                np.Plugin.Events.Fire("OnCreateItem", f, np.Template.Raw);

                var doc = new DocumentWindow(f.Name);
                doc.Controls.Add(ViewSelector.Select(np.Template, System.IO.File.ReadAllBytes(fi), f, np.Template.AutoCompletionProvider as IntellisenseProvider).GetView());

                AddDocument(doc);
            }
        }
예제 #3
0
        public static RadTreeNode Build(File sol)
        {
            var n = new RadTreeNode(sol.Name);
            n.Tag = sol;

            n.Image = Icons[sol.ID];

            return n;
        }
예제 #4
0
        public static View Select(ItemTemplate it, byte[] data, File file, IntellisenseProvider intellisenseOProvider, DockWindow window = null)
        {
            if(it.View != null)
            {
                it.View.Window = window;

                it.View.Create(data);

                return it.View;
            }
            else
            {
                var v = new EditorView(it, file);
                v.Window = window;
                v.IntellisenseProvider = intellisenseOProvider;

                v.Create(data);

                return v;
            }
        }
예제 #5
0
        public EditorView(ItemTemplate p, File f)
        {
            var e = EditorBuilder.Build(p.Extension, null, null);
            e.CompletionRequest += (s, ee) =>
            {
                if (p.AutoCompletionProvider != null)
                {
                    e.ShowCompletionWindow(p.AutoCompletionProvider, ee.Key, true);
                }
            };

            e.DocumentChanged += (s, ev) =>
            {
                p.Plugin.Events.Fire("OnDocumentChanged", p, ev.Document.TextContent);
            };

            e.Tag = this;
            File = f;

            _view = e;
        }
예제 #6
0
        public Form1()
        {
            InitializeComponent();

            startpageDocument.Controls.Add(new StartPage(openMenuItem_Click, newProjectMenuItem_Click)
            {
                Dock = System.Windows.Forms.DockStyle.Fill
            });

            NotificationService.Init(radDesktopAlert1);

            ThemeResolutionService.ApplicationThemeName = "VisualStudio2012Dark";

            Workspace.Settings.Load();

            if (!Workspace.Settings.Get <bool>("BetaAccepted"))
            {
                new BetaKeyDialog(this).ShowDialog();
                Hide();
            }

            Workspace.Output = new Core.Contracts.Debug(outputTextBox);
            Workspace.PluginManager.Load(Environment.CurrentDirectory + "\\Plugins");

            foreach (var item in Workspace.PluginManager.Plugins)
            {
                foreach (var win in item.Windows)
                {
                    var tw   = new ToolWindow(win.Value.Title);
                    var ctrl = win.Value.View.Build();
                    ctrl.Dock = System.Windows.Forms.DockStyle.Fill;

                    tw.Controls.Add(ctrl);

                    dock.AddDocument(tw);
                }
            }

            // add here loading from startup
            // file, project, solution

            var args = Environment.GetCommandLineArgs();

            if (args.Length > 0)
            {
                string file = null;

#if DEBUG
                if (args.Length > 1)
                {
                    file = args[1];
                }
#else
                file = args[0];
#endif

                if (file != null)
                {
                    switch (Path.GetExtension(file))
                    {
                    case ".sln":
                        Workspace.Solution     = Solution.Load(file);
                        Workspace.SolutionPath = file;

                        startpageDocument.Hide();
                        solutionExplorerWindow.Show();

                        newProjectMenuItem.Enabled = true;
                        newFileMenuItem.Enabled    = true;

                        explorerTreeView.Nodes.Clear();
                        explorerTreeView.Nodes.Add(SolutionExplorer.Build(Workspace.Solution, solutionContextMenu, projectContextMenu, fileContextMenu));

                        break;

                    case "proj":
                        var p = Project.Load(file);

                        explorerTreeView.Nodes.Clear();
                        explorerTreeView.Nodes.Add(SolutionExplorer.Build(p, projectContextMenu, fileContextMenu));

                        break;

                    default:
                        var f      = new Core.ProjectSystem.File();
                        var shortF = Path.GetFileName(file);

                        f.Name = shortF;
                        f.Src  = file;
                        f.ID   = Utils.GetTemplateID(shortF);

                        explorerTreeView.Nodes.Clear();
                        explorerTreeView.Nodes.Add(SolutionExplorer.Build(f, fileContextMenu));

                        ItemTemplate np  = null;
                        Plugin       npp = null;

                        foreach (var item in Workspace.PluginManager.Plugins)
                        {
                            foreach (var it in item.ItemTemplates)
                            {
                                if (it.ID == f.ID)
                                {
                                    np  = it;
                                    npp = item;
                                }
                            }
                        }

                        var raw = System.IO.File.ReadAllBytes(file);

                        npp.Events.Fire("OnCreateItem", np, f, raw);

                        var doc = new DocumentWindow(f.Name);
                        doc.Controls.Add(ViewSelector.Select(np, raw, f, np.AutoCompletionProvider as IntellisenseProvider, doc).GetView());

                        AddDocument(doc);

                        startpageDocument.Hide();

                        break;
                    }
                }
            }

            RefreshLanguage();

            addItemContextItem.Click += radMenuItem13_Click;
        }
예제 #7
0
파일: Form1.cs 프로젝트: MyvarHD/OpenIDE
        private void radMenuItem13_Click(object sender, EventArgs e)
        {
            var np = new NewItemDialog();
            if (np.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var f = new Core.ProjectSystem.File();
                f.Name = np.Filename;
                f.Src = np.Filename;
                f.ID = np.Type;

                Workspace.SelectedProject.Files.Add(f);

                explorerTreeView.Nodes.Clear();
                explorerTreeView.Nodes.Add(SolutionExplorer.Build(Workspace.Solution, radContextMenu1));

                Workspace.Solution.Save(Workspace.SolutionPath);
                var fi = new FileInfo(Workspace.SolutionPath).Directory.FullName + "\\" + f.Name;

                System.IO.File.WriteAllBytes(fi, np.Template.Raw);

                np.Plugin.Events.Fire("OnCreateItem", f, np.Template.Raw);

                var doc = new DocumentWindow(f.Name);
                doc.Controls.Add(ViewSelector.Select(np.Template, System.IO.File.ReadAllBytes(fi)).GetView());

                dock.AddDocument(doc);
            }
        }
예제 #8
0
파일: Form1.cs 프로젝트: MyvarHD/OpenIDE
        public Form1()
        {
            InitializeComponent();

            startpageDocument.Controls.Add(new StartPage() { Dock = System.Windows.Forms.DockStyle.Fill });

            NotificationService.Init(radDesktopAlert1);

            ThemeResolutionService.ApplicationThemeName = "VisualStudio2012Dark";

            Workspace.Settings.Load();

            if(!Workspace.Settings.Get<bool>("BetaAccepted"))
            {
                new BetaKeyDialog(this).ShowDialog();
                Hide();
            }

            Workspace.Output = new Core.Contracts.Debug(outputTextBox);
            Workspace.PluginManager.Load(Environment.CurrentDirectory + "\\Plugins");

            // add here loading from startup
            // file, project, solution

            var args = Environment.GetCommandLineArgs();
            if(args.Length > 0)
            {
                string file = null;

            #if DEBUG
                file = args[1];
            #else
                file = args[0];
            #endif

                switch (Path.GetExtension(file))
                {
                    case ".sln":
                        Workspace.Solution = Solution.Load(file);
                        Workspace.SolutionPath = file;

                        startpageDocument.Hide();
                        solutionExplorerWindow.Show();

                        newProjectMenuItem.Enabled = true;
                        newFileMenuItem.Enabled = true;

                        explorerTreeView.Nodes.Clear();
                        explorerTreeView.Nodes.Add(SolutionExplorer.Build(Workspace.Solution, radContextMenu1));

                        break;
                    case "proj":

                        break;
                    default:
                        var f = new Core.ProjectSystem.File();
                        var shortF = Path.GetFileName(file);

                        f.Name = shortF;
                        f.Src = file;
                        f.ID = Utils.GetTemplateID(shortF);

                        explorerTreeView.Nodes.Clear();
                        explorerTreeView.Nodes.Add(SolutionExplorer.Build(f));

                        ItemTemplate np = null;
                        Plugin npp = null;

                        foreach (var item in Workspace.PluginManager.Plugins)
                        {
                            foreach (var it in item.ItemTemplates)
                            {
                                if(it.ID == f.ID)
                                {
                                    np = it;
                                    npp = item;
                                }
                            }
                        }

                        var raw = System.IO.File.ReadAllBytes(file);

                        npp.Events.Fire("OnCreateItem", f, raw);

                        var doc = new DocumentWindow(f.Name);
                        doc.Controls.Add(ViewSelector.Select(np, raw).GetView());

                        dock.AddDocument(doc);

                        startpageDocument.Hide();

                        break;
                }
            }

            RefreshLanguage();

            addItemContextItem.Click += radMenuItem13_Click;
        }