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());
}
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());
}
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);
}
}
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);
}
}
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);
}
Aggregations