Search in sources :

Example 1 with NoSQLSelectorTreeViewerProvider

use of org.talend.repository.nosql.ui.provider.NoSQLSelectorTreeViewerProvider in project tbd-studio-se by Talend.

the class AbstractNoSQLRetrieveSchemaForm method addSchemaFields.

protected void addSchemaFields(Composite parent) {
    // $NON-NLS-1$
    Group schemaGroup = Form.createGroup(parent, 1, Messages.getString("AbstractNoSQLRetrieveSchemaForm.schemaGroup"));
    Composite filterComposite = new Composite(schemaGroup, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    filterComposite.setLayout(gridLayout);
    GridData filterCompGridData = new GridData(GridData.FILL_HORIZONTAL);
    filterComposite.setLayoutData(filterCompGridData);
    // $NON-NLS-1$
    filterText = new LabelledText(filterComposite, Messages.getString("AbstractNoSQLRetrieveSchemaForm.nameFilter"), 1);
    ScrolledComposite scrolledComposite = new ScrolledComposite(schemaGroup, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NONE);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    schemaViewer = new ContainerCheckedTreeViewer(scrolledComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION) {

        @Override
        protected void doCheckStateChanged(Object element) {
            super.doCheckStateChanged(element);
            performCheckStateChanged((INoSQLSchemaNode) element);
        }
    };
    schemaViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
    schemaViewer.setUseHashlookup(true);
    schemaViewer.addFilter(new SchemaViewerFilter());
    schemaTree = schemaViewer.getTree();
    schemaTree.setHeaderVisible(true);
    schemaTree.setLinesVisible(true);
    scrolledComposite.setContent(schemaTree);
    scrolledComposite.setMinSize(schemaTree.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    TreeColumnLayout tcLayout = new TreeColumnLayout();
    scrolledComposite.setLayout(tcLayout);
    TreeColumn column1 = new TreeColumn(schemaTree, SWT.LEFT);
    // $NON-NLS-1$
    column1.setText(Messages.getString("AbstractNoSQLRetrieveSchemaForm.name"));
    column1.setWidth(300);
    column1.setResizable(true);
    tcLayout.setColumnData(column1, new ColumnWeightData(40, 150));
    TreeColumn column2 = new TreeColumn(schemaTree, SWT.LEFT);
    // $NON-NLS-1$
    column2.setText(Messages.getString("AbstractNoSQLRetrieveSchemaForm.type"));
    column2.setWidth(150);
    column2.setResizable(true);
    tcLayout.setColumnData(column2, new ColumnWeightData(25, 100));
    TreeColumn column3 = new TreeColumn(schemaTree, SWT.LEFT);
    // $NON-NLS-1$
    column3.setText(Messages.getString("AbstractNoSQLRetrieveSchemaForm.colNum"));
    column3.setWidth(130);
    column3.setResizable(true);
    tcLayout.setColumnData(column3, new ColumnWeightData(20, 50));
    TreeColumn column4 = new TreeColumn(schemaTree, SWT.LEFT);
    // $NON-NLS-1$
    column4.setText(Messages.getString("AbstractNoSQLRetrieveSchemaForm.creationStauts"));
    column4.setWidth(120);
    column4.setResizable(true);
    tcLayout.setColumnData(column4, new ColumnWeightData(15, 70));
    try {
        List<INoSQLSchemaNode> nodes = wizardPageProvider.createSchemaNodes(getConnection());
        NoSQLSelectorTreeViewerProvider viewProvider = new NoSQLSelectorTreeViewerProvider();
        schemaViewer.setContentProvider(viewProvider);
        schemaViewer.setLabelProvider(viewProvider);
        schemaViewer.setInput(nodes);
    } catch (NoSQLExtractSchemaException e) {
        ExceptionHandler.process(e);
    }
}
Also used : LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) NoSQLSelectorTreeViewerProvider(org.talend.repository.nosql.ui.provider.NoSQLSelectorTreeViewerProvider) Group(org.eclipse.swt.widgets.Group) INoSQLSchemaNode(org.talend.repository.nosql.model.INoSQLSchemaNode) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) TreeColumnLayout(org.eclipse.jface.layout.TreeColumnLayout) GridLayout(org.eclipse.swt.layout.GridLayout) TreeColumn(org.eclipse.swt.widgets.TreeColumn) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ContainerCheckedTreeViewer(org.eclipse.ui.dialogs.ContainerCheckedTreeViewer) NoSQLExtractSchemaException(org.talend.repository.nosql.exceptions.NoSQLExtractSchemaException)

Aggregations

TreeColumnLayout (org.eclipse.jface.layout.TreeColumnLayout)1 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Group (org.eclipse.swt.widgets.Group)1 TreeColumn (org.eclipse.swt.widgets.TreeColumn)1 ContainerCheckedTreeViewer (org.eclipse.ui.dialogs.ContainerCheckedTreeViewer)1 LabelledText (org.talend.commons.ui.swt.formtools.LabelledText)1 NoSQLExtractSchemaException (org.talend.repository.nosql.exceptions.NoSQLExtractSchemaException)1 INoSQLSchemaNode (org.talend.repository.nosql.model.INoSQLSchemaNode)1 NoSQLSelectorTreeViewerProvider (org.talend.repository.nosql.ui.provider.NoSQLSelectorTreeViewerProvider)1