[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: No common IList interface for List and Combo

Hi,

Interfaces like these don't exist in swt.  They have been requested before
(eg.- https://bugs.eclipse.org/bugs/show_bug.cgi?id=4394 ), but in the
interest of keeping the toolkit minimal they've never gained favour.  So I
don't think it's worth submitting a new request.

Grant


"amonteith" <a.m@xxxxx> wrote in message
news:f15a47b044fac1069a14a06dc90de9f2$1@xxxxxxxxxxxxxxxxxx
> I'm building a wee eclipse plugin, and am making a composite widget
> (ClassMethodSelector) that, once a Class has been selected, uses either a
> org.eclipse.swt.widgets.List or Combo to display a set of method names to
> be selected (depending on if the user wants multiple or only single
> selections, respectively).  So, when I go to add the method names to the
> method list selector (List or Combo) I would have thought I could cast to
> some common IList type interface and use the common 'add' method.
> i.e. I want to:
> <code>
>  IList list;
>  if (SINGLE) list = (IList)comboList;
>  else if (MULTI) list = (IList)listList;
>
>  for (IMethod method: type.getMethods()) {
>      if (method meets other criteria: e.g. it exists)
>          list.add(method.getElementName());
>  }
> </code>
>
> They don't share any such interface.  Is there a particular reason for
> this that I'm missing, or is this a valid thing to be requested?  (I'm new
> here: first time poster.... I did do a search of the newsgroup before
> posting and didn't find any other references to the problem).
>
> It just seems unnecessarily tedious to either rewrite the code for each or
> have an extra conditional before adding each method name.
>