Search in sources :

Example 1 with TabItem

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);
        }
    }
}
Also used : TabItem(org.pentaho.xul.swt.tab.TabItem) TabMapEntry(org.pentaho.di.ui.spoon.TabMapEntry) KettleException(org.pentaho.di.core.exception.KettleException)

Example 2 with TabItem

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;
}
Also used : TabItem(org.pentaho.xul.swt.tab.TabItem) JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) TabSet(org.pentaho.xul.swt.tab.TabSet) EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) TabMapEntry(org.pentaho.di.ui.spoon.TabMapEntry)

Example 3 with TabItem

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();
        }
    }
}
Also used : TabItem(org.pentaho.xul.swt.tab.TabItem) TransLogTable(org.pentaho.di.core.logging.TransLogTable) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) TabMapEntry(org.pentaho.di.ui.spoon.TabMapEntry) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) PropsUI(org.pentaho.di.ui.core.PropsUI)

Example 4 with TabItem

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);
}
Also used : TabItem(org.pentaho.xul.swt.tab.TabItem) CTabItem(org.eclipse.swt.custom.CTabItem) KettleException(org.pentaho.di.core.exception.KettleException) TabSet(org.pentaho.xul.swt.tab.TabSet) SharedObjects(org.pentaho.di.shared.SharedObjects) KettleFileException(org.pentaho.di.core.exception.KettleFileException) KettleException(org.pentaho.di.core.exception.KettleException)

Example 5 with 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();
}
Also used : TabItem(org.pentaho.xul.swt.tab.TabItem) CTabItem(org.eclipse.swt.custom.CTabItem) JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph)

Aggregations

TabItem (org.pentaho.xul.swt.tab.TabItem)14 TabMapEntry (org.pentaho.di.ui.spoon.TabMapEntry)7 PropsUI (org.pentaho.di.ui.core.PropsUI)5 TabSet (org.pentaho.xul.swt.tab.TabSet)5 KettleException (org.pentaho.di.core.exception.KettleException)4 JobGraph (org.pentaho.di.ui.spoon.job.JobGraph)4 TransGraph (org.pentaho.di.ui.spoon.trans.TransGraph)4 CTabItem (org.eclipse.swt.custom.CTabItem)3 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)3 EngineMetaInterface (org.pentaho.di.core.EngineMetaInterface)2 Point (org.pentaho.di.core.gui.Point)2 BrowserFunction (org.eclipse.swt.browser.BrowserFunction)1 OpenWindowListener (org.eclipse.swt.browser.OpenWindowListener)1 WindowEvent (org.eclipse.swt.browser.WindowEvent)1 CTabFolder (org.eclipse.swt.custom.CTabFolder)1 Composite (org.eclipse.swt.widgets.Composite)1 Matchers.anyString (org.mockito.Matchers.anyString)1 AbstractMeta (org.pentaho.di.base.AbstractMeta)1 KettleFileException (org.pentaho.di.core.exception.KettleFileException)1 LogChannelInterface (org.pentaho.di.core.logging.LogChannelInterface)1