public GuiBuilderProject(DotNetProject project, string fileName)
 {
     this.fileName = fileName;
     this.project  = project;
     Counters.GuiProjectsLoaded++;
     GuiBuilderService.NotifyGuiProjectLoaded();
 }
Beispiel #2
0
 public override void ShowPage(int npage)
 {
     if (designer != null && group != null)
     {
         // At every page switch update the generated code, to make sure code completion works
         // for the generated fields. The call to GenerateSteticCodeStructure will generate
         // the code for the window (only the fields in fact) and update the parser database, it
         // will not save the code to disk.
         if (project.Project.UsePartialTypes)
         {
             GuiBuilderService.GenerateSteticCodeStructure((DotNetProject)project.Project, designer.RootComponent, null, false, false);
         }
     }
     base.ShowPage(npage);
 }
 public void Dispose()
 {
     if (disposed)
     {
         return;
     }
     GuiBuilderService.NotifyGuiProjectUnloaded();
     Counters.GuiProjectsLoaded--;
     disposed = true;
     if (watcher != null)
     {
         watcher.Dispose();
     }
     Unload();
 }
 public void Run(IProgressMonitor monitor, DotNetProject project, ConfigurationSelector configuration)
 {
     lock (this) {
         try {
             Stetic.CodeGenerationResult res = GuiBuilderService.GenerateSteticCode(monitor, project, configuration);
             if (res != null)
             {
                 Messages = res.Warnings;
             }
         } catch (Exception ex) {
             Error = ex;
             LoggingService.LogError(ex.ToString());
             Messages = new string [] { Error.Message };
         }
         Monitor.PulseAll(this);
     }
 }
        public async Task <bool> Run(ProgressMonitor monitor, DotNetProject project, ConfigurationSelector configuration)
        {
            try {
                Stetic.CodeGenerationResult res = await GuiBuilderService.GenerateSteticCode(monitor, project, configuration);

                if (res != null)
                {
                    Messages = res.Warnings;
                }
                return(true);
            } catch (Exception ex) {
                Error = ex;
                LoggingService.LogError(ex.ToString());
                Messages = new  [] { Error.Message };
                return(false);
            }
        }
        void OnComponentNameChanged(object s, Stetic.ComponentNameEventArgs args)
        {
            try {
                // Make sure the fields in the partial class are up to date.
                // Provide the args parameter to GenerateSteticCodeStructure, in this
                // way the component that has been renamed will be generated with the
                // old name, and UpdateField will be able to find it (to rename the
                // references to the field, it needs to have the old name).
                if (gproject.Project.UsePartialTypes)
                {
                    GuiBuilderService.GenerateSteticCodeStructure((DotNetProject)gproject.Project, designer.RootComponent, args, false, false);
                }

                codeBinder.UpdateField(args.Component, args.OldName);
            }
            catch (Exception ex) {
                MessageService.ShowException(ex);
            }
        }
Beispiel #7
0
        public override void Save(string fileName)
        {
            base.Save(fileName);

            if (designer == null)
            {
                return;
            }

            string oldBuildFile = GuiBuilderService.GetBuildCodeFileName(gproject.Project, window.RootWidget.Name);

            codeBinder.UpdateBindings(fileName);

            if (!ErrorMode)
            {
                if (designer != null)
                {
                    designer.Save();
                }
                if (actionsBox != null)
                {
                    actionsBox.Save();
                }
            }

            string newBuildFile = GuiBuilderService.GetBuildCodeFileName(gproject.Project, window.RootWidget.Name);

            if (oldBuildFile != newBuildFile && oldBuildFile != null && newBuildFile != null)
            {
                if (System.IO.File.Exists(newBuildFile))
                {
                    FileService.DeleteFile(newBuildFile);
                }
                if (System.IO.File.Exists(oldBuildFile))
                {
                    FileService.MoveFile(oldBuildFile, newBuildFile);
                }
            }

            gproject.Save(true);
            OnDirtyChanged(EventArgs.Empty);
        }
        void OnSteticFileChanged(object s, FileSystemEventArgs args)
        {
            lock (fileSaveLock) {
                if (lastSaveTime == System.IO.File.GetLastWriteTime(fileName))
                {
                    return;
                }
            }

            if (GuiBuilderService.HasOpenDesigners(project, true))
            {
                if (MessageService.AskQuestion(GettextCatalog.GetString("The project '{0}' has been modified by an external application. Do you want to reload it?", project.Name), GettextCatalog.GetString("Unsaved changes in the open GTK designers will be lost."), AlertButton.Cancel, AlertButton.Reload) != AlertButton.Reload)
                {
                    return;
                }
            }
            if (!disposed)
            {
                Reload();
            }
        }
Beispiel #9
0
        public StringCollection GenerateFiles(string guiFolder)
        {
            StringCollection files = new StringCollection();

            if (hasError)
            {
                return(files);
            }

            IDotNetLanguageBinding binding = LanguageBindingService.GetBindingPerLanguageName(project.LanguageName) as IDotNetLanguageBinding;
            string path = Path.Combine(guiFolder, binding.GetFileName("generated"));

            if (!System.IO.File.Exists(path))
            {
                // Generate an empty build class
                CodeDomProvider provider = binding.GetCodeDomProvider();
                if (provider == null)
                {
                    throw new UserException("Code generation not supported for language: " + project.LanguageName);
                }
                GuiBuilderService.SteticApp.GenerateProjectCode(path, "Stetic", provider, null);
            }
            files.Add(path);

            if (Windows != null)
            {
                foreach (GuiBuilderWindow win in Windows)
                {
                    files.Add(GuiBuilderService.GenerateSteticCodeStructure(project, win.RootWidget, true, false));
                }
            }

            foreach (Stetic.ActionGroupInfo ag in SteticProject.ActionGroups)
            {
                files.Add(GuiBuilderService.GenerateSteticCodeStructure(project, ag, true, false));
            }

            return(files);
        }
        public override void Save(string fileName)
        {
            string oldBuildFile = GuiBuilderService.GetBuildCodeFileName(project.Project, groupInfo.Name);

            base.Save(fileName);
            if (designer == null)
            {
                return;
            }

            codeBinder.UpdateBindings(fileName);

            designer.Save();

            string newBuildFile = GuiBuilderService.GetBuildCodeFileName(project.Project, groupInfo.Name);

            if (oldBuildFile != newBuildFile)
            {
                FileService.MoveFile(oldBuildFile, newBuildFile);
            }

            project.Save(true);
        }
        protected override async Task OnSave()
        {
            await base.OnSave();

            if (designer == null)
            {
                return;
            }

            string oldBuildFile = GuiBuilderService.GetBuildCodeFileName(gproject.Project, window.RootWidget.Name);

            codeBinder.UpdateBindings(FilePath);
            if (!ErrorMode)
            {
                if (designer != null)
                {
                    designer.Save();
                }
                if (actionsBox != null)
                {
                    actionsBox.Save();
                }
            }

            string newBuildFile = GuiBuilderService.GetBuildCodeFileName(gproject.Project, window.RootWidget.Name);

            if (oldBuildFile != newBuildFile)
            {
                if (System.IO.File.Exists(newBuildFile))
                {
                    FileService.DeleteFile(newBuildFile);
                }
                FileService.MoveFile(oldBuildFile, newBuildFile);
            }

            gproject.SaveWindow(true, window.RootWidget.Name);
        }
Beispiel #12
0
        public override void Save(FileSaveInformation fileSaveInformation)
        {
            base.Save(fileSaveInformation);

            if (designer == null)
            {
                return;
            }

            string oldBuildFile = GuiBuilderService.GetBuildCodeFileName(gproject.Project, window.RootWidget.Name);

            codeBinder.UpdateBindings(fileSaveInformation.FileName);
            if (!ErrorMode)
            {
                if (designer != null)
                {
                    designer.Save();
                }
                if (actionsBox != null)
                {
                    actionsBox.Save();
                }
            }

            string newBuildFile = GuiBuilderService.GetBuildCodeFileName(gproject.Project, window.RootWidget.Name);

            if (oldBuildFile != newBuildFile)
            {
                if (System.IO.File.Exists(newBuildFile))
                {
                    FileService.DeleteFile(newBuildFile);
                }
                FileService.MoveFile(oldBuildFile, newBuildFile);
            }

            gproject.SaveWindow(true, window.RootWidget.Name);
        }
Beispiel #13
0
        public override async Task Save(FileSaveInformation fileSaveInformation)
        {
            string oldBuildFile = GuiBuilderService.GetBuildCodeFileName(project.Project, groupInfo.Name);

            await base.Save(fileSaveInformation);

            if (designer == null)
            {
                return;
            }

            codeBinder.UpdateBindings(fileSaveInformation.FileName);

            designer.Save();

            string newBuildFile = GuiBuilderService.GetBuildCodeFileName(project.Project, groupInfo.Name);

            if (oldBuildFile != newBuildFile)
            {
                FileService.MoveFile(oldBuildFile, newBuildFile);
            }

            project.SaveProject(true);
        }
Beispiel #14
0
        protected override async Task OnSave()
        {
            string oldBuildFile = GuiBuilderService.GetBuildCodeFileName(project.Project, groupInfo.Name);

            await base.OnSave();

            if (designer == null)
            {
                return;
            }

            codeBinder.UpdateBindings(FilePath);

            designer.Save();

            string newBuildFile = GuiBuilderService.GetBuildCodeFileName(project.Project, groupInfo.Name);

            if (oldBuildFile != newBuildFile)
            {
                FileService.MoveFile(oldBuildFile, newBuildFile);
            }

            project.SaveProject(true);
        }
 string ImportFile(string file)
 {
     return(GuiBuilderService.ImportFile(gproject.Project, file));
 }
Beispiel #16
0
 void OnSignalActivated(object s, EventArgs a)
 {
     GuiBuilderService.JumpToSignalHandler(signalsEditor.SelectedSignal);
 }