Skip to content

Instantly share code, notes, and snippets.

@jganoff
Created September 6, 2012 21:06
Show Gist options
  • Save jganoff/3660380 to your computer and use it in GitHub Desktop.
Save jganoff/3660380 to your computer and use it in GitHub Desktop.
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 (save && control instanceof TabItemInterface) {
TabItemInterface tabItem = (TabItemInterface) control;
if (!tabItem.applyChanges()) {
return false;
}
}
if (control instanceof TransGraph) {
TransMeta transMeta = ((TransGraph) control).getManagedObject();
spoonInstance.delegates.trans.closeTransformation(transMeta);
spoonInstance.refreshTree();
} else if (control instanceof JobGraph) {
JobMeta jobMeta = ((JobGraph) control).getManagedObject();
spoonInstance.delegates.jobs.closeJob(jobMeta);
spoonInstance.refreshTree();
} else {
// we don't care about any other ETL tab types
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment