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); } }
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; } } }
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(); } } }
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; } } }
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 (); }
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(); }
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); } }
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); }
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); }
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); }
void UnregisterWindow(GuiBuilderWindow win) { if (!formInfos.Contains(win)) { return; } formInfos.Remove(win); if (WindowRemoved != null) { WindowRemoved(this, new WindowEventArgs(win)); } win.Dispose(); NotifyChanged(); }
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(); } } }
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); } }
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; } } }
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; } } }
public WindowEventArgs(GuiBuilderWindow win) { this.win = win; }
public void Remove(GuiBuilderWindow win) { gproject.RemoveComponent(win.RootWidget); UnregisterWindow(win); }
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; }
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; }
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 (); } } }
public WindowEventArgs (GuiBuilderWindow win) { this.win = win; }
public void Remove (GuiBuilderWindow win) { gproject.RemoveComponent (win.RootWidget); UnregisterWindow (win); }
void UnregisterWindow (GuiBuilderWindow win) { if (!formInfos.Contains (win)) return; formInfos.Remove (win); if (WindowRemoved != null) WindowRemoved (this, new WindowEventArgs (win)); win.Dispose (); NotifyChanged (); }
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 (); } } }