Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Combo & CCombo
Combo & CCombo [message #662313] Wed, 30 March 2011 08:45 Go to next message
David  Pérez is currently offline David PérezFriend
Messages: 228
Registered: July 2009
Senior Member
This two classes are fully compatible, but it is difficult to write generic code that works on both of them.

I suggest to create an interface like this:

interface ICombo {
void add (String string);
void add (String string, int index);
....
}

public class CCombo extends Composite implements ICombo {
.....
}

public class Combo extends Composite implements ICombo {
.....
}

As an example of this, the classes in this project http://sourceforge.net/projects/swtaddons/, work only with Combo.
I have to copy and paste are lot of code Confused , just for supporting CCombo, the class I normally use for embedding as a cell editor in a table.

What do you think, SWT gurus?

David
Re: Combo & CCombo [message #662674 is a reply to message #662313] Thu, 31 March 2011 14:03 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Hi David,

The topic of interfaces like this has come up before, usually to capture the
commonalities between (for instance) TableItem and TreeItem. However the
position has remained that adding interfaces like this is not desirable, as
they are not of significant benefit (using a control whose type is not
precisely known is not typical) and they add bloat. Yes, I'm sure that
interface definitions compile to an almost trivial size, but all API
additions in swt are tightly guarded as a general principle and require
strong justification.

Grant


"David P
Previous Topic:SWT.ON_TOP and Alt-Tab
Next Topic:[SOLVED] Unwanted canvas redrawing when maximizing/minimizing/restoring shell
Goto Forum:
  


Current Time: Thu Apr 02 07:32:29 GMT 2020

Powered by FUDForum. Page generated in 0.01541 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top