本文整理汇总了Java中org.pentaho.di.ui.spoon.Spoon类的典型用法代码示例。如果您正苦于以下问题:Java Spoon类的具体用法?Java Spoon怎么用?Java Spoon使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Spoon类属于org.pentaho.di.ui.spoon包,在下文中一共展示了Spoon类的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: deleteUnitTest
import org.pentaho.di.ui.spoon.Spoon; //导入依赖的package包/类
protected void deleteUnitTest(String unitTestName) {
MessageBox box = new MessageBox(Spoon.getInstance().getShell(), SWT.YES | SWT.NO);
box.setText(BaseMessages.getString(PKG, "ShowUnitTestMenuExtensionPoint.YouSureToDelete.Title"));
box.setMessage(BaseMessages.getString(PKG, "ShowUnitTestMenuExtensionPoint.YouSureToDelete.Message", unitTestName));
int answer = box.open();
if ((answer&SWT.YES)!=0) {
try {
MetaStoreFactory<TransUnitTest> factory = new MetaStoreFactory<TransUnitTest>(TransUnitTest.class, Spoon.getInstance().getMetaStore(), PentahoDefaults.NAMESPACE);
factory.deleteElement(unitTestName);
DataSetHelper.getInstance().detachUnitTest();
} catch(Exception exception) {
new ErrorDialog(Spoon.getInstance().getShell(),
BaseMessages.getString(PKG, "ShowUnitTestMenuExtensionPoint.ErrorDeletingUnitTest.Title"),
BaseMessages.getString(PKG, "ShowUnitTestMenuExtensionPoint.ErrorDeletingUnitTest.Message", unitTestName),
exception);
}
}
}
示例3: 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 );
}
}
示例4: 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 );
}
}
示例5: 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);
}
}
示例6: 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;
}
示例7: 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 );
}
}
示例8: 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;
}
}
}
}
示例9: stopJob
import org.pentaho.di.ui.spoon.Spoon; //导入依赖的package包/类
public synchronized void stopJob() {
try {
if (job != null && running && job.isInitialized()) {
job.stopAll();
job.endProcessing("stop", new Result()); //$NON-NLS-1$
job.waitUntilFinished(5000); // wait until everything is stopped, maximum 5 seconds...
job = null;
running = false;
log.logMinimal(Spoon.APP_NAME, Messages.getString("JobLog.Log.JobWasStopped")); //$NON-NLS-1$
}
} catch (KettleJobException je) {
MessageBox m = new MessageBox(shell, SWT.OK | SWT.ICON_WARNING);
m.setText(Messages.getString("JobLog.Dialog.UnableToSaveStopLineInLoggingTable.Title")); //$NON-NLS-1$
m
.setMessage(Messages.getString("JobLog.Dialog.UnableToSaveStopLineInLoggingTable.Message") + Const.CR + je.toString()); //$NON-NLS-1$
m.open();
} finally {
setControlStates();
}
}
示例10: copyJobEntries
import org.pentaho.di.ui.spoon.Spoon; //导入依赖的package包/类
public void copyJobEntries(JobMeta jobMeta, JobEntryCopy jec[])
{
if (jec == null || jec.length == 0)
return;
String xml = XMLHandler.getXMLHeader();
xml += XMLHandler.openTag(Spoon.XML_TAG_JOB_JOB_ENTRIES) + Const.CR; //$NON-NLS-1$
for (int i = 0; i < jec.length; i++)
{
if (jec[i]==null)
continue;
xml += jec[i].getXML();
}
xml += " " + XMLHandler.closeTag(Spoon.XML_TAG_JOB_JOB_ENTRIES) + Const.CR; //$NON-NLS-1$
spoon.toClipboard(xml);
}
示例11: isDefaultJobName
import org.pentaho.di.ui.spoon.Spoon; //导入依赖的package包/类
public boolean isDefaultJobName(String name)
{
if (!name.startsWith(Spoon.STRING_JOB))
return false;
// see if there are only digits behind the job...
// This will detect:
// "Job"
// "Job "
// "Job 1"
// "Job 2"
// ...
for (int i = Spoon.STRING_JOB.length() + 1; i < name.length(); i++)
{
if (!Character.isDigit(name.charAt(i)))
return false;
}
return true;
}
示例12: isDefaultTransformationName
import org.pentaho.di.ui.spoon.Spoon; //导入依赖的package包/类
public boolean isDefaultTransformationName(String name)
{
if (!name.startsWith(Spoon.STRING_TRANSFORMATION))
return false;
// see if there are only digits behind the transformation...
// This will detect:
// "Transformation"
// "Transformation "
// "Transformation 1"
// "Transformation 2"
// ...
for (int i = Spoon.STRING_TRANSFORMATION.length() + 1; i < name.length(); i++)
{
if (!Character.isDigit(name.charAt(i)))
return false;
}
return true;
}
示例13: stop
import org.pentaho.di.ui.spoon.Spoon; //导入依赖的package包/类
public void stop() {
if (running && !halting) {
halting = true;
trans.stopAll();
try {
trans.endProcessing("stop"); //$NON-NLS-1$
log.logMinimal(Spoon.APP_NAME, Messages.getString("TransLog.Log.ProcessingOfTransformationStopped")); //$NON-NLS-1$
} catch (KettleException e) {
new ErrorDialog(
shell,
Messages.getString("TransLog.Dialog.ErrorWritingLogRecord.Title"), Messages.getString("TransLog.Dialog.ErrorWritingLogRecord.Message"), e); //$NON-NLS-1$ //$NON-NLS-2$
}
running = false;
initialized = false;
halted = false;
halting = false;
setControlStates();
transMeta.setInternalKettleVariables(); // set the original vars back as they may be changed by a mapping
}
}
示例14: addToolBar
import org.pentaho.di.ui.spoon.Spoon; //导入依赖的package包/类
private void addToolBar() {
try {
XulLoader loader = new SwtXulLoader();
loader.setSettingsManager(XulSpoonSettingsManager.getInstance());
ResourceBundle bundle = new XulSpoonResourceBundle(Spoon.class);
XulDomContainer xulDomContainer = loader.loadXul(XUL_FILE_TOOLBAR, bundle);
xulDomContainer.addEventHandler(this);
toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById("import-rules-toolbar"); //$NON-NLS-1$
ToolBar swtToolbar = (ToolBar) toolbar.getManagedObject();
swtToolbar.layout(true, true);
} catch (Throwable t) {
LogChannel.GENERAL.logError(Const.getStackTracker(t));
new ErrorDialog(shell,
BaseMessages.getString(PKG, "ImportRulesDialog.Exception.ErrorReadingXULFile.Title"), //$NON-NLS-1$
BaseMessages.getString(PKG, "ImportRulesDialog.Exception.ErrorReadingXULFile.Message", XUL_FILE_TOOLBAR), new Exception(t)); //$NON-NLS-1$
}
}
示例15: addToolBar
import org.pentaho.di.ui.spoon.Spoon; //导入依赖的package包/类
private void addToolBar() {
try {
XulLoader loader = new SwtXulLoader();
loader.setSettingsManager(XulSpoonSettingsManager.getInstance());
ResourceBundle bundle = new XulSpoonResourceBundle(Spoon.class);
XulDomContainer xulDomContainer = loader.loadXul(XUL_FILE_TRANS_LOG_TOOLBAR, bundle);
xulDomContainer.addEventHandler(this);
toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById("nav-toolbar"); //$NON-NLS-1$
ToolBar swtToolbar = (ToolBar) toolbar.getManagedObject();
swtToolbar.layout(true, true);
} catch (Throwable t) {
log.logError(Const.getStackTracker(t));
new ErrorDialog(jobLogComposite.getShell(), BaseMessages.getString(PKG, "Spoon.Exception.ErrorReadingXULFile.Title"), BaseMessages.getString(PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_LOG_TOOLBAR), new Exception(t)); //$NON-NLS-1$ //$NON-NLS-2$
}
}