Java Code Examples for org.pentaho.di.ui.xul.KettleXulLoader#setOuterContext()

The following examples show how to use org.pentaho.di.ui.xul.KettleXulLoader#setOuterContext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileOverwriteDialogController.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public static FileOverwriteDialogController getInstance( Shell shell, List<UIRepositoryObject> objects ) {
  try {
    KettleXulLoader swtLoader = new KettleXulLoader();
    swtLoader.setOuterContext( shell );
    swtLoader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
    XulDomContainer container =
      swtLoader.loadXul(
        "org/pentaho/di/ui/repository/repositoryexplorer/xul/file-overwrite-dialog.xul", resourceBundle );
    final XulRunner runner = new SwtXulRunner();
    runner.addContainer( container );

    FileOverwriteDialogController dialogController = new FileOverwriteDialogController( container, objects );

    container.addEventHandler( dialogController );

    runner.initialize();

    return dialogController;
  } catch ( Exception e ) {
    return null;
  }
}
 
Example 2
Source File: XulPreviewRowsDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void open() {
  try {
    KettleXulLoader theLoader = new KettleXulLoader();
    theLoader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
    theLoader.setOuterContext( this.shell );
    this.container = theLoader.loadXul( XUL );

    this.controller =
      new XulPreviewRowsController( this.shell, this.databaseMeta, this.schema, this.table, this.limit );
    this.container.addEventHandler( this.controller );

    this.runner = new SwtXulRunner();
    this.runner.addContainer( this.container );
    this.runner.initialize();

    XulDialog thePreviewDialog =
      (XulDialog) this.container.getDocumentRoot().getElementById( "previewRowsDialog" );
    thePreviewDialog.show();

  } catch ( Exception e ) {
    logger.info( e );
  }
}
 
Example 3
Source File: XulStepFieldsDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void open( boolean isAcceptButtonHidden ) {
  try {
    KettleXulLoader theLoader = new KettleXulLoader();
    theLoader.setOuterContext( this.shell );
    theLoader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
    this.container = theLoader.loadXul( XUL );

    this.controller =
      new XulStepFieldsController( this.shell, this.databaseMeta, this.schemaTableCombo, this.rowMeta );
    this.controller.setShowAcceptButton( isAcceptButtonHidden );
    this.container.addEventHandler( this.controller );

    this.runner = new SwtXulRunner();
    this.runner.addContainer( this.container );
    this.runner.initialize();

    XulDialog thePreviewDialog =
      (XulDialog) this.container.getDocumentRoot().getElementById( "stepFieldsDialog" );
    thePreviewDialog.show();
    ( (SwtDialog) thePreviewDialog ).dispose();
  } catch ( Exception e ) {
    logger.info( e );
  }
}
 
Example 4
Source File: XulDatabaseExplorerDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
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;
}