Search in sources :

Example 11 with XulToolbarbutton

use of org.pentaho.ui.xul.components.XulToolbarbutton in project pentaho-kettle by pentaho.

the class TransGraph method disposeExtraView.

private void disposeExtraView() {
    extraViewComposite.dispose();
    sashForm.layout();
    sashForm.setWeights(new int[] { 100 });
    XulToolbarbutton button = (XulToolbarbutton) toolbar.getElementById("trans-show-results");
    button.setTooltiptext(BaseMessages.getString(PKG, "Spoon.Tooltip.ShowExecutionResults"));
    ToolItem toolItem = (ToolItem) button.getManagedObject();
    toolItem.setImage(GUIResource.getInstance().getImageShowResults());
}
Also used : XulToolbarbutton(org.pentaho.ui.xul.components.XulToolbarbutton) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 12 with XulToolbarbutton

use of org.pentaho.ui.xul.components.XulToolbarbutton in project pentaho-kettle by pentaho.

the class EESpoonPlugin method updateMenuState.

/**
 * Change the menu-item states based on Execute and Create permissions.
 * @param createPermitted
 *          - if true, we enable menu-items requiring creation permissions
 * @param executePermitted
 *          - if true, we enable menu-items requiring execute permissions
 */
void updateMenuState(boolean createPermitted, boolean executePermitted) {
    Document doc = getDocumentRoot();
    if (doc != null) {
        // Main spoon menu
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("process-run")).setDisabled(!executePermitted);
        // $NON-NLS-1$
        XulToolbarbutton transRunButton = ((XulToolbarbutton) doc.getElementById("trans-run"));
        if (transRunButton != null) {
            transRunButton.setDisabled(!executePermitted);
        }
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("trans-preview")).setDisabled(!executePermitted);
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("trans-debug")).setDisabled(!executePermitted);
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("trans-replay")).setDisabled(!executePermitted);
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("trans-verify")).setDisabled(!executePermitted);
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("trans-impact")).setDisabled(!executePermitted);
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("trans-get-sql")).setDisabled(!executePermitted);
        // Disable Show Last menu under the Action menu.
        // $NON-NLS-1$
        ((XulMenu) doc.getElementById("trans-last")).setDisabled(!executePermitted);
        // Schedule is a plugin
        if (doc.getElementById("trans-schedule") != null) {
            // $NON-NLS-1$
            ((XulMenuitem) doc.getElementById("trans-schedule")).setDisabled(!executePermitted);
        }
        // Main spoon toolbar
        // $NON-NLS-1$
        ((XulToolbarbutton) doc.getElementById("toolbar-file-new")).setDisabled(!createPermitted);
        // $NON-NLS-1$
        ((XulToolbarbutton) doc.getElementById("toolbar-file-save")).setDisabled(!createPermitted);
        // $NON-NLS-1$
        ((XulToolbarbutton) doc.getElementById("toolbar-file-save-as")).setDisabled(!createPermitted);
        // Popup menus
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("trans-class-new")).setDisabled(!createPermitted);
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("job-class-new")).setDisabled(!createPermitted);
        // Main spoon menu
        // $NON-NLS-1$
        ((XulMenu) doc.getElementById("file-new")).setDisabled(!createPermitted);
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("file-save")).setDisabled(!createPermitted);
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("file-save-as")).setDisabled(!createPermitted);
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("file-close")).setDisabled(!createPermitted);
        boolean exportAllowed = createPermitted && executePermitted;
        // $NON-NLS-1$
        ((XulMenu) doc.getElementById("file-export")).setDisabled(!exportAllowed);
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("repository-export-all")).setDisabled(!exportAllowed);
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("file-save-as-vfs")).setDisabled(!exportAllowed);
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("edit-cut-steps")).setDisabled(!exportAllowed);
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("edit-copy-steps")).setDisabled(!exportAllowed);
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("edit.copy-file")).setDisabled(!exportAllowed);
        // $NON-NLS-1$
        ((XulMenuitem) doc.getElementById("edit-paste-steps")).setDisabled(!exportAllowed);
        // $NON-NLS-1$
        XulMenuitem transCopyContextMenu = ((XulMenuitem) doc.getElementById("trans-graph-entry-copy"));
        if (transCopyContextMenu != null) {
            transCopyContextMenu.setDisabled(!exportAllowed);
        }
    }
}
Also used : XulMenuitem(org.pentaho.ui.xul.components.XulMenuitem) Document(org.pentaho.ui.xul.dom.Document) XulToolbarbutton(org.pentaho.ui.xul.components.XulToolbarbutton) XulMenu(org.pentaho.ui.xul.containers.XulMenu)

Aggregations

XulToolbarbutton (org.pentaho.ui.xul.components.XulToolbarbutton)12 ToolItem (org.eclipse.swt.widgets.ToolItem)7 XulMenuitem (org.pentaho.ui.xul.components.XulMenuitem)3 CTabItem (org.eclipse.swt.custom.CTabItem)2 EngineMetaInterface (org.pentaho.di.core.EngineMetaInterface)2 PurRepository (org.pentaho.di.repository.pur.PurRepository)2 Spoon (org.pentaho.di.ui.spoon.Spoon)2 XulMenu (org.pentaho.ui.xul.containers.XulMenu)2 FileObject (org.apache.commons.vfs2.FileObject)1 Rectangle (org.eclipse.swt.graphics.Rectangle)1 KettleException (org.pentaho.di.core.exception.KettleException)1 SimpleLoggingObject (org.pentaho.di.core.logging.SimpleLoggingObject)1 JobMeta (org.pentaho.di.job.JobMeta)1 Repository (org.pentaho.di.repository.Repository)1 RepositoryObject (org.pentaho.di.repository.RepositoryObject)1 EEJobMeta (org.pentaho.di.repository.pur.model.EEJobMeta)1 ILockable (org.pentaho.di.repository.pur.model.ILockable)1 RepositoryLock (org.pentaho.di.repository.pur.model.RepositoryLock)1 TransMeta (org.pentaho.di.trans.TransMeta)1 IAbsSecurityProvider (org.pentaho.di.ui.repository.pur.services.IAbsSecurityProvider)1