Search in sources :

Example 16 with TransGraph

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

the class Spoon method zoomIn.

public void zoomIn() {
    TransGraph transGraph = getActiveTransGraph();
    if (transGraph != null) {
        transGraph.zoomIn();
    }
    JobGraph jobGraph = getActiveJobGraph();
    if (jobGraph != null) {
        jobGraph.zoomIn();
    }
}
Also used : JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph)

Example 17 with TransGraph

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

the class Spoon method enableMenus.

public void enableMenus() {
    boolean disableTransMenu = getActiveTransformation() == null;
    boolean disableJobMenu = getActiveJob() == null;
    boolean disableMetaMenu = getActiveMeta() == null;
    boolean isRepositoryRunning = rep != null;
    boolean disablePreviewButton = true;
    String activePerspectiveId = null;
    SpoonPerspectiveManager manager = SpoonPerspectiveManager.getInstance();
    if (manager != null && manager.getActivePerspective() != null) {
        activePerspectiveId = manager.getActivePerspective().getId();
    }
    boolean etlPerspective = false;
    if (activePerspectiveId != null && activePerspectiveId.length() > 0) {
        etlPerspective = activePerspectiveId.equals(MainSpoonPerspective.ID);
    }
    TransGraph transGraph = getActiveTransGraph();
    if (transGraph != null) {
        disablePreviewButton = !(transGraph.isRunning() && !transGraph.isHalting());
    }
    boolean disableSave = true;
    boolean disableDatabaseExplore = true;
    TabItemInterface currentTab = getActiveTabitem();
    if (currentTab != null && currentTab.canHandleSave()) {
        disableSave = !currentTab.hasContentChanged();
    }
    EngineMetaInterface meta = getActiveMeta();
    if (meta != null) {
        disableSave = !meta.canSave();
        disableDatabaseExplore = false;
    }
    org.pentaho.ui.xul.dom.Document doc;
    if (mainSpoonContainer != null) {
        doc = mainSpoonContainer.getDocumentRoot();
        if (doc != null) {
            if (etlPerspective) {
                doc.getElementById("file").setVisible(etlPerspective);
                doc.getElementById("edit").setVisible(etlPerspective);
                doc.getElementById("view").setVisible(etlPerspective);
                doc.getElementById("action").setVisible(etlPerspective);
                doc.getElementById("tools").setVisible(etlPerspective);
                doc.getElementById("help").setVisible(etlPerspective);
                doc.getElementById("help-welcome").setVisible(etlPerspective);
                doc.getElementById("help-plugins").setVisible(true);
            }
            // Only enable certain menu-items if we need to.
            disableMenuItem(doc, "file-new-database", disableTransMenu && disableJobMenu);
            disableMenuItem(doc, "menubar-new-database", disableTransMenu && disableJobMenu);
            disableMenuItem(doc, "file-save", disableTransMenu && disableJobMenu && disableMetaMenu || disableSave);
            disableMenuItem(doc, "toolbar-file-save", disableTransMenu && disableJobMenu && disableMetaMenu || disableSave);
            disableMenuItem(doc, "file-save-as", disableTransMenu && disableJobMenu && disableMetaMenu || disableSave);
            disableMenuItem(doc, "toolbar-file-save-as", disableTransMenu && disableJobMenu && disableMetaMenu || disableSave);
            disableMenuItem(doc, "file-save-as-vfs", disableTransMenu && disableJobMenu && disableMetaMenu);
            disableMenuItem(doc, "file-close", disableTransMenu && disableJobMenu && disableMetaMenu);
            disableMenuItem(doc, "file-print", disableTransMenu && disableJobMenu);
            disableMenuItem(doc, "file-export-to-xml", disableTransMenu && disableJobMenu);
            disableMenuItem(doc, "file-export-all-to-xml", disableTransMenu && disableJobMenu);
            // Disable the undo and redo menus if there is no active transformation
            // or active job
            // DO NOT ENABLE them otherwise ... leave that to the undo/redo settings
            // 
            disableMenuItem(doc, UNDO_MENU_ITEM, disableTransMenu && disableJobMenu);
            disableMenuItem(doc, REDO_MENU_ITEM, disableTransMenu && disableJobMenu);
            disableMenuItem(doc, "edit-clear-selection", disableTransMenu && disableJobMenu);
            disableMenuItem(doc, "edit-select-all", disableTransMenu && disableJobMenu);
            updateSettingsMenu(doc, disableTransMenu, disableJobMenu);
            disableMenuItem(doc, "edit-settings", disableTransMenu && disableJobMenu && disableMetaMenu);
            // View Menu
            ((XulMenuitem) doc.getElementById("view-results")).setSelected(isExecutionResultsPaneVisible());
            disableMenuItem(doc, "view-results", transGraph == null && disableJobMenu);
            disableMenuItem(doc, "view-zoom-in", disableTransMenu && disableJobMenu);
            disableMenuItem(doc, "view-zoom-out", disableTransMenu && disableJobMenu);
            disableMenuItem(doc, "view-zoom-100pct", disableTransMenu && disableJobMenu);
            // Transformations
            disableMenuItem(doc, "process-run", disableTransMenu && disablePreviewButton && disableJobMenu);
            disableMenuItem(doc, "process-run-options", disableTransMenu && disablePreviewButton && disableJobMenu);
            disableMenuItem(doc, "trans-replay", disableTransMenu && disablePreviewButton);
            disableMenuItem(doc, "trans-preview", disableTransMenu && disablePreviewButton);
            disableMenuItem(doc, "trans-debug", disableTransMenu && disablePreviewButton);
            disableMenuItem(doc, "trans-verify", disableTransMenu);
            disableMenuItem(doc, "trans-impact", disableTransMenu);
            disableMenuItem(doc, "trans-get-sql", disableTransMenu);
            disableMenuItem(doc, "trans-last-impact", disableTransMenu);
            // Tools
            disableMenuItem(doc, "repository-explore", !isRepositoryRunning);
            disableMenuItem(doc, "tools-dabase-explore", !isRepositoryRunning && disableDatabaseExplore);
            disableMenuItem(doc, "repository-clear-shared-object-cache", !isRepositoryRunning);
            disableMenuItem(doc, "toolbar-expore-repository", !isRepositoryRunning);
            disableMenuItem(doc, "repository-export-all", !isRepositoryRunning);
            disableMenuItem(doc, "repository-import-directory", !isRepositoryRunning);
            disableMenuItem(doc, "trans-last-preview", !isRepositoryRunning || disableTransMenu);
            // Wizard
            disableMenuItem(doc, "wizard-connection", disableTransMenu && disableJobMenu);
            disableMenuItem(doc, "wizard-copy-table", disableTransMenu && disableJobMenu);
            disableMenuItem(doc, "wizard-copy-tables", isRepositoryRunning && disableTransMenu && disableJobMenu);
            disableMenuItem(doc, "database-inst-dependancy", !isRepositoryRunning);
            SpoonPluginManager.getInstance().notifyLifecycleListeners(SpoonLifeCycleEvent.MENUS_REFRESHED);
            MenuManager menuManager = getMenuBarManager();
            menuManager.updateAll(true);
            // What steps & plugins to show?
            refreshCoreObjects();
            fireMenuControlers();
        }
    }
}
Also used : XulMenuitem(org.pentaho.ui.xul.components.XulMenuitem) MenuManager(org.eclipse.jface.action.MenuManager) EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph)

Example 18 with TransGraph

use of org.pentaho.di.ui.spoon.trans.TransGraph 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)

Example 19 with TransGraph

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

the class Spoon method paste.

public void paste() {
    String clipContent = fromClipboard();
    if (clipContent != null) {
        // 
        try {
            Document document = XMLHandler.loadXMLString(clipContent);
            boolean transformation = XMLHandler.getSubNode(document, TransMeta.XML_TAG) != null;
            boolean job = XMLHandler.getSubNode(document, JobMeta.XML_TAG) != null;
            boolean steps = XMLHandler.getSubNode(document, Spoon.XML_TAG_TRANSFORMATION_STEPS) != null;
            boolean jobEntries = XMLHandler.getSubNode(document, Spoon.XML_TAG_JOB_JOB_ENTRIES) != null;
            if (transformation) {
                pasteTransformation();
            } else if (job) {
                pasteJob();
            } else if (steps) {
                TransGraph transGraph = getActiveTransGraph();
                if (transGraph != null && transGraph.getLastMove() != null) {
                    pasteXML(transGraph.getManagedObject(), clipContent, transGraph.getLastMove());
                }
            } else if (jobEntries) {
                JobGraph jobGraph = getActiveJobGraph();
                if (jobGraph != null && jobGraph.getLastMove() != null) {
                    pasteXML(jobGraph.getManagedObject(), clipContent, jobGraph.getLastMove());
                }
            }
        } catch (KettleXMLException e) {
            log.logError("Unable to paste", e);
        }
    }
}
Also used : JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) Document(org.w3c.dom.Document)

Example 20 with TransGraph

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

the class Spoon method showLastTransCheck.

/**
 * Show the remarks of the last transformation check that was run.
 *
 * @see #checkTrans()
 */
public void showLastTransCheck() {
    TransMeta transMeta = getActiveTransformation();
    if (transMeta == null) {
        return;
    }
    TransGraph transGraph = delegates.trans.findTransGraphOfTransformation(transMeta);
    if (transGraph == null) {
        return;
    }
    CheckResultDialog crd = new CheckResultDialog(transMeta, shell, SWT.NONE, transGraph.getRemarks());
    String stepName = crd.open();
    if (stepName != null) {
        // Go to the indicated step!
        StepMeta stepMeta = transMeta.findStep(stepName);
        if (stepMeta != null) {
            delegates.steps.editStep(transMeta, stepMeta);
        }
    }
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta) CheckResultDialog(org.pentaho.di.ui.core.dialog.CheckResultDialog) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) StepMeta(org.pentaho.di.trans.step.StepMeta)

Aggregations

TransGraph (org.pentaho.di.ui.spoon.trans.TransGraph)37 JobGraph (org.pentaho.di.ui.spoon.job.JobGraph)15 TransMeta (org.pentaho.di.trans.TransMeta)10 Test (org.junit.Test)8 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)7 ArrayList (java.util.ArrayList)6 Point (org.pentaho.di.core.gui.Point)6 JobMeta (org.pentaho.di.job.JobMeta)6 StepMeta (org.pentaho.di.trans.step.StepMeta)6 EngineMetaInterface (org.pentaho.di.core.EngineMetaInterface)5 KettleException (org.pentaho.di.core.exception.KettleException)5 TabMapEntry (org.pentaho.di.ui.spoon.TabMapEntry)5 Browser (org.eclipse.swt.browser.Browser)4 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)4 FileObject (org.apache.commons.vfs2.FileObject)3 SashForm (org.eclipse.swt.custom.SashForm)3 Composite (org.eclipse.swt.widgets.Composite)3 MessageBox (org.eclipse.swt.widgets.MessageBox)3 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)3 TabItem (org.pentaho.xul.swt.tab.TabItem)3