Community
Participate
Working Groups
It would be nice if the MenuItem and the ToolItem classes can implement a common interface with some methods like getEnabled/setEnabled, getSelection/setSelection and/or getText/setText so I will be able to f.e. acitivate or deactivate such controls without making any difference: interface IExample { public boolean getEnabled(); public void setEnabled(boolean value); ... } class MenuItem implements IExample { } class ToolItem implements IExample { } IExample item = (IExample) new MenuItem(menuBar, SWT.PUSH); item.setEnabled(false); IExample item = (IExample) new ToolItem(toolBar, SWT.PUSH); item.setEnabled(false); Another solution would be to refactor these methods to the Item class so I can cast MenuItem and ToolItem to the superclass and then call setEnabled or setSelection etc. on that superclass.