[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
|
You could use a Viewer ListViewer and ComboViewer inherit from the same
base class (AbstractListViewer).
Tom
amonteith schrieb:
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.
--
B e s t S o l u t i o n . at
--------------------------------------------------------------------
Tom Schindl JFace-Committer
--------------------------------------------------------------------