Reputation: 1427
Using SWT, Is it possible to create a custom widget and insert it to a Table
or Tree
as if it was a TreeItem
or TableItem
?
I tried to create a class and extend TreeItem
but I'm getting this warning:
MyClass illegally extends TreeItem
Is there a way to do this?
Upvotes: 1
Views: 467
Reputation: 111217
Most SWT widgets are not designed to be extended and enforce this by checking that the current class is in the org.eclipse.swt.widgets
package. This can be worked around but is very strongly discouraged.
Widgets generally contain a lot of platform specific code, an override class might very easily end up using code which will only work on one platform.
There are various other ways to extend tables and trees. Using TableEditor
and TreeEditor
is one way. Drawing the table/tree yourself using SWT.MeasureItem
, SWT.PaintItem
and SWT.EraseItem
is another.
Upvotes: 2