/** {@inheritDoc} */ public Object[] getSelectedElements() { Object value = editor.getValue(); if (value == null) { return new Object[] {}; } return new Object[] {value}; }
/** * {@inheritDoc} * * <p>The control for this selector is obtained by instantiating the generic class with a parent * composite and a default style */ public void createControls(Composite parent) { try { Constructor<? extends AbstractValueEditor> construct = editorClass.getDeclaredConstructor(Composite.class, Integer.TYPE); editor = construct.newInstance(parent, SWT.BORDER); editor.addCommitListener( new ICommitListener() { public void commit(AbstractEditor editor) { if (!elementSelectionListeners.isEmpty()) { Object value = StandardSelector.this.editor.getValue(); for (IElementSelectionListener listener : elementSelectionListeners) { listener.addElements(new Object[] {value}); } } } }); } catch (Exception ex) { Activator.log.error(ex); } }