public void testSetEnabledWithoutDisabling() { Shell shell = new Shell(); Composite composite = new Composite(shell, SWT.NONE); composite.setEnabled(false); CommonUiUtil.setEnabled(composite, true); assertFalse(composite.getEnabled()); CommonUiUtil.setEnabled(composite, true); assertFalse(composite.getEnabled()); }
public void testSetEnabledStateDisableStateRemoved() { Shell shell = new Shell(); Composite composite = new Composite(shell, SWT.NONE); Label label = new Label(composite, SWT.NONE); label.setEnabled(false); CommonUiUtil.setEnabled(composite, false); CommonUiUtil.setEnabled(composite, true); // the second call should have not changed anything CommonUiUtil.setEnabled(composite, true); assertTrue(composite.getEnabled()); assertFalse(label.getEnabled()); }
public void testSetEnabledStateDisabledParent() { Shell shell = new Shell(); Composite composite = new Composite(shell, SWT.NONE); composite.setEnabled(false); Label label = new Label(composite, SWT.NONE); CommonUiUtil.setEnabled(composite, false); assertFalse(composite.getEnabled()); assertFalse(label.getEnabled()); CommonUiUtil.setEnabled(composite, true); assertFalse(composite.getEnabled()); assertTrue(label.getEnabled()); }
@Override public void showBusy(boolean busy) { if (editorBusyIndicator != null) { if (busy) { if (TasksUiInternal.isAnimationsEnabled()) { editorBusyIndicator.start(); } } else { editorBusyIndicator.stop(); } } if (!isHeaderFormDisposed()) { Form form = getHeaderForm().getForm().getForm(); if (form != null && !form.isDisposed()) { // TODO consider only disabling certain actions IToolBarManager toolBarManager = form.getToolBarManager(); if (toolBarManager instanceof ToolBarManager) { ToolBar control = ((ToolBarManager) toolBarManager).getControl(); if (control != null) { control.setEnabled(!busy); } } if (leftToolBar != null) { leftToolBar.setEnabled(!busy); } if (titleLabel != null) { titleLabel.setEnabled(!busy); } CommonUiUtil.setEnabled(form.getBody(), !busy); for (IFormPage page : getPages()) { if (page instanceof WorkbenchPart) { WorkbenchPart part = (WorkbenchPart) page; part.showBusy(busy); } } } } }