Composite control = new Composite(parent, SWT.NONE);
control.setLayout(new FillLayout(SWT.VERTICAL));
ExpandBar expandBar = new ExpandBar(control, SWT.NONE);
ExpandItem projectPropertiesExpanditem = new ExpandItem(expandBar, SWT.NONE);
projectPropertiesExpanditem.setExpanded(true);
projectPropertiesExpanditem.setText("Project Properties");
Composite composite = new Composite(expandBar, SWT.NONE);
projectPropertiesExpanditem.setControl(composite);
composite.setLayout(new GridLayout(2, false));
Label lblName = new Label(composite, SWT.NONE);
lblName.setAlignment(SWT.RIGHT);
lblName.setSize(594, 59);
lblName.setText("Name");
nameText = new Text(composite, SWT.BORDER);
GridData gd_nameText = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
gd_nameText.widthHint = 300;
nameText.setLayoutData(gd_nameText);
nameText.setSize(594, 67);
nameText.setEditable(false);
Label lblLibraryName = new Label(composite, SWT.NONE);
lblLibraryName.setAlignment(SWT.RIGHT);
lblLibraryName.setSize(594, 79);
lblLibraryName.setText("Library Name");
libraryNameText = new Text(composite, SWT.BORDER);
libraryNameText.setEditable(false);
GridData gd_libraryNameText = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_libraryNameText.widthHint = 95;
libraryNameText.setLayoutData(gd_libraryNameText);
libraryNameText.setSize(594, 94);
Label lblType = new Label(composite, SWT.NONE);
lblType.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblType.setText("Type");
combo = new Combo(composite, SWT.NONE);
combo.setVisibleItemCount(3);
combo.setItems(new String[] {"APPLICATION", "LIBRARY", "SERVER"});
GridData gd_combo = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_combo.widthHint = 198;
combo.setLayoutData(gd_combo);
new Label(composite, SWT.NONE);
btnCheckButton = new Button(composite, SWT.CHECK);
btnCheckButton.setSize(594, 118);
btnCheckButton.setText("Restricted Availability");
new Label(composite, SWT.NONE);
btnMultithreaded = new Button(composite, SWT.CHECK);
btnMultithreaded.setText("Multithreaded");
new Label(composite, SWT.NONE);
btnInternal = new Button(composite, SWT.CHECK);
btnInternal.setEnabled(false);
btnInternal.setText("Internal");
Label lblCompatibilityLevel = new Label(composite, SWT.NONE);
lblCompatibilityLevel.setSize(594, 158);
lblCompatibilityLevel.setText("Compatibility Level");
compatabilitySpinner = new Spinner(composite, SWT.BORDER);
compatabilitySpinner.addModifyListener(dirtyListener);
GridData gd_compatabilitySpinner = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_compatabilitySpinner.widthHint = 37;
compatabilitySpinner.setLayoutData(gd_compatabilitySpinner);
Label lblUuid = new Label(composite, SWT.NONE);
lblUuid.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblUuid.setText("UUID");
uuidText = new Text(composite, SWT.BORDER);
uuidText.setEditable(false);
uuidText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
Label lblStart = new Label(composite, SWT.NONE);
lblStart.setText("Start");
new Label(composite, SWT.NONE);
Label lblStartClass = new Label(composite, SWT.NONE);
lblStartClass.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblStartClass.setBounds(0, 0, 49, 13);
lblStartClass.setText("Class");
txtStartclass = new Text(composite, SWT.BORDER);
txtStartclass.addModifyListener(dirtyListener);
GridData gd_txtStartclass = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
gd_txtStartclass.widthHint = 300;
txtStartclass.setLayoutData(gd_txtStartclass);
Label lblStartMethod = new Label(composite, SWT.NONE);
lblStartMethod.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblStartMethod.setText("Method");
txtStartmethod = new Text(composite, SWT.BORDER);
txtStartmethod.addModifyListener(dirtyListener);
GridData gd_txtStartmethod = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
gd_txtStartmethod.widthHint = 300;
txtStartmethod.setLayoutData(gd_txtStartmethod);
projectPropertiesExpanditem.setHeight(projectPropertiesExpanditem.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
ExpandItem supplierPlansExpanditem = new ExpandItem(expandBar, SWT.NONE);
supplierPlansExpanditem.setExpanded(true);
supplierPlansExpanditem.setImage(ResourceManager.getPluginImage("Tool", "icons/package.gif"));
supplierPlansExpanditem.setText("Supplier Plans");
Composite composite_1 = new Composite(expandBar, SWT.NONE);
supplierPlansExpanditem.setControl(composite_1);
Button editSuppButton = new Button(composite_1, SWT.NONE);
editSuppButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Set<ToolPlan> allPlans = ToolProjectSupport.getAllPlansForProject(model.getProject());
Set<ToolPlan> supplierPlans = model.getSupplierPlansAsToolPlans();
ListSelectionDialog supplierDialog = new ListSelectionDialog(getShell(),
allPlans,
new IStructuredContentProvider(){
@Override
public void dispose() {
}
@Override
public void inputChanged(Viewer arg0, Object arg1,
Object arg2) {
}
@Override
public Object[] getElements(Object parent) {
if (parent instanceof Set<?>){
return ((Set<?>)parent).toArray();
}
return null;
}
},
new LabelProvider(),
"Select suppier plans from list");
supplierDialog.setInitialSelections(supplierPlans.toArray());
supplierDialog.setTitle("Supplier Plans");
int act = supplierDialog.open();
switch (act){
case Dialog.OK:
/*
* 1. clear the existing suppliers,
* 2. write the selected ones
* 3. rewrite the prx file
*/
Object[] sups = supplierDialog.getResult();
model.clearSuppliers();
for (Object elem : sups){
String name = ((ToolPlan)elem).getToolName();
model.addSupplierPlan(name);
}
model.setDirty(true);
supplierPlanTreeViewer.setInput(model.getSupplierPlansAsToolPlans());
break;
case Dialog.CANCEL:
break;
}
}
});
editSuppButton.setBounds(0, 0, 94, 30);
formToolkit.adapt(editSuppButton, true, true);
editSuppButton.setText("Edit");
composite_1.setLayout(new GridLayout(2, false));
supplierPlanTreeViewer = new TreeViewer(composite_1, SWT.BORDER);
Tree supplierPlanTree = supplierPlanTreeViewer.getTree();
supplierPlanTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
new Label(composite_1, SWT.NONE);
new Label(composite_1, SWT.NONE);
supplierPlanTreeViewer.setContentProvider(new ITreeContentProvider() {
@Override
public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
}
@Override
public void dispose() {
}
@Override
public boolean hasChildren(Object parent) {
return false;
}
@Override
public Object getParent(Object child) {
return null;
}
@Override
public Object[] getElements(Object parent) {
if (parent instanceof Set<?>){
return ((Set<?>)parent).toArray();
}
return null;
}
@Override
public Object[] getChildren(Object parent) {
return getElements(parent);
}
});
supplierPlanTreeViewer.setLabelProvider(new LabelProvider());
supplierPlansExpanditem.setHeight(supplierPlansExpanditem.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
if (this.model != null){
bind();
}
m_bindingContext = initDataBindings();
return control;