use of org.pentaho.di.ui.job.entries.missing.MissingEntryDialog in project pentaho-kettle by pentaho.
the class JobLoadProgressDialog method open.
public JobMeta open() {
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
Spoon spoon = Spoon.getInstance();
try {
// Call extension point(s) before the file has been opened
ExtensionPointHandler.callExtensionPoint(spoon.getLog(), KettleExtensionPoint.JobBeforeOpen.id, (objectId == null) ? jobname : objectId.toString());
if (objectId != null) {
jobInfo = rep.loadJob(objectId, versionLabel);
} else {
jobInfo = rep.loadJob(jobname, repdir, new ProgressMonitorAdapter(monitor), versionLabel);
}
// Call extension point(s) now that the file has been opened
ExtensionPointHandler.callExtensionPoint(spoon.getLog(), KettleExtensionPoint.JobAfterOpen.id, jobInfo);
if (jobInfo.hasMissingPlugins()) {
MissingEntryDialog missingDialog = new MissingEntryDialog(shell, jobInfo.getMissingEntries());
if (missingDialog.open() == null) {
jobInfo = null;
}
}
} catch (KettleException e) {
throw new InvocationTargetException(e, "Error loading job");
}
}
};
try {
ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
pmd.run(true, false, op);
} catch (InvocationTargetException e) {
KettleRepositoryLostException krle = KettleRepositoryLostException.lookupStackStrace(e);
if (krle != null) {
throw krle;
}
new ErrorDialog(shell, "Error loading job", "An error occured loading the job!", e);
jobInfo = null;
} catch (InterruptedException e) {
new ErrorDialog(shell, "Error loading job", "An error occured loading the job!", e);
jobInfo = null;
}
return jobInfo;
}
use of org.pentaho.di.ui.job.entries.missing.MissingEntryDialog in project pentaho-kettle by pentaho.
the class JobFileListener method open.
public boolean open(Node jobNode, String fname, boolean importfile) {
Spoon spoon = Spoon.getInstance();
try {
// Call extension point(s) before the file has been opened
ExtensionPointHandler.callExtensionPoint(spoon.getLog(), KettleExtensionPoint.JobBeforeOpen.id, fname);
JobMeta jobMeta = new JobMeta();
jobMeta.loadXML(jobNode, fname, spoon.getRepository(), spoon.getMetaStore(), false, spoon);
if (jobMeta.hasMissingPlugins()) {
MissingEntryDialog missingDialog = new MissingEntryDialog(spoon.getShell(), jobMeta.getMissingEntries());
if (missingDialog.open() == null) {
return true;
}
}
jobMeta.setRepositoryDirectory(spoon.getDefaultSaveLocation(jobMeta));
jobMeta.setRepository(spoon.getRepository());
jobMeta.setMetaStore(spoon.getMetaStore());
spoon.setJobMetaVariables(jobMeta);
spoon.getProperties().addLastFile(LastUsedFile.FILE_TYPE_JOB, fname, null, false, null);
spoon.addMenuLast();
// if any exist.
if (importfile) {
if (spoon.getRepository() != null) {
jobMeta = fixLinks(jobMeta);
}
} else {
jobMeta.clearChanged();
}
jobMeta.setFilename(fname);
spoon.delegates.jobs.addJobGraph(jobMeta);
// Call extension point(s) now that the file has been opened
ExtensionPointHandler.callExtensionPoint(spoon.getLog(), KettleExtensionPoint.JobAfterOpen.id, jobMeta);
spoon.refreshTree();
SpoonPerspectiveManager.getInstance().activatePerspective(MainSpoonPerspective.class);
return true;
} catch (KettleException e) {
new ErrorDialog(spoon.getShell(), BaseMessages.getString(PKG, "Spoon.Dialog.ErrorOpening.Title"), BaseMessages.getString(PKG, "Spoon.Dialog.ErrorOpening.Message") + fname, e);
}
return false;
}
Aggregations