Inheritance: MonoDevelop.Ide.Gui.AbstractViewContent, MonoDevelop.Ide.Gui.Content.IUrlHandler
示例#1
0
        protected override void Run()
        {
            var assemblyBrowserView = new AssemblyBrowserViewContent();

            if (Ide.IdeApp.ProjectOperations.CurrentSelectedSolution == null)
            {
                foreach (var assembly in defaultAssemblies)
                {
                    assemblyBrowserView.Widget.AddReferenceByAssemblyName(assembly, assembly == defaultAssemblies [0]);
                }
            }
            else
            {
                foreach (var project in Ide.IdeApp.ProjectOperations.CurrentSelectedSolution.GetAllProjects())
                {
                    assemblyBrowserView.Widget.AddProject(project, false);

                    var netProject = project as DotNetProject;
                    if (netProject == null)
                    {
                        continue;
                    }
                    foreach (string file in netProject.GetReferencedAssemblies(ConfigurationSelector.Default, false))
                    {
                        if (!File.Exists(file))
                        {
                            continue;
                        }
                        assemblyBrowserView.Widget.AddReferenceByFileName(file, false);
                    }
                }
            }

            Ide.IdeApp.Workbench.OpenDocument(assemblyBrowserView, true);
        }
		protected override void Run ()
		{
			foreach (var view in IdeApp.Workbench.Documents) {
				if (view.PrimaryView is AssemblyBrowserViewContent) {
					view.Window.SelectWindow ();
					return;
				}
			}

			var assemblyBrowserView = new AssemblyBrowserViewContent ();
			
			if (Ide.IdeApp.ProjectOperations.CurrentSelectedSolution == null) {
				foreach (var assembly in defaultAssemblies) {
					assemblyBrowserView.Widget.AddReferenceByAssemblyName (assembly, assembly == defaultAssemblies [0]); 
				}
			} else {
				foreach (var project in Ide.IdeApp.ProjectOperations.CurrentSelectedSolution.GetAllProjects ()) {
					assemblyBrowserView.Widget.AddProject (project, false);
					
					var netProject = project as DotNetProject;
					if (netProject == null)
						continue;
					foreach (string file in netProject.GetReferencedAssemblies (ConfigurationSelector.Default, false)) {
						if (!File.Exists (file))
							continue;
						assemblyBrowserView.Widget.AddReferenceByFileName (file, false); 
					}
				}
			}
			
			Ide.IdeApp.Workbench.OpenDocument (assemblyBrowserView, true);
		}
示例#3
0
		internal AssemblyBrowserViewContent GetViewContent ()
		{
			if (viewContent == null || viewContent.IsDisposed) {
				viewContent = new AssemblyBrowserViewContent ();
				viewContent.Control.Destroyed += HandleDestroyed;
			}
			return viewContent;
		}
示例#4
0
 internal AssemblyBrowserViewContent GetViewContent()
 {
     if (viewContent == null || viewContent.IsDisposed)
     {
         viewContent           = new AssemblyBrowserViewContent();
         viewContent.Disposed += HandleDestroyed;
     }
     return(viewContent);
 }
		AssemblyBrowserViewContent GetViewContent ()
		{
			if (viewContent == null || viewContent.IsDisposed) {
				viewContent = new AssemblyBrowserViewContent ();
				viewContent.Control.Destroyed += delegate {
					this.viewContent = null;
				};
			}
			return viewContent;
		}
示例#6
0
 AssemblyBrowserViewContent GetViewContent()
 {
     if (viewContent == null || viewContent.IsDisposed)
     {
         viewContent = new AssemblyBrowserViewContent();
         viewContent.Control.Destroyed += delegate {
             this.viewContent = null;
         };
     }
     return(viewContent);
 }
 void InspectEditorhandleLinkRequest(object sender, Mono.TextEditor.LinkEventArgs args)
 {
     if (args.Button == 2 || (args.Button == 1 && (args.ModifierState & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask))
     {
         AssemblyBrowserViewContent assemblyBrowserView = new AssemblyBrowserViewContent();
         foreach (DomCecilCompilationUnit cu in definitions)
         {
             assemblyBrowserView.Load(cu.FileName);
         }
         IdeApp.Workbench.OpenDocument(assemblyBrowserView, true);
         ((AssemblyBrowserWidget)assemblyBrowserView.Control).Open(args.Link);
     }
     else
     {
         this.Open(args.Link);
     }
 }
		void InspectEditorhandleLinkRequest (object sender, Mono.TextEditor.LinkEventArgs args)
		{
			var loader = (AssemblyLoader)this.TreeView.GetSelectedNode ().GetParentDataItem (typeof(AssemblyLoader), true);

			if (args.Button == 2 || (args.Button == 1 && (args.ModifierState & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask)) {
				AssemblyBrowserViewContent assemblyBrowserView = new AssemblyBrowserViewContent ();
				foreach (var cu in definitions) {
					assemblyBrowserView.Load (cu.UnresolvedAssembly.AssemblyName);
				}
				IdeApp.Workbench.OpenDocument (assemblyBrowserView, true);
				((AssemblyBrowserWidget)assemblyBrowserView.Control).Open (args.Link);
			} else {
				this.Open (args.Link, loader);
			}
		}
		internal void SetReferencedSegments (List<ReferenceSegment> refs)
		{
			ReferencedSegments = refs;
			if (ReferencedSegments == null)
				return;
			foreach (var _seg in refs) {
				var seg = _seg;
				var line = inspectEditor.GetLineByOffset (seg.Offset);
				if (line == null)
					continue;
				// FIXME: ILSpy sometimes gives reference segments for punctuation. See http://bugzilla.xamarin.com/show_bug.cgi?id=2918
				string text = inspectEditor.GetTextAt (seg.Offset, seg.Length);
				if (text != null && text.Length == 1 && !(char.IsLetter (text [0]) || text [0] == '…'))
					continue;
				var marker = TextMarkerFactory.CreateLinkMarker (inspectEditor, seg.Offset, seg.Length, delegate (LinkRequest request) {
					bool? isNotPublic;
					var link = GetLink (seg, out isNotPublic);
					if (link == null)
						return;
					if (isNotPublic.HasValue) {
						if (isNotPublic.Value) {
							PublicApiOnly = false;
						}
					} else {
						// unable to determine if the member is public or not (in case of member references) -> try to search
						var nav = SearchMember (link, false);
						if (nav == null)
							PublicApiOnly = false;
					}
					var loader = (AssemblyLoader)this.TreeView.GetSelectedNode ().GetParentDataItem (typeof(AssemblyLoader), true);
					// args.Button == 2 || (args.Button == 1 && (args.ModifierState & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask)
					if (request == LinkRequest.RequestNewView) {
						AssemblyBrowserViewContent assemblyBrowserView = new AssemblyBrowserViewContent ();
						foreach (var cu in definitions) {
							assemblyBrowserView.Load (cu.UnresolvedAssembly.AssemblyName);
						}
						IdeApp.Workbench.OpenDocument (assemblyBrowserView, true);
						((AssemblyBrowserWidget)assemblyBrowserView.Control).Open (link);
					} else {
						this.Open (link, loader);
					}
				});
				marker.OnlyShowLinkOnHover = true;
				underlineMarkers.Add (marker);
				inspectEditor.AddMarker (marker);
			}
		}
		void InspectEditorhandleLinkRequest (object sender, Mono.TextEditor.LinkEventArgs args)
		{
			if (args.Button == 2 || (args.Button == 1 && (args.ModifierState & Gdk.ModifierType.ShiftMask) == Gdk.ModifierType.ShiftMask)) {
				AssemblyBrowserViewContent assemblyBrowserView = new AssemblyBrowserViewContent ();
				foreach (DomCecilCompilationUnit cu in definitions) {
					assemblyBrowserView.Load (cu.FileName);
				}
				IdeApp.Workbench.OpenDocument (assemblyBrowserView, true);
				((AssemblyBrowserWidget)assemblyBrowserView.Control).Open (args.Link);
			} else {
				this.Open (args.Link);
			}
		}
示例#11
0
 void HandleDestroyed(object sender, EventArgs e)
 {
     ((AssemblyBrowserViewContent)sender).Disposed -= HandleDestroyed;
     this.viewContent = null;
 }
示例#12
0
		void HandleDestroyed (object sender, EventArgs e)
		{
			((Gtk.Widget)sender).Destroyed -= HandleDestroyed;
			this.viewContent = null;
		}
 void HandleDestroyed(object sender, EventArgs e)
 {
     ((Gtk.Widget)sender).Destroyed -= HandleDestroyed;
     this.viewContent = null;
 }
示例#14
0
		void HandleDestroyed (object sender, EventArgs e)
		{
			((AssemblyBrowserViewContent)sender).Disposed -= HandleDestroyed;
			this.viewContent = null;
		}