use of org.eclipse.swt.widgets.TreeColumn in project tdi-studio-se by Talend.
the class UpdateDetectionDialog method createColumns.
/**
* create table columns.
*/
private void createColumns(final Tree tree) {
TreeColumn column = new TreeColumn(tree, SWT.NONE);
column.setText(ITEMS);
column.setWidth(SIZING_COLUMN_WIDTH * 10);
tree.setSortColumn(column);
if (isOnlySimpleShow()) {
column.setWidth(SIZING_COLUMN_WIDTH * 20);
} else {
column = new TreeColumn(tree, SWT.NONE);
column.setText(OPERATIONS);
column.setWidth(SIZING_COLUMN_WIDTH * 7);
column = new TreeColumn(tree, SWT.NONE);
column.setText(REMARKS);
column.setWidth(SIZING_COLUMN_WIDTH * 6);
}
}
use of org.eclipse.swt.widgets.TreeColumn in project tdi-studio-se by Talend.
the class ErrorDetailDialog method createTreeTableViewer.
/**
* DOC chuang Comment method "createTreeTableView".
*
* @param parent
*/
private void createTreeTableViewer(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
viewer = new TreeViewer(composite, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
// init tree
final Tree tree = viewer.getTree();
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
// create tree column
TreeColumn column = new TreeColumn(tree, SWT.NONE);
//$NON-NLS-1$
column.setText("Resource");
column.setWidth(150);
column = new TreeColumn(tree, SWT.NONE);
//$NON-NLS-1$
column.setText("Description");
column.setWidth(300);
viewer.setContentProvider(new ErrorDetailContentProvider());
viewer.setLabelProvider(new ErrorDetailLabelProvider());
viewer.setInput(errors);
viewer.expandAll();
}
use of org.eclipse.swt.widgets.TreeColumn in project tdi-studio-se by Talend.
the class JSONFileOutputStep2Form method addJSONFileViewer.
private void addJSONFileViewer(final Composite mainComposite, final int width, final int height) {
final Group group = Form.createGroup(mainComposite, 1, "Linker Target", height);
GridData data = new GridData(GridData.FILL_BOTH);
Composite composite = new Composite(group, SWT.BORDER);
composite.setLayout(new GridLayout());
composite.setLayoutData(data);
JSONViewer = new TreeViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
data = new GridData(GridData.FILL_BOTH);
JSONViewer.getControl().setLayoutData(data);
JSONViewer.setUseHashlookup(true);
Tree tree = JSONViewer.getTree();
if (isReadOnly()) {
tree.setEnabled(false);
}
tree.setLinesVisible(true);
tree.setBackground(tree.getDisplay().getSystemColor(SWT.COLOR_WHITE));
TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
column1.setText("JSON Tree");
column1.setWidth(120);
TreeColumn column2 = new TreeColumn(tree, SWT.CENTER);
column2.setText("Related Column");
column2.setWidth(100);
TreeColumn column3 = new TreeColumn(tree, SWT.CENTER);
column3.setText("Node Status");
column3.setWidth(100);
TreeColumn column4 = new TreeColumn(tree, SWT.CENTER);
column4.setText("Default Value");
column4.setWidth(100);
tree.setHeaderVisible(true);
JSONFileTreeViewerProvider provider = new JSONFileTreeViewerProvider();
JSONViewer.setLabelProvider(provider);
JSONViewer.setCellModifier(new ICellModifier() {
public void modify(Object element, String property, Object value) {
TreeItem treeItem = (TreeItem) element;
FOXTreeNode node = (FOXTreeNode) treeItem.getData();
if (property.equals("C1")) {
node.setLabel((String) value);
}
if (property.equals("C4")) {
node.setDefaultValue((String) value);
}
JSONViewer.refresh(node);
}
public Object getValue(Object element, String property) {
FOXTreeNode node = (FOXTreeNode) element;
if (property.equals("C1")) {
//$NON-NLS-1$
return node.getLabel();
}
if (property.equals("C4")) {
//$NON-NLS-1$
return node.getDefaultValue();
}
return null;
}
public boolean canModify(Object element, String property) {
FOXTreeNode node = (FOXTreeNode) element;
if (property.equals("C1")) {
if (node.getLabel() != null && node.getLabel().length() > 0) {
return true;
}
}
if (property.equals("C4")) {
if (node.getDefaultValue() != null && node.getDefaultValue().length() > 0) {
return true;
}
}
return false;
}
});
JSONViewer.setColumnProperties(new String[] { "C1", "C2", "C3", "C4" });
CellEditor editor = new TextCellEditor(JSONViewer.getTree());
editor.addListener(new DialogErrorJSONLabelCellEditor(editor, "C1"));
CellEditor editorDefault = new TextCellEditor(JSONViewer.getTree());
editorDefault.addListener(new DialogErrorJSONLabelCellEditor(editorDefault, "C4"));
JSONViewer.setCellEditors(new CellEditor[] { editor, null, null, editorDefault });
JSONViewer.setContentProvider(provider);
// JSONViewer.setInput(treeData);
JSONViewer.expandAll();
createAction();
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
fillContextMenu(manager);
}
});
Menu menu = menuMgr.createContextMenu(JSONViewer.getControl());
JSONViewer.getControl().setMenu(menu);
JSONViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
}
});
initToolBar(composite);
}
use of org.eclipse.swt.widgets.TreeColumn in project cubrid-manager by CUBRID.
the class AddDashboardDialog method createDbTree.
/**
*
* Create table area
*
* @param parent the parent composite
*/
private void createDbTree(Composite parent) {
Label tipLabel = new Label(parent, SWT.LEFT | SWT.WRAP);
tipLabel.setText(Messages.lblDashboardInfo);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
tipLabel.setLayoutData(gridData);
dbTv = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
{
dbTree = dbTv.getTree();
gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 2;
gridData.heightHint = 200;
dbTree.setLayoutData(gridData);
dbTree.setHeaderVisible(true);
dbTree.setLinesVisible(true);
TreeColumn column = new TreeColumn(dbTree, SWT.CENTER);
column.setText(Messages.colIP);
column.setWidth(120);
column = new TreeColumn(dbTree, SWT.CENTER);
column.setText(Messages.colPort);
column.setWidth(50);
column = new TreeColumn(dbTree, SWT.CENTER);
column.setText(Messages.colServerType);
column.setWidth(100);
column = new TreeColumn(dbTree, SWT.CENTER);
column.setText(Messages.colServerStatus);
column.setWidth(100);
column = new TreeColumn(dbTree, SWT.CENTER);
column.setText(Messages.colName);
column.setWidth(150);
column = new TreeColumn(dbTree, SWT.CENTER);
column.setText(Messages.colStatus);
column.setWidth(150);
column = new TreeColumn(dbTree, SWT.CENTER);
column.setText(Messages.colType);
column.setWidth(60);
dbTv.setContentProvider(new DatabaseProvider());
dbTv.setLabelProvider(new DatabaseProvider());
dbTv.setInput(hostNodeList);
dbTree.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
deleteButton.setEnabled(dbTree.getSelectionCount() > 0);
}
});
}
Composite composite = new Composite(parent, SWT.NONE);
RowLayout rowLayout = new RowLayout();
rowLayout.spacing = 5;
composite.setLayout(rowLayout);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalAlignment = GridData.END;
composite.setLayoutData(gridData);
Button addButton = new Button(composite, SWT.NONE);
addButton.setText(Messages.btnAdd);
addButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
StructuredSelection selection = (StructuredSelection) dbTv.getSelection();
HostNode hostNode = null;
int addType = 0;
if (selection != null && !selection.isEmpty()) {
Object obj = selection.getFirstElement();
if (obj instanceof HostNode) {
hostNode = (HostNode) obj;
addType = 0;
} else if (obj instanceof DatabaseNode) {
hostNode = ((DatabaseNode) obj).getParent();
addType = 1;
} else if (obj instanceof BrokerNode) {
hostNode = ((BrokerNode) obj).getParent();
addType = 2;
}
}
AddHostAndDbWizard wizard = new AddHostAndDbWizard(hostNode, hostNodeList, addType);
CMWizardDialog dialog = new CMWizardDialog(getShell(), wizard);
dialog.setPageSize(660, 380);
if (IDialogConstants.OK_ID == dialog.open()) {
List<HostNode> addedHostNodeList = wizard.getAddedHostNodeList();
HAUtil.mergeHostNode(hostNodeList, addedHostNodeList);
dbTv.refresh();
}
deleteButton.setEnabled(dbTree.getSelectionCount() > 0);
verify();
}
});
deleteButton = new Button(composite, SWT.NONE);
deleteButton.setText(Messages.btnDelete);
deleteButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
StructuredSelection selection = (StructuredSelection) dbTv.getSelection();
if (selection != null && !selection.isEmpty()) {
Object[] objs = selection.toArray();
for (int i = 0; i < objs.length; i++) {
Object obj = objs[i];
if (obj instanceof HostNode) {
hostNodeList.remove((HostNode) obj);
} else if (obj instanceof DatabaseNode) {
((DatabaseNode) obj).getParent().getCopyedHaNodeList().remove((DatabaseNode) obj);
} else if (obj instanceof BrokerNode) {
((BrokerNode) obj).getParent().getCopyedHaNodeList().remove((BrokerNode) obj);
}
}
dbTv.refresh();
}
deleteButton.setEnabled(dbTree.getSelectionCount() > 0);
verify();
}
});
deleteButton.setEnabled(false);
}
use of org.eclipse.swt.widgets.TreeColumn in project bndtools by bndtools.
the class BundleTree method createBundleTreeViewer.
private void createBundleTreeViewer(Composite container) {
bundleTreeViewerComposite = new Composite(container, SWT.NONE);
bundleTreeViewerComposite.setLayoutData(createFillGridData());
TreeColumnLayout layout = new TreeColumnLayout();
bundleTreeViewerComposite.setLayout(layout);
bundleTreeViewer = new TreeViewer(bundleTreeViewerComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
bundleTreeViewer.setUseHashlookup(true);
bundleTreeViewer.getTree().setHeaderVisible(true);
TreeViewerColumn treeViewerColumn = new TreeViewerColumn(bundleTreeViewer, SWT.NONE);
TreeColumn treeColumn = treeViewerColumn.getColumn();
layout.setColumnData(treeColumn, new ColumnWeightData(100, 340, true));
treeColumn.setText(Messages.symbNameResources);
treeViewerColumn.setLabelProvider(new TreeLabelProvider());
bundleTreeViewer.setContentProvider(bundleTreeViewerProvider);
bundleTreeViewer.setAutoExpandLevel(3);
}
Aggregations