Search in sources :

Example 1 with AbstractGraph

use of org.pentaho.di.ui.spoon.AbstractGraph in project pentaho-kettle by pentaho.

the class SpoonTabsDelegate method renameTabs.

/**
 * Rename the tabs
 */
public void renameTabs() {
    List<TabMapEntry> list = new ArrayList<TabMapEntry>(tabMap);
    for (TabMapEntry entry : list) {
        if (entry.getTabItem().isDisposed()) {
            // this should not be in the map, get rid of it.
            tabMap.remove(entry.getObjectName());
            continue;
        }
        // TabItem before = entry.getTabItem();
        // PDI-1683: need to get the String here, otherwise using only the "before" instance below, the reference gets
        // changed and result is always the same
        // String beforeText=before.getText();
        // 
        Object managedObject = entry.getObject().getManagedObject();
        if (managedObject != null) {
            if (entry.getObject() instanceof AbstractGraph) {
                AbstractMeta meta = (AbstractMeta) managedObject;
                String tabText = makeTabName(meta, entry.isShowingLocation());
                entry.getTabItem().setText(tabText);
                String toolTipText = BaseMessages.getString(PKG, "Spoon.TabTrans.Tooltip", tabText);
                if (entry.getObject() instanceof JobGraph) {
                    toolTipText = BaseMessages.getString(PKG, "Spoon.TabJob.Tooltip", tabText);
                }
                if (Const.isWindows() && !Utils.isEmpty(meta.getFilename())) {
                    toolTipText += Const.CR + Const.CR + meta.getFilename();
                }
                entry.getTabItem().setToolTipText(toolTipText);
            }
        }
    }
    spoon.setShellText();
}
Also used : AbstractGraph(org.pentaho.di.ui.spoon.AbstractGraph) JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) AbstractMeta(org.pentaho.di.base.AbstractMeta) ArrayList(java.util.ArrayList) FileObject(org.apache.commons.vfs2.FileObject) TabMapEntry(org.pentaho.di.ui.spoon.TabMapEntry)

Example 2 with AbstractGraph

use of org.pentaho.di.ui.spoon.AbstractGraph in project pentaho-kettle by pentaho.

the class SpoonTabsDelegate method tabSelected.

public void tabSelected(TabItem item) {
    // 
    for (TabMapEntry entry : tabMap) {
        boolean isAbstractGraph = (entry.getObject() instanceof AbstractGraph);
        if (item.equals(entry.getTabItem())) {
            if (isAbstractGraph) {
                EngineMetaInterface meta = entry.getObject().getMeta();
                if (meta != null) {
                    meta.setInternalKettleVariables();
                }
                if (spoon.getCoreObjectsState() != SpoonInterface.STATE_CORE_OBJECTS_SPOON) {
                    spoon.refreshCoreObjects();
                }
                ((AbstractGraph) entry.getObject()).setFocus();
            }
            break;
        }
    }
    // Also refresh the tree
    spoon.refreshTree();
    // calls also enableMenus() and markTabsChanged()
    spoon.setShellText();
}
Also used : AbstractGraph(org.pentaho.di.ui.spoon.AbstractGraph) EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface) TabMapEntry(org.pentaho.di.ui.spoon.TabMapEntry)

Aggregations

AbstractGraph (org.pentaho.di.ui.spoon.AbstractGraph)2 TabMapEntry (org.pentaho.di.ui.spoon.TabMapEntry)2 ArrayList (java.util.ArrayList)1 FileObject (org.apache.commons.vfs2.FileObject)1 AbstractMeta (org.pentaho.di.base.AbstractMeta)1 EngineMetaInterface (org.pentaho.di.core.EngineMetaInterface)1 JobGraph (org.pentaho.di.ui.spoon.job.JobGraph)1