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();
        }
Пример #2
0
		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 ();
		}
Пример #3
0
        void PopulateListView()
        {
            store.Clear();

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

                if (projectEntry is UnknownProject)
                {
                    continue;
                }

                string txt;
                int    matchRank = 0;

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

                bool          selected       = selection.Contains(projectEntry.Name);
                bool          allowSelecting = true;
                DotNetProject netProject     = projectEntry as DotNetProject;
                if (netProject != null)
                {
                    string reason;

                    if (ProjectReferencesProject(references, null, netProject, configureProject.Name))
                    {
                        txt           += " " + GLib.Markup.EscapeText(GettextCatalog.GetString("(Cyclic dependencies not allowed)"));
                        allowSelecting = false;
                    }
                    else if (!configureProject.CanReferenceProject(netProject, out reason))
                    {
                        txt           += " " + GLib.Markup.EscapeText("(" + reason + ")");
                        allowSelecting = false;
                    }
                }

                var icon = ImageService.GetIcon(projectEntry.StockIcon, IconSize.Menu);
                if (!allowSelecting)
                {
                    // Don't show unselectable projects if there is a filter
                    if (stringMatcher != null)
                    {
                        continue;
                    }
                    icon = icon.WithAlpha(0.5);
                }
                Gtk.TreeIter it = store.AppendValues(txt, projectEntry.BaseDirectory.ToString(), projectEntry, selected, icon, allowSelecting);
                if (!allowSelecting)
                {
                    store.SetValue(it, ColColor, "dimgrey");
                }
            }
        }