Search in sources :

Example 1 with XulToolbarbutton

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

the class JobGraph method addAllTabs.

public void addAllTabs() {
    CTabItem tabItemSelection = null;
    if (extraViewTabFolder != null && !extraViewTabFolder.isDisposed()) {
        tabItemSelection = extraViewTabFolder.getSelection();
    }
    jobHistoryDelegate.addJobHistory();
    jobLogDelegate.addJobLog();
    jobGridDelegate.addJobGrid();
    jobMetricsDelegate.addJobMetrics();
    if (tabItemSelection != null) {
        extraViewTabFolder.setSelection(tabItemSelection);
    } else {
        extraViewTabFolder.setSelection(jobGridDelegate.getJobGridTab());
    }
    XulToolbarbutton button = (XulToolbarbutton) toolbar.getElementById("job-show-results");
    button.setTooltiptext(BaseMessages.getString(PKG, "Spoon.Tooltip.HideExecutionResults"));
    ToolItem swtToolItem = (ToolItem) button.getManagedObject();
    swtToolItem.setImage(GUIResource.getInstance().getImageHideResults());
}
Also used : CTabItem(org.eclipse.swt.custom.CTabItem) XulToolbarbutton(org.pentaho.ui.xul.components.XulToolbarbutton) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 2 with XulToolbarbutton

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

the class TransGraph method addAllTabs.

public void addAllTabs() {
    CTabItem tabItemSelection = null;
    if (extraViewTabFolder != null && !extraViewTabFolder.isDisposed()) {
        tabItemSelection = extraViewTabFolder.getSelection();
    }
    transHistoryDelegate.addTransHistory();
    transLogDelegate.addTransLog();
    transGridDelegate.addTransGrid();
    transPerfDelegate.addTransPerf();
    transMetricsDelegate.addTransMetrics();
    transPreviewDelegate.addTransPreview();
    List<SpoonUiExtenderPluginInterface> relevantExtenders = SpoonUiExtenderPluginType.getInstance().getRelevantExtenders(TransGraph.class, LOAD_TAB);
    for (SpoonUiExtenderPluginInterface relevantExtender : relevantExtenders) {
        relevantExtender.uiEvent(this, LOAD_TAB);
    }
    if (tabItemSelection != null) {
        extraViewTabFolder.setSelection(tabItemSelection);
    } else {
        extraViewTabFolder.setSelection(transGridDelegate.getTransGridTab());
    }
    XulToolbarbutton button = (XulToolbarbutton) toolbar.getElementById("trans-show-results");
    button.setTooltiptext(BaseMessages.getString(PKG, "Spoon.Tooltip.HideExecutionResults"));
    ToolItem toolItem = (ToolItem) button.getManagedObject();
    toolItem.setImage(GUIResource.getInstance().getImageHideResults());
}
Also used : SpoonUiExtenderPluginInterface(org.pentaho.di.ui.spoon.SpoonUiExtenderPluginInterface) CTabItem(org.eclipse.swt.custom.CTabItem) XulToolbarbutton(org.pentaho.ui.xul.components.XulToolbarbutton) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 3 with XulToolbarbutton

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

the class SpoonMenuLockController method updateMenu.

public void updateMenu(Document doc) {
    try {
        Spoon spoon = Spoon.getInstance();
        // If we are working with an Enterprise Repository
        if ((spoon != null) && (spoon.getRepository() != null) && (spoon.getRepository() instanceof PurRepository)) {
            ILockService service = getService(spoon.getRepository());
            EngineMetaInterface meta = spoon.getActiveMeta();
            // If (meta is not null) and (meta is either a Transformation or Job)
            if ((meta != null) && (meta instanceof ILockable)) {
                RepositoryLock repoLock = null;
                if (service != null && meta.getObjectId() != null) {
                    if (meta instanceof EEJobMeta) {
                        repoLock = service.getJobLock(meta.getObjectId());
                    } else {
                        repoLock = service.getTransformationLock(meta.getObjectId());
                    }
                }
                // If (there is a lock on this item) and (the UserInfo does not have permission to unlock this file)
                if (repoLock != null) {
                    if (!service.canUnlockFileById(meta.getObjectId())) {
                        // User does not have modify permissions on this file
                        // $NON-NLS-1$
                        ((XulToolbarbutton) doc.getElementById("toolbar-file-save")).setDisabled(true);
                        // $NON-NLS-1$
                        ((XulMenuitem) doc.getElementById("file-save")).setDisabled(true);
                    }
                }
            }
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : EEJobMeta(org.pentaho.di.repository.pur.model.EEJobMeta) PurRepository(org.pentaho.di.repository.pur.PurRepository) XulMenuitem(org.pentaho.ui.xul.components.XulMenuitem) Spoon(org.pentaho.di.ui.spoon.Spoon) ILockService(org.pentaho.di.ui.repository.pur.services.ILockService) EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface) RepositoryLock(org.pentaho.di.repository.pur.model.RepositoryLock) XulToolbarbutton(org.pentaho.ui.xul.components.XulToolbarbutton) KettleException(org.pentaho.di.core.exception.KettleException) ILockable(org.pentaho.di.repository.pur.model.ILockable)

Example 4 with XulToolbarbutton

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

the class SpoonMenuABSController method updateMenu.

public void updateMenu(Document doc) {
    try {
        Spoon spoon = Spoon.getInstance();
        boolean createPermitted = true;
        boolean executePermitted = true;
        // If we are working with an Enterprise Repository
        if ((spoon != null) && (spoon.getRepository() != null) && (spoon.getRepository() instanceof PurRepository)) {
            Repository repo = spoon.getRepository();
            // Check for ABS Security
            if (repo.hasService(IAbsSecurityProvider.class)) {
                IAbsSecurityProvider securityProvider = (IAbsSecurityProvider) repo.getService(IAbsSecurityProvider.class);
                // Get create & execute permission
                createPermitted = securityProvider.isAllowed(IAbsSecurityProvider.CREATE_CONTENT_ACTION);
                executePermitted = securityProvider.isAllowed(IAbsSecurityProvider.EXECUTE_CONTENT_ACTION);
                EngineMetaInterface meta = spoon.getActiveMeta();
                // If (meta is not null) and (meta is either a Transformation or Job)
                if ((meta != null) && ((meta instanceof JobMeta) || (meta instanceof TransMeta))) {
                    // 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);
                }
                // Handle Execute permissions
                // $NON-NLS-1$
                ((XulMenuitem) doc.getElementById("process-run")).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. Disable without execute permissions.
                // $NON-NLS-1$
                ((XulMenu) doc.getElementById("trans-last")).setDisabled(!executePermitted);
                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);
                // Schedule is a plugin
                if (doc.getElementById("trans-schedule") != null) {
                    // $NON-NLS-1$
                    ((XulMenuitem) doc.getElementById("trans-schedule")).setDisabled(!executePermitted);
                }
                TransGraph transGraph = Spoon.getInstance().getActiveTransGraph();
                if (transGraph != null) {
                    XulToolbar toolbar = transGraph.getToolbar();
                    XulToolbarbutton runButton = (XulToolbarbutton) toolbar.getElementById("trans-run");
                    XulToolbarbutton debugButton = (XulToolbarbutton) toolbar.getElementById("trans-debug");
                    XulToolbarbutton previewButton = (XulToolbarbutton) toolbar.getElementById("trans-preview");
                    XulToolbarbutton replayButton = (XulToolbarbutton) toolbar.getElementById("trans-replay");
                    XulToolbarbutton verifyButton = (XulToolbarbutton) toolbar.getElementById("trans-verify");
                    XulToolbarbutton impactButton = (XulToolbarbutton) toolbar.getElementById("trans-impact");
                    XulToolbarbutton generateSqlButton = (XulToolbarbutton) toolbar.getElementById("trans-get-sql");
                    if ((runButton != null) && (runButton.isDisabled() ^ !executePermitted)) {
                        runButton.setDisabled(!executePermitted);
                    }
                    if ((debugButton != null) && (debugButton.isDisabled() ^ !executePermitted)) {
                        debugButton.setDisabled(!executePermitted);
                    }
                    if ((previewButton != null) && (previewButton.isDisabled() ^ !executePermitted)) {
                        previewButton.setDisabled(!executePermitted);
                    }
                    if ((replayButton != null) && (replayButton.isDisabled() ^ !executePermitted)) {
                        replayButton.setDisabled(!executePermitted);
                    }
                    if ((verifyButton != null) && (verifyButton.isDisabled() ^ !executePermitted)) {
                        verifyButton.setDisabled(!executePermitted);
                    }
                    if ((impactButton != null) && (impactButton.isDisabled() ^ !executePermitted)) {
                        impactButton.setDisabled(!executePermitted);
                    }
                    if ((generateSqlButton != null) && (generateSqlButton.isDisabled() ^ !executePermitted)) {
                        generateSqlButton.setDisabled(!executePermitted);
                    }
                }
                JobGraph jobGraph = Spoon.getInstance().getActiveJobGraph();
                if (jobGraph != null) {
                    XulToolbar toolbar = jobGraph.getToolbar();
                    XulToolbarbutton runButton = (XulToolbarbutton) toolbar.getElementById("job-run");
                    XulToolbarbutton generateSqlButton = (XulToolbarbutton) toolbar.getElementById("job-get-sql");
                    if ((runButton != null) && (runButton.isDisabled() ^ !executePermitted)) {
                        runButton.setDisabled(!executePermitted);
                    }
                    if ((generateSqlButton != null) && (generateSqlButton.isDisabled() ^ !executePermitted)) {
                        generateSqlButton.setDisabled(!executePermitted);
                    }
                }
            }
        }
        EESpoonPlugin.updateChangedWarningDialog(createPermitted);
    } catch (Exception e) {
        // don't let this bomb all the way out, otherwise we'll get stuck: PDI-4670
        log.logError(e.getMessage(), e);
    }
}
Also used : IAbsSecurityProvider(org.pentaho.di.ui.repository.pur.services.IAbsSecurityProvider) JobMeta(org.pentaho.di.job.JobMeta) XulToolbar(org.pentaho.ui.xul.containers.XulToolbar) PurRepository(org.pentaho.di.repository.pur.PurRepository) TransMeta(org.pentaho.di.trans.TransMeta) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) XulToolbarbutton(org.pentaho.ui.xul.components.XulToolbarbutton) XulMenu(org.pentaho.ui.xul.containers.XulMenu) Repository(org.pentaho.di.repository.Repository) PurRepository(org.pentaho.di.repository.pur.PurRepository) JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) XulMenuitem(org.pentaho.ui.xul.components.XulMenuitem) Spoon(org.pentaho.di.ui.spoon.Spoon) EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface)

Example 5 with XulToolbarbutton

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

the class MantleController method setToolbarButtonEnabled.

public void setToolbarButtonEnabled(String id, boolean enabled) {
    XulToolbarbutton button = (XulToolbarbutton) document.getElementById(id);
    button.setDisabled(!enabled);
}
Also used : XulToolbarbutton(org.pentaho.ui.xul.components.XulToolbarbutton)

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