Search in sources :

Example 1 with RetrieveColumnRunnable

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

the class AbstractNoSQLRetrieveSchemaForm method addTable.

private void addTable(TreeItem item) {
    INoSQLSchemaNode node = (INoSQLSchemaNode) item.getData();
    if (isExistTable(node, false)) {
        MetadataTable table = getTable(node, false);
        orgomg.cwm.objectmodel.core.Package pack = (orgomg.cwm.objectmodel.core.Package) table.eContainer();
        boolean confirm = MessageDialog.openConfirm(Display.getDefault().getActiveShell(), // $NON-NLS-1$
        Messages.getString("AbstractNoSQLRetrieveSchemaForm.confirm"), // $NON-NLS-1$
        Messages.getString("AbstractNoSQLRetrieveSchemaForm.ConfirmMessage", pack.getName()));
        if (confirm) {
            TreeItem existItem = getExistItem(table);
            if (existItem != null) {
                existItem.setChecked(false);
                deleteTable(existItem);
            }
        } else {
            item.setChecked(false);
            return;
        }
    }
    if (!retrieveSchemaExecutor.isThreadRunning(node) && node.getSchemaType() == ENoSQLSchemaType.TABLE) {
        RetrieveColumnRunnable runnable = new RetrieveColumnRunnable(metadataProvider, getConnection(), node, hitTablesMap) {

            @Override
            protected void refresh(INoSQLSchemaNode schemaNode) {
                refreshTable(schemaNode);
            }
        };
        retrieveSchemaExecutor.execute(runnable);
    }
}
Also used : INoSQLSchemaNode(org.talend.repository.nosql.model.INoSQLSchemaNode) TreeItem(org.eclipse.swt.widgets.TreeItem) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) RetrieveColumnRunnable(org.talend.repository.nosql.ui.thread.RetrieveColumnRunnable)

Example 2 with RetrieveColumnRunnable

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

the class AbstractNoSQLRetrieveSchemaForm method deleteTable.

private void deleteTable(TreeItem item) {
    INoSQLSchemaNode node = (INoSQLSchemaNode) item.getData();
    if (node != null && node.getSchemaType() == ENoSQLSchemaType.TABLE) {
        String tableName = MetadataToolHelper.validateTableName(node.getName());
        NoSQLSchemaUtil.removeTableFromConnection(getConnection(), tableName, NoSQLRepositoryUtil.getDBName(node));
        hitTablesMap.remove(tableName);
        clearItemStatus(node);
        RetrieveColumnRunnable runnable = retrieveSchemaExecutor.getRunnable(node);
        if (runnable != null) {
            runnable.setCanceled(true);
        }
        schemaViewer.refresh(node);
    }
}
Also used : INoSQLSchemaNode(org.talend.repository.nosql.model.INoSQLSchemaNode) RetrieveColumnRunnable(org.talend.repository.nosql.ui.thread.RetrieveColumnRunnable)

Aggregations

INoSQLSchemaNode (org.talend.repository.nosql.model.INoSQLSchemaNode)2 RetrieveColumnRunnable (org.talend.repository.nosql.ui.thread.RetrieveColumnRunnable)2 TreeItem (org.eclipse.swt.widgets.TreeItem)1 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)1