public SelectReferenceDialog()
        {
            Build();

            refTreeStore             = new ListStore(typeof(string), typeof(string), typeof(string), typeof(ProjectReference), typeof(string));
            ReferencesTreeView.Model = refTreeStore;

            TreeViewColumn col = new TreeViewColumn();

            col.Title = GettextCatalog.GetString("Reference");
            CellRendererPixbuf crp = new CellRendererPixbuf();

            col.PackStart(crp, false);
            col.AddAttribute(crp, "stock-id", IconColumn);
            CellRendererText text_render = new CellRendererText();

            col.PackStart(text_render, true);
            col.AddAttribute(text_render, "text", NameColumn);

            ReferencesTreeView.AppendColumn(col);
            ReferencesTreeView.AppendColumn(GettextCatalog.GetString("Type"), new CellRendererText(), "text", TypeNameColumn);
            ReferencesTreeView.AppendColumn(GettextCatalog.GetString("Location"), new CellRendererText(), "text", LocationColumn);

            projectRefPanel  = new ProjectReferencePanel(this);
            gacRefPanel      = new GacReferencePanel(this);
            assemblyRefPanel = new AssemblyReferencePanel(this);

            mainBook.RemovePage(mainBook.CurrentPage);
            mainBook.AppendPage(gacRefPanel, new Label(GettextCatalog.GetString("Packages")));
            mainBook.AppendPage(projectRefPanel, new Label(GettextCatalog.GetString("Projects")));
            mainBook.AppendPage(assemblyRefPanel, new Label(GettextCatalog.GetString(".Net Assembly")));
            mainBook.Page = 0;
            ReferencesTreeView.Selection.Changed += new EventHandler(OnChanged);
            Child.ShowAll();
            OnChanged(null, null);
        }
示例#2
0
        public void Reset()
        {
            store.Clear();

            bool isPcl = configureProject.IsPortableLibrary;

            foreach (SystemAssembly systemAssembly in targetContext.GetAssemblies(targetVersion))
            {
                if (systemAssembly.Package.IsFrameworkPackage && (isPcl || systemAssembly.Name == "mscorlib"))
                {
                    continue;
                }

                bool   selected = IsSelected(ReferenceType.Package, systemAssembly.FullName, systemAssembly.Package.Name);
                int    matchRank = 0;
                string name, version;

                if (stringMatcher != null)
                {
                    string txt = systemAssembly.Name + " " + systemAssembly.Version;
                    if (!stringMatcher.CalcMatchRank(txt, out matchRank))
                    {
                        continue;
                    }
                    int[] match = stringMatcher.GetMatch(txt);
                    name    = GetMatchMarkup(treeView, systemAssembly.Name, match, 0);
                    version = GetMatchMarkup(treeView, systemAssembly.Version, match, systemAssembly.Name.Length + 1);
                }
                else
                {
                    name    = GLib.Markup.EscapeText(systemAssembly.Name);
                    version = GLib.Markup.EscapeText(systemAssembly.Version);
                }
                string pkg = systemAssembly.Package.GetDisplayName();
                if (systemAssembly.Package.IsInternalPackage)
                {
                    pkg += " " + GettextCatalog.GetString("(Provided by {0})", BrandingService.ApplicationName);
                }

                store.AppendValues(name,
                                   version,
                                   systemAssembly,
                                   selected,
                                   systemAssembly.FullName,
                                   pkg,
                                   MonoDevelop.Ide.Gui.Stock.Package,
                                   matchRank,
                                   ReferenceType.Package);
            }

            if (showAll)
            {
                Solution openSolution = configureProject.ParentSolution;
                if (openSolution == null)
                {
                    return;
                }

                Dictionary <DotNetProject, bool> references = new Dictionary <DotNetProject, bool> ();

                foreach (Project projectEntry in openSolution.GetAllItems <Project>())
                {
                    if (projectEntry == configureProject)
                    {
                        continue;
                    }

                    bool   selected  = IsSelected(ReferenceType.Project, projectEntry.Name, "");
                    int    matchRank = 0;
                    string name;

                    if (stringMatcher != null)
                    {
                        if (!stringMatcher.CalcMatchRank(projectEntry.Name, out matchRank))
                        {
                            continue;
                        }
                        int[] match = stringMatcher.GetMatch(projectEntry.Name);
                        name = GetMatchMarkup(treeView, projectEntry.Name, match, 0);
                    }
                    else
                    {
                        name = GLib.Markup.EscapeText(projectEntry.Name);
                    }

                    DotNetProject netProject = projectEntry as DotNetProject;
                    if (netProject != null)
                    {
                        if (ProjectReferencePanel.ProjectReferencesProject(references, null, netProject, configureProject.Name))
                        {
                            continue;
                        }

                        string reason;
                        if (!configureProject.CanReferenceProject(netProject, out reason))
                        {
                            continue;
                        }
                    }
                    store.AppendValues(name, "", null, selected, projectEntry.FileName.ToString(), "", projectEntry.StockIcon, matchRank, ReferenceType.Project);
                }

                foreach (FilePath file in selectDialog.GetRecentFileReferences())
                {
                    bool   selected  = IsSelected(ReferenceType.Assembly, file, "");
                    int    matchRank = 0;
                    string fname     = file.FileName;
                    string name;

                    string version = string.Empty;
                    try {
                        string sname = SystemAssemblyService.GetAssemblyName(file);
                        var    aname = SystemAssemblyService.ParseAssemblyName(sname);
                        version = aname.Version.ToString();
                    } catch {
                        continue;
                    }

                    if (stringMatcher != null)
                    {
                        if (!stringMatcher.CalcMatchRank(fname, out matchRank))
                        {
                            continue;
                        }
                        int[] match = stringMatcher.GetMatch(fname);
                        name = GetMatchMarkup(treeView, fname, match, 0);
                    }
                    else
                    {
                        name = GLib.Markup.EscapeText(fname);
                    }
                    store.AppendValues(name, version, null, selected, (string)file, GLib.Markup.EscapeText(file), MonoDevelop.Ide.Gui.Stock.OpenFolder, matchRank, ReferenceType.Assembly);
                }
            }
        }
		public SelectReferenceDialog ()
		{
			Build ();

			combinedBox = new CombinedBox ();
			combinedBox.Show ();
			mainBook = new Notebook ();
			combinedBox.Add (mainBook);
			alignment1.Add (combinedBox);
			mainBook.ShowAll ();

			filterEntry = combinedBox.FilterEntry;

			boxRefs.WidthRequest = 200;
			
			refTreeStore = new ListStore (typeof (string), typeof(string), typeof(string), typeof(ProjectReference), typeof(Xwt.Drawing.Image));
			ReferencesTreeView.Model = refTreeStore;

			TreeViewColumn col = new TreeViewColumn ();
			col.Title = GettextCatalog.GetString("Reference");
			CellRendererImage crp = new CellRendererImage ();
			crp.Yalign = 0f;
			col.PackStart (crp, false);
			col.AddAttribute (crp, "image", IconColumn);
			CellRendererText text_render = new CellRendererText ();
			col.PackStart (text_render, true);
			col.AddAttribute (text_render, "markup", NameColumn);
			text_render.Ellipsize = Pango.EllipsizeMode.End;
			
			ReferencesTreeView.AppendColumn (col);
//			ReferencesTreeView.AppendColumn (GettextCatalog.GetString ("Type"), new CellRendererText (), "text", TypeNameColumn);
//			ReferencesTreeView.AppendColumn (GettextCatalog.GetString ("Location"), new CellRendererText (), "text", LocationColumn);
			
			projectRefPanel = new ProjectReferencePanel (this);
			packageRefPanel = new PackageReferencePanel (this, false);
			allRefPanel = new PackageReferencePanel (this, true);
			assemblyRefPanel = new AssemblyReferencePanel (this);
			panels.Add (allRefPanel);
			panels.Add (packageRefPanel);
			panels.Add (projectRefPanel);
			panels.Add (assemblyRefPanel);
			
			//mainBook.RemovePage (mainBook.CurrentPage);
			
			HBox tab = new HBox (false, 3);
//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Reference, IconSize.Menu)), false, false, 0);
			tab.PackStart (new Label (GettextCatalog.GetString ("_All")), true, true, 0);
			tab.BorderWidth = 3;
			tab.ShowAll ();
			mainBook.AppendPage (allRefPanel, tab);
			
			tab = new HBox (false, 3);
//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Package, IconSize.Menu)), false, false, 0);
			tab.PackStart (new Label (GettextCatalog.GetString ("_Packages")), true, true, 0);
			tab.BorderWidth = 3;
			tab.ShowAll ();
			mainBook.AppendPage (packageRefPanel, tab);
			
			tab = new HBox (false, 3);
//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Project, IconSize.Menu)), false, false, 0);
			tab.PackStart (new Label (GettextCatalog.GetString ("Pro_jects")), true, true, 0);
			tab.BorderWidth = 3;
			tab.ShowAll ();
			mainBook.AppendPage (projectRefPanel, tab);
			
			tab = new HBox (false, 3);
//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.OpenFolder, IconSize.Menu)), false, false, 0);
			tab.PackStart (new Label (GettextCatalog.GetString (".Net A_ssembly")), true, true, 0);
			tab.BorderWidth = 3;
			tab.ShowAll ();
			mainBook.AppendPage (assemblyRefPanel, tab);
			
			mainBook.Page = 0;
			
			var w = selectedHeader.Child;
			selectedHeader.Remove (w);
			HeaderBox header = new HeaderBox (1, 0, 1, 1);
			header.SetPadding (6, 6, 6, 6);
			header.GradientBackround = true;
			header.Add (w);
			selectedHeader.Add (header);
			
			RemoveReferenceButton.CanFocus = false;
			ReferencesTreeView.Selection.Changed += new EventHandler (OnChanged);
			Child.ShowAll ();
			OnChanged (null, null);
			InsertFilterEntry ();
		}
        public SelectReferenceDialog()
        {
            Build();

            combinedBox = new CombinedBox();
            combinedBox.Show();
            mainBook = new Notebook();
            combinedBox.Add(mainBook);
            alignment1.Add(combinedBox);
            mainBook.ShowAll();

            filterEntry = combinedBox.FilterEntry;

            boxRefs.WidthRequest = 200;

            refTreeStore             = new ListStore(typeof(string), typeof(string), typeof(string), typeof(ProjectReference), typeof(Xwt.Drawing.Image));
            ReferencesTreeView.Model = refTreeStore;

            TreeViewColumn col = new TreeViewColumn();

            col.Title = GettextCatalog.GetString("Reference");
            CellRendererImage crp = new CellRendererImage();

            crp.Yalign = 0f;
            col.PackStart(crp, false);
            col.AddAttribute(crp, "image", IconColumn);
            CellRendererText text_render = new CellRendererText();

            col.PackStart(text_render, true);
            col.AddAttribute(text_render, "markup", NameColumn);
            text_render.Ellipsize = Pango.EllipsizeMode.End;

            ReferencesTreeView.AppendColumn(col);
//			ReferencesTreeView.AppendColumn (GettextCatalog.GetString ("Type"), new CellRendererText (), "text", TypeNameColumn);
//			ReferencesTreeView.AppendColumn (GettextCatalog.GetString ("Location"), new CellRendererText (), "text", LocationColumn);

            projectRefPanel  = new ProjectReferencePanel(this);
            packageRefPanel  = new PackageReferencePanel(this, false);
            allRefPanel      = new PackageReferencePanel(this, true);
            assemblyRefPanel = new AssemblyReferencePanel(this);
            panels.Add(allRefPanel);
            panels.Add(packageRefPanel);
            panels.Add(projectRefPanel);
            panels.Add(assemblyRefPanel);

            //mainBook.RemovePage (mainBook.CurrentPage);

            HBox tab = new HBox(false, 3);

//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Reference, IconSize.Menu)), false, false, 0);
            tab.PackStart(new Label(GettextCatalog.GetString("_All")), true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll();
            mainBook.AppendPage(allRefPanel, tab);

            tab = new HBox(false, 3);
//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Package, IconSize.Menu)), false, false, 0);
            tab.PackStart(new Label(GettextCatalog.GetString("_Packages")), true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll();
            mainBook.AppendPage(packageRefPanel, tab);

            tab = new HBox(false, 3);
//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Project, IconSize.Menu)), false, false, 0);
            tab.PackStart(new Label(GettextCatalog.GetString("Pro_jects")), true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll();
            mainBook.AppendPage(projectRefPanel, tab);

            tab = new HBox(false, 3);
//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.OpenFolder, IconSize.Menu)), false, false, 0);
            tab.PackStart(new Label(GettextCatalog.GetString(".Net A_ssembly")), true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll();
            mainBook.AppendPage(assemblyRefPanel, tab);

            mainBook.Page = 0;

            var w = selectedHeader.Child;

            selectedHeader.Remove(w);
            HeaderBox header = new HeaderBox(1, 0, 1, 1);

            header.SetPadding(6, 6, 6, 6);
            header.GradientBackground = true;
            header.Add(w);
            selectedHeader.Add(header);

            RemoveReferenceButton.CanFocus        = false;
            ReferencesTreeView.Selection.Changed += new EventHandler(OnChanged);
            Child.ShowAll();
            OnChanged(null, null);
            InsertFilterEntry();
        }
		public SelectReferenceDialog ()
		{
			Build ();
			
			refTreeStore = new ListStore (typeof (string), typeof(string), typeof(string), typeof(ProjectReference), typeof(string));
			ReferencesTreeView.Model = refTreeStore;

			TreeViewColumn col = new TreeViewColumn ();
			col.Title = GettextCatalog.GetString("Reference");
			CellRendererPixbuf crp = new CellRendererPixbuf ();
			col.PackStart (crp, false);
			col.AddAttribute (crp, "stock-id", IconColumn);
			CellRendererText text_render = new CellRendererText ();
			col.PackStart (text_render, true);
			col.AddAttribute (text_render, "text", NameColumn);
			
			ReferencesTreeView.AppendColumn (col);
			ReferencesTreeView.AppendColumn (GettextCatalog.GetString ("Type"), new CellRendererText (), "text", TypeNameColumn);
			ReferencesTreeView.AppendColumn (GettextCatalog.GetString ("Location"), new CellRendererText (), "text", LocationColumn);
			
			projectRefPanel = new ProjectReferencePanel (this);
			gacRefPanel = new GacReferencePanel (this);
			assemblyRefPanel = new AssemblyReferencePanel (this);
			
			mainBook.RemovePage (mainBook.CurrentPage);
			mainBook.AppendPage (gacRefPanel, new Label (GettextCatalog.GetString ("Packages")));
			mainBook.AppendPage (projectRefPanel, new Label (GettextCatalog.GetString ("Projects")));
			mainBook.AppendPage (assemblyRefPanel, new Label (GettextCatalog.GetString (".Net Assembly")));
			mainBook.Page = 0;
			ReferencesTreeView.Selection.Changed += new EventHandler (OnChanged);
			ShowAll ();
			OnChanged (null, null);
		}