Search in sources :

Example 16 with INoSQLSchemaNode

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);
            }
        }
    }
}
Also used : INoSQLSchemaNode(org.talend.repository.nosql.model.INoSQLSchemaNode) TreeItem(org.eclipse.swt.widgets.TreeItem)

Example 17 with INoSQLSchemaNode

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);
                }
            }
        }
    });
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) INoSQLSchemaNode(org.talend.repository.nosql.model.INoSQLSchemaNode) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) TreeItem(org.eclipse.swt.widgets.TreeItem) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) NoSQLExtractSchemaException(org.talend.repository.nosql.exceptions.NoSQLExtractSchemaException)

Aggregations

INoSQLSchemaNode (org.talend.repository.nosql.model.INoSQLSchemaNode)17 ArrayList (java.util.ArrayList)6 NoSQLExtractSchemaException (org.talend.repository.nosql.exceptions.NoSQLExtractSchemaException)6 TreeItem (org.eclipse.swt.widgets.TreeItem)5 NoSQLSchemaNode (org.talend.repository.nosql.model.NoSQLSchemaNode)5 NoSQLServerException (org.talend.repository.nosql.exceptions.NoSQLServerException)4 ENoSQLSchemaType (org.talend.repository.nosql.model.ENoSQLSchemaType)3 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)2 ContextType (org.talend.designer.core.model.utils.emf.talendfile.ContextType)2 RetrieveColumnRunnable (org.talend.repository.nosql.ui.thread.RetrieveColumnRunnable)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 TreeColumnLayout (org.eclipse.jface.layout.TreeColumnLayout)1 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1