use of org.pentaho.di.core.exception.KettleException in project pentaho-kettle by pentaho.
the class SpoonTabsDelegate method tabClose.
public boolean tabClose(TabItem item, boolean force) throws KettleException {
// Try to find the tab-item that's being closed.
boolean createPerms = !RepositorySecurityUI.verifyOperations(Spoon.getInstance().getShell(), Spoon.getInstance().getRepository(), false, RepositoryOperation.MODIFY_TRANSFORMATION, RepositoryOperation.MODIFY_JOB);
boolean close = true;
boolean canSave = true;
for (TabMapEntry entry : tabMap) {
if (item.equals(entry.getTabItem())) {
final TabItemInterface itemInterface = entry.getObject();
final Object managedObject = itemInterface.getManagedObject();
if (!force) {
if (managedObject != null && AbstractMeta.class.isAssignableFrom(managedObject.getClass())) {
canSave = !((AbstractMeta) managedObject).hasMissingPlugins();
}
if (canSave) {
// Can we close this tab? Only allow users with create content perms to save
if (!itemInterface.canBeClosed() && createPerms) {
int reply = itemInterface.showChangedWarning();
if (reply == SWT.YES) {
close = itemInterface.applyChanges();
} else {
if (reply == SWT.CANCEL) {
close = false;
} else {
close = true;
}
}
}
}
}
String beforeCloseId = null;
String afterCloseId = null;
if (itemInterface instanceof TransGraph) {
beforeCloseId = KettleExtensionPoint.TransBeforeClose.id;
afterCloseId = KettleExtensionPoint.TransAfterClose.id;
} else if (itemInterface instanceof JobGraph) {
beforeCloseId = KettleExtensionPoint.JobBeforeClose.id;
afterCloseId = KettleExtensionPoint.JobAfterClose.id;
}
if (beforeCloseId != null) {
try {
ExtensionPointHandler.callExtensionPoint(log, beforeCloseId, managedObject);
} catch (KettleException e) {
// prevent tab close
close = false;
}
}
//
if (close) {
if (itemInterface instanceof TransGraph) {
TransMeta transMeta = (TransMeta) managedObject;
spoon.delegates.trans.closeTransformation(transMeta);
spoon.refreshTree();
// spoon.refreshCoreObjects();
} else if (itemInterface instanceof JobGraph) {
JobMeta jobMeta = (JobMeta) managedObject;
spoon.delegates.jobs.closeJob(jobMeta);
spoon.refreshTree();
// spoon.refreshCoreObjects();
} else if (itemInterface instanceof SpoonBrowser) {
this.removeTab(entry);
spoon.refreshTree();
} else if (itemInterface instanceof Composite) {
Composite comp = (Composite) itemInterface;
if (comp != null && !comp.isDisposed()) {
comp.dispose();
}
}
if (afterCloseId != null) {
try {
ExtensionPointHandler.callExtensionPoint(log, afterCloseId, managedObject);
} catch (KettleException e) {
// fails gracefully... what else could we do?
}
}
}
break;
}
}
return close;
}
use of org.pentaho.di.core.exception.KettleException in project pentaho-kettle by pentaho.
the class CapabilityManagerDialog method main.
public static void main(String[] args) {
Display display = new Display();
try {
KettleEnvironment.init();
PropsUI.init(display, Props.TYPE_PROPERTIES_SPOON);
KettleLogStore.init(PropsUI.getInstance().getMaxNrLinesInLog(), PropsUI.getInstance().getMaxLogLineTimeoutMinutes());
} catch (KettleException e) {
e.printStackTrace();
}
KettleClientEnvironment.getInstance().setClient(KettleClientEnvironment.ClientType.SPOON);
Shell shell = new Shell(display, SWT.DIALOG_TRIM);
shell.open();
CapabilityManagerDialog capabilityManagerDialog = new CapabilityManagerDialog(shell);
capabilityManagerDialog.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
use of org.pentaho.di.core.exception.KettleException in project pentaho-kettle by pentaho.
the class SaveProgressDialog method open.
public boolean open() {
boolean retval = true;
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
rep.save(meta, versionComment, new ProgressMonitorAdapter(monitor));
} catch (KettleException e) {
throw new InvocationTargetException(e, BaseMessages.getString(PKG, "TransSaveProgressDialog.Exception.ErrorSavingTransformation") + e.toString());
}
}
};
try {
ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
pmd.run(true, true, op);
} catch (InvocationTargetException e) {
MessageDialog errorDialog = new MessageDialog(shell, BaseMessages.getString(PKG, "TransSaveProgressDialog.UnableToSave.DialogTitle"), null, BaseMessages.getString(PKG, "TransSaveProgressDialog.UnableToSave.DialogMessage"), MessageDialog.ERROR, new String[] { BaseMessages.getString(PKG, "TransSaveProgressDialog.UnableToSave.Close") }, 0);
errorDialog.open();
retval = false;
} catch (InterruptedException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "TransSaveProgressDialog.ErrorSavingTransformation.DialogTitle"), BaseMessages.getString(PKG, "TransSaveProgressDialog.ErrorSavingTransformation.DialogMessage"), e);
retval = false;
}
return retval;
}
use of org.pentaho.di.core.exception.KettleException in project pentaho-kettle by pentaho.
the class PGPDecryptStreamDialog method get.
private void get() {
if (!gotPreviousFields) {
try {
String fieldvalue = wStreamFieldName.getText();
String passphrasefieldvalue = wPassphraseFieldName.getText();
wStreamFieldName.removeAll();
wPassphraseFieldName.removeAll();
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
String[] fields = r.getFieldNames();
wStreamFieldName.setItems(fields);
wPassphraseFieldName.setItems(fields);
}
if (fieldvalue != null) {
wStreamFieldName.setText(fieldvalue);
}
if (passphrasefieldvalue != null) {
wPassphraseFieldName.setText(passphrasefieldvalue);
}
gotPreviousFields = true;
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "PGPDecryptStreamDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "PGPDecryptStreamDialog.FailedToGetFields.DialogMessage"), ke);
}
}
}
use of org.pentaho.di.core.exception.KettleException in project pentaho-kettle by pentaho.
the class PGPEncryptStreamDialog method get.
private void get() {
if (!gotPreviousFields) {
try {
String fieldvalue = wStreamFieldName.getText();
wStreamFieldName.removeAll();
String Keyfieldvalue = wKeyNameFieldName.getText();
wKeyNameFieldName.removeAll();
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
wStreamFieldName.setItems(r.getFieldNames());
wKeyNameFieldName.setItems(r.getFieldNames());
}
if (fieldvalue != null) {
wStreamFieldName.setText(fieldvalue);
}
if (Keyfieldvalue != null) {
wKeyNameFieldName.setText(Keyfieldvalue);
}
gotPreviousFields = true;
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "PGPEncryptStreamDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "PGPEncryptStreamDialog.FailedToGetFields.DialogMessage"), ke);
}
}
}
Aggregations