use of org.talend.designer.webservice.ui.tree.WebServiceTreeLabelProvider in project tdi-studio-se by Talend.
the class AddListDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
// Composite baseCom = (Composite) super.createDialogArea(parent);
Composite createDialogArea = (Composite) super.createDialogArea(parent);
createDialogArea.setLayout(new FillLayout());
SashForm baseCom = new SashForm(createDialogArea, SWT.VERTICAL | SWT.BORDER);
treeViewer = new TreeViewer(baseCom, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
tree = treeViewer.getTree();
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
// Paramater Name Column
TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
column1.setText("Parameter Name");
column1.setWidth(200);
// Array Index Column
TreeColumn column2 = new TreeColumn(tree, SWT.CENTER);
column2.setText("Array Index");
column2.setWidth(100);
treeViewer.setColumnProperties(new String[] { NAME, INDEX });
CellEditor editor = new TextCellEditor(treeViewer.getTree());
// CellEditor nameEditor = new ComboBoxCellEditor(treeViewer.getTree());
treeViewer.setCellEditors(new CellEditor[] { null, editor });
treeViewer.setCellModifier(new ICellModifier() {
public boolean canModify(Object element, String property) {
if (element instanceof ParameterInfo) {
ParameterInfo para = (ParameterInfo) element;
if (INDEX.equals(property) && para.getArraySize() != 0) {
// if item is array it can edit.
return true;
}
}
return false;
}
public Object getValue(Object element, String property) {
if (element instanceof ParameterInfo) {
ParameterInfo para = (ParameterInfo) element;
if (INDEX.equals(property)) {
return para.getIndex() == null ? "" : para.getIndex();
} else if (NAME.equals(property)) {
return para.getName();
}
}
return null;
}
public void modify(Object element, String property, Object value) {
if (element instanceof TreeItem) {
ParameterInfo para = (ParameterInfo) ((TreeItem) element).getData();
if (INDEX.equals(property)) {
para.setIndex(value.toString());
}
}
treeViewer.refresh();
}
});
// DrillDownAdapter adapter = new DrillDownAdapter(treeView);
treeViewer.setContentProvider(new WebServiceTreeContentProvider());
treeViewer.setLabelProvider(new WebServiceTreeLabelProvider());
treeViewer.setInput(para);
treeViewer.addSelectionChangedListener(selectAction);
// tree.addSelectionListener(new SelectionAdapter() {
//
// @Override
// public void widgetSelected(SelectionEvent e) {
// TreeItem[] selects = tree.getSelection();
// ISelection select = (ISelection) treeViewer.getSelection();
// Object obj = ((IStructuredSelection) select).getFirstElement();
// if (obj instanceof ParameterInfo) {
// // if (((ParameterInfo) obj).getParameterInfos().size() > 0) {
// // // ErrorDialog dialog = new ErrorDialog(parentShell, "", "", null, 0);
// // // dialog.open();
// // selectedParaInfo = null;
// // } else {
// selectedParaInfo = (ParameterInfo) obj;
// // }
// }
// }
//
// });
treeViewer.getTree().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
createAllTypeDialog();
}
});
return baseCom;
}
Aggregations