use of org.talend.repository.nosql.model.INoSQLSchemaNode in project tbd-studio-se by Talend.
the class AbstractNoSQLRetrieveSchemaForm method retrieving.
private void retrieving(TreeItem item, boolean checked) {
if (item.getItemCount() > 0) {
schemaViewer.expandToLevel(item.getData(), AbstractTreeViewer.ALL_LEVELS);
TreeItem[] childrenItems = item.getItems();
for (TreeItem childItem : childrenItems) {
childItem.setChecked(checked);
retrieving(childItem, checked);
}
} else {
INoSQLSchemaNode node = (INoSQLSchemaNode) item.getData();
if (node != null && node.getSchemaType() == ENoSQLSchemaType.TABLE) {
if (checked) {
addTable(item);
} else {
deleteTable(item);
}
}
}
}
use of org.talend.repository.nosql.model.INoSQLSchemaNode in project tbd-studio-se by Talend.
the class AbstractNoSQLRetrieveSchemaForm method addFieldsListeners.
/*
* (non-Javadoc)
*
* @see org.talend.repository.nosql.ui.common.AbstractNoSQLForm#addFieldsListeners()
*/
@Override
protected void addFieldsListeners() {
filterText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
schemaViewer.refresh();
}
});
schemaTree.addListener(SWT.Expand, new Listener() {
@Override
public void handleEvent(Event event) {
TreeItem treeItem = (TreeItem) event.item;
for (TreeItem item : treeItem.getItems()) {
if (item.getData() != null) {
INoSQLSchemaNode node = (INoSQLSchemaNode) item.getData();
if (node != null && node.getSchemaType() == ENoSQLSchemaType.TABLE) {
if (isExistTable(node, true)) {
item.setChecked(true);
} else {
item.setChecked(false);
}
} else {
item.setGrayed(item.getChecked());
}
}
}
}
});
schemaTree.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (e.detail == SWT.CHECK) {
try {
TreeItem item = (TreeItem) e.item;
boolean checked = item.getChecked();
retrieving(item, checked);
} catch (Exception exception) {
ExceptionHandler.process(exception);
}
boolean pageC = pageComplete();
if (pageC) {
parentWizardPage.setPageComplete(false);
}
}
}
});
}
Aggregations