[MonoDevelop] Task Class Wizard

Michael Hutchinson m.j.hutchinson at gmail.com
Thu Sep 25 00:47:40 EDT 2008

On Wed, Sep 24, 2008 at 12:46 AM, dave <knottnhupfer at gmail.com> wrote:
> Hello,
> 2008/9/22 Michael Hutchinson <m.j.hutchinson at gmail.com>:
>> Take a look at
>> http://anonsvn.mono-project.com/viewvc/trunk/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OverridesImplementsDialog.cs?view=markup
>> Maybe you could refactor that into a widget that the class wizard could re-use.
> I took a look at this class. It's possible that I can only reuse the
> TreeView and the TreeStorage?
> So I thought about to create a functional method in a new utility
> class which takes a reference of the TreeView and TreeStore and builds
> the view.
> Furthermore this class owns also a method ( or more ) to add the data.
> So both classes (ClassWizard and OverridesImplementDialog) can use the
> same code.
> Is it ok so?
> Sorry for all this questions but I don't will start with the
> refactoring before I'm not sure that I'm on the right way :)

I think you're on the right path :-)

The approach I'd personally take would be to encapsulate the TreeView
and TreeStore totally inside the widget, but that's open to debate...

For example, I think the following signature would pretty much cover both cases:

public class MemberOverrideWidget : Gtk.Bin
    public MemberOverrideWidget (Ambience ambience);
    public void AddMembers (IEnumerable<IMember> members);
    public IEnumerable<MemberOverride> GetOverrides ();
    public bool ShowTypeRemovalButton { get; set; }

public class MemberOverride
    public bool IsExplicit { get; }
    public bool IsVirtual { get; }
    public IMember Member { get; }
    public CodeDomMethod ToCodeDom ();

So this API pretty much lets you feed IMembers in, and get out the
selected overrides in a LINQ-friendly IEnumerable (which can be
implemented very easily using 'yield').

It could certainly be improved/refined.

Michael Hutchinson

More information about the Monodevelop-list mailing list