/** @see org.eclipse.ui.forms.IDetailsPage#commit() */ public void commit(boolean onSave) { m_editAdapters.commit(onSave); // send event that the input was changed if (m_mform.getToolkit() instanceof IEditEventBusProvider) { ((IEditEventBusProvider) m_mform.getToolkit()) .getEventBus() .publishEvent(new ChangeEvent(m_input)); } }
public void createContents(Composite parent) { TableWrapLayout lo = new TableWrapLayout(); lo.leftMargin = 0; lo.rightMargin = 0; lo.topMargin = 0; lo.numColumns = 1; parent.setLayout(lo); FormToolkit toolkit = m_mform.getToolkit(); Section section = toolkit.createSection( parent, // // Section.DESCRIPTION | // Section.TITLE_BAR | // Section.EXPANDED); TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP); td.colspan = 1; section.setLayoutData(td); section.setText("Edit Provided Capability"); Composite sectionClient = toolkit.createComposite(section); GridLayout layout = new GridLayout(2, false); sectionClient.setLayout(layout); FormColors colors = toolkit.getColors(); Color headerColor = colors.getColor("org.eclipse.ui.forms.TITLE"); // $NON-NLS-1$ Label label = null; // -- NAMESPACE label = toolkit.createLabel(sectionClient, "Namespace:"); label.setForeground(headerColor); final Text nsText = toolkit.createText(sectionClient, ""); // $NON-NLS-1$ GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); gd.minimumWidth = 200; nsText.setLayoutData(gd); m_editAdapters.createEditAdapter( "nsText", nsText, //$NON-NLS-1$ new RequiredValidator(StructuredNameValidator.instance()), new Mutator() { @Override public String getValue() { return m_input != null && m_input.getNamespace() != null ? m_input.getNamespace() : ""; //$NON-NLS-1$ } @Override public void setValue(String input) throws Exception { m_input.setNamespace( input == null ? "" //$NON-NLS-1$ : input.trim()); } }); // -- NAME label = toolkit.createLabel(sectionClient, "Name:"); label.setForeground(headerColor); final Text nameText = toolkit.createText(sectionClient, ""); nameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); m_editAdapters.createEditAdapter( "name", nameText, //$NON-NLS-1$ new RequiredValidator( NullValidator.instance()), // TODO: A ProvidedCapability name validator new Mutator() { @Override public String getValue() { return m_input != null && m_input.getName() != null ? m_input.getName() : ""; //$NON-NLS-1$ } @Override public void setValue(String input) throws Exception { m_input.setName( input == null ? "" //$NON-NLS-1$ : input.trim()); } }); // -- VERSION label = toolkit.createLabel(sectionClient, "Version:"); label.setForeground(headerColor); final Text versionText = toolkit.createText(sectionClient, ""); versionText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); m_editAdapters.createEditAdapter( "version", versionText, //$NON-NLS-1$ new RequiredValidator(VersionValidator.instance()), new Mutator() { @Override public String getValue() { return m_input != null && m_input.getVersion() != null ? m_input.getVersion() : ""; //$NON-NLS-1$ } @Override public void setValue(String input) throws Exception { m_input.setVersion( input == null ? "" //$NON-NLS-1$ : input.trim()); } }); section.setClient(sectionClient); }
public boolean isDirty() { return m_editAdapters.isDirty(); }
public void refresh() { m_editAdapters.refresh(); }