use of org.eclipse.jface.viewers.TreeViewer in project tdi-studio-se by Talend.
the class ConfigureChartDialog method createAttributesViewer.
/**
* Creates the attributes viewer.
*
* @param parent The parent composite
* @return The attribute viewer
*/
private TreeViewer createAttributesViewer(Composite parent) {
TreeViewer viewer = new TreeViewer(parent, SWT.BORDER | SWT.FULL_SELECTION);
viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
viewer.setContentProvider(new MBeanAttributeContentProvider());
viewer.setLabelProvider(new MBeanAttributeLabelProvider(viewer));
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
viewerSlectionChanged((IStructuredSelection) event.getSelection());
}
});
configureTree(viewer.getTree());
viewer.setInput(attributes.toArray(new MBeanAttribute[attributes.size()]));
return viewer;
}
use of org.eclipse.jface.viewers.TreeViewer in project tdi-studio-se by Talend.
the class SWTResourcesPage method createSashFormControls.
/*
* @see AbstractSashForm#createSashFormControls(SashForm, IActionBars)
*/
@Override
protected void createSashFormControls(SashForm sashForm, IActionBars actionBars) {
resourceFilteredTree = new SWTResourceFilteredTree(sashForm, actionBars);
TreeViewer resourceViewer = resourceFilteredTree.getViewer();
resourceViewer.setContentProvider(new SWTResourceContentProvider(resourceViewer));
resourceViewer.setLabelProvider(new SWTResourceLabelProvider());
resourceViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
if (selection.isEmpty()) {
selection = null;
}
stackTraceViewer.setInput(selection);
}
});
stackTraceViewer = new StackTraceViewer(sashForm, actionBars);
}
use of org.eclipse.jface.viewers.TreeViewer in project tdi-studio-se by Talend.
the class AllTypeDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite createDialogArea = (Composite) super.createDialogArea(parent);
createDialogArea.setLayout(new FillLayout());
SashForm baseCom = new SashForm(createDialogArea, SWT.VERTICAL | SWT.BORDER);
baseCom.setLayout(new GridLayout(1, true));
Group group1 = new Group(baseCom, SWT.None);
group1.setText(Messages.getString("AllTypeDialog.Group1Text"));
group1.setLayoutData(new GridData(GridData.FILL_BOTH));
group1.setLayout(new FillLayout());
Font font = new Font(Display.getCurrent(), "Arial", 43, 3);
group1.setFont(font);
font.dispose();
Group group2 = new Group(baseCom, SWT.None);
group2.setText(Messages.getString("AllTypeDialog.Group2Text"));
group2.setLayoutData(new GridData(GridData.FILL_BOTH));
font = new Font(Display.getCurrent(), "Arial", 43, 3);
group2.setFont(font);
group2.setLayout(new FillLayout());
font.dispose();
list = new List(group1, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
list.setItems(allXMLSchemaTypeName);
treeViewer = new TreeViewer(group2, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
tree = treeViewer.getTree();
tree.setHeaderVisible(false);
tree.setLinesVisible(true);
treeViewer.setContentProvider(new WebServiceTreeContentProvider());
treeViewer.setLabelProvider(new AllTypeLabelProvider());
treeViewer.setInput(null);
treeViewer.refresh();
list.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String selection = list.getSelection()[0];
if (selection.contains(COMPLEXTYPE)) {
String[] split = selection.split(":");
String complexTypeName = split[1];
for (XmlSchemaType xmlSchemaType : allXmlSchemaType) {
if (xmlSchemaType.getName().equals(complexTypeName)) {
ParameterInfo parameterRoot = new ParameterInfo();
parameterRoot.setName("parameters");
ParameterInfo parameterSon = new ParameterInfo();
parameterSon.setName(complexTypeName);
parameterSon.setParent(parameterRoot);
parameterRoot.getParameterInfos().add(parameterSon);
XmlSchemaComplexType xmlElementComplexType = (XmlSchemaComplexType) xmlSchemaType;
XmlSchemaParticle xmlSchemaParticle = xmlElementComplexType.getParticle();
if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
XmlSchemaObjectCollection childCollection = xmlSchemaGroupBase.getItems();
if (childCollection != null) {
buildParameterFromCollection(childCollection, parameterSon);
}
}
treeViewer.setInput(parameterRoot);
treeViewer.refresh();
selectedParaInfo = parameterSon;
}
}
} else {
treeViewer.setInput(null);
treeViewer.refresh();
selectedParaInfo = null;
}
}
});
return baseCom;
}
use of org.eclipse.jface.viewers.TreeViewer in project tdi-studio-se by Talend.
the class DB2ExplainPlanExecution method displayResults.
private void displayResults(final ExplainNode node) {
Display.getDefault().asyncExec(new Runnable() {
@Override
@SuppressWarnings("deprecation")
public void run() {
clearCanvas();
GridLayout gLayout = new GridLayout();
gLayout.numColumns = 2;
gLayout.marginLeft = 0;
gLayout.horizontalSpacing = 0;
gLayout.verticalSpacing = 0;
gLayout.marginWidth = 0;
gLayout.marginHeight = 0;
composite.setLayout(gLayout);
try {
//$NON-NLS-1$
composite.setData("parenttab", parentTab);
Composite pp = new Composite(composite, SWT.NULL);
pp.setLayout(new FillLayout());
pp.setLayoutData(new GridData(GridData.FILL_BOTH));
TreeViewer tv = new TreeViewer(pp, SWT.BORDER | SWT.FULL_SELECTION);
Tree tree = tv.getTree();
tree.setLinesVisible(true);
tree.setHeaderVisible(true);
TreeColumn tc = new TreeColumn(tree, SWT.NULL);
//$NON-NLS-1$
tc.setText("");
tc = new TreeColumn(tree, SWT.NULL);
//$NON-NLS-1$
tc.setText(Messages.getString("DB2ExplainPlanExecution.tableColumnText1"));
tc = new TreeColumn(tree, SWT.NULL);
//$NON-NLS-1$
tc.setText(Messages.getString("DB2ExplainPlanExecution.tableColumnText2"));
TableLayout tableLayout = new TableLayout();
tableLayout.addColumnData(new ColumnWeightData(6, 150, true));
tableLayout.addColumnData(new ColumnWeightData(1, 50, true));
tableLayout.addColumnData(new ColumnWeightData(1, 50, true));
tree.setLayout(tableLayout);
tv.setContentProvider(new ITreeContentProvider() {
@Override
public void dispose() {
}
@Override
public Object[] getChildren(Object parentElement) {
return ((ExplainNode) parentElement).getChildren();
}
@Override
public Object[] getElements(Object inputElement) {
ExplainNode nd = ((ExplainNode) inputElement);
return nd.getChildren();
}
@Override
public Object getParent(Object element) {
return ((ExplainNode) element).getParent();
}
@Override
public boolean hasChildren(Object element) {
if (((ExplainNode) element).getChildren().length > 0) {
return true;
}
return false;
}
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
});
tv.setLabelProvider(new TreeLabelProvider() {
});
tv.setInput(node);
tv.refresh();
tv.expandAll();
// make columns full size
for (int i = 0; i < tree.getColumnCount(); i++) {
tree.getColumn(i).pack();
}
final Composite parent = composite;
tree.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
switch(e.keyCode) {
case SWT.F5:
// refresh SQL Results
try {
//$NON-NLS-1$
Object o = parent.getData("parenttab");
if (o != null) {
AbstractSQLExecution sqlExec = (AbstractSQLExecution) ((TabItem) o).getData();
if (sqlExec != null) {
sqlExec.startExecution();
}
}
} catch (Exception e1) {
//$NON-NLS-1$
SqlBuilderPlugin.log(Messages.getString("DB2ExplainPlanExecution.logMessageError1"), e1);
}
break;
default:
return;
}
}
});
} catch (Exception e) {
// add message
String message = e.getMessage();
Label errorLabel = new Label(composite, SWT.FILL);
errorLabel.setText(message);
errorLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
//$NON-NLS-1$
SqlBuilderPlugin.log(Messages.getString("DB2ExplainPlanExecution.logMessageError2"), e);
}
composite.layout();
composite.redraw();
}
;
});
}
use of org.eclipse.jface.viewers.TreeViewer in project tdi-studio-se by Talend.
the class OracleExplainPlanExecution method displayResults.
private void displayResults(final ExplainNode node) {
Display.getDefault().asyncExec(new Runnable() {
@Override
@SuppressWarnings("deprecation")
public void run() {
clearCanvas();
GridLayout gLayout = new GridLayout();
gLayout.numColumns = 2;
gLayout.marginLeft = 0;
gLayout.horizontalSpacing = 0;
gLayout.verticalSpacing = 0;
gLayout.marginWidth = 0;
gLayout.marginHeight = 0;
composite.setLayout(gLayout);
try {
//$NON-NLS-1$
composite.setData("parenttab", parentTab);
Composite pp = new Composite(composite, SWT.NULL);
pp.setLayout(new FillLayout());
pp.setLayoutData(new GridData(GridData.FILL_BOTH));
TreeViewer tv = new TreeViewer(pp, SWT.BORDER | SWT.FULL_SELECTION);
Tree tree = tv.getTree();
tree.setLinesVisible(true);
tree.setHeaderVisible(true);
TreeColumn tc = new TreeColumn(tree, SWT.NULL);
//$NON-NLS-1$
tc.setText("");
tc = new TreeColumn(tree, SWT.NULL);
//$NON-NLS-1$
tc.setText(Messages.getString("OracleExplainPlanExecution.tableColumnText1"));
tc = new TreeColumn(tree, SWT.NULL);
//$NON-NLS-1$
tc.setText(Messages.getString("OracleExplainPlanExecution.tableColumnText2"));
TableLayout tableLayout = new TableLayout();
tableLayout.addColumnData(new ColumnWeightData(6, 150, true));
tableLayout.addColumnData(new ColumnWeightData(1, 50, true));
tableLayout.addColumnData(new ColumnWeightData(1, 50, true));
tree.setLayout(tableLayout);
tv.setContentProvider(new ITreeContentProvider() {
@Override
public void dispose() {
}
@Override
public Object[] getChildren(Object parentElement) {
return ((ExplainNode) parentElement).getChildren();
}
@Override
public Object[] getElements(Object inputElement) {
ExplainNode nd = ((ExplainNode) inputElement);
return nd.getChildren();
}
@Override
public Object getParent(Object element) {
return ((ExplainNode) element).getParent();
}
@Override
public boolean hasChildren(Object element) {
if (((ExplainNode) element).getChildren().length > 0) {
return true;
}
return false;
}
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
});
tv.setLabelProvider(new TreeLabelProvider() {
});
tv.setInput(node);
tv.refresh();
tv.expandAll();
// make columns full size
for (int i = 0; i < tree.getColumnCount(); i++) {
tree.getColumn(i).pack();
}
final Composite parent = composite;
tree.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
switch(e.keyCode) {
case SWT.F5:
// refresh SQL Results
try {
//$NON-NLS-1$
Object o = parent.getData("parenttab");
if (o != null) {
AbstractSQLExecution sqlExec = (AbstractSQLExecution) ((TabItem) o).getData();
if (sqlExec != null) {
sqlExec.startExecution();
}
}
} catch (Exception e1) {
//$NON-NLS-1$
SqlBuilderPlugin.log(Messages.getString("OracleExplainPlanExecution.logMessage1"), e1);
}
break;
default:
return;
}
}
});
} catch (Exception e) {
// add message
String message = e.getMessage();
Label errorLabel = new Label(composite, SWT.FILL);
errorLabel.setText(message);
errorLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
//$NON-NLS-1$
SqlBuilderPlugin.log(Messages.getString("OracleExplainPlanExecution.logMessage2"), e);
}
composite.layout();
composite.redraw();
}
;
});
}
Aggregations