Java Code Examples for org.eclipse.swt.widgets.Button#isDisposed()
The following examples show how to use
org.eclipse.swt.widgets.Button#isDisposed() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DynamicAddRemoveLineComposite.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public void dispose() { super.dispose(); if (regionForAdd != null && !regionForAdd.isDisposed()) { regionForAdd.dispose(); } // for (Region region : regions) { // if (region != null && !region.isDisposed()) { // region.dispose(); // } // } for (Control composite : controls) { if (!composite.isDisposed()) { composite.dispose(); } } for (Button toDispose : removes) { if (toDispose != null && !toDispose.isDisposed()) { toDispose.dispose(); } } }
Example 2
Source File: NumberEditor.java From gama with GNU General Public License v3.0 | 6 votes |
@Override protected void checkButtons() { super.checkButtons(); final Button t = items[DEFINE]; if (t == null || t.isDisposed()) { return; } if (param.isDefined()) { t.setToolTipText("Set the parameter to undefined"); t.setImage(GamaIcons.create("small.undefine").image()); getEditorControl().setEnabled(true); } else { t.setToolTipText("Define the parameter (currently undefined)"); t.setImage(GamaIcons.create("small.define").image()); getEditorControl().setEnabled(false); } }
Example 3
Source File: SWTCheckBoxListWidget.java From atdl4j with MIT License | 6 votes |
@Override public void processReinit( Object aControlInitValue ) { if ( aControlInitValue != null ) { // -- apply initValue if one has been specified -- setValue( (String) aControlInitValue, true ); } else { // -- reset each when no initValue exists -- for ( Button tempButton : multiCheckBox ) { if ( ( tempButton != null ) && ( ! tempButton.isDisposed() ) ) { tempButton.setSelection( false ); } } } }
Example 4
Source File: MatrixEditor.java From gama with GNU General Public License v3.0 | 5 votes |
@Override protected void checkButtons() { final Button edit = items[EDIT]; if (edit != null && !edit.isDisposed()) { edit.setEnabled(true); } }
Example 5
Source File: SelectionStatusDialog.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * Update the status of the ok button to reflect the given status. Subclasses * may override this method to update additional buttons. * @param status */ protected void updateButtonsEnableState(IStatus status) { Button okButton = getOkButton(); if (okButton != null && !okButton.isDisposed()) { okButton.setEnabled(!status.matches(IStatus.ERROR)); } }
Example 6
Source File: LevelPropertyDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
private void setButtonEnabled( Button button, boolean enabled ) { if ( button != null && !button.isDisposed( ) ) { button.setEnabled( enabled ); } }
Example 7
Source File: OperationsComposite.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void dispose() { super.dispose(); for (final OperationViewer text : operationViewers) { if (text != null) { text.dispose(); } } for (final Button toDispose : removes) { if (toDispose != null && !toDispose.isDisposed()) { toDispose.dispose(); } } }
Example 8
Source File: ExpressionEditor.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Update the status of the ok button to reflect the given status. * Subclasses may override this method to update additional buttons. * * @param status */ protected void updateButtonsEnableState( IStatus status ) { Button okButton = getOkButton( ); if ( okButton != null && !okButton.isDisposed( ) ) { okButton.setEnabled( !status.matches( IStatus.ERROR ) ); } }
Example 9
Source File: OperationGroupViewer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public void dispose() { for (final OperationViewer text : operationViewers) { if (text != null) { text.dispose(); } } for (final Button toDispose : removes) { if (toDispose != null && !toDispose.isDisposed()) { toDispose.dispose(); } } getOperations().removeListChangeListener(operationListlistener); }
Example 10
Source File: IntEditor.java From gama with GNU General Public License v3.0 | 5 votes |
@Override protected void checkButtons() { super.checkButtons(); final Button plus = items[PLUS]; if (plus != null && !plus.isDisposed()) { plus.setEnabled(param.isDefined() && (maxValue == null || applyPlus() < maxValue.intValue())); } final Button minus = items[MINUS]; if (minus != null && !minus.isDisposed()) { minus.setEnabled(param.isDefined() && (minValue == null || applyMinus() > minValue.intValue())); } }
Example 11
Source File: FloatEditor.java From gama with GNU General Public License v3.0 | 5 votes |
@Override protected void checkButtons() { super.checkButtons(); final Button plus = items[PLUS]; if (plus != null && !plus.isDisposed()) { plus.setEnabled(param.isDefined() && (maxValue == null || applyPlus() < maxValue.doubleValue())); } final Button minus = items[MINUS]; if (minus != null && !minus.isDisposed()) { minus.setEnabled(param.isDefined() && (minValue == null || applyMinus() > minValue.doubleValue())); } }
Example 12
Source File: SelectModulaSourceFileDialog.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
@Override protected void updateButtonsEnableState(IStatus status) { Button okButton = getOkButton(); StructuredSelection ss = getSelectedItems(); if (ss.size() == 0 || (ss.getFirstElement() instanceof ListItem && ((ListItem)ss.getFirstElement()).isDelimiter())) { if (okButton != null && !okButton.isDisposed()) { okButton.setEnabled(false); } } else { super.updateButtonsEnableState(status); } }
Example 13
Source File: AbstractPreferencePage.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * Loads values of all field editors using current search scopes in the preference store. Also updates fields * enabled status. (The effect is that fields show project specific values when enabled, and instance scoped/default * values when disabled). */ protected void updateFieldEditors(boolean enabled) { Composite parent = getFieldEditorParent(); for (FieldEditor editor : editors) { editor.load(); editor.setEnabled(enabled, parent); } Button defaultsButton = getDefaultsButton(); if (defaultsButton != null && !defaultsButton.isDisposed()) { defaultsButton.setEnabled(enabled); } }
Example 14
Source File: M2DocFileSelectionDialog.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
@Override public void selectionChanged(SelectionChangedEvent event) { final Object selected = ((IStructuredSelection) event.getSelection()).getFirstElement(); final Button okButton = getButton(OK); final boolean enableOkButton; if (selected instanceof IFile) { final IFile file = (IFile) selected; fileText.setText(file.getFullPath().toString()); fileName = file.getFullPath().toString(); enableOkButton = true; } else if (!onlyFileSelection && selected instanceof IContainer) { final IContainer container = (IContainer) selected; final int lastSlashIndex = fileName.lastIndexOf("/"); final String newFileName; if (lastSlashIndex >= 0) { newFileName = container.getFullPath().toString() + fileName.substring(lastSlashIndex); } else { newFileName = container.getFullPath().toString() + "/" + fileName; } fileText.setText(newFileName); fileName = newFileName; enableOkButton = true; } else { enableOkButton = false; } if (okButton != null && !okButton.isDisposed()) { okButton.setEnabled(enableOkButton); } }
Example 15
Source File: AbstractEditor.java From gama with GNU General Public License v3.0 | 4 votes |
protected void checkButtons() { final Button revert = items[REVERT]; if (revert == null || revert.isDisposed()) { return; } revert.setEnabled(currentValue == null ? originalValue != null : !currentValue.equals(originalValue)); }
Example 16
Source File: DelegateUIHelper.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private static void saveBooleanSetting(String key, Button button) { if (button != null && !button.isDisposed() && button.getEnabled()) JavaPlugin.getDefault().getDialogSettings().put(key, button.getSelection()); }
Example 17
Source File: LaunchSelectionDialog.java From eclipse-extras with Eclipse Public License 1.0 | 4 votes |
private void updateEditButtonEnablement( IAction action ) { Button button = getButton( EDIT_BUTTON_ID ); if( button != null && !button.isDisposed() ) { button.setEnabled( action.isEnabled() ); } }
Example 18
Source File: EnumDataTypeDialog.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
protected void updateButtonEnablementReversedToEmptinessOfList(final Button button, final TableViewer list) { if (button != null && !button.isDisposed()) { button.setEnabled(!list.getSelection().isEmpty()); } }
Example 19
Source File: AbstractEntryComposite.java From ice with Eclipse Public License 1.0 | 4 votes |
@Override public void refresh() { logger.info("Refresh called for " + entry.getName()); if (label != null) { label.dispose(); label = null; } if (widget != null) { logger.info("Disposing widget - " + widget.getClass().getCanonicalName()); widget.dispose(); widget = null; } for (Button button : buttons) { if (!button.isDisposed()) { button.dispose(); } } // Remove all of the previous buttons. buttons.clear(); // Print an error if this Entry has been prematurely disposed. if (isDisposed()) { logger.info("EntryComposite Message: " + "This composite has been prematurely disposed!"); return; } // Remove the resize listener. if (resizeListener != null) { removeControlListener(resizeListener); resizeListener = null; } // Re-render the Composite render(); // Re-draw the Composite layout(); return; }
Example 20
Source File: IntRadioListSwtParameter.java From BiglyBT with GNU General Public License v2.0 | 4 votes |
/** * Make UI components for a list of in values, displayed as radio buttons * <p/> * When parent composite is of GridLayout, resulting new widgets will take 2 columns * * @param composite Where widgets will be placed. Composite is not altered * @param paramID ID of the parameter (usually config id) * @param labelKey Messagebundle key for the text shown before text box * @param values list of values that can be stored * @param displayStrings fancy words representing each value * @param compact true - all in one wrappable row; false - one option per row * @param valueProcessor null if you want to use COConfigurationManager */ public IntRadioListSwtParameter(Composite composite, String paramID, String labelKey, int[] values, String[] displayStrings, boolean compact, SwtParameterValueProcessor<IntRadioListSwtParameter, Integer> valueProcessor) { super(paramID); this.values = values; boolean doGridData = doGridData(composite); createStandardLabel(composite, labelKey); cHolder = new Composite(composite, SWT.NONE); setMainControl(cHolder); RowLayout rowLayout = Utils.getSimpleRowLayout(false); rowLayout.type = compact ? SWT.HORIZONTAL : SWT.VERTICAL; cHolder.setLayout(rowLayout); if (doGridData) { GridData gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 2; cHolder.setLayoutData(gridData); } radios = new Button[displayStrings.length]; if (displayStrings.length != values.length) { return; } Listener listener = event -> { Button button = (Button) event.widget; if (button == null || button.isDisposed()) { return; } if (button.getSelection()) { int val = ((Number) button.getData("value")).intValue(); setValue(val); } }; for (int i = 0; i < displayStrings.length; i++) { radios[i] = new Button(cHolder, SWT.RADIO); radios[i].setText(displayStrings[i]); radios[i].setData("value", values[i]); radios[i].addListener(SWT.Selection, listener); } if (valueProcessor != null) { setValueProcessor(valueProcessor); } else if (this.paramID != null) { setConfigValueProcessor(Integer.class); } }