Ejemplo n.º 1
0
        public override void Selected()
        {
            if (blockSelected || IsInCurrentViewContent())
            {
                return;
            }

            if (activated)
            {
                throw new Exception("Editor should be null when document is selected");
            }

            var doc = IdeApp.Workbench.ActiveDocument.ParsedDocument as AspNetParsedDocument;

            if (doc != null)
            {
                proxy = new MonoDevelopProxy(viewContent.Project, doc.Info.InheritedClass);
                System.Diagnostics.Trace.WriteLine("Creating AspNetEdit EditorHost");
                host = new EditorHost(proxy);
                host.Initialise();
                System.Diagnostics.Trace.WriteLine("Created AspNetEdit EditorHost");
                activated = true;

                // Loading the GUI of the Designer
                LoadGui();

                // Loading the doc structure in the DocumentOutlinePad
                BuildTreeStore(doc.XDocument);
                // subscribing to changes in the DOM
                IdeApp.Workbench.ActiveDocument.DocumentParsed += document_OnParsed;
            }
        }
Ejemplo n.º 2
0
        void DestroyEditorAndSockets()
        {
            if (proxy != null)
            {
                proxy.Dispose();
                proxy = null;
            }

            if (host != null)
            {
                System.Diagnostics.Trace.WriteLine("Disposing AspNetEdit's EditorHost");

                designerFrame.Remove(webKitWindow);
                webKitWindow.Dispose();
                host.Dispose();
                host = null;

                System.Diagnostics.Trace.WriteLine("Disposed AspNetEdit's EditorHost");
            }

            if (IdeApp.Workbench.ActiveDocument != null)
            {
                IdeApp.Workbench.ActiveDocument.DocumentParsed -= document_OnParsed;
            }
        }
Ejemplo n.º 3
0
		public EditorHost (MonoDevelopProxy proxy)
		{
			this.proxy = proxy;
			
			//set up the services
			services = new ServiceContainer ();
			services.AddService (typeof(INameCreationService), new NameCreationService ());
			services.AddService (typeof(ISelectionService), new SelectionService ());
			services.AddService (typeof(ITypeResolutionService), new TypeResolutionService ());
			services.AddService (
				typeof(IEventBindingService),
				new AspNetEdit.Editor.ComponentModel.EventBindingService (proxy)
			);
			ExtenderListService extListServ = new ExtenderListService ();
			services.AddService (typeof(IExtenderListService), extListServ);
			services.AddService (typeof(IExtenderProviderService), extListServ);
			services.AddService (typeof(ITypeDescriptorFilterService), new TypeDescriptorFilterService ());
			services.AddService (typeof (IMenuCommandService), new AspNetEdit.Editor.ComponentModel.MenuCommandService ());
			//services.AddService (typeof (IToolboxService), toolboxService);

			var project = MonoDevelop.Ide.IdeApp.Workbench.ActiveDocument.Project as AspNetAppProject;
			var aspParsedDoc = MonoDevelop.Ide.IdeApp.Workbench.ActiveDocument.ParsedDocument as AspNetParsedDocument;
			if (project != null && aspParsedDoc != null) {
				WebFormReferenceManager refMan = new WebFormReferenceManager (project);
				refMan.Doc = aspParsedDoc;
				services.AddService (typeof(WebFormReferenceManager), refMan);
			}

			System.Diagnostics.Trace.WriteLine ("Creating DesignerHost");
			designerHost = new DesignerHost (services, this);
			System.Diagnostics.Trace.WriteLine ("Created DesignerHost");
			designerHost.DocumentChanged += new DesignerHost.DocumentChangedEventHandler (OnDocumentChanged);
		}
Ejemplo n.º 4
0
        void DestroyEditorAndSockets()
        {
            if (proxy != null)
            {
                proxy.Dispose();
                proxy = null;
            }

            if (editorProcess != null)
            {
                editorProcess.Dispose();
                editorProcess = null;
            }

            if (propGridSocket != null)
            {
                propertyFrame.Remove(propGridSocket);
                propGridSocket.Dispose();
                propGridSocket = null;
            }

            if (designerSocket != null)
            {
                designerFrame.Remove(designerSocket);
                designerSocket.Dispose();
                designerSocket = null;
            }
        }
Ejemplo n.º 5
0
		public void Initialise (MonoDevelopProxy proxy, Frame designerFrame)
		{
			System.Diagnostics.Trace.WriteLine ("Creating AspNetEdit EditorHost");
			host = new EditorHost (proxy);
			host.Initialise ();
			System.Diagnostics.Trace.WriteLine ("Created AspNetEdit EditorHost");
			
			//StartGuiThread ();
			Gtk.Application.Invoke ( delegate { LoadGui (designerFrame); });
		}
Ejemplo n.º 6
0
		public EditorHost (MonoDevelopProxy proxy)
		{
			this.proxy = proxy;
			
			//set up the services
			services = new ServiceContainer ();
			services.AddService (typeof (INameCreationService), new NameCreationService ());
			services.AddService (typeof (ISelectionService), new SelectionService ());
			services.AddService (typeof (ITypeResolutionService), new TypeResolutionService ());
			services.AddService (typeof (IEventBindingService), new AspNetEdit.Editor.ComponentModel.EventBindingService (proxy));
			ExtenderListService extListServ = new ExtenderListService ();
			services.AddService (typeof (IExtenderListService), extListServ);
			services.AddService (typeof (IExtenderProviderService), extListServ);
			services.AddService (typeof (ITypeDescriptorFilterService), new TypeDescriptorFilterService ());
			//services.AddService (typeof (IToolboxService), toolboxService);
			
			System.Diagnostics.Trace.WriteLine ("Creating DesignerHost");
			host = new DesignerHost (services);
			System.Diagnostics.Trace.WriteLine ("Created DesignerHost");
		}
Ejemplo n.º 7
0
        public override void Selected()
        {
            //check that the Mozilla extension is installed correctly, and if not, display an error
            if (extensionError != null)
            {
                return;
            }
            else if (!CheckExtension(ref extensionError))
            {
                LoggingService.LogError(extensionError);
                Label errorlabel = new Label(extensionError);
                errorlabel.Wrap = true;

                HBox  box        = new HBox(false, 10);
                Image errorImage = new Image(Gtk.Stock.DialogError, Gtk.IconSize.Dialog);

                box.PackStart(new Label(), true, true, 0);
                box.PackStart(errorImage, false, false, 10);
                box.PackStart(errorlabel, true, false, 10);
                box.PackStart(new Label(), true, true, 0);

                designerFrame.Add(box);
                designerFrame.ShowAll();
                return;
            }
            else
            {
                extensionError = null;
            }

            if (editorProcess != null)
            {
                throw new Exception("Editor should be null when document is selected");
            }

            designerSocket = new Gtk.Socket();
            designerSocket.Show();
            designerFrame.Add(designerSocket);

            propGridSocket = new Gtk.Socket();
            propGridSocket.Show();
            propertyFrame.Add(propGridSocket);

            editorProcess = (EditorProcess)Runtime.ProcessService.CreateExternalProcessObject(typeof(EditorProcess), false);

            if (designerSocket.IsRealized)
            {
                editorProcess.AttachDesigner(designerSocket.Id);
            }
            if (propGridSocket.IsRealized)
            {
                editorProcess.AttachPropertyGrid(propGridSocket.Id);
            }

            designerSocket.Realized += delegate { editorProcess.AttachDesigner(designerSocket.Id); };
            propGridSocket.Realized += delegate { editorProcess.AttachPropertyGrid(propGridSocket.Id); };

            //designerSocket.FocusOutEvent += delegate {
            //	MonoDevelop.DesignerSupport.DesignerSupport.Service.PropertyPad.BlankPad (); };

            //hook up proxy for event binding
            string codeBehind = null;

            if (viewContent.Project != null)
            {
                string mimeType = DesktopService.GetMimeTypeForUri(viewContent.ContentName);

                var cu = MonoDevelop.Projects.Dom.Parser.ProjectDomService.Parse(viewContent.Project, viewContent.ContentName)
                         as MonoDevelop.AspNet.Parser.AspNetParsedDocument;

                if (cu != null && cu.PageInfo != null && !string.IsNullOrEmpty(cu.PageInfo.InheritedClass))
                {
                    codeBehind = cu.PageInfo.InheritedClass;
                }
            }
            proxy = new MonoDevelopProxy(viewContent.Project, codeBehind);

            ITextBuffer textBuf = (ITextBuffer)viewContent.GetContent(typeof(ITextBuffer));

            editorProcess.Initialise(proxy, textBuf.Text, viewContent.ContentName);

            activated = true;

            //FIXME: track 'dirtiness' properly
            viewContent.IsDirty = true;
        }
Ejemplo n.º 8
0
		void DestroyEditorAndSockets ()
		{
			if (proxy != null) {
				proxy.Dispose ();
				proxy = null;
			}

			if (host != null) {
				System.Diagnostics.Trace.WriteLine ("Disposing AspNetEdit's EditorHost");

				designerFrame.Remove (webKitWindow);
				webKitWindow.Dispose ();
				host.Dispose ();
				host = null;

				System.Diagnostics.Trace.WriteLine ("Disposed AspNetEdit's EditorHost");
			}

			if (IdeApp.Workbench.ActiveDocument != null) {
				IdeApp.Workbench.ActiveDocument.DocumentParsed -= document_OnParsed;
			}
		}
Ejemplo n.º 9
0
		public override void Selected ()
		{
			if (blockSelected || !IsInCurrentViewContent ())
				return;

			if (activated)
				throw new Exception ("Editor should be null when document is selected");

			var doc = IdeApp.Workbench.ActiveDocument.ParsedDocument as AspNetParsedDocument;
			if (doc != null) {
				proxy = new MonoDevelopProxy (viewContent.Project, doc.Info.InheritedClass);
				System.Diagnostics.Trace.WriteLine ("Creating AspNetEdit EditorHost");
				host = new EditorHost (proxy);
				host.Initialise ();
				System.Diagnostics.Trace.WriteLine ("Created AspNetEdit EditorHost");
				activated = true;

				// Loading the GUI of the Designer
				LoadGui ();

				// Loading the doc structure in the DocumentOutlinePad
				BuildTreeStore (doc.XDocument);
				// subscribing to changes in the DOM
				IdeApp.Workbench.ActiveDocument.DocumentParsed += document_OnParsed;
			}
		}
		void DestroyEditorAndSockets ()
		{
			if (proxy != null) {
				proxy.Dispose ();
				proxy = null;
			}
			
			if (editorProcess != null) {
				editorProcess.Dispose ();
				editorProcess = null;
			}
			
			if (propGridSocket != null) {
				propertyFrame.Remove (propGridSocket);
				propGridSocket.Dispose ();
				propGridSocket = null;
			}
			
			if (designerSocket != null) {
				designerFrame.Remove (designerSocket);
				designerSocket.Dispose ();
				designerSocket = null;
			}
		}
		public override void Selected ()
		{
			//check that the Mozilla extension is installed correctly, and if not, display an error
			if (extensionError != null) {
				return;
			} else if (!CheckExtension (ref extensionError)) {
				LoggingService.LogError (extensionError);
				Label errorlabel = new Label (extensionError);
				errorlabel.Wrap = true;
				
				HBox box = new HBox (false, 10);
				Image errorImage = new Image (Gtk.Stock.DialogError, Gtk.IconSize.Dialog);
				
				box.PackStart (new Label (), true, true, 0);
				box.PackStart (errorImage, false, false, 10);
				box.PackStart (errorlabel, true, false, 10);
				box.PackStart (new Label (), true, true, 0);
				
				designerFrame.Add (box);
				designerFrame.ShowAll ();
				return;
			} else {
				extensionError = null;
			}
			
			if (editorProcess != null)
				throw new Exception ("Editor should be null when document is selected");
			
			designerSocket = new Gtk.Socket ();
			designerSocket.Show ();
			designerFrame.Add (designerSocket);
			
			propGridSocket = new Gtk.Socket ();
			propGridSocket.Show ();
			propertyFrame.Add (propGridSocket);
			
			editorProcess = (EditorProcess) Runtime.ProcessService.CreateExternalProcessObject (typeof (EditorProcess), false);
			
			if (designerSocket.IsRealized)
				editorProcess.AttachDesigner (designerSocket.Id);
			if (propGridSocket.IsRealized)
				editorProcess.AttachPropertyGrid (propGridSocket.Id);
			
			designerSocket.Realized += delegate { editorProcess.AttachDesigner (designerSocket.Id); };
			propGridSocket.Realized += delegate { editorProcess.AttachPropertyGrid (propGridSocket.Id); };
			
			//designerSocket.FocusOutEvent += delegate {
			//	MonoDevelop.DesignerSupport.DesignerSupport.Service.PropertyPad.BlankPad (); };
			
			//hook up proxy for event binding
			string codeBehind = null;
			if (viewContent.Project != null) {
				string mimeType =
					DesktopService.GetMimeTypeForUri (viewContent.ContentName);
				
				MonoDevelop.AspNet.Parser.AspNetParsedDocument cu = 
					MonoDevelop.Projects.Dom.Parser.ProjectDomService.Parse (
						null, viewContent.ContentName, mimeType)
					as MonoDevelop.AspNet.Parser.AspNetParsedDocument;
					
				if (cu != null && cu.PageInfo != null && !string.IsNullOrEmpty (cu.PageInfo.InheritedClass))
					codeBehind = cu.PageInfo.InheritedClass;
			}
			proxy = new MonoDevelopProxy (viewContent.Project, codeBehind);
			
			ITextBuffer textBuf = (ITextBuffer) viewContent.GetContent (typeof(ITextBuffer));			
			editorProcess.Initialise (proxy, textBuf.Text, viewContent.ContentName);
			
			activated = true;
			
			//FIXME: track 'dirtiness' properly
			viewContent.IsDirty = true;
		}
Ejemplo n.º 12
0
		void LoadGui (MonoDevelopProxy proxy, string document, string fileName)
		{
			System.Diagnostics.Trace.WriteLine ("Creating AspNetEdit EditorHost");
			host = new EditorHost (proxy);
			host.Initialise (document, fileName);
			System.Diagnostics.Trace.WriteLine ("Created AspNetEdit EditorHost");
			
			System.Diagnostics.Trace.WriteLine ("Building AspNetEdit GUI");
			Gtk.VBox outerBox = new Gtk.VBox ();
			
			geckoFrame = new Frame ();
			geckoFrame.Shadow = ShadowType.In;
			geckoFrame.Add (host.DesignerView);
			outerBox.PackEnd (geckoFrame, true, true, 0);
			
			Toolbar tb = BuildToolbar ();
			outerBox.PackStart (tb, false, false, 0);
			
			outerBox.ShowAll ();
			base.DesignerWidget = outerBox;
			
			//grid picks up some services from the designer host
			propertyGrid = new PropertyGrid (host.Services);
			propertyGrid.ShowAll ();
			base.PropertyGridWidget = propertyGrid;
			System.Diagnostics.Trace.WriteLine ("Built AspNetEdit GUI");
		}
Ejemplo n.º 13
0
		public void Initialise (MonoDevelopProxy proxy, string document, string fileName)
		{
			StartGuiThread ();
			Gtk.Application.Invoke ( delegate { LoadGui (proxy, document, fileName); });
		}