public void refresh() { collapse(); this.model.getDatabase().clear(); createDatabaseNodes( this.dbExplorerDialog.getShell() ); if ( this.status != UiPostActionStatus.OK ) { // something goes dramatically wrong! return; } fireBindings(); }
private String getSchemaAndTable( XulDatabaseExplorerModel model ) { return getSchemaAndTable( model, model.getDatabaseMeta() ); }
public boolean open() { try { KettleXulLoader theLoader = new KettleXulLoader(); theLoader.setSettingsManager( XulSpoonSettingsManager.getInstance() ); theLoader.setSettingsManager( new DefaultSettingsManager( new File( Const.getKettleDirectory() + Const.FILE_SEPARATOR + "xulSettings.properties" ) ) ); theLoader.setOuterContext( this.shell ); this.container = theLoader.loadXul( XUL, new XulDatabaseExplorerResourceBundle() ); XulDialog theExplorerDialog = (XulDialog) this.container.getDocumentRoot().getElementById( "databaseExplorerDialog" ); SpoonPluginManager.getInstance().applyPluginsForContainer( "database_dialog", container ); this.controller = new XulDatabaseExplorerController( this.shell, this.databaseMeta, this.databases, look ); this.container.addEventHandler( this.controller ); this.runner = new SwtXulRunner(); this.runner.addContainer( this.container ); this.runner.initialize(); this.controller.setSelectedSchemaAndTable( schemaName, selectedTable ); // show dialog if connection is success only. if ( controller.getActionStatus() == UiPostActionStatus.OK ) { theExplorerDialog.show(); } } catch ( Exception e ) { LogChannel.GENERAL.logError( "Error exploring database", e ); } return this.controller.getSelectedTable() != null; }
public void viewSql() { if ( this.model.getTable() == null ) { return; } SQLEditor theSqlEditor = new SQLEditor( this.getDatabaseMeta(), this.dbExplorerDialog.getShell(), SWT.NONE, this.model .getDatabaseMeta(), this.dbcache, "SELECT * FROM " + getSchemaAndTable( this.model ) ); theSqlEditor.open(); }
createDatabaseNodes( shell ); if ( this.status != UiPostActionStatus.OK ) { this.databaseTree, "selectedItem", "buttonMenuPopUpImg", "disabled", isDisabledConvertor ); this.bf.createBinding( this.databaseTree, "selectedItem", "action_popup", "disabled", isDisabledConvertor ); fireBindings();
public String getTableName() { return ( this.controller != null ) ? this.controller.getSelectedTable() : selectedTable; }
public String getSchemaName() { return ( this.controller != null ) ? this.controller.getSelectedSchema() : schemaName; }
public void truncate() { if ( this.model.getTable() == null ) { return; } DatabaseMeta dm = this.model.getDatabaseMeta(); String message = dm.getTruncateTableStatement( this.model.getSchema(), this.model.getTable() ); if ( message == null ) { message = "Truncating tables is not supported by " + dm.getDatabaseInterface().getPluginName(); } SQLEditor theSqlEditor = new SQLEditor( this.getDatabaseMeta(), this.dbExplorerDialog.getShell(), SWT.NONE, dm, this.dbcache, "-- " + message ); theSqlEditor.open(); }
public void getDDL() { if ( model.getTable() == null ) { return; } Database db = new Database( null, this.model.getDatabaseMeta() ); try { db.connect(); String tableName = getSchemaAndTable( this.model ); RowMetaInterface r = db.getTableFields( tableName ); String sql = db.getCreateTableStatement( tableName, r, null, false, null, true ); SQLEditor se = new SQLEditor( this.getDatabaseMeta(), this.dbExplorerDialog.getShell(), SWT.NONE, this.model .getDatabaseMeta(), this.dbcache, sql ); se.open(); } catch ( KettleDatabaseException dbe ) { new ErrorDialog( this.dbExplorerDialog.getShell(), BaseMessages.getString( PKG, "Dialog.Error.Header" ), BaseMessages .getString( PKG, "DatabaseExplorerDialog.Error.RetrieveLayout" ), dbe ); } finally { db.disconnect(); } }
private void fireBindings() { try { this.databaseTreeBinding.fireSourceChanged(); if ( this.getSelectedTable() != null ) { this.selectedTableBinding.fireSourceChanged(); } // if (this.getSelectedSchema() != null) { // this.selectedSchemaBinding.fireSourceChanged(); // } } catch ( Exception e ) { LogChannel.GENERAL.logError( "Error firing bindings in database explorer", e ); } }
try { targetdb.connect(); String tableName = getSchemaAndTable( model ); RowMetaInterface r = targetdb.getTableFields( tableName ); new SQLEditor( this.getDatabaseMeta(), this.dbExplorerDialog.getShell(), SWT.NONE, this.model .getDatabaseMeta(), this.dbcache, sql ); se.open();
try { TransProfileFactory profileFactory = new TransProfileFactory( this.model.getDatabaseMeta(), getSchemaAndTable( this.model ) ); TransMeta transMeta = profileFactory.generateTransformation( new LoggingObject( model.getTable() ) ); TransPreviewProgressDialog progressDialog =