当前位置: 首页>>代码示例>>Java>>正文


Java Spoon.getInstance方法代码示例

本文整理汇总了Java中org.pentaho.di.ui.spoon.Spoon.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java Spoon.getInstance方法的具体用法?Java Spoon.getInstance怎么用?Java Spoon.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.ui.spoon.Spoon的用法示例。


在下文中一共展示了Spoon.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: editUnitTest

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
protected void editUnitTest(String unitTestName, TransMeta transMeta) {
  try {
    Spoon spoon = Spoon.getInstance();
    MetaStoreFactory<TransUnitTest> setFactory = new MetaStoreFactory<TransUnitTest>(
        TransUnitTest.class, spoon.getMetaStore(), PentahoDefaults.NAMESPACE);
    TransUnitTest unitTest = setFactory.loadElement(unitTestName);
    if (unitTest==null) {
      throw new KettleException(BaseMessages.getString(PKG, "ShowUnitTestMenuExtensionPoint.ErrorEditingUnitTest.Message", unitTestName));
    }
    TransUnitTestDialog dialog = new TransUnitTestDialog(spoon.getShell(), transMeta, spoon.getMetaStore(), unitTest);
    if (dialog.open()) {
      setFactory.saveElement(unitTest);
    }
  } catch(Exception exception) {
    new ErrorDialog(Spoon.getInstance().getShell(), 
        BaseMessages.getString(PKG, "ShowUnitTestMenuExtensionPoint.ErrorEditingUnitTest.Title"),
        BaseMessages.getString(PKG, "ShowUnitTestMenuExtensionPoint.ErrorEditingUnitTest.Message", unitTestName), 
        exception);
  }
}
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:21,代码来源:ShowUnitTestMenuExtensionPoint.java

示例2: runLayout

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public void runLayout( String id ) {

    Spoon spoon = Spoon.getInstance();
    // Either a Job or Transformation is active, both are AbstractGraphs
    EngineMetaInterface meta = spoon.getActiveMeta();

    if ( meta != null ) {
      Point canvasDimensions = LayoutUtils.getGraphDimensions( meta );
      Graph g = GraphUtils.createGraph( meta );
      for ( LayoutProvider provider : providers ) {
        if ( id.equals( provider.getId() ) ) {
          provider.applyLayout( g, canvasDimensions.x, canvasDimensions.y );
          LayoutUtils.applyGraphToMeta( g );

          // Normalize layout so all steps/entries are visible on the canvas
          LayoutUtils.fitToBounds( g );
          return;
        }
      }
    }
  }
 
开发者ID:mattyb149,项目名称:pdi-layout,代码行数:22,代码来源:PdiLayoutManager.java

示例3: addDataSource

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
protected void addDataSource() 
{
  Spoon theSpoon = Spoon.getInstance();
  SpoonDBDelegate theDelegate = new SpoonDBDelegate(theSpoon);
  theDelegate.newConnection(this.databasesInterface);
  
  ArrayList<DatabaseMeta> theDatabases = new ArrayList<DatabaseMeta>();
  theDatabases.addAll(this.databasesInterface.getDatabases());

  String[] theNames = new String[theDatabases.size()];
  for (int i = 0; i < theDatabases.size(); i++) {
    theNames[i] = theDatabases.get(i).getName();
  }
  this.choices = theNames;
  refresh();
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:17,代码来源:EnterSelectionDialog.java

示例4: generateDateTransformation

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
private TransMeta generateDateTransformation(DatabaseMeta databaseMeta, LogicalTable logicalTable) throws KettleException {
  // We actually load the transformation from a template and then slightly modify it.
  //
  String filename = "/org/pentaho/di/resources/Generate date dimension.ktr";
  InputStream inputStream = getClass().getResourceAsStream(filename);
  TransMeta transMeta = new TransMeta(inputStream, Spoon.getInstance().rep, true, new Variables(), null);
  
  // Find the table output step and inject the target table name and database...
  //
  StepMeta stepMeta = transMeta.findStep("TARGET");
  if (stepMeta!=null) {
    TableOutputMeta meta = (TableOutputMeta) stepMeta.getStepMetaInterface();
    meta.setDatabaseMeta(databaseMeta);
    String phTable = ConceptUtil.getString(logicalTable, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);
    meta.setTableName(phTable);
  }
  
  return transMeta;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:20,代码来源:JobGenerator.java

示例5: generateTimeTransformation

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
private TransMeta generateTimeTransformation(DatabaseMeta databaseMeta, LogicalTable logicalTable) throws KettleException {
  // We actually load the transformation from a template and then slightly modify it.
  //
  String filename = "/org/pentaho/di/resources/Generate time dimension.ktr";
  InputStream inputStream = getClass().getResourceAsStream(filename);
  TransMeta transMeta = new TransMeta(inputStream, Spoon.getInstance().rep, true, new Variables(), null);
  
  // Find the table output step and inject the target table name and database...
  //
  StepMeta stepMeta = transMeta.findStep("TARGET");
  if (stepMeta!=null) {
    TableOutputMeta meta = (TableOutputMeta) stepMeta.getStepMetaInterface();
    meta.setDatabaseMeta(databaseMeta);
    String phTable = ConceptUtil.getString(logicalTable, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);
    meta.setTableName(phTable);
  }
  
  return transMeta;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:20,代码来源:JobGenerator.java

示例6: generateSqlJobButton

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
protected void generateSqlJobButton(StarDomain starDomain) {
  final Spoon spoon = Spoon.getInstance();
  
  List<DatabaseMeta> sharedDatabases = SharedDatabaseUtil.loadSharedDatabases(); 
  
  // TODO: validate presence of repository, repository directory
  //
  JobGenerator jobGenerator = new JobGenerator(starDomain, spoon.rep, new RepositoryDirectory(), sharedDatabases, defaultLocale);
  try {
    JobMeta jobMeta = jobGenerator.generateSqlJob();
    spoon.addJobGraph(jobMeta);
    SpoonPerspectiveManager.getInstance().activatePerspective(MainSpoonPerspective.class);
  } catch(Exception e) {
    new ErrorDialog(spoon.getShell(),
        BaseMessages.getString(PKG, "StarModelerPerspective.ErrorGeneratingSqlJob.Title"),
        BaseMessages.getString(PKG, "StarModelerPerspective.ErrorGeneratingSqlJob.Message"), e);
    
  }
    
  
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:22,代码来源:StarModelerPerspective.java

示例7: generateSqlJobButton

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
protected void generateSqlJobButton(StarDomain starDomain) {
  final Spoon spoon = Spoon.getInstance();

  List<DatabaseMeta> sharedDatabases = SharedDatabaseUtil.loadSharedDatabases();

  // TODO: validate presence of repository, repository directory
  //
  JobGenerator jobGenerator = new JobGenerator(starDomain, spoon.rep, new RepositoryDirectory(), sharedDatabases, defaultLocale);
  try {
    JobMeta jobMeta = jobGenerator.generateSqlJob();
    spoon.addJobGraph(jobMeta);
    SpoonPerspectiveManager.getInstance().activatePerspective(MainSpoonPerspective.class);
  } catch(Exception e) {
    new ErrorDialog(spoon.getShell(),
        BaseMessages.getString(PKG, "StarModelerPerspective.ErrorGeneratingSqlJob.Title"),
        BaseMessages.getString(PKG, "StarModelerPerspective.ErrorGeneratingSqlJob.Message"), e);

  }


}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:22,代码来源:StarModelerPerspective.java

示例8: generateDomainJobButton

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
protected void generateDomainJobButton(StarDomain starDomain) {
  final Spoon spoon = Spoon.getInstance();

  List<DatabaseMeta> sharedDatabases = SharedDatabaseUtil.loadSharedDatabases();

  JobGenerator jobGenerator = new JobGenerator(starDomain, spoon.rep, new RepositoryDirectory(), sharedDatabases, defaultLocale);
  try {
    List<TransMeta> transMetas = jobGenerator.generateDimensionTransformations();
    for (TransMeta transMeta : transMetas) {
      spoon.addTransGraph(transMeta);
    }
    SpoonPerspectiveManager.getInstance().activatePerspective(MainSpoonPerspective.class);
  } catch(Exception e) {
    new ErrorDialog(spoon.getShell(),
        BaseMessages.getString(PKG, "StarModelerPerspective.ErrorGeneratingSqlJob.Title"),
        BaseMessages.getString(PKG, "StarModelerPerspective.ErrorGeneratingSqlJob.Message"), e);

  }

}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:21,代码来源:StarModelerPerspective.java

示例9: generateDateTransformation

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
private TransMeta generateDateTransformation(DatabaseMeta databaseMeta, LogicalTable logicalTable) throws KettleException {
  // We actually load the transformation from a template and then slightly modify it.
  //
  String filename = "/org/pentaho/di/resources/Generate date dimension.ktr";
  InputStream inputStream = getClass().getResourceAsStream(filename);
  TransMeta transMeta = new TransMeta(inputStream, Spoon.getInstance().rep, true, new Variables(), null);

  // Find the table output step and inject the target table name and database...
  //
  StepMeta stepMeta = transMeta.findStep("TARGET");
  if (stepMeta!=null) {
    TableOutputMeta meta = (TableOutputMeta) stepMeta.getStepMetaInterface();
    meta.setDatabaseMeta(databaseMeta);
    String phTable = ConceptUtil.getString(logicalTable, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);
    meta.setTableName(phTable);
  }

  return transMeta;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:20,代码来源:JobGenerator.java

示例10: onStart

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public void onStart( LifeEventHandler handler ) throws LifecycleException {

    if ( new File( GoogleDriveFileObject.resolveCredentialsPath() + "/" + resourceBundle.getString( "client.secrets" ) )
        .exists() ) {
      /*
      * Registers the UI for the VFS Browser
      * */
      final Spoon spoon = Spoon.getInstance();
      spoon.getDisplay().asyncExec( new Runnable() {
        public void run() {
          VfsFileChooserDialog dialog = spoon.getVfsFileChooserDialog( null, null );
          GoogleDriveFileChooserDialog
              hadoopVfsFileChooserDialog =
              new GoogleDriveFileChooserDialog( GoogleDriveFileProvider.SCHEME, GoogleDriveFileProvider.DISPLAY_NAME,
                  dialog, SWT.NONE );
          dialog.addVFSUIPanel( hadoopVfsFileChooserDialog );
        }
      } );
    }
  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:21,代码来源:GoogleDriveKettleLifecycleListener.java

示例11: generateTimeTransformation

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
private TransMeta generateTimeTransformation(DatabaseMeta databaseMeta, LogicalTable logicalTable) throws KettleException {
  // We actually load the transformation from a template and then slightly modify it.
  //
  String filename = "/org/pentaho/di/resources/Generate time dimension.ktr";
  InputStream inputStream = getClass().getResourceAsStream(filename);
  TransMeta transMeta = new TransMeta(inputStream, Spoon.getInstance().rep, true, new Variables(), null);

  // Find the table output step and inject the target table name and database...
  //
  StepMeta stepMeta = transMeta.findStep("TARGET");
  if (stepMeta!=null) {
    TableOutputMeta meta = (TableOutputMeta) stepMeta.getStepMetaInterface();
    meta.setDatabaseMeta(databaseMeta);
    String phTable = ConceptUtil.getString(logicalTable, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);
    meta.setTableName(phTable);
  }

  return transMeta;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:20,代码来源:JobGenerator.java

示例12: getCurrentUnitTest

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public TransUnitTest getCurrentUnitTest(TransMeta transMeta) throws MetaStoreException, KettleException {
  // What is the unit test we are using?
  //
  String testName = transMeta.getAttribute( DataSetConst.ATTR_GROUP_DATASET, DataSetConst.ATTR_TRANS_SELECTED_UNIT_TEST_NAME );
  if (Const.isEmpty( testName )) {
    return null;
  }
  Spoon spoon = Spoon.getInstance();
  List<DatabaseMeta> databases = getAvailableDatabases( spoon.getRepository() );
  FactoriesHierarchy hierarchy = new FactoriesHierarchy( spoon.getMetaStore(), databases );
  TransUnitTest unitTest = hierarchy.getTestFactory().loadElement( testName );
  return unitTest;
}
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:14,代码来源:DataSetHelper.java

示例13: refreshSpoon

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
/**
 * Refreshes Spoons plugin registry, core objects and some UI things.
 * 
 * @throws KettleException
 */
private static void refreshSpoon() throws KettleException {
  PluginRegistry.init();
  Spoon spoon = Spoon.getInstance();
  spoon.refreshCoreObjects();
  spoon.refreshTree();
  spoon.refreshGraph();
  spoon.enableMenus();
  GUIResource.getInstance().reload();
  spoon.selectionFilter.setText(spoon.selectionFilter.getText());
}
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:16,代码来源:Market.java

示例14: closeETLTabs

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
/**
 * Close all transformation ETL tabs, possibly saving them in the process.
 * 
 * @param save Flag indicating if the transformation tabs' content should be saved ({@code true}) or discarded ({@code false})
 * @return {@code true} if the operation completed successfully; {@code false} otherwise
 * @throws KettleException Error saving a transformation tab
 */
private boolean closeETLTabs(boolean save) throws KettleException {
  Spoon spoonInstance = Spoon.getInstance();
  int numTabs = spoonInstance.delegates.tabs.getTabs().size();
  for (int i = numTabs - 1; i >= 0; i--) {
    spoonInstance.tabfolder.setSelected(i);
    // Logic copied directly out of SpoonTabsDelegate.tabClose(). That needs to be refactored badly.
    Object control = spoonInstance.tabfolder.getSelected().getControl();
    // Save the changes if we're requested to and the control object is a tab item
    if (control instanceof TransGraph) {
      TransMeta transMeta = ((TransGraph) control).getManagedObject();
      if (!openedFromInstaview(transMeta)) {
        // Don't save or close tabs we didn't open
        continue;
      }
      if (save) {
        TabItemInterface tabItem = (TabItemInterface) control;
        if (!tabItem.applyChanges()) {
          return false;
        }
      }
      spoonInstance.delegates.trans.closeTransformation(transMeta);
      spoonInstance.refreshTree();
    }
    // we don't care about any other ETL tab types
  }
  return true;
}
 
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:35,代码来源:AgileBiInstaPerspective.java

示例15: updateMenu

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public void updateMenu( Document doc ) {
  try {
    Spoon spoon = Spoon.getInstance();

    // If we are working with an Enterprise Repository
    if ( ( spoon != null ) && ( spoon.getRepository() != null ) && ( spoon.getRepository() instanceof PurRepository ) ) {
      ILockService service = getService( spoon.getRepository() );

      EngineMetaInterface meta = spoon.getActiveMeta();

      // If (meta is not null) and (meta is either a Transformation or Job)
      if ( ( meta != null ) && ( meta instanceof ILockable ) ) {

        RepositoryLock repoLock = null;
        if ( service != null && meta.getObjectId() != null ) {
          if ( meta instanceof EEJobMeta ) {
            repoLock = service.getJobLock( meta.getObjectId() );
          } else {
            repoLock = service.getTransformationLock( meta.getObjectId() );
          }
        }
        // If (there is a lock on this item) and (the UserInfo does not have permission to unlock this file)
        if ( repoLock != null ) {
          if ( !service.canUnlockFileById( meta.getObjectId() ) ) {
            // User does not have modify permissions on this file
            ( (XulToolbarbutton) doc.getElementById( "toolbar-file-save" ) ).setDisabled( true ); //$NON-NLS-1$
            ( (XulMenuitem) doc.getElementById( "file-save" ) ).setDisabled( true ); //$NON-NLS-1$  
          }
        }
      }
    }
  } catch ( Exception e ) {
    throw new RuntimeException( e );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:36,代码来源:SpoonMenuLockController.java


注:本文中的org.pentaho.di.ui.spoon.Spoon.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。