use of org.pentaho.xul.swt.tab.TabItem in project pentaho-kettle by pentaho.
the class SpoonEEJobDelegate method addJobGraph.
@Override
public void addJobGraph(JobMeta jobMeta) {
super.addJobGraph(jobMeta);
TabMapEntry tabEntry = spoon.delegates.tabs.findTabMapEntry(jobMeta);
if (tabEntry != null) {
TabItem tabItem = tabEntry.getTabItem();
try {
if ((service != null) && (jobMeta.getObjectId() != null) && (service.getJobLock(jobMeta.getObjectId()) != null)) {
tabItem.setImage(GUIResource.getInstance().getImageLocked());
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
use of org.pentaho.xul.swt.tab.TabItem in project pentaho-kettle by pentaho.
the class SpoonTabsDelegate method getActiveMeta.
public EngineMetaInterface getActiveMeta() {
TabSet tabfolder = spoon.tabfolder;
if (tabfolder == null) {
return null;
}
TabItem tabItem = tabfolder.getSelected();
if (tabItem == null) {
return null;
}
// What transformation is in the active tab?
// TransLog, TransGraph & TransHist contain the same transformation
//
TabMapEntry mapEntry = getTab(tabfolder.getSelected());
EngineMetaInterface meta = null;
if (mapEntry != null) {
if (mapEntry.getObject() instanceof TransGraph) {
meta = (mapEntry.getObject()).getMeta();
}
if (mapEntry.getObject() instanceof JobGraph) {
meta = (mapEntry.getObject()).getMeta();
}
}
return meta;
}
use of org.pentaho.xul.swt.tab.TabItem in project pentaho-kettle by pentaho.
the class SpoonTransformationDelegate method addTransGraph.
public void addTransGraph(TransMeta transMeta) {
boolean added = addTransformation(transMeta);
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(transMeta, showLocation);
TabMapEntry tabEntry = spoon.delegates.tabs.findTabMapEntry(tabName, ObjectType.TRANSFORMATION_GRAPH);
if (tabEntry != null) {
// We change the already loaded transformation to also show the location.
//
showLocation = true;
// Try again, including the location of the object...
//
tabName = spoon.delegates.tabs.makeTabName(transMeta, showLocation);
TabMapEntry exactSameEntry = spoon.delegates.tabs.findTabMapEntry(tabName, ObjectType.TRANSFORMATION_GRAPH);
if (exactSameEntry != null) {
// Already loaded, simply select the tab item in question...
//
addTab = false;
} else {
// We might need to rename the tab of the entry already loaded!
//
tabEntry.setShowingLocation(true);
String newTabName = spoon.delegates.tabs.makeTabName(tabEntry.getObject().getMeta(), showLocation);
tabEntry.getTabItem().setText(newTabName);
}
}
TransGraph transGraph = null;
if (addTab) {
transGraph = new TransGraph(spoon.tabfolder.getSwtTabset(), spoon, transMeta);
PropsUI props = PropsUI.getInstance();
if (tabName.length() >= getMaxTabLength()) {
tabName = new StringBuilder().append(tabName.substring(0, getMaxTabLength())).append("\u2026").toString();
}
TabItem tabItem = new TabItem(spoon.tabfolder, tabName, tabName, props.getSashWeights());
String toolTipText = BaseMessages.getString(PKG, "Spoon.TabTrans.Tooltip", spoon.delegates.tabs.makeTabName(transMeta, showLocation));
if (!Utils.isEmpty(transMeta.getFilename())) {
toolTipText += Const.CR + Const.CR + transMeta.getFilename();
}
tabItem.setToolTipText(toolTipText);
tabItem.setImage(GUIResource.getInstance().getImageTransGraph());
tabItem.setControl(transGraph);
TransLogTable logTable = transMeta.getTransLogTable();
String versionLabel = transMeta.getObjectRevision() == null ? null : transMeta.getObjectRevision().getName();
tabEntry = new TabMapEntry(tabItem, transMeta.getFilename(), transMeta.getName(), transMeta.getRepositoryDirectory(), versionLabel, transGraph, ObjectType.TRANSFORMATION_GRAPH, transMeta.getVariable(Spoon.CONNECTION));
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);
if (addTab) {
TransLogTable logTable = transMeta.getTransLogTable();
// OK, also see if we need to open a new history window.
if (isLogTableDefined(logTable) && !transMeta.isSlaveTransformation()) {
addTabsToTransGraph(transGraph);
}
}
spoon.setUndoMenu(transMeta);
spoon.enableMenus();
} else {
TabMapEntry tabEntry = spoon.delegates.tabs.findTabMapEntry(transMeta);
if (tabEntry != null) {
int idx = spoon.tabfolder.indexOf(tabEntry.getTabItem());
// keep the focus on the graph
spoon.tabfolder.setSelected(idx);
spoon.setUndoMenu(transMeta);
spoon.enableMenus();
}
}
}
use of org.pentaho.xul.swt.tab.TabItem in project pentaho-kettle by pentaho.
the class BaseStreamingDialog method createSubtrans.
private void createSubtrans(TransMeta newTransMeta) {
// remember current tab
TabItem tabItem = spoonInstance.getTabSet().getSelected();
newTransMeta.setMetaStore(spoonInstance.getMetaStore());
try {
SharedObjects sharedObjects = newTransMeta.readSharedObjects();
newTransMeta.setSharedObjects(sharedObjects);
newTransMeta.importFromMetaStore();
newTransMeta.clearChanged();
} catch (Exception e) {
log.logError("Failed to retrieve shared objects", e);
}
spoonInstance.delegates.tabs.makeTabName(newTransMeta, false);
spoonInstance.addTransGraph(newTransMeta);
spoonInstance.applyVariables();
if (spoonInstance.setDesignMode()) {
// No refresh done yet, do so
spoonInstance.refreshTree();
}
spoonInstance.loadPerspective(MainSpoonPerspective.ID);
try {
ExtensionPointHandler.callExtensionPoint(log, KettleExtensionPoint.TransformationCreateNew.id, newTransMeta);
} catch (KettleException e) {
log.logError("Failed to call extension point", e);
}
// go back to inital tab
TabSet ts = spoonInstance.getTabSet();
ts.setSelected(tabItem);
}
use of org.pentaho.xul.swt.tab.TabItem in project pentaho-kettle by pentaho.
the class Spoon method refreshGraph.
public void refreshGraph() {
if (shell.isDisposed()) {
return;
}
TabItem tabItem = tabfolder.getSelected();
if (tabItem == null) {
return;
}
TabMapEntry tabMapEntry = delegates.tabs.getTab(tabItem);
if (tabMapEntry != null) {
if (tabMapEntry.getObject() instanceof TransGraph) {
TransGraph transGraph = (TransGraph) tabMapEntry.getObject();
transGraph.redraw();
}
if (tabMapEntry.getObject() instanceof JobGraph) {
JobGraph jobGraph = (JobGraph) tabMapEntry.getObject();
jobGraph.redraw();
}
}
setShellText();
}
Aggregations