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;
		}