}
@Override
protected void createFormContent(IManagedForm managedForm) {
ScrolledForm form = managedForm.getForm();
FormToolkit toolkit = managedForm.getToolkit();
toolkit.decorateFormHeading(form.getForm());
WidgetFactory factory = new WidgetFactory(toolkit);
form.setText(PAGE_TITLE);
ColumnLayout layout = new ColumnLayout();
layout.maxNumColumns = 2;
form.getBody().setLayout(layout);
if (!_model.hasPluginConfig()) {
GridLayout gridLayout = new GridLayout(1, false);
form.getBody().setLayout(gridLayout);
toolkit.createLabel(form.getBody(), "This design is currently not configured to be used as WGA Plugin.");
_btnCreatePluginConfig = toolkit.createButton(form.getBody(), "Create WGA Plugin Configuration", SWT.PUSH);
_btnCreatePluginConfig.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
handleCreatePluginConfig();
}
});
} else {
// registration section
Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
section.setText("Registration");
Composite sectionClient = toolkit.createComposite(section);
section.setClient(sectionClient);
GridLayout sectionLayout = new GridLayout();
GridData fillHSpan = new GridData(GridData.FILL_HORIZONTAL);
fillHSpan.horizontalSpan = 4;
GridData fillH = new GridData(GridData.FILL_HORIZONTAL);
GridData prefSize = new GridData();
prefSize.widthHint = 50;
sectionLayout.numColumns = 5;
sectionClient.setLayout(sectionLayout);
_txtUniqueName = factory.createText(sectionClient, "Unique Name:", "pluginUniqueName");
_txtUniqueName.setLayoutData(fillHSpan);
registerField("pluginUniqueName", _txtUniqueName);
_txtVersion = factory.createText(sectionClient, "Version:", "pluginVersion");
_txtVersion.setLayoutData(prefSize);
registerField("pluginVersion", _txtVersion);
_txtBuild = factory.createText(sectionClient, "Build", "pluginBuild");
_txtBuild.setLayoutData(prefSize);
registerField("pluginBuild", _txtBuild);
factory.addFiller(sectionClient);
_txtMinWGAVersion = factory.createText(sectionClient, "Minimum WGA Version:", "pluginWGAVersion");
_txtMinWGAVersion.setLayoutData(prefSize);
registerField("pluginWGAVersion", _txtMinWGAVersion);
factory.addFiller(sectionClient, 3);
_txtMinJavaVersion = factory.createText(sectionClient, "Minimum Java Version:", "pluginJavaVersion");
_txtMinJavaVersion.setLayoutData(prefSize);
registerField("pluginJavaVersion", _txtMinJavaVersion);
factory.addFiller(sectionClient, 3);
// information section
section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
section.setText("Information and Functionality");
sectionClient = toolkit.createComposite(section);
section.setClient(sectionClient);
sectionLayout = new GridLayout();
sectionLayout.numColumns = 2;
sectionClient.setLayout(sectionLayout);
_txtTitle = factory.createText(sectionClient, "Title:", "pluginTitle");
_txtTitle.setLayoutData(fillH);
registerField("pluginTitle", _txtTitle);
_txtVendor = factory.createText(sectionClient, "Vendor:", "pluginVendor");
_txtVendor.setLayoutData(fillH);
registerField("pluginVendor", _txtVendor);
_txtVendorHomepage = factory.createText(sectionClient, "Vendor Homepage:", "pluginVendorHomepage");
_txtVendorHomepage.setLayoutData(fillH);
registerField("pluginVendorHomepage", _txtVendorHomepage);
_txtDescription = factory.createTextArea(sectionClient, "Description:", "pluginDescription");
GridData textBox = new GridData(GridData.FILL_BOTH);
textBox.minimumHeight = 100;
_txtDescription.setLayoutData(textBox);
registerField("pluginDescription", _txtDescription);
_txtPluginHomepage = factory.createText(sectionClient, "Plugin Homepage:", "pluginHomepage");
_txtPluginHomepage.setLayoutData(fillH);
registerField("pluginHomepage", _txtPluginHomepage);
_comboAuthenticationSource = factory.createCombo(sectionClient, "Authentication source:", "pluginAuthenticationSource");
registerField("pluginAuthenticationSource", _comboAuthenticationSource);
_comboPersMode = factory.createCombo(sectionClient, "Personalisation mode:", "pluginPersonalisationMode");
registerField("pluginPersonalisationMode", _comboPersMode);
toolkit.createLabel(sectionClient, "Usage:");
_chkUsageDesignProvider = toolkit.createButton(sectionClient, "Design Provider", SWT.CHECK);
_chkUsageDesignProvider.setData("pluginUsageAsDesignProvider");
registerField("pluginUsageAsDesignProvider", _chkUsageDesignProvider);
toolkit.createLabel(sectionClient, "");
_chkUsageAuthSource = toolkit.createButton(sectionClient, "Authentication Source", SWT.CHECK);
_chkUsageAuthSource.setData("pluginUsageAsAuthenticationSource");
registerField("pluginUsageAsAuthenticationSource", _chkUsageAuthSource);
toolkit.createLabel(sectionClient, "");
_chkUsageContentStore = toolkit.createButton(sectionClient, "Published WGA Content Store", SWT.CHECK);
_chkUsageContentStore.setData("pluginUsageAsContentStore");
_chkUsageContentStore.setData(SWTBotIDs.WIDGET_KEY, ResourceIDs.BUTTON_IN_DESGINPLUGIN_EDITOR);
registerField("pluginUsageAsContentStore", _chkUsageContentStore);
// _chkAllowContentAuthoring = factory.createCheckBox(sectionClient, "Further options:", "Allow Content Authoring", "allowContentAuthoring");
// registerField("allowContentAuthoring", _chkAllowContentAuthoring);
_chkClearPluginDatabaseOnUpdate = factory.createCheckBox(sectionClient, "", "Clear plugin database on update", "pluginClearDatabaseOnUpdate");
registerField("pluginClearDatabaseOnUpdate", _chkClearPluginDatabaseOnUpdate);
_chkDisableInit = factory.createCheckBox(sectionClient, "", "Do not execute init/ connect functionalities on plugin itself", "pluginDisableInit");
registerField("pluginDisableInit", _chkDisableInit);
// dependencies section
section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.COMPACT);
section.setText("Dependencies");
sectionClient = toolkit.createComposite(section);
section.setClient(sectionClient);
sectionLayout = new GridLayout();
sectionLayout.numColumns = 2;
sectionClient.setLayout(sectionLayout);
_tblDependencies = toolkit.createTable(sectionClient, SWT.BORDER|SWT.FULL_SELECTION);
_tblDependencies.setHeaderVisible(true);
GridData tblLayoutData = new GridData(GridData.FILL_BOTH);
tblLayoutData.verticalSpan = 2;
tblLayoutData.minimumHeight = 200;
_tblDependencies.setLayoutData(tblLayoutData);
registerField("pluginDependencies", _tblDependencies);
int tableWidth = 450;
_uniqueNameColumn = new TableColumn(_tblDependencies, SWT.NONE);
_uniqueNameColumn.setText("Plugin unique name");
_uniqueNameColumn.setWidth((int)(tableWidth * 0.8));
_minVersionColumn = new TableColumn(_tblDependencies, SWT.NONE);
_minVersionColumn.setText("Minimum version");
_minVersionColumn.setWidth((int)(tableWidth * 0.2));
_pluginDependenciesModel = new PluginDependenciesModel(_model.getPluginDependencies());
_pluginDependenciesModel.addListener(new BeanListTableModelListener() {
public void add(Object bean) {
_model.fireModelChanged();
}
public void remove(Object bean) {
_model.fireModelChanged();
}
public void update(Object bean) {
_model.fireModelChanged();
}
@SuppressWarnings("unchecked")
public void refresh(List beans) {
_model.fireModelChanged();
}
});
_tblViewerPluginDependencies = new TableViewer(_tblDependencies);
// text editors for both columns
CellEditor[] editors = new CellEditor[2];
editors[0] = new TextCellEditor(_tblDependencies);
editors[1] = new TextCellEditor(_tblDependencies);
_tblViewerPluginDependencies.setCellEditors(editors);
_tblViewerPluginDependencies.setCellModifier(new BeanListTableModelCellModifier(_tblViewerPluginDependencies, _pluginDependenciesModel));
_tblViewerPluginDependencies.setContentProvider(new BeanListTableModelContentProvider());
_tblViewerPluginDependencies.setLabelProvider(new BeanListTableModelLabelProvider(_pluginDependenciesModel));
_tblViewerPluginDependencies.setInput(_pluginDependenciesModel);
GridData btnLayout = new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_FILL, false, false);
_btnAddDependency = toolkit.createButton(sectionClient, "add", SWT.PUSH);
_btnAddDependency.setLayoutData(btnLayout);
_btnAddDependency.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
handleAddDependency();
}
});
//factory.addFiller(sectionClient);
_btnRemoveDependency = toolkit.createButton(sectionClient, "remove", SWT.PUSH);
_btnRemoveDependency.setLayoutData(btnLayout);
_btnRemoveDependency.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
handleRemoveDependency();
}
});
WGADesignExportSection.create(form, toolkit, _editor, "menu:" + WGADesignEditor.ID + ".exportPlugin");
((WGADesignEditor)_editor).createPageToolbar(form.getForm());
bind(form, SWTBinder.BINDING_STRATEGY_AS_YOU_TYPE);
}
}