Ejemplo n.º 1
0
        void OnFileRemoved(object sender, ProjectFileEventArgs e)
        {
            ArrayList toDelete = new ArrayList();

            foreach (ProjectFileEventInfo args in e)
            {
                var doc = TypeSystemService.ParseFile(args.Project, args.ProjectFile.Name);
                if (doc == null)
                {
                    continue;
                }

                foreach (var t in doc.TopLevelTypeDefinitions)
                {
                    GuiBuilderWindow win = GetWindowForClass(t.FullName);
                    if (win != null)
                    {
                        toDelete.Add(win);
                    }
                }
            }

            foreach (GuiBuilderWindow win in toDelete)
            {
                Remove(win);
            }
        }
Ejemplo n.º 2
0
        void ISupportsProjectReload.Update(Project project)
        {
            if (gproject != null && gproject.Project == project)
            {
                return;
            }

            if (designer != null)
            {
                designerStatus = designer.SaveStatus();
            }

            CloseDesigner();
            CloseProject();
            if (project != null)
            {
                GuiBuilderWindow w = GuiBuilderDisplayBinding.GetWindow(this.ContentName);
                if (w != null)
                {
                    AttachWindow(w);
                    if (designerStatus != null)
                    {
                        designer.LoadStatus(designerStatus);
                    }
                    designerStatus = null;
                }
            }
        }
Ejemplo n.º 3
0
        void RegisterWindow(Stetic.WidgetInfo widget, bool notify)
        {
            if (formInfos != null)
            {
                foreach (GuiBuilderWindow w in formInfos)
                {
                    if (w.RootWidget == widget)
                    {
                        return;
                    }
                }

                GuiBuilderWindow win = new GuiBuilderWindow(this, gproject, widget);
                formInfos.Add(win);

                if (notify)
                {
                    if (WindowAdded != null)
                    {
                        WindowAdded(this, new WindowEventArgs(win));
                    }
                    NotifyChanged();
                }
            }
        }
Ejemplo n.º 4
0
        protected override void OnSetProject(Projects.Project project)
        {
            base.OnSetProject(project);

            if (gproject != null && gproject.Project == project)
            {
                return;
            }

            if (designer != null)
            {
                designerStatus = designer.SaveStatus();
            }

            CloseDesigner();
            CloseProject();
            if (project != null)
            {
                GuiBuilderWindow w = GuiBuilderDisplayBinding.GetWindow(this.ContentName, project);
                if (w != null)
                {
                    AttachWindow(w);
                    if (designerStatus != null)
                    {
                        designer.LoadStatus(designerStatus);
                    }
                    designerStatus = null;
                }
            }
        }
Ejemplo n.º 5
0
        void OnFileRemoved(object sender, ProjectFileEventArgs args)
        {
            ArrayList toDelete = new ArrayList();

            ParsedDocument doc = ProjectDomService.GetParsedDocument(ProjectDomService.GetProjectDom(args.Project), args.ProjectFile.Name);

            if (doc == null || doc.CompilationUnit == null)
            {
                return;
            }

            foreach (IType t in doc.CompilationUnit.Types)
            {
                GuiBuilderWindow win = GetWindowForClass(t.FullName);
                if (win != null)
                {
                    toDelete.Add(win);
                }
            }

            foreach (GuiBuilderWindow win in toDelete)
            {
                Remove(win);
            }
        }
		void AttachWindow (GuiBuilderWindow window)
		{
			gproject = window.Project;
			GtkDesignInfo info = GtkDesignInfo.FromProject (gproject.Project);
			gproject.SteticProject.ImagesRootPath = FileService.AbsoluteToRelativePath (info.GtkGuiFolder, gproject.Project.BaseDirectory);
			gproject.UpdateLibraries ();
			LoadDesigner ();
		}
Ejemplo n.º 7
0
        void AttachWindow(GuiBuilderWindow window)
        {
            gproject = window.Project;
            GtkDesignInfo info = GtkDesignInfo.FromProject(gproject.Project);

            gproject.SteticProject.ImagesRootPath = FileService.AbsoluteToRelativePath(info.GtkGuiFolder, gproject.Project.BaseDirectory);
            gproject.UpdateLibraries();
            LoadDesigner();
        }
Ejemplo n.º 8
0
        public void ReloadFile(string fileName)
        {
            GuiBuilderWindow window = GetWindowForFile(fileName);

            if (window != null)
            {
                var root = window.RootWidget;
                UnregisterWindow(window);
                gproject.ReloadComponent(window.Name);
                RegisterWindow(root, false);
            }
        }
Ejemplo n.º 9
0
        public GuiBuilderView(IViewContent content, GuiBuilderWindow window) : base(content)
        {
            rootName = window.Name;

            designerPage = new DesignerPage();
            designerPage.Show();
            AddButton(GettextCatalog.GetString("Designer"), designerPage);

            actionsPage = new ActionGroupPage();
            actionsPage.Show();

            AttachWindow(window);
        }
		public GuiBuilderView (IViewContent content, GuiBuilderWindow window): base (content)
		{
			rootName = window.Name;
			
			designerPage = new DesignerPage (window.Project);
			designerPage.Show ();
			AddButton (GettextCatalog.GetString ("Designer"), designerPage);
			
			actionsPage = new ActionGroupPage ();
			actionsPage.Show ();
			
			AttachWindow (window);
		}
Ejemplo n.º 11
0
        internal static GuiBuilderWindow GetWindow(string file, Project project)
        {
            if (!IdeApp.Workspace.IsOpen)
            {
                return(null);
            }
            if (!GtkDesignInfo.HasDesignedObjects(project))
            {
                return(null);
            }
            GtkDesignInfo info = GtkDesignInfo.FromProject(project);

            if (file.StartsWith(info.GtkGuiFolder))
            {
                return(null);
            }
            var docId = IdeApp.TypeSystemService.GetDocumentId(project, file);

            if (docId == null)
            {
                return(null);
            }
            var doc = IdeApp.TypeSystemService.GetCodeAnalysisDocument(docId);

            if (doc == null)
            {
                return(null);
            }
            Microsoft.CodeAnalysis.SemanticModel semanticModel;
            try {
                semanticModel = doc.GetSemanticModelAsync().Result;
            } catch {
                return(null);
            }
            if (semanticModel == null)
            {
                return(null);
            }
            var root = semanticModel.SyntaxTree.GetRoot();

            foreach (var classDeclaration in root.DescendantNodesAndSelf(child => !(child is BaseTypeDeclarationSyntax)).OfType <ClassDeclarationSyntax> ())
            {
                var c = semanticModel.GetDeclaredSymbol(classDeclaration);
                GuiBuilderWindow win = info.GuiBuilderProject.GetWindowForClass(c.ToDisplayString(Microsoft.CodeAnalysis.SymbolDisplayFormat.CSharpErrorMessageFormat));
                if (win != null)
                {
                    return(win);
                }
            }
            return(null);
        }
        internal static GuiBuilderWindow GetWindow(string file)
        {
            if (!IdeApp.Workspace.IsOpen)
            {
                return(null);
            }

            Project project = null;

            foreach (Project p in IdeApp.Workspace.GetAllProjects())
            {
                if (p.IsFileInProject(file))
                {
                    project = p;
                    break;
                }
            }

            if (!GtkDesignInfo.HasDesignedObjects(project))
            {
                return(null);
            }

            GtkDesignInfo info = GtkDesignInfo.FromProject(project);

            if (file.StartsWith(info.GtkGuiFolder))
            {
                return(null);
            }

            var doc = TypeSystemService.ParseFile(project, file);

            if (doc == null)
            {
                return(null);
            }

            foreach (var t in doc.TopLevelTypeDefinitions)
            {
                GuiBuilderWindow win = info.GuiBuilderProject.GetWindowForClass(t.FullName);
                if (win != null)
                {
                    return(win);
                }
            }
            return(null);
        }
Ejemplo n.º 13
0
        internal static GuiBuilderWindow GetWindow(string file)
        {
            if (!IdeApp.Workspace.IsOpen)
            {
                return(null);
            }

            Project project = null;

            foreach (Project p in IdeApp.Workspace.GetAllProjects())
            {
                if (p.IsFileInProject(file))
                {
                    project = p;
                    break;
                }
            }

            if (!GtkDesignInfo.HasDesignedObjects(project))
            {
                return(null);
            }

            GtkDesignInfo info = GtkDesignInfo.FromProject(project);

            if (file.StartsWith(info.GtkGuiFolder))
            {
                return(null);
            }

            ParsedDocument doc = ProjectDomService.GetParsedDocument(null, file);

            if (doc == null || doc.CompilationUnit == null)
            {
                return(null);
            }

            foreach (IType t in doc.CompilationUnit.Types)
            {
                GuiBuilderWindow win = info.GuiBuilderProject.GetWindowForClass(t.FullName);
                if (win != null)
                {
                    return(win);
                }
            }
            return(null);
        }
Ejemplo n.º 14
0
        void UnregisterWindow(GuiBuilderWindow win)
        {
            if (!formInfos.Contains(win))
            {
                return;
            }

            formInfos.Remove(win);

            if (WindowRemoved != null)
            {
                WindowRemoved(this, new WindowEventArgs(win));
            }

            win.Dispose();
            NotifyChanged();
        }
Ejemplo n.º 15
0
        public void RegisterWindow(Stetic.WidgetInfo widget, bool notify)
        {
            if (formInfos != null)
            {
                foreach (GuiBuilderWindow w in formInfos)
                {
                    if (w.RootWidget == widget)
                    {
                        return;
                    }
                }

                GuiBuilderWindow win = new GuiBuilderWindow(this, gproject, widget);
                formInfos.Add(win);

                GuiBuilderWindow winToRemove = null;
                foreach (GuiBuilderWindow form in formInfosRemoved)
                {
                    if (form.RootWidget == widget)
                    {
                        winToRemove = form;
                        break;
                    }
                }

                if (winToRemove != null)
                {
                    formInfosRemoved.Remove(winToRemove);
                }

                if (notify)
                {
                    if (WindowAdded != null)
                    {
                        WindowAdded(this, new WindowEventArgs(win));
                    }
                    NotifyChanged();
                }
            }
        }
Ejemplo n.º 16
0
        void OnFileRemoved(object sender, ProjectFileEventArgs e)
        {
            ArrayList toDelete = new ArrayList();

            foreach (ProjectFileEventInfo args in e)
            {
                var docId = TypeSystemService.GetDocumentId(args.Project, args.ProjectFile.Name);
                if (docId == null)
                {
                    continue;
                }
                var doc = TypeSystemService.GetCodeAnalysisDocument(docId);
                if (doc == null)
                {
                    continue;
                }
                var semanticModel = doc.GetSemanticModelAsync().Result;
                if (semanticModel == null)
                {
                    continue;
                }


                foreach (var classDeclaration in semanticModel.SyntaxTree.GetRoot().DescendantNodesAndSelf(child => !(child is BaseTypeDeclarationSyntax)).OfType <ClassDeclarationSyntax> ())
                {
                    var c = semanticModel.GetDeclaredSymbol(classDeclaration);
                    GuiBuilderWindow win = GetWindowForClass(c.ToDisplayString(Microsoft.CodeAnalysis.SymbolDisplayFormat.MinimallyQualifiedFormat));
                    if (win != null)
                    {
                        toDelete.Add(win);
                    }
                }
            }

            foreach (GuiBuilderWindow win in toDelete)
            {
                Remove(win);
            }
        }
Ejemplo n.º 17
0
        protected override void OnOwnerChanged()
        {
            base.OnOwnerChanged();

            // View not yet initialized
            if (designerPage == null)
            {
                return;
            }

            var project = Owner as Projects.Project;

            if (gproject != null && gproject.Project == project)
            {
                return;
            }

            if (designer != null)
            {
                designerStatus = designer.SaveStatus();
            }

            CloseDesigner();
            CloseProject();
            if (project != null)
            {
                GuiBuilderWindow w = GuiBuilderDisplayBinding.GetWindow(FilePath, project);
                if (w != null)
                {
                    AttachWindow(w);
                    if (designerStatus != null)
                    {
                        designer.LoadStatus(designerStatus);
                    }
                    designerStatus = null;
                }
            }
        }
Ejemplo n.º 18
0
        public void ReloadDesigner(Project project)
        {
            if (designer != null)
            {
                designerStatus = designer.SaveStatus();
            }

            CloseDesigner();
            CloseProject();
            if (project != null)
            {
                GuiBuilderWindow w = GuiBuilderDisplayBinding.GetWindow(this.ContentName);
                if (w != null)
                {
                    AttachWindow(w);
                    if (designerStatus != null)
                    {
                        designer.LoadStatus(designerStatus);
                    }
                    designerStatus = null;
                }
            }
        }
Ejemplo n.º 19
0
 public WindowEventArgs(GuiBuilderWindow win)
 {
     this.win = win;
 }
Ejemplo n.º 20
0
 public void Remove(GuiBuilderWindow win)
 {
     gproject.RemoveComponent(win.RootWidget);
     UnregisterWindow(win);
 }
Ejemplo n.º 21
0
 public GuiBuilderView(GuiBuilderWindow window)
 {
     rootName    = window.Name;
     this.window = window;
 }
		void LoadDesigner ()
		{
			this.window = gproject.GetWindow (rootName);
			if (window == null) {
				// The window doesn't exist anymore
				return;
			}
			
			gproject.Unloaded += OnDisposeProject;
			
			designer = gproject.SteticProject.CreateWidgetDesigner (window.RootWidget, false);
			
			// Designer page
			designerPage.ClearChild ();
			designerPage.Add (designer);
			
			if (designer.RootComponent == null) {
				// Something went wrong while creating the designer. Show it, but don't do aything else.
				designer.ShowAll ();
				return;
			}

			designer.AllowWidgetBinding = !gproject.Project.UsePartialTypes;
			
			codeBinder = new CodeBinder (gproject.Project, new OpenDocumentFileProvider (), designer.RootComponent);
			
			designer.BindField += OnBindWidgetField;
			designer.ModifiedChanged += OnWindowModifiedChanged;
			designer.SignalAdded += OnSignalAdded;
			designer.SignalRemoved += OnSignalRemoved;
			designer.SignalChanged += OnSignalChanged;
			designer.ComponentNameChanged += OnComponentNameChanged;
			designer.RootComponentChanged += OnRootComponentChanged;
			designer.ComponentTypesChanged += OnComponentTypesChanged;
			designer.ImportFileCallback = ImportFile;
			
			// Actions designer
			actionsBox = designer.CreateActionGroupDesigner ();
			actionsBox.AllowActionBinding = !gproject.Project.UsePartialTypes;
			actionsBox.BindField += new EventHandler (OnBindActionField);
			actionsBox.ModifiedChanged += new EventHandler (OnActionshanged);
			
			actionsPage.ClearChild ();
			actionsPage.PackStart (actionsBox, true, true, 0);
			actionsPage.ShowAll ();
			
			if (actionsBox.HasData) {
				if (!HasPage (actionsPage))
					AddButton (GettextCatalog.GetString ("Actions"), actionsPage);
			} else {
				RemoveButton (actionsPage);
			}
			
			designer.ShowAll ();
			GuiBuilderService.SteticApp.ActiveDesigner = designer;
		}
Ejemplo n.º 23
0
        void LoadDesigner()
        {
            this.window = gproject.GetWindow(rootName);
            if (window == null)
            {
                // The window doesn't exist anymore
                return;
            }

            gproject.Unloaded += OnDisposeProject;

            designer = gproject.SteticProject.CreateWidgetDesigner(window.RootWidget, false);

            // Designer page
            designerPage.ClearChild();
            designerPage.Add(designer);

            if (designer.RootComponent == null)
            {
                // Something went wrong while creating the designer. Show it, but don't do aything else.
                designer.ShowAll();
                return;
            }

            designer.AllowWidgetBinding = !gproject.Project.UsePartialTypes;

            codeBinder = new CodeBinder(gproject.Project, new OpenDocumentFileProvider(), designer.RootComponent);

            designer.BindField             += OnBindWidgetField;
            designer.ModifiedChanged       += OnWindowModifiedChanged;
            designer.SignalAdded           += OnSignalAdded;
            designer.SignalRemoved         += OnSignalRemoved;
            designer.SignalChanged         += OnSignalChanged;
            designer.ComponentNameChanged  += OnComponentNameChanged;
            designer.RootComponentChanged  += OnRootComponentChanged;
            designer.ComponentTypesChanged += OnComponentTypesChanged;
            designer.ImportFileCallback     = ImportFile;

            // Actions designer
            actionsBox = designer.CreateActionGroupDesigner();
            actionsBox.AllowActionBinding = !gproject.Project.UsePartialTypes;
            actionsBox.BindField         += new EventHandler(OnBindActionField);
            actionsBox.ModifiedChanged   += new EventHandler(OnActionshanged);

            actionsPage.ClearChild();
            actionsPage.PackStart(actionsBox, true, true, 0);
            actionsPage.ShowAll();

            if (actionsBox.HasData)
            {
                if (!HasPage(actionsPage))
                {
                    AddButton(GettextCatalog.GetString("Actions"), actionsPage);
                }
            }
            else
            {
                RemoveButton(actionsPage);
            }

            designer.ShowAll();
            GuiBuilderService.SteticApp.ActiveDesigner = designer;
        }
Ejemplo n.º 24
0
		public void RegisterWindow (Stetic.WidgetInfo widget, bool notify)
		{
			if (formInfos != null) {
				foreach (GuiBuilderWindow w in formInfos)
					if (w.RootWidget == widget)
						return;
			
				GuiBuilderWindow win = new GuiBuilderWindow (this, gproject, widget);
				formInfos.Add (win);
				
				GuiBuilderWindow winToRemove = null;
				foreach (GuiBuilderWindow form in formInfosRemoved)
					if (form.RootWidget == widget) {
						winToRemove = form;
						break;
					}
				
				if (winToRemove != null)
					formInfosRemoved.Remove (winToRemove);
			
				if (notify) {
					if (WindowAdded != null)
						WindowAdded (this, new WindowEventArgs (win));
					NotifyChanged ();
				}
			}
		}
Ejemplo n.º 25
0
		public WindowEventArgs (GuiBuilderWindow win)
		{
			this.win = win;
		}
Ejemplo n.º 26
0
		public void Remove (GuiBuilderWindow win)
		{
			gproject.RemoveComponent (win.RootWidget);
			UnregisterWindow (win);
		}
Ejemplo n.º 27
0
		void UnregisterWindow (GuiBuilderWindow win)
		{
			if (!formInfos.Contains (win))
				return;

			formInfos.Remove (win);

			if (WindowRemoved != null)
				WindowRemoved (this, new WindowEventArgs (win));

			win.Dispose ();
			NotifyChanged ();
		}
Ejemplo n.º 28
0
		void RegisterWindow (Stetic.WidgetInfo widget, bool notify)
		{
			if (formInfos != null) {
				foreach (GuiBuilderWindow w in formInfos)
					if (w.RootWidget == widget)
						return;
			
				GuiBuilderWindow win = new GuiBuilderWindow (this, gproject, widget);
				formInfos.Add (win);
			
				if (notify) {
					if (WindowAdded != null)
						WindowAdded (this, new WindowEventArgs (win));
					NotifyChanged ();
				}
			}
		}