Search in sources :

Example 1 with ISQLBuilderDialog

use of org.talend.sqlbuilder.ui.ISQLBuilderDialog in project tdi-studio-se by Talend.

the class CreateTableCommand method execute.

@Override
public void execute() {
    for (MetadataTable metadataTable : metaTables) {
        if (!tableNames.contains(metadataTable.getSourceName())) {
            Table table = new Table();
            table.setMetadataTable(metadataTable, null);
            table.setErDiagram(erDiagram);
            erDiagram.addTable(table);
            erDiagram.getMetadataTables().add(metadataTable);
        }
    }
    IRunnableWithProgress progress = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            //$NON-NLS-1$
            monitor.beginTask("", IProgressMonitor.UNKNOWN);
            try {
                fks = EMFRepositoryNodeManager.getInstance().getPKFromTables(erDiagram.getMetadataTables(), erDiagram.getErDiagramComposite().getDialog().getSelectedContext());
            } finally {
                monitor.done();
            }
        }
    };
    ISQLBuilderDialog dialog = erDiagram.getErDiagramComposite().getDialog();
    UIUtils.runWithProgress(progress, true, dialog.getProgressMonitor(), dialog.getShell());
    erDiagram.setRelations(fks);
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) Table(org.talend.sqlbuilder.erdiagram.ui.nodes.Table) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) ISQLBuilderDialog(org.talend.sqlbuilder.ui.ISQLBuilderDialog) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Aggregations

IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)1 Table (org.talend.sqlbuilder.erdiagram.ui.nodes.Table)1 ISQLBuilderDialog (org.talend.sqlbuilder.ui.ISQLBuilderDialog)1