use of org.pentaho.di.ui.spoon.job.JobGraph in project pentaho-kettle by pentaho.
the class Spoon method undoAction.
public void undoAction(UndoInterface undoInterface) {
if (undoInterface == null) {
return;
}
TransAction ta = undoInterface.previousUndo();
if (ta == null) {
return;
}
// something changed: change the menu
setUndoMenu(undoInterface);
if (undoInterface instanceof TransMeta) {
delegates.trans.undoTransformationAction((TransMeta) undoInterface, ta);
if (ta.getType() == TransAction.TYPE_ACTION_DELETE_STEP) {
// something changed: change the menu
setUndoMenu(undoInterface);
handleSelectedStepOnUndo((TransMeta) undoInterface);
ta = undoInterface.viewPreviousUndo();
if (ta != null && ta.getType() == TransAction.TYPE_ACTION_DELETE_HOP) {
ta = undoInterface.previousUndo();
delegates.trans.undoTransformationAction((TransMeta) undoInterface, ta);
}
}
}
if (undoInterface instanceof JobMeta) {
delegates.jobs.undoJobAction((JobMeta) undoInterface, ta);
if (ta.getType() == TransAction.TYPE_ACTION_DELETE_JOB_ENTRY) {
// something changed: change the menu
setUndoMenu(undoInterface);
ta = undoInterface.viewPreviousUndo();
if (ta != null && ta.getType() == TransAction.TYPE_ACTION_DELETE_JOB_HOP) {
ta = undoInterface.previousUndo();
delegates.jobs.undoJobAction((JobMeta) undoInterface, ta);
}
}
}
// Put what we undo in focus
if (undoInterface instanceof TransMeta) {
TransGraph transGraph = delegates.trans.findTransGraphOfTransformation((TransMeta) undoInterface);
transGraph.forceFocus();
}
if (undoInterface instanceof JobMeta) {
JobGraph jobGraph = delegates.jobs.findJobGraphOfJob((JobMeta) undoInterface);
jobGraph.forceFocus();
}
}
use of org.pentaho.di.ui.spoon.job.JobGraph in project pentaho-kettle by pentaho.
the class Spoon method zoomOut.
public void zoomOut() {
TransGraph transGraph = getActiveTransGraph();
if (transGraph != null) {
transGraph.zoomOut();
}
JobGraph jobGraph = getActiveJobGraph();
if (jobGraph != null) {
jobGraph.zoomOut();
}
}
use of org.pentaho.di.ui.spoon.job.JobGraph in project pentaho-kettle by pentaho.
the class Spoon method zoom100Percent.
public void zoom100Percent() {
TransGraph transGraph = getActiveTransGraph();
if (transGraph != null) {
transGraph.zoom100Percent();
}
JobGraph jobGraph = getActiveJobGraph();
if (jobGraph != null) {
jobGraph.zoom100Percent();
}
}
use of org.pentaho.di.ui.spoon.job.JobGraph in project pentaho-kettle by pentaho.
the class TransGraph method openMapping.
/**
* Open the transformation mentioned in the mapping...
*/
public void openMapping(StepMeta stepMeta, int index) {
try {
Object referencedMeta = null;
Trans subTrans = getActiveSubtransformation(this, stepMeta);
if (subTrans != null && (stepMeta.getStepMetaInterface().getActiveReferencedObjectDescription() == null || index < 0)) {
TransMeta subTransMeta = subTrans.getTransMeta();
referencedMeta = subTransMeta;
Object[] objectArray = new Object[4];
objectArray[0] = stepMeta;
objectArray[1] = subTransMeta;
ExtensionPointHandler.callExtensionPoint(log, KettleExtensionPoint.OpenMapping.id, objectArray);
} else {
StepMetaInterface meta = stepMeta.getStepMetaInterface();
if (!Utils.isEmpty(meta.getReferencedObjectDescriptions())) {
referencedMeta = meta.loadReferencedObject(index, spoon.rep, spoon.metaStore, transMeta);
}
}
if (referencedMeta == null) {
return;
}
if (referencedMeta instanceof TransMeta) {
TransMeta mappingMeta = (TransMeta) referencedMeta;
mappingMeta.clearChanged();
spoon.addTransGraph(mappingMeta);
TransGraph subTransGraph = spoon.getActiveTransGraph();
attachActiveTrans(subTransGraph, this.currentStep);
}
if (referencedMeta instanceof JobMeta) {
JobMeta jobMeta = (JobMeta) referencedMeta;
jobMeta.clearChanged();
spoon.addJobGraph(jobMeta);
JobGraph jobGraph = spoon.getActiveJobGraph();
attachActiveJob(jobGraph, this.currentStep);
}
} catch (Exception e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "TransGraph.Exception.UnableToLoadMapping.Title"), BaseMessages.getString(PKG, "TransGraph.Exception.UnableToLoadMapping.Message"), e);
}
}
use of org.pentaho.di.ui.spoon.job.JobGraph in project pentaho-kettle by pentaho.
the class SpoonJobDelegate method addJobGraph.
public void addJobGraph(JobMeta jobMeta) {
boolean added = addJob(jobMeta);
if (added) {
// See if there already is a tab for this graph with the short default name.
// If there is, set that one to show the location as well.
// If not, simply add it without
// If no, add it
// If yes, select that tab
//
boolean showLocation = false;
boolean addTab = true;
String tabName = spoon.delegates.tabs.makeTabName(jobMeta, false);
TabMapEntry tabEntry = spoon.delegates.tabs.findTabMapEntry(tabName, ObjectType.JOB_GRAPH);
if (tabEntry != null) {
// We change the already loaded job to also show the location.
//
showLocation = true;
tabEntry.setShowingLocation(true);
String newTabName = spoon.delegates.tabs.makeTabName(tabEntry.getObject().getMeta(), true);
tabEntry.getTabItem().setText(newTabName);
// Try again, including the location of the object...
//
tabName = spoon.delegates.tabs.makeTabName(jobMeta, true);
tabEntry = spoon.delegates.tabs.findTabMapEntry(tabName, ObjectType.JOB_GRAPH);
if (tabEntry != null) {
// Already loaded, simply select the tab item in question...
//
addTab = false;
}
}
if (addTab) {
JobGraph jobGraph = new JobGraph(spoon.tabfolder.getSwtTabset(), spoon, jobMeta);
PropsUI props = PropsUI.getInstance();
TabItem tabItem = new TabItem(spoon.tabfolder, tabName, tabName, props.getSashWeights());
String toolTipText = BaseMessages.getString(PKG, "Spoon.TabJob.Tooltip", spoon.delegates.tabs.makeTabName(jobMeta, showLocation));
if (!Utils.isEmpty(jobMeta.getFilename())) {
toolTipText += Const.CR + Const.CR + jobMeta.getFilename();
}
tabItem.setToolTipText(toolTipText);
tabItem.setImage(GUIResource.getInstance().getImageJobGraph());
tabItem.setControl(jobGraph);
// OK, also see if we need to open a new history window.
if (jobMeta.getJobLogTable().getDatabaseMeta() != null && !Utils.isEmpty(jobMeta.getJobLogTable().getTableName())) {
jobGraph.addAllTabs();
jobGraph.extraViewTabFolder.setSelection(jobGraph.jobHistoryDelegate.getJobHistoryTab());
}
String versionLabel = jobMeta.getObjectRevision() == null ? null : jobMeta.getObjectRevision().getName();
tabEntry = new TabMapEntry(tabItem, jobMeta.getFilename(), jobMeta.getName(), jobMeta.getRepositoryDirectory(), versionLabel, jobGraph, ObjectType.JOB_GRAPH);
tabEntry.setShowingLocation(showLocation);
spoon.delegates.tabs.addTab(tabEntry);
}
int idx = spoon.tabfolder.indexOf(tabEntry.getTabItem());
// keep the focus on the graph
spoon.tabfolder.setSelected(idx);
spoon.setUndoMenu(jobMeta);
spoon.enableMenus();
} else {
TabMapEntry tabEntry = spoon.delegates.tabs.findTabMapEntry(jobMeta);
if (tabEntry != null) {
int idx = spoon.tabfolder.indexOf(tabEntry.getTabItem());
// keep the focus on the graph
spoon.tabfolder.setSelected(idx);
// keep the focus on the graph
spoon.tabfolder.setSelected(idx);
spoon.setUndoMenu(jobMeta);
spoon.enableMenus();
}
}
}
Aggregations