public override object GetContent(Type type)
        {
//			if (type == typeof(IEditableTextBuffer)) {
//				// Intercept the IPositionable interface, since we need to
//				// switch to the text editor when jumping to a line
//				if (content.GetContent (type) != null)
//					return this;
//				else
//					return null;
//			}
//
            object ob = base.GetContent(type);

            if (ob != null)
            {
                return(ob);
            }
            else if (content != null)
            {
                return(content.GetContent(type));
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
        public override T GetContent <T> ()
        {
//			if (type == typeof(IEditableTextBuffer)) {
//				// Intercept the IPositionable interface, since we need to
//				// switch to the text editor when jumping to a line
//				if (content.GetContent (type) != null)
//					return this;
//				else
//					return null;
//			}
//
            return(base.GetContent <T> () ?? content.GetContent <T> ());
        }
		public bool CanAttachTo (IViewContent content)
		{
			if (content.GetContent (typeof(MonoDevelop.Ide.Gui.Content.IEditableTextBuffer)) == null)
				return false;
			else
				return CodeBehind.IsDesigneable (content.Project.GetProjectFile (content.ContentName));
		}
 public bool CanAttachTo(IViewContent content)
 {
     if (content.GetContent(typeof(MonoDevelop.Ide.Gui.Content.IEditableTextBuffer)) == null)
     {
         return(false);
     }
     else
     {
         return(CodeBehind.IsDesigneable(content.Project.GetProjectFile(content.ContentName)));
     }
 }
		public bool CanAttachTo (IViewContent content)
		{
			if (content.GetContent <MonoDevelop.Ide.Gui.Content.IEditableTextBuffer> () == null)
				return false;
			
			switch (AspNetAppProject.DetermineWebSubtype (content.IsUntitled? content.UntitledName : content.ContentName)) {
				case WebSubtype.WebForm:
					return true;
				default:
					return false;
			}
		}
        public override object GetContent(Type contentType)
        {
            object ob = base.GetContent(contentType);

            if (ob != null)
            {
                return(ob);
            }
            else
            {
                return(content.GetContent(contentType));
            }
        }
        public bool CanAttachTo(IViewContent content)
        {
            if (content.GetContent(typeof(MonoDevelop.Ide.Gui.Content.IEditableTextBuffer)) == null)
            {
                return(false);
            }

            switch (AspNetAppProject.DetermineWebSubtype(content.IsUntitled? content.UntitledName : content.ContentName))
            {
            case WebSubtype.WebForm:
                return(true);

            default:
                return(false);
            }
        }
Exemple #8
0
        public void Invoke(string fileName)
        {
            try {
                Counters.OpenDocumentTimer.Trace("Creating content");
                string mimeType = DesktopService.GetMimeTypeForUri(fileName);
                if (binding.CanHandle(fileName, mimeType, project))
                {
                    newContent = binding.CreateContent(fileName, mimeType, project);
                }
                else
                {
                    fileInfo.ProgressMonitor.ReportError(GettextCatalog.GetString("The file '{0}' could not be opened.", fileName), null);
                }
                if (newContent == null)
                {
                    fileInfo.ProgressMonitor.ReportError(GettextCatalog.GetString("The file '{0}' could not be opened.", fileName), null);
                    return;
                }

                if (project != null)
                {
                    newContent.Project = project;
                }

                Counters.OpenDocumentTimer.Trace("Loading file");

                IEncodedTextContent etc = newContent.GetContent <IEncodedTextContent> ();
                try {
                    if (fileInfo.Encoding != null && etc != null)
                    {
                        etc.Load(fileName, fileInfo.Encoding);
                    }
                    else
                    {
                        newContent.Load(fileName);
                    }
                } catch (InvalidEncodingException iex) {
                    fileInfo.ProgressMonitor.ReportError(GettextCatalog.GetString("The file '{0}' could not opened. {1}", fileName, iex.Message), null);
                    return;
                } catch (OverflowException oex) {
                    fileInfo.ProgressMonitor.ReportError(GettextCatalog.GetString("The file '{0}' could not opened. File too large.", fileName), null);
                    return;
                }
            } catch (Exception ex) {
                fileInfo.ProgressMonitor.ReportError(GettextCatalog.GetString("The file '{0}' could not be opened.", fileName), ex);
                return;
            }
            // content got re-used
            if (newContent.WorkbenchWindow != null)
            {
                newContent.WorkbenchWindow.SelectWindow();
                fileInfo.NewContent = newContent;
                return;
            }

            Counters.OpenDocumentTimer.Trace("Showing view");

            workbench.ShowView(newContent, fileInfo.Options.HasFlag(OpenDocumentOptions.BringToFront));
            DisplayBindingService.AttachSubWindows(newContent.WorkbenchWindow);

            newContent.WorkbenchWindow.DocumentType = binding.Name;

            IEditableTextBuffer ipos = newContent.GetContent <IEditableTextBuffer> ();

            if (fileInfo.Line > 0 && ipos != null)
            {
                if (newContent.Control.IsRealized)
                {
                    JumpToLine();
                }
                else
                {
                    newContent.Control.Realized += HandleNewContentControlRealized;
                }
            }
            fileInfo.NewContent = newContent;
        }
Exemple #9
0
 public bool CanHandle(VersionControlItem item, IViewContent primaryView)
 {
     return((primaryView == null || primaryView.GetContent <ITextFile> () != null) &&
            !item.IsDirectory &&
            item.Path.HasExtension(".plist"));
 }
 public override object GetContent(Type type)
 {
     return(base.GetContent(type) ?? content.GetContent(type));
 }
		public bool CanHandle (VersionControlItem item, IViewContent primaryView)
		{
			return (primaryView == null || primaryView.GetContent <ITextFile> () != null)
				&& DesktopService.GetMimeTypeIsText (DesktopService.GetMimeTypeForUri (item.Path));
		}
 public bool CanHandle(VersionControlItem item, IViewContent primaryView)
 {
     return((primaryView == null || primaryView.GetContent <ITextFile> () != null) &&
            DesktopService.GetMimeTypeIsText(DesktopService.GetMimeTypeForUri(item.Path)));
 }
Exemple #13
0
 public override T GetContent <T> ()
 {
     return(base.GetContent <T> () ?? content.GetContent <T> ());
 }
Exemple #14
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;
        }
Exemple #15
0
 public override object GetContent(Type type)
 {
     return(type.IsInstanceOfType(this) ? this : content?.GetContent(type));
 }
Exemple #16
0
        public void Invoke(string fileName)
        {
            try {
                Counters.OpenDocumentTimer.Trace("Creating content");
                if (binding.CanCreateContentForUri(fileName))
                {
                    newContent = binding.CreateContentForUri(fileName);
                }
                else
                {
                    string mimeType = DesktopService.GetMimeTypeForUri(fileName);
                    if (!binding.CanCreateContentForMimeType(mimeType))
                    {
                        fileInfo.ProgressMonitor.ReportError(GettextCatalog.GetString("The file '{0}' could not be opened.", fileName), null);
                        return;
                    }
                    newContent = binding.CreateContentForMimeType(mimeType, null);
                }
                if (newContent == null)
                {
                    fileInfo.ProgressMonitor.ReportError(GettextCatalog.GetString("The file '{0}' could not be opened.", fileName), null);
                    return;
                }

                if (project != null)
                {
                    newContent.Project = project;
                }

                Counters.OpenDocumentTimer.Trace("Loading file");

                IEncodedTextContent etc = newContent.GetContent <IEncodedTextContent> ();
                if (fileInfo.Encoding != null && etc != null)
                {
                    etc.Load(fileName, fileInfo.Encoding);
                }
                else
                {
                    newContent.Load(fileName);
                }
            } catch (Exception ex) {
                fileInfo.ProgressMonitor.ReportError(GettextCatalog.GetString("The file '{0}' could not be opened.", fileName), ex);
                return;
            }
            // content got re-used
            if (newContent.WorkbenchWindow != null)
            {
                newContent.WorkbenchWindow.SelectWindow();
                fileInfo.NewContent = newContent;
                return;
            }

            Counters.OpenDocumentTimer.Trace("Showing view");

            workbench.ShowView(newContent, fileInfo.BringToFront);
            DisplayBindingService.AttachSubWindows(newContent.WorkbenchWindow);

            newContent.WorkbenchWindow.DocumentType = binding.Name;

            IEditableTextBuffer ipos = newContent.GetContent <IEditableTextBuffer> ();

            if (fileInfo.Line != -1 && ipos != null)
            {
                GLib.Timeout.Add(10, new GLib.TimeoutHandler(JumpToLine));
            }
            fileInfo.NewContent = newContent;
        }
		public bool CanHandle (VersionControlItem item, IViewContent primaryView)
		{
			return (primaryView == null || primaryView.GetContent<ITextFile> () != null)
				&& !item.IsDirectory
				&& item.Path.HasExtension (".plist");
		}