use of org.knime.workbench.ui.navigator.actions.selection.TreeSelectionControl.TreeSelectionChangeListener in project knime-core by knime.
the class ResourceSelectDialog method createDialogArea.
@Override
protected Control createDialogArea(final Composite parent) {
TreeSelectionControl tree = new TreeSelectionControl();
tree.setContentProvider(new KnimeResourceContentProviderWithRoot());
tree.setLabelProvider(new KnimeResourceLabelProviderWithRoot());
tree.setInitialSelection(m_initialSelection);
tree.setInput(m_root);
tree.setMessage(m_message);
tree.setValidator(new ISelectionValidator() {
public String isValid(final Object selection) {
if (m_validator != null) {
String result = m_validator.isValid(selection);
Button b = getButton(IDialogConstants.OK_ID);
// store it in case button is not created yet
m_valid = result == null;
if (b != null) {
b.setEnabled(m_valid);
}
return result;
}
return null;
}
});
tree.setChangeListener(new TreeSelectionChangeListener() {
public void treeSelectionChanged(final Object newSelection, final boolean valid) {
m_selectedContainer = findSelectedContainer(newSelection);
}
});
return tree.createTreeControl(parent);
}
Aggregations