in plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/DBPoolWizard.java [405:522]
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
composite.setLayout(layout);
GridData data = new GridData();
// data.verticalAlignment = GridData.FILL;
data.horizontalAlignment = GridData.FILL;
data.widthHint = 300;
composite.setLayoutData(data);
Group basicGroup = new Group(composite, SWT.NONE);
basicGroup.setText(CommonMessages.basicGroup);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 4;
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
// data.grabExcessVerticalSpace = true;
data.horizontalSpan = 2;
basicGroup.setLayout(layout);
data.grabExcessHorizontalSpace = true;
basicGroup.setLayoutData(data);
Label label = new Label(basicGroup, SWT.LEFT);
label.setText(CommonMessages.poolName);
GridData labelData = new GridData();
labelData.horizontalAlignment = GridData.FILL;
label.setLayoutData(labelData);
text[0] = new Text(basicGroup, SWT.BORDER);
GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_FILL);
textData.grabExcessHorizontalSpace = true;
textData.widthHint = 100;
text[0].setLayoutData(textData);
label = new Label(basicGroup, SWT.LEFT);
label.setText(CommonMessages.dbType);
label.setLayoutData(labelData);
combo = new Combo(basicGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
combo.setLayoutData(textData);
combo.add("Derby Embedded");
combo.add("Derby Embedded XA");
combo.select(1);
label = new Label(basicGroup, SWT.LEFT);
label.setText(CommonMessages.dbName);
label.setLayoutData(labelData);
text[1] = new Text(basicGroup, SWT.BORDER);
text[1].setLayoutData(textData);
Group driverGroup = new Group(composite, SWT.NONE);
driverGroup.setText(CommonMessages.driverGroup);
driverGroup.setLayout(layout);
driverGroup.setLayoutData(data);
List list = new List(driverGroup, SWT.BORDER | SWT.MULTI
| SWT.V_SCROLL);
GridData listData = new GridData(SWT.FILL, SWT.FILL, true, true);
list.setLayoutData(listData);
listViewer = new ListViewer(list);
listViewer.setContentProvider(new IStructuredContentProvider() {
public Object[] getElements(Object element) {
return ((java.util.List<?>) element).toArray();
}
public void dispose() {
}
public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
}
});
listViewer.setInput(getInput());
MenuManager popupMenu = new MenuManager();
Action helpAction = new Action(Messages.dbAddNewDriver) {
public void run() {
DriverDialog dialog = new DriverDialog(Display.getCurrent()
.getActiveShell());
dialog.open();
if (dialog.getReturnCode() == 0) {
if (dialog.getDependency() != null) {
dependencies.add(dialog.getDependency());
listViewer.refresh();
}
}
}
};
popupMenu.add(helpAction);
Menu menu = popupMenu.createContextMenu(list);
list.setMenu(menu);
// if edit a pool,the info must be filled into wizard
if (eObject != null && ExtModule.class.isInstance(eObject)) {
ExtModule extModule = (ExtModule) eObject;
try {
ConnectiondefinitionInstance conndefInstance = ((JAXBElement<Connector>) extModule
.getAny()).getValue().getResourceadapter().get(0)
.getOutboundResourceadapter()
.getConnectionDefinition().get(0)
.getConnectiondefinitionInstance().get(0);
text[0].setText(conndefInstance.getName());
java.util.List<ConfigPropertySetting> configPropertySettingList = conndefInstance
.getConfigPropertySetting();
for (ConfigPropertySetting cps : configPropertySettingList) {
if (cps.getName().equals("DatabaseName")) {
text[1].setText(cps.getValue());
}
}
// there need some improvement
list.setSelection(new int[] { 0 });
listViewer.refresh();
} catch (Exception e) {
e.printStackTrace();
}
}
setControl(composite);
}