/** * Method declared on IPreferencePage. * * @return performOK */ public boolean performOk() { // read preferences from widgets boolean showCount = m_showContainerCount.getSelection(); // set preferences in store getPreferenceStore().setValue(Constants.SHOWCHILDCOUNT_KEY, showCount); getPreferenceStore() .setValue( Constants.MAPPING_MOD_KEY, InputCodeHelper.getInstance().getModifier()[m_mappingModifier.getSelectionIndex()]); getPreferenceStore() .setValue( Constants.MAPPING_WITH_PARENTS_MOD_KEY, InputCodeHelper.getInstance() .getModifier()[m_mappingWithParentsModifier.getSelectionIndex()]); InputComboUtil.setPrefCode(m_mappingKey, getPreferenceStore(), Constants.MAPPING_TRIGGER_KEY); InputComboUtil.setPrefType( m_mappingKey, getPreferenceStore(), Constants.MAPPING_TRIGGER_TYPE_KEY); InputComboUtil.setPrefCode( m_mappingWithParentsKey, getPreferenceStore(), Constants.MAPPING_WITH_PARENTS_TRIGGER_KEY); InputComboUtil.setPrefType( m_mappingWithParentsKey, getPreferenceStore(), Constants.MAPPING_WITH_PARENTS_TRIGGER_TYPE_KEY); return super.performOk(); }
/** @param parent parent of this Combo */ private void createShortCutsArea(Composite parent) { InputCodeHelper keys = InputCodeHelper.getInstance(); Composite composite = new Composite(parent, SWT.NONE); compositeGridData(composite, NUM_COLUMNS); Label label = new Label(composite, SWT.NONE); label.setText(Messages.ObjectMappingPreferencePageCollectShortcut); label.setFont(LayoutUtil.BOLD_TAHOMA); GridData data2 = new GridData(); data2.horizontalSpan = 4; label.setLayoutData(data2); label = new Label(composite, SWT.NONE); m_mappingModifier = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); m_mappingModifier.setItems(keys.getModifierString()); label = new Label(composite, SWT.NONE); label.setText(" + "); // $NON-NLS-1$ m_mappingKey = InputComboUtil.createInputCombo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); label = new Label(composite, SWT.NONE); label.setText(Messages.ObjectMappingPreferencePageCollectWithParentsShortcut); label.setFont(LayoutUtil.BOLD_TAHOMA); label.setLayoutData(data2); label = new Label(composite, SWT.NONE); m_mappingWithParentsModifier = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); m_mappingWithParentsModifier.setItems(keys.getModifierString()); label = new Label(composite, SWT.NONE); label.setText(" + "); // $NON-NLS-1$ m_mappingWithParentsKey = InputComboUtil.createInputCombo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); }
/** * Performs special processing when this page's Restore Defaults button has been pressed. Sets the * contents of the nameEntry field to be the default */ protected void performDefaults() { // sets widgets to default values m_showContainerCount.setSelection(getDefaultPrefsBool(Constants.SHOWCHILDCOUNT_KEY)); m_mappingModifier.select( InputCodeHelper.getInstance() .getIndexOfModifier(getDefaultPrefsInt(Constants.MAPPING_MOD_KEY))); m_mappingWithParentsModifier.select( InputCodeHelper.getInstance() .getIndexOfModifier(getDefaultPrefsInt(Constants.MAPPING_WITH_PARENTS_MOD_KEY))); InputComboUtil.setSelectedInput( m_mappingKey, getDefaultPrefsInt(Constants.MAPPING_TRIGGER_KEY), getDefaultPrefsInt(Constants.MAPPING_TRIGGER_TYPE_KEY)); InputComboUtil.setSelectedInput( m_mappingWithParentsKey, getDefaultPrefsInt(Constants.MAPPING_WITH_PARENTS_TRIGGER_KEY), getDefaultPrefsInt(Constants.MAPPING_WITH_PARENTS_TRIGGER_TYPE_KEY)); }