use of org.pentaho.di.ui.job.dialog.JobLoadProgressDialog in project pentaho-kettle by pentaho.
the class Spoon method loadObjectFromRepository.
public void loadObjectFromRepository(ObjectId objectId, RepositoryObjectType objectType, String revision) throws Exception {
// Try to open the selected transformation.
if (objectType.equals(RepositoryObjectType.TRANSFORMATION)) {
try {
TransLoadProgressDialog progressDialog = new TransLoadProgressDialog(shell, rep, objectId, revision);
TransMeta transMeta = progressDialog.open();
transMeta.clearChanged();
if (transMeta != null) {
if (log.isDetailed()) {
log.logDetailed(BaseMessages.getString(PKG, "Spoon.Log.LoadToTransformation", transMeta.getName(), transMeta.getRepositoryDirectory().getName()));
}
props.addLastFile(LastUsedFile.FILE_TYPE_TRANSFORMATION, transMeta.getName(), transMeta.getRepositoryDirectory().getPath(), true, rep.getName(), getUsername(), null);
addMenuLast();
addTransGraph(transMeta);
}
refreshTree();
refreshGraph();
} catch (Exception e) {
if (KettleRepositoryLostException.lookupStackStrace(e) == null) {
new ErrorDialog(((Spoon) SpoonFactory.getInstance()).getShell(), BaseMessages.getString(Spoon.class, "Spoon.Dialog.ErrorOpeningById.Message", objectId), e.getMessage(), e);
} else {
throw e;
}
}
} else if (objectType.equals(RepositoryObjectType.JOB)) {
try {
JobLoadProgressDialog progressDialog = new JobLoadProgressDialog(shell, rep, objectId, revision);
JobMeta jobMeta = progressDialog.open();
jobMeta.clearChanged();
if (jobMeta != null) {
props.addLastFile(LastUsedFile.FILE_TYPE_JOB, jobMeta.getName(), jobMeta.getRepositoryDirectory().getPath(), true, rep.getName(), getUsername(), null);
saveSettings();
addMenuLast();
addJobGraph(jobMeta);
}
refreshTree();
refreshGraph();
} catch (Exception e) {
if (KettleRepositoryLostException.lookupStackStrace(e) == null) {
new ErrorDialog(((Spoon) SpoonFactory.getInstance()).getShell(), BaseMessages.getString(Spoon.class, "Spoon.Dialog.ErrorOpeningById.Message", objectId), e.getMessage(), e);
} else {
throw e;
}
}
}
}
use of org.pentaho.di.ui.job.dialog.JobLoadProgressDialog in project pentaho-kettle by pentaho.
the class Spoon method loadLastUsedFile.
private void loadLastUsedFile(LastUsedFile lastUsedFile, String repositoryName, boolean trackIt, boolean isStartup) throws KettleException {
boolean useRepository = repositoryName != null;
//
if (lastUsedFile.isSourceRepository()) {
if (!Utils.isEmpty(lastUsedFile.getRepositoryName())) {
if (useRepository && !lastUsedFile.getRepositoryName().equalsIgnoreCase(repositoryName)) {
// We just asked...
useRepository = false;
}
}
}
if (useRepository && lastUsedFile.isSourceRepository()) {
if (rep != null) {
// load from this repository...
if (rep.getName().equalsIgnoreCase(lastUsedFile.getRepositoryName())) {
RepositoryDirectoryInterface rdi = rep.findDirectory(lastUsedFile.getDirectory());
if (rdi != null) {
// does the file exist in the repo?
final RepositoryObjectType fileType = lastUsedFile.isJob() ? RepositoryObjectType.JOB : RepositoryObjectType.TRANSFORMATION;
if (!rep.exists(lastUsedFile.getFilename(), rdi, fileType)) {
// opening this file
if (isStartup) {
if (log.isDetailed()) {
log.logDetailed(BaseMessages.getString(PKG, "Spoon.log.openingMissingFile"));
}
} else {
final Dialog dlg = new SimpleMessageDialog(shell, BaseMessages.getString(PKG, "Spoon.Dialog.MissingRecentFile.Title"), BaseMessages.getString(PKG, "Spoon.Dialog.MissingRecentFile.Message", lastUsedFile.getLongFileType().toLowerCase()), MessageDialog.ERROR, BaseMessages.getString(PKG, "System.Button.Close"), MISSING_RECENT_DLG_WIDTH, SimpleMessageDialog.BUTTON_WIDTH);
dlg.open();
}
} else {
// Are we loading a transformation or a job?
if (lastUsedFile.isTransformation()) {
if (log.isDetailed()) {
// "Auto loading transformation ["+lastfiles[0]+"] from repository directory ["+lastdirs[0]+"]"
log.logDetailed(BaseMessages.getString(PKG, "Spoon.Log.AutoLoadingTransformation", lastUsedFile.getFilename(), lastUsedFile.getDirectory()));
}
TransLoadProgressDialog tlpd = new TransLoadProgressDialog(shell, rep, lastUsedFile.getFilename(), rdi, null);
TransMeta transMeta = tlpd.open();
if (transMeta != null) {
if (trackIt) {
props.addLastFile(LastUsedFile.FILE_TYPE_TRANSFORMATION, lastUsedFile.getFilename(), rdi.getPath(), true, rep.getName(), getUsername(), null);
}
// transMeta.setFilename(lastUsedFile.getFilename());
transMeta.clearChanged();
addTransGraph(transMeta);
refreshTree();
}
} else if (lastUsedFile.isJob()) {
JobLoadProgressDialog progressDialog = new JobLoadProgressDialog(shell, rep, lastUsedFile.getFilename(), rdi, null);
JobMeta jobMeta = progressDialog.open();
if (jobMeta != null) {
if (trackIt) {
props.addLastFile(LastUsedFile.FILE_TYPE_JOB, lastUsedFile.getFilename(), rdi.getPath(), true, rep.getName(), getUsername(), null);
}
jobMeta.clearChanged();
addJobGraph(jobMeta);
}
}
refreshTree();
}
}
}
}
}
// open files stored locally, not in the repository
if (!lastUsedFile.isSourceRepository() && !Utils.isEmpty(lastUsedFile.getFilename())) {
if (lastUsedFile.isTransformation()) {
openFile(lastUsedFile.getFilename(), rep != null);
}
if (lastUsedFile.isJob()) {
openFile(lastUsedFile.getFilename(), false);
}
refreshTree();
}
}
use of org.pentaho.di.ui.job.dialog.JobLoadProgressDialog in project pentaho-kettle by pentaho.
the class Spoon method loadObjectFromRepository.
public void loadObjectFromRepository(String objName, RepositoryObjectType objectType, RepositoryDirectoryInterface repDir, String versionLabel) throws Exception {
// Try to open the selected transformation.
if (objectType.equals(RepositoryObjectType.TRANSFORMATION)) {
try {
TransLoadProgressDialog progressDialog = new TransLoadProgressDialog(shell, rep, objName, repDir, versionLabel);
TransMeta transMeta = progressDialog.open();
transMeta.clearChanged();
if (transMeta != null) {
if (log.isDetailed()) {
log.logDetailed(BaseMessages.getString(PKG, "Spoon.Log.LoadToTransformation", objName, repDir.getName()));
}
props.addLastFile(LastUsedFile.FILE_TYPE_TRANSFORMATION, objName, repDir.getPath(), true, rep.getName(), getUsername(), null);
addMenuLast();
addTransGraph(transMeta);
}
refreshTree();
refreshGraph();
} catch (Exception e) {
if (KettleRepositoryLostException.lookupStackStrace(e) == null) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "Spoon.Dialog.ErrorOpening.Message") + objName + Const.CR + // "Error opening : "
e.getMessage());
mb.setText(BaseMessages.getString(PKG, "Spoon.Dialog.ErrorOpening.Title"));
mb.open();
} else {
throw e;
}
}
} else if (objectType.equals(RepositoryObjectType.JOB)) {
// Try to open the selected job.
try {
JobLoadProgressDialog progressDialog = new JobLoadProgressDialog(shell, rep, objName, repDir, versionLabel);
JobMeta jobMeta = progressDialog.open();
jobMeta.clearChanged();
if (jobMeta != null) {
props.addLastFile(LastUsedFile.FILE_TYPE_JOB, objName, repDir.getPath(), true, rep.getName(), getUsername(), null);
saveSettings();
addMenuLast();
addJobGraph(jobMeta);
}
refreshTree();
refreshGraph();
} catch (Exception e) {
if (KettleRepositoryLostException.lookupStackStrace(e) == null) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "Spoon.Dialog.ErrorOpening.Message") + objName + Const.CR + // "Error opening : "
e.getMessage());
mb.setText(BaseMessages.getString(PKG, "Spoon.Dialog.ErrorOpening.Title"));
mb.open();
} else {
throw e;
}
}
}
}
Aggregations