public AssemblyReferencePanel(SelectReferenceDialog selectDialog)
        {
            this.selectDialog = selectDialog;

            chooser = new FileChooserWidget (FileChooserAction.Open, "");
            chooser.SetCurrentFolder (Environment.GetFolderPath (Environment.SpecialFolder.Personal));
            chooser.SelectMultiple = true;

            // this should only allow dll's and exe's
            FileFilter filter = new FileFilter ();
            filter.Name = GettextCatalog.GetString ("Assemblies");
            filter.AddPattern ("*.dll");
            filter.AddPattern ("*.exe");
            chooser.AddFilter (filter);
            chooser.FileActivated += new EventHandler (SelectReferenceDialog);

            PackStart (chooser, true, true, 0);

            PackStart (new Gtk.VSeparator(), false, false, 0);

            VBox box = new VBox ();
            Gtk.Button addButton = new Gtk.Button (Gtk.Stock.Add);
            addButton.Clicked += new EventHandler(SelectReferenceDialog);
            box.PackStart (addButton, false, false, 0);
            PackStart (box, false, false, 0);

            BorderWidth = 6;
            Spacing = 6;
            ShowAll();
        }
        public GacReferencePanel(SelectReferenceDialog selectDialog)
        {
            this.selectDialog = selectDialog;

            store = new TreeStore (typeof (string), typeof (string), typeof(string), typeof(bool), typeof(string));
            treeView = new TreeView (store);

            TreeViewColumn firstColumn = new TreeViewColumn ();
            firstColumn.Title = GettextCatalog.GetString ("Reference Name");
            CellRendererToggle tog_render = new CellRendererToggle ();
            tog_render.Toggled += new Gtk.ToggledHandler (AddReference);
            firstColumn.PackStart (tog_render, false);
            firstColumn.AddAttribute (tog_render, "active", 3);

            CellRendererText text_render = new CellRendererText ();
            firstColumn.PackStart (text_render, true);
            firstColumn.AddAttribute (text_render, "text", 0);

            treeView.AppendColumn (firstColumn);
            treeView.AppendColumn (GettextCatalog.GetString ("Version"), new CellRendererText (), "text", 1);
            // FIXME: this seems useless
            //treeView.AppendColumn (GettextCatalog.GetString ("Path"), new CellRendererText (), "text", 2);

            store.SetSortColumnId (0, SortType.Ascending);
            store.SetSortFunc (0, new TreeIterCompareFunc (SortTree));

            PrintCache();
            ScrolledWindow sc = new ScrolledWindow ();
            sc.ShadowType = Gtk.ShadowType.In;
            sc.Add (treeView);
            this.PackStart (sc, true, true, 0);
            ShowAll ();
            BorderWidth = 6;
        }
        public ProjectReferencePanel(SelectReferenceDialog selectDialog)
            : base(false, 6)
        {
            this.selectDialog = selectDialog;

            store = new TreeStore (typeof (string), typeof (string), typeof(Project), typeof(bool), typeof(Gdk.Pixbuf));
            store.SetSortColumnId (0, SortType.Ascending);
            treeView = new TreeView (store);

            TreeViewColumn firstColumn = new TreeViewColumn ();

            firstColumn.Title = GettextCatalog.GetString ("Project");
            CellRendererToggle tog_render = new CellRendererToggle ();
            tog_render.Xalign = 0;
            tog_render.Toggled += new Gtk.ToggledHandler (AddReference);
            firstColumn.PackStart (tog_render, false);
            firstColumn.AddAttribute (tog_render, "active", 3);

            Gtk.CellRendererPixbuf pix_render = new Gtk.CellRendererPixbuf ();
            firstColumn.PackStart (pix_render, false);
            firstColumn.AddAttribute (pix_render, "pixbuf", 4);

            CellRendererText text_render = new CellRendererText ();
            firstColumn.PackStart (text_render, true);
            firstColumn.AddAttribute (text_render, "text", 0);

            treeView.AppendColumn (firstColumn);
            treeView.AppendColumn (GettextCatalog.GetString ("Directory"), new CellRendererText (), "text", 1);

            ScrolledWindow sc = new ScrolledWindow ();
            sc.ShadowType = Gtk.ShadowType.In;
            sc.Add (treeView);
            PackStart (sc, true, true, 0);
            ShowAll ();
            BorderWidth = 6;
        }
        public bool AddReferenceToProject(Project project)
        {
            bool res = false;

            if (selDialog == null)
                selDialog = new SelectReferenceDialog(project);
            else
                selDialog.SetProject (project);

            if (selDialog.Run() == (int)Gtk.ResponseType.Ok) {
                ProjectReferenceCollection newRefs = selDialog.ReferenceInformations;

                ArrayList toDelete = new ArrayList ();
                foreach (ProjectReference refInfo in project.ProjectReferences)
                    if (!newRefs.Contains (refInfo))
                        toDelete.Add (refInfo);

                foreach (ProjectReference refInfo in toDelete)
                        project.ProjectReferences.Remove (refInfo);

                foreach (ProjectReference refInfo in selDialog.ReferenceInformations)
                    if (!project.ProjectReferences.Contains (refInfo))
                        project.ProjectReferences.Add(refInfo);

                res = true;
            }
            selDialog.Hide ();
            return res;
        }