public ViewContentContainer(LiteViewContent viewContent)
        {
            base.HideOnClose = viewContent is LiteToolWindow;
            _extensionHost = LiteDevelopApplication.Current.ExtensionHost;

            ViewContent = viewContent;
            ViewContent.ControlChanged += ViewContent_ControlChanged;
            ViewContent.TextChanged += ViewContent_TextChanged;
            ViewContent.IconChanged += ViewContent_IconChanged;
            ViewContent.Closing += ViewContent_Closing;
            ViewContent.Closed += ViewContent_Closed;

            if (DocumentContent != null)
            {
                _currentFile = DocumentContent.AssociatedFile;
                DocumentContent.AssociatedFileChanged += DocumentContent_AssociatedFileChanged;
                DocumentContent_AssociatedFileChanged(null, null);
            }
            else if (ToolWindow != null)
            {
                ToolWindow.DockStateChanged += ToolWindow_DockStateChanged;
            }

            UpdateText();
            UpdateControl();
            UpdateIcon();
        }
        private void Current_InitializedApplication(object sender, EventArgs e)
        {
            _extensionHost = LiteDevelopApplication.Current.ExtensionHost;
            _extensionHost.BookmarkManager.Bookmarks.InsertedItem += Bookmarks_InsertedItem;
            _extensionHost.BookmarkManager.Bookmarks.RemovedItem += Bookmarks_RemovedItem;

            _extensionHost.UILanguageChanged += _extensionHost_UILanguageChanged;
            _extensionHost_UILanguageChanged(_extensionHost, EventArgs.Empty);
        }
        public static void UserCreateProject(LiteExtensionHost extensionHost)
        {
            var solution = extensionHost.CurrentSolution;

               using (var dlg = new CreateProjectDialog(solution))
               {
               if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
               {
                   var projectDirectory = new FilePath(dlg.Directory, dlg.FileName);

                   if (dlg.CreateSolutionDirectory)
                       projectDirectory = projectDirectory.Combine(projectDirectory.FileName);

                   if (System.IO.Directory.Exists(projectDirectory.FullPath))
                   {
                       if (MessageBox.Show(LiteDevelopApplication.Current.MuiProcessor.GetString("CreateProjectDialog.FolderAlreadyExists", "folder=" + projectDirectory), "LiteDevelop", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
                           return;
                   }
                   else
                   {
                       System.IO.Directory.CreateDirectory(projectDirectory.FullPath);
                   }

                   bool newSolution = solution == null;
                   if (newSolution)
                   {
                       var solutionDirectory = dlg.CreateSolutionDirectory ? projectDirectory.ParentDirectory : projectDirectory;

                       solution = Solution.CreateSolution(projectDirectory.FileName);
                       solution.FilePath = solutionDirectory.Combine(projectDirectory.FileName + ".sln");
                   }

                   var projects = dlg.Template.Create(new FileCreationContext()
                       {
                           CurrentProject = null,
                           CurrentSolution = solution,
                           FilePath = projectDirectory,
                           FileService = extensionHost.FileService,
                           ProgressReporter = extensionHost.CreateOrGetReporter("Build"),
                       }).Cast<Project>();

                   if (newSolution)
                       extensionHost.DispatchSolutionCreated(new SolutionEventArgs(solution));

                   foreach (var project in projects)
                       solution.Nodes.Add(new ProjectEntry(project));

                   if (newSolution)
                       extensionHost.DispatchSolutionLoad(new SolutionEventArgs(solution));
               }
               }
        }
        public override void Initialize(InitializationContext context)
        {
            _extensionHost = (LiteExtensionHost)context.Host;
            _extensionHost.TemplateService.AddFileSearchDirectory(new FilePath(Application.StartupPath).Combine("Templates", "File"));
            _extensionHost.TemplateService.AddProjectSearchDirectory(new FilePath(Application.StartupPath).Combine("Templates", "Project"));
            _extensionHost.TemplateService.AddIconSearchDirectory(new FilePath(Application.StartupPath).Combine("Templates", "Icons"));

            var generalSettingsEditorControl = new GeneralSettingsEditor(_settings = LiteDevelopSettings.Instance)
            {
                Dock = DockStyle.Fill
            };
            var internationalSettingsEditorControl = new InternationalSettingsEditor(_settings)
            {
                Dock = DockStyle.Fill
            };
            var appearanceEditorControl = new AppearanceEditor()
            {
                Dock = DockStyle.Fill
            };

            var generalSettingsNode       = new SettingsNode("General", generalSettingsEditorControl);
            var internationalSettingsNode = new SettingsNode("International", internationalSettingsEditorControl);
            var appearanceNode            = new SettingsNode("Appearance", appearanceEditorControl);

            _settingsNode = new SettingsNode("LiteDevelop", generalSettingsEditorControl);
            _settingsNode.Nodes.AddRange(new TreeNode[]
            {
                generalSettingsNode,
                appearanceNode,
                internationalSettingsNode,
            });

            _componentMuiIdentifiers = new Dictionary <object, string>()
            {
                { generalSettingsNode, "LiteDevelopExtension.GeneralSettings" },
                { appearanceNode, "LiteDevelopExtension.Appearance" },
                { internationalSettingsNode, "LiteDevelopExtension.InternationalSettings" },
            };

            _extensionHost.UILanguageChanged += extensionHost_UILanguageChanged;
            extensionHost_UILanguageChanged(null, null);

            _appearanceMapPath    = Path.Combine(Constants.AppDataDirectory, "appearance.xml");
            _defaultAppearanceMap = AppearanceMap.LoadFromFile(Path.Combine(
                                                                   Path.GetDirectoryName(typeof(LiteDevelopExtension).Assembly.Location),
                                                                   "default_appearance.xml"));

            try { _appearanceMap = AppearanceMap.LoadFromFile(_appearanceMapPath); }
            catch { _appearanceMap = _defaultAppearanceMap; }
        }
        private void Current_InitializedApplication(object sender, EventArgs e)
        {
            _extensionHost = LiteDevelopApplication.Current.ExtensionHost;

            errorsToolStripButton.Checked = LiteDevelopSettings.Instance.GetValue<bool>("ErrorList.ErrorsVisible");
            warningsToolStripButton.Checked = LiteDevelopSettings.Instance.GetValue<bool>("ErrorList.WarningsVisible");
            messagesToolStripButton.Checked = LiteDevelopSettings.Instance.GetValue<bool>("ErrorList.MessagesVisible");

            _extensionHost.UILanguageChanged += extensionHost_UILanguageChanged;
            _extensionHost.ControlManager.AppearanceChanged += ControlManager_AppearanceChanged;
            _errorManager = _extensionHost.ErrorManager;
            _errorManager.Errors.InsertedItem += Errors_InsertedItem;
            _errorManager.Errors.RemovedItem += Errors_RemovedItem;

            extensionHost_UILanguageChanged(null, null);
        }
        public static void UserCreateFile(LiteExtensionHost extensionHost, Project currentProject, string directory)
        {
            using (var dlg = new CreateFileDialog(currentProject))
            {
                if (!string.IsNullOrEmpty(directory))
                {
                    dlg.Directory = directory;
                }

                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    var filePath = new FilePath(dlg.FileName);
                    var files = dlg.Template.Create(new FileCreationContext()
                        {
                            CurrentProject = currentProject,
                            CurrentSolution = extensionHost.CurrentSolution,
                            FilePath = filePath,
                            FileService = extensionHost.FileService,
                            ProgressReporter = extensionHost.CreateOrGetReporter("Build"),
                        });

                    foreach (var createdFile in files)
                    {
                        extensionHost.FileService.SelectFileHandler(
                            extensionHost.ExtensionManager.GetFileHandlers(createdFile.FilePath),
                            createdFile.FilePath).OpenFile((OpenedFile)createdFile);
                    }
                }
            }
        }
 public static void UserCreateFile(LiteExtensionHost extensionHost, string directory)
 {
     UserCreateFile(extensionHost, extensionHost.GetCurrentSelectedProject(), directory);
 }
 public static void UserCreateFile(LiteExtensionHost extensionHost)
 {
     UserCreateFile(extensionHost, string.Empty);
 }
예제 #9
0
        public override void Initialize(InitializationContext context)
        {
            _extensionHost = (LiteExtensionHost)context.Host;

            var generalSettingsEditorControl = new GeneralSettingsEditor(_settings = LiteDevelopSettings.Instance) { Dock = DockStyle.Fill };
            var internationalSettingsEditorControl = new InternationalSettingsEditor(_settings) { Dock = DockStyle.Fill };
            var appearanceEditorControl = new AppearanceEditor() { Dock = DockStyle.Fill };

            var generalSettingsNode = new SettingsNode("General", generalSettingsEditorControl);
            var internationalSettingsNode = new SettingsNode("International", internationalSettingsEditorControl);
            var appearanceNode = new SettingsNode("Appearance", appearanceEditorControl);

            _settingsNode = new SettingsNode("LiteDevelop", generalSettingsEditorControl);
            _settingsNode.Nodes.AddRange(new TreeNode[]
            {
                generalSettingsNode,
                appearanceNode,
                internationalSettingsNode,
            });

            _componentMuiIdentifiers = new Dictionary<object, string>()
            {
                {generalSettingsNode, "LiteDevelopExtension.GeneralSettings"},
                {appearanceNode, "LiteDevelopExtension.Appearance"},
                {internationalSettingsNode, "LiteDevelopExtension.InternationalSettings"},
            };

            _extensionHost.UILanguageChanged += extensionHost_UILanguageChanged;
            extensionHost_UILanguageChanged(null, null);

            _appearanceMapPath = Path.Combine(Constants.AppDataDirectory, "appearance.xml");
            _defaultAppearanceMap  = AppearanceMap.LoadFromFile(Path.Combine(
                    Path.GetDirectoryName(typeof(LiteDevelopExtension).Assembly.Location),
                    "default_appearance.xml"));

            try { _appearanceMap = AppearanceMap.LoadFromFile(_appearanceMapPath); }
            catch { _appearanceMap = _defaultAppearanceMap; }
        }
예제 #10
0
        private void InitializeExtensionHost()
        {
            _extensionHost = new LiteExtensionHost();
            var solutionExplorer = _mainForm.GetToolWindow<SolutionExplorerContent>();
            var outputWindow = _mainForm.GetToolWindow<OutputContent>();

            _extensionHost.SettingsManager = new ExtensionSettingsManager();

            _extensionHost.ControlManager = new ControlManager(_extensionHost)
            {
                DockPanel = _mainForm.DockPanel,
                ToolStripPanel = _mainForm.ToolStripPanel,
                MenuStrip = _mainForm.MenuStrip,
                EditMenu = _mainForm.EditItem,
                ViewMenu = _mainForm.ViewItem,
                DebugMenu = _mainForm.DebugItem,
                ToolsMenu = _mainForm.ToolsItem,
                StatusStrip = _mainForm.StatusStrip,
                SolutionExplorerMenu = FindControl(solutionExplorer, "mainTreeView").ContextMenuStrip
            };

            _extensionHost.FileService = new FileService(_extensionHost);
            _extensionHost.BookmarkManager = new BookmarkManager();
            _extensionHost.ErrorManager = new ErrorManager();
            _extensionHost.OutputContent = outputWindow;
            _extensionHost.ProgressBar = _mainForm.DefaultStatusProgressBar.ProgressBar;
            _extensionHost.CredentialManager = new CredentialManager();
            _extensionHost.UILanguage = UILanguage.GetLanguageById(LiteDevelopSettings.Instance.GetValue("Application.LanguageID"));

            _muiProcessor = new Framework.Mui.MuiProcessor(_extensionHost, Path.Combine(Application.StartupPath, "MUI"));

            _extensionHost.ExtensionManager = new ExtensionManager(_extensionHost);

            _appearanceProcessor = _extensionHost.ControlManager.GlobalAppearanceMap.Processor;
        }
예제 #11
0
        public static void UserCreateFile(LiteExtensionHost extensionHost, Project currentProject, string directory)
        {
            using (var dlg = new CreateFileDialog(currentProject))
            {
                if (!string.IsNullOrEmpty(directory))
                {
                    dlg.Directory = directory;
                }

                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    var result = (dlg.Template as FileTemplate).CreateFile(extensionHost.FileService, currentProject, new FilePath(dlg.FileName));

                    foreach (var createdFile in result.CreatedFiles)
                    {
                        var openedFile = createdFile.File as OpenedFile;
                        openedFile.Save(extensionHost.CreateOrGetReporter("Build"));

                        if (currentProject != null)
                        {
                            currentProject.ProjectFiles.Add(new ProjectFileEntry(openedFile));
                        }

                        createdFile.ExtensionToUse.OpenFile(openedFile);
                    }
                }
            }
        }
 private void Current_InitializedApplication(object sender, EventArgs e)
 {
     _host = LiteDevelopApplication.Current.ExtensionHost;
     _muiProcessor = LiteDevelopApplication.Current.MuiProcessor;
 }
예제 #13
0
 private void Current_InitializedApplication(object sender, EventArgs e)
 {
     _host         = LiteDevelopApplication.Current.ExtensionHost;
     _muiProcessor = LiteDevelopApplication.Current.MuiProcessor;
 }
        private void Current_InitializedApplication(object sender, EventArgs e)
        {
            _componentMuiIdentifiers = new Dictionary<object, string>()
            {
                {this, "SolutionExplorerContent.Title"},
                {this.addToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Add"},
                {this.newFileToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Add.NewFile"},
                {this.newDirectoryToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Add.NewDirectory"},
                {this.newProjectToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Add.NewProject"},
                {this.existingFileToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Add.ExistingFile"},
                {this.openToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Open"},
                {this.removeToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Remove"},
                {this.renameToolStripMenuItem, "SolutionExplorerContent.ContextMenu.Rename"},
                {this.setAsStartupProjectToolStripMenuItem, "SolutionExplorerContent.ContextMenu.SetAsStartupProject"},
                {this.viewInExplorerToolStripMenuItem, "SolutionExplorerContent.ContextMenu.ViewInExplorer"},
            };

            _extensionHost = LiteDevelopApplication.Current.ExtensionHost;

            _extensionHost.UILanguageChanged += _extensionHost_UILanguageChanged;
            _extensionHost.SolutionLoad += _extensionHost_SolutionLoad;
            _extensionHost.SolutionUnload += _extensionHost_SolutionUnload;
            _extensionHost.ControlManager.AppearanceChanged += ControlManager_AppearanceChanged;
            _extensionHost_UILanguageChanged(null, null);
        }
예제 #15
0
        public static void UserCreateProject(LiteExtensionHost extensionHost)
        {
            var solution = extensionHost.CurrentSolution;

            using (var dlg = new CreateProjectDialog(solution))
            {
                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string projectDirectory = Path.Combine(dlg.Directory, Path.GetFileNameWithoutExtension(dlg.FileName));

                    if (dlg.CreateSolutionDirectory)
                        projectDirectory = Path.Combine(projectDirectory, Path.GetFileNameWithoutExtension(dlg.FileName));

                    if (System.IO.Directory.Exists(projectDirectory))
                    {
                        if (MessageBox.Show(LiteDevelopApplication.Current.MuiProcessor.GetString("CreateProjectDialog.FolderAlreadyExists", "folder=" + projectDirectory), "LiteDevelop", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
                            return;
                    }
                    else
                    {
                        System.IO.Directory.CreateDirectory(projectDirectory);
                    }

                    var projectTemplate = dlg.Template as ProjectTemplate;
                    var result = projectTemplate.CreateProject(extensionHost.FileService, new FilePath(projectDirectory, Path.GetFileName(dlg.FileName)));

                    result.Project.Save(extensionHost.CreateOrGetReporter("Build"));

                    if (solution == null)
                    {
                        string solutionDirectory = dlg.CreateSolutionDirectory ? Path.GetDirectoryName(projectDirectory) : projectDirectory;

                        solution = Solution.CreateSolution(result.Project.Name);
                        solution.FilePath = new FilePath(solutionDirectory, Path.GetFileNameWithoutExtension(dlg.FileName) + ".sln");
                        solution.Settings.StartupProjects.Add(result.Project.ProjectGuid);
                        solution.Save(extensionHost.CreateOrGetReporter("Build"));
                        extensionHost.DispatchSolutionCreated(new SolutionEventArgs(solution));
                        solution.Nodes.Add(new ProjectEntry(result.Project));
                        extensionHost.DispatchSolutionLoad(new SolutionEventArgs(solution));
                    }
                    else
                        solution.Nodes.Add(new ProjectEntry(result.Project));

                    for (int i = 0; i < result.CreatedFiles.Count; i++)
                    {
                        result.CreatedFiles[i].ExtensionToUse.OpenFile(result.CreatedFiles[i].File as OpenedFile);
                    }
                }
            }
        }