@PreDestroy void destroy() { if (widget != null) { widget.dispose(); widget = null; } }
@Override public void fill(final Composite parent) { if (loadWidget()) { widget.fill(parent); } }
@Override public void init(IWorkbenchWindow workbenchWindow) { if (loadWidget()) { widget.init(workbenchWindow); } }
@PostConstruct void createWidget(IWorkbenchWindow iwbw, Composite parent, MToolControl toolControl) { IConfigurationElement ice = ((WorkbenchWindow) iwbw).getICEFor(toolControl); if (ice == null) return; parent = new Composite(parent, SWT.NONE); parent.setLayout(new RowLayout()); widget = (IWorkbenchWidget) Util.safeLoadExecutableExtension(ice, IWorkbenchRegistryConstants.ATT_CLASS, IWorkbenchWidget.class); widget.init(iwbw); if (widget instanceof AbstractTrimWidget) { ((AbstractTrimWidget) widget).fill(parent, SWT.DEFAULT, getSide(toolControl)); } else { widget.fill(parent); } }
@Override public void fill(final ToolBar parent, final int index) { if (loadWidget()) { widget.fill(parent, index); } }
@Override public void dispose() { if (loadWidget()) { widget.dispose(); } }
@Override public void fill(final CoolBar parent, final int index) { if (loadWidget()) { widget.fill(parent, index); } }
@Override public void fill(final Menu parent, final int index) { if (loadWidget()) { widget.fill(parent, index); } }
/** * Convenience method that allows the trim layout manager to * inform widgets if they have changed locations. If the IWidget * implementation does not support the method then we default * to using the simpler <code>fill(final Composite parent)</code>. * * @param parent The composite to create the controls in * @param oldSide The side the trim was previously displayed on * @param newSide The new side that the trim will be displayed on */ public void fill(Composite parent, int oldSide, int newSide) { if (loadWidget()) { if (isMoveableTrimWidget()) { ((AbstractWorkbenchTrimWidget) widget).fill(parent, oldSide, newSide); } else { widget.fill(parent); } } }