本文整理汇总了Java中org.pentaho.di.ui.spoon.Spoon.getShell方法的典型用法代码示例。如果您正苦于以下问题:Java Spoon.getShell方法的具体用法?Java Spoon.getShell怎么用?Java Spoon.getShell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.ui.spoon.Spoon
的用法示例。
在下文中一共展示了Spoon.getShell方法的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);
}
}
示例2: removeDataSetGroup
import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public void removeDataSetGroup() {
Spoon spoon = ( (Spoon) SpoonFactory.getInstance() );
IMetaStore metaStore = spoon.getMetaStore();
MetaStoreFactory<DataSetGroup> groupFactory = new MetaStoreFactory<DataSetGroup>( DataSetGroup.class, metaStore, PentahoDefaults.NAMESPACE );
try {
List<String> groupNames = groupFactory.getElementNames();
Collections.sort( groupNames );
EnterSelectionDialog esd = new EnterSelectionDialog( spoon.getShell(), groupNames.toArray( new String[groupNames.size()] ), "Select the group", "Select the group to edit..." );
String groupName = esd.open();
if ( groupName != null ) {
// TODO: Find the unit tests for this group, if there are any, we can't remove the group
//
groupFactory.deleteElement(groupName);
}
} catch ( Exception e ) {
new ErrorDialog( spoon.getShell(), "Error", "Error retrieving the list of data set groups or deleting a group", e );
}
}
示例3: addDataSet
import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public void addDataSet() {
Spoon spoon = ( (Spoon) SpoonFactory.getInstance() );
IMetaStore metaStore = spoon.getMetaStore();
try {
MetaStoreFactory<DataSetGroup> groupFactory = new MetaStoreFactory<DataSetGroup>( DataSetGroup.class, metaStore, PentahoDefaults.NAMESPACE );
List<DatabaseMeta> databases = getAvailableDatabases( spoon.getRepository() );
groupFactory.addNameList( DataSetConst.DATABASE_LIST_KEY, databases );
List<DataSetGroup> groups = groupFactory.getElements();
MetaStoreFactory<DataSet> setFactory = new MetaStoreFactory<DataSet>( DataSet.class, metaStore, PentahoDefaults.NAMESPACE );
setFactory.addNameList( DataSetConst.GROUP_LIST_KEY, groups );
DataSet dataSet = new DataSet();
editDataSet( spoon, dataSet, groups, setFactory, null );
} catch ( Exception e ) {
new ErrorDialog( spoon.getShell(), "Error", "Error creating a new data set", e );
}
}
示例4: editDataSet
import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
private void editDataSet( Spoon spoon, DataSet dataSet, List<DataSetGroup> groups, MetaStoreFactory<DataSet> setFactory, String setName ) throws MetaStoreException {
try {
DataSetDialog setDialog = new DataSetDialog( spoon.getShell(), setFactory.getMetaStore(), dataSet, groups, getAvailableDatabases(spoon.getRepository()) );
while ( setDialog.open() ) {
String message = validateDataSet( dataSet, setName, setFactory.getElementNames() );
// Save the data set...
//
if ( message == null ) {
setFactory.saveElement( dataSet );
break;
} else {
MessageBox box = new MessageBox( spoon.getShell(), SWT.OK );
box.setText( "Error" );
box.setMessage( message );
box.open();
}
}
} catch(Exception e) {
new ErrorDialog(spoon.getShell(), "Error", "Unable to edit data set", e);
}
}
示例5: checkTestPresent
import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
private boolean checkTestPresent(Spoon spoon, TransMeta transMeta) {
spoon.getLog().logBasic("Check test present...");
String testName = transMeta.getAttribute( DataSetConst.ATTR_GROUP_DATASET, DataSetConst.ATTR_TRANS_SELECTED_UNIT_TEST_NAME );
if (!Const.isEmpty( testName )) {
return false;
}
// there is no test defined of selected in the transformation.
// Show a warning
//
MessageBox box = new MessageBox(spoon.getShell(), SWT.OK | SWT.ICON_INFORMATION );
box.setMessage("Please create a test-case first by left clicking on the test icon.");
box.setText("First create a test-case");
box.open();
return true;
}
示例6: detachUnitTest
import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public void detachUnitTest() {
Spoon spoon = ( (Spoon) SpoonFactory.getInstance() );
try {
TransGraph transGraph = spoon.getActiveTransGraph();
if ( transGraph == null ) {
return;
}
TransMeta transMeta = spoon.getActiveTransformation();
if (transMeta == null ) {
return;
}
transMeta.setAttribute( DataSetConst.ATTR_GROUP_DATASET, DataSetConst.ATTR_TRANS_SELECTED_UNIT_TEST_NAME, null );
transMeta.setChanged();
DataSetConst.clearStepDataSetIndicators( transMeta );
spoon.refreshGraph();
} catch ( Exception e ) {
new ErrorDialog( spoon.getShell(), "Error", "Error detaching unit test", e );
}
}
示例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);
}
}
示例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);
}
}
示例9: quickVisualizeTable
import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public void quickVisualizeTable() {
Spoon spoon = ((Spoon)SpoonFactory.getInstance());
if( spoon.getSelectionObject() instanceof DatabaseMeta ) {
final DatabaseMeta databaseMeta = (DatabaseMeta) spoon.getSelectionObject();
DatabaseExplorerDialog std = new DatabaseExplorerDialog(spoon.getShell(), SWT.NONE, databaseMeta, new ArrayList<DatabaseMeta>());
if (std.open()) {
TableModelerSource source = new TableModelerSource( databaseMeta, std.getTableName(), std.getSchemaName() == null ? "" : std.getSchemaName() ); //$NON-NLS-1$
if( source.getSchemaName() == null ) {
source.setSchemaName(""); //$NON-NLS-1$
}
try{
ModelerWorkspace model = createModelerWorkspace();
ModelerWorkspaceUtil.populateModelFromSource(model, source);
quickVisualize( model );
} catch(Exception e){
logger.error("Error opening visualization", e);
new ErrorDialog(((Spoon) SpoonFactory.getInstance()).getShell(), "Error", "Error executing Quick Visualize", e);
}
}
}
}
示例10: databaseModelItem
import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public void databaseModelItem() {
Spoon spoon = ((Spoon)SpoonFactory.getInstance());
if( spoon.getSelectionObject() instanceof DatabaseMeta ) {
final DatabaseMeta databaseMeta = (DatabaseMeta) spoon.getSelectionObject();
DatabaseExplorerDialog std = new DatabaseExplorerDialog(spoon.getShell(), SWT.NONE, databaseMeta, new ArrayList<DatabaseMeta>());
if (std.open()) {
TableModelerSource source = new TableModelerSource( databaseMeta, std.getTableName(), std.getSchemaName());
try{
ModelerWorkspace model = createModelerWorkspace();
ModelerWorkspaceUtil.populateModelFromSource(model, source);
AgileBiModelerPerspective.getInstance().createTabForModel(model, getUniqueUntitledTabName(spoon, MODELER_NAME));
} catch(Exception e){
logger.error("Error creating model", e);
new ErrorDialog(((Spoon) SpoonFactory.getInstance()).getShell(), "Error", "Error creating Modeler", e);
}
}
}
}
示例11: browse
import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public String browse() {
Spoon spoon = spoonSupplier.get();
CompletableFuture<String> name = new CompletableFuture<>();
Runnable execute = () -> {
DirectoryDialog directoryDialog = new DirectoryDialog( spoonSupplier.get().getShell() );
name.complete( directoryDialog.open() );
};
if ( spoon.getShell() != null ) {
spoon.getShell().getDisplay().asyncExec( execute );
} else {
execute.run();
}
try {
return name.get();
} catch ( Exception e ) {
return "/";
}
}
示例12: connectToRepository
import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public void connectToRepository( RepositoryMeta repositoryMeta, String username, String password ) throws KettleException {
final Repository repository = loadRepositoryObject( repositoryMeta.getId() );
repository.init( repositoryMeta );
repositoryConnect( repository, username, password );
if ( username != null ) {
getPropsUI().setLastRepositoryLogin( username );
}
Spoon spoon = spoonSupplier.get();
Runnable execute = () -> {
if ( spoon.getRepository() != null ) {
spoon.closeRepository();
} else {
spoon.closeAllJobsAndTransformations( true );
}
spoon.setRepository( repository );
setConnectedRepository( repositoryMeta );
fireListeners();
};
if ( spoon.getShell() != null ) {
spoon.getShell().getDisplay().asyncExec( execute );
} else {
execute.run();
}
}
示例13: 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);
}
}
示例14: 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);
}
}
示例15: editDataSetGroup
import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public void editDataSetGroup() {
Spoon spoon = ( (Spoon) SpoonFactory.getInstance() );
IMetaStore metaStore = spoon.getMetaStore();
MetaStoreFactory<DataSetGroup> groupFactory = new MetaStoreFactory<DataSetGroup>( DataSetGroup.class, metaStore, PentahoDefaults.NAMESPACE );
try {
List<String> groupNames = groupFactory.getElementNames();
Collections.sort( groupNames );
EnterSelectionDialog esd = new EnterSelectionDialog( spoon.getShell(), groupNames.toArray( new String[groupNames.size()] ), "Select the group", "Select the group to edit..." );
String groupName = esd.open();
if ( groupName != null ) {
List<DatabaseMeta> databases = getAvailableDatabases( spoon.getRepository() );
groupFactory.addNameList( DataSetConst.DATABASE_LIST_KEY, databases );
DataSetGroup dataSetGroup = groupFactory.loadElement( groupName );
DataSetGroupDialog groupDialog = new DataSetGroupDialog( spoon.getShell(), dataSetGroup, databases );
while ( groupDialog.open() ) {
String message = validateDataSetGroup( dataSetGroup, groupName, groupFactory.getElementNames() );
// Save the group ...
//
if ( message == null ) {
groupFactory.saveElement( dataSetGroup );
break;
} else {
MessageBox box = new MessageBox( spoon.getShell(), SWT.OK );
box.setText( "Error" );
box.setMessage( message );
box.open();
}
}
}
} catch ( Exception e ) {
new ErrorDialog( spoon.getShell(), "Error", "Error retrieving the list of data set groups", e );
}
}