public void refresh() { if (!isPageOpened()) { return; } super.refresh(); _defaultButton.removeSelectionListener(_defaultpctSelectionListener); _userDefinedButton.removeSelectionListener(_udpctfreeSelectionListener); _percentageSpinner.removeSelectionListener(_percentageSpinnerListener); // -1 means default if (((SybaseASATable) _table).getPctfree() == -1) { _defaultButton.setSelection(true); _userDefinedButton.setSelection(false); _percentageSpinner.setEnabled(false); _defaultButton.notifyListeners(SWT.Selection, new Event()); } else { _userDefinedButton.setSelection(true); _defaultButton.setSelection(false); _percentageSpinner.setEnabled(true); int percentage = _percentageSpinner.getSelection(); String info = "% ("; // $NON-NLS-1$ int reservedBytes = (percentage * 2048) / 100; info = info + reservedBytes + Messages.ASAStorageEditorPage_bytes_reserved; _tipLabel.setText(info); ((SybaseASATable) _table).setPctfree(_percentageSpinner.getSelection()); } _defaultButton.addSelectionListener(_defaultpctSelectionListener); _userDefinedButton.addSelectionListener(_udpctfreeSelectionListener); _percentageSpinner.addSelectionListener(_percentageSpinnerListener); }
public void widgetSelected(SelectionEvent e) { int percentage = _percentageSpinner.getSelection(); String info = "% ("; // $NON-NLS-1$ int reservedBytes = (percentage * 2048) / 100; info = info + reservedBytes + Messages.ASAStorageEditorPage_reserved_bytes; _tipLabel.setText(info); ((SybaseASATable) _table).setPctfree(_percentageSpinner.getSelection()); ASAStorageEditorPage.this.markDirty(); }
public void widgetSelected(SelectionEvent e) { if (_userDefinedButton.getSelection()) { _percentageSpinner.setEnabled(true); ((SybaseASATable) _table).setPctfree(_percentageSpinner.getSelection()); ASAStorageEditorPage.this.markDirty(); } else { _percentageSpinner.setEnabled(false); } }
public void createSectionContent(Composite parent) { if (!(_table instanceof SybaseASATable)) { return; } getSection().setLayoutData(new GridData(GridData.FILL_BOTH)); getSection().setLayout(new GridLayout()); GridLayout layout = new GridLayout(); parent.setLayout(layout); parent.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite dbSpaceComp = _toolkit.createComposite(parent); layout = new GridLayout(); layout.numColumns = 2; dbSpaceComp.setLayout(layout); LabelFormEntry spaceName = new LabelFormEntry( dbSpaceComp, _toolkit, SWT.NONE, Messages.ASAStorageEditorPage_dbspace_name, 2); spaceName .getValueLabel() .setText( ((SybaseASATable) _table).getDbSpace() == null ? "" : ((SybaseASATable) _table).getDbSpace().getName()); // $NON-NLS-1$ LabelFormEntry spaceFile = new LabelFormEntry( dbSpaceComp, _toolkit, SWT.NONE, Messages.ASAStorageEditorPage_file, 2); spaceFile .getValueLabel() .setText( ((SybaseASATable) _table).getDbSpace() == null ? "" : ((SybaseASATable) _table).getDbSpace().getFileName()); // $NON-NLS-1$ Composite pctFreeComp = _toolkit.createComposite(parent); layout = new GridLayout(); layout.numColumns = 2; pctFreeComp.setLayout(layout); LabelFormEntry pctFreeLabel = new LabelFormEntry( pctFreeComp, _toolkit, SWT.NONE, Messages.ASAStorageEditorPage_bytes_reserved_label, 2); pctFreeLabel.getValueLabel().setText(" "); // $NON-NLS-1$ Composite pctFreeValueComp = _toolkit.createComposite(parent); layout = new GridLayout(); layout.numColumns = 4; pctFreeValueComp.setLayout(layout); _defaultButton = _toolkit.createButton(pctFreeValueComp, Messages.ASAStorageEditorPage_default, SWT.RADIO); _defaultButton.setToolTipText(Messages.ASAStorageEditorPage_default_tip); _defaultButton.addSelectionListener(_defaultpctSelectionListener); _userDefinedButton = _toolkit.createButton( pctFreeValueComp, Messages.ASAStorageEditorPage_percentage, SWT.RADIO); _userDefinedButton.setToolTipText(Messages.ASAStorageEditorPage_percentage_tip); _percentageSpinner = new Spinner(pctFreeValueComp, SWT.BORDER); _percentageSpinner.setToolTipText(Messages.ASAStorageEditorPage_percentage_tip); // By default, the percentage is 10 _percentageSpinner.setSelection(10); _tipLabel = _toolkit.createLabel(pctFreeValueComp, Messages.ASAStorageEditorPage_204_default); GridData gd = new GridData(GridData.FILL_HORIZONTAL); _tipLabel.setLayoutData(gd); // -1 means default if (((SybaseASATable) _table).getPctfree() == -1) { _defaultButton.setSelection(true); _percentageSpinner.setEnabled(false); } else { _userDefinedButton.setSelection(true); _percentageSpinner.setSelection(((SybaseASATable) _table).getPctfree()); int percentage = _percentageSpinner.getSelection(); String info = "% ("; // $NON-NLS-1$ int reservedBytes = (percentage * 2048) / 100; info = info + reservedBytes + Messages.ASAStorageEditorPage_byte_reserved_for_table; _tipLabel.setText(info); ((SybaseASATable) _table).setPctfree(_percentageSpinner.getSelection()); } _userDefinedButton.addSelectionListener(_udpctfreeSelectionListener); _percentageSpinner.addSelectionListener(_percentageSpinnerListener); }