public boolean hasValue(String value) { return value.equals(getPreferences().get(getKey())); }
protected void comboSelected(int index) { getPreferences().put(getKey(), fValues[index]); setChanged(); notifyObservers(fValues[index]); }
tabPolicy.addObserver(new Observer() { @Override public void update(Observable o, Object arg) {
tabPolicy.addObserver(new Observer() { public void update(Observable o, Object arg) { updateTabPreferences((String) arg, tabSize, indentSize, onlyForLeading);
@Override protected void doCreatePreferences(Composite composite, int numColumns) { final Group group= createGroup(numColumns, composite, FormatterMessages.BracesTabPage_group_brace_positions_title); createBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_class_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION); createBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_anonymous_class_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION); createBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_constructor_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION); createBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_method_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION); createBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_enum_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION); createBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_enumconst_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT); createBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_annotation_type_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANNOTATION_TYPE_DECLARATION); createBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_blocks, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK); createBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_blocks_in_case, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE); createBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_switch_case, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH); ComboPreference arrayInitOption= createBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_array_initializer, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER); final CheckboxPreference arrayInitCheckBox= createIndentedCheckboxPref(group, numColumns, FormatterMessages.BracesTabPage_option_keep_empty_array_initializer_on_one_line, DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE, FALSE_TRUE); arrayInitOption.addObserver(new Observer() { @Override public void update(Observable o, Object arg) { updateOptionEnablement((ComboPreference) o, arrayInitCheckBox); } }); updateOptionEnablement(arrayInitOption, arrayInitCheckBox); createBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_lambda_body, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_LAMBDA_BODY); }
protected void doCreatePreferences(Composite composite, int numColumns) { final Group group= createGroup(numColumns, composite, FormatterMessages.BracesTabPage_group_brace_positions_title); createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_class_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION); createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_anonymous_class_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION); createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_constructor_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION); createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_method_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION); createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_enum_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION); createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_enumconst_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT); createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_annotation_type_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANNOTATION_TYPE_DECLARATION); createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_blocks, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK); createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_blocks_in_case, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE); createBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_switch_case, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH); ComboPreference arrayInitOption= createBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_array_initializer, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER); final CheckboxPreference arrayInitCheckBox= createIndentedCheckboxPref(group, numColumns, FormatterMessages.BracesTabPage_option_keep_empty_array_initializer_on_one_line, DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE, FALSE_TRUE); arrayInitOption.addObserver(new Observer() { public void update(Observable o, Object arg) { updateOptionEnablement((ComboPreference) o, arrayInitCheckBox); } }); updateOptionEnablement(arrayInitOption, arrayInitCheckBox); }
public boolean hasValue(String value) { return value.equals(getPreferences().get(getKey())); }
public boolean hasValue(String value) { return value.equals(getPreferences().get(getKey())); }
protected ComboPreference createComboPref(Composite composite, int numColumns, String name, String key, String [] values, String [] items) { final ComboPreference pref= new ComboPreference(composite, numColumns, fWorkingValues, key, values, name, items); fDefaultFocusManager.add(pref); pref.addObserver(fUpdater); return pref; }
public String getSelectedItem() { final String selected= getPreferences().get(getKey()); for (int i= 0; i < fValues.length; i++) { if (fValues[i].equals(selected)) { return fItems[i]; } } return ""; //$NON-NLS-1$ }
protected ComboPreference createComboPref(Composite composite, int numColumns, String name, String key, String [] values, String [] items) { final ComboPreference pref= new ComboPreference(composite, numColumns, fWorkingValues, key, values, name, items); fDefaultFocusManager.add(pref); pref.addObserver(fUpdater); return pref; }
public String getSelectedItem() { final String selected= (String)getPreferences().get(getKey()); for (int i= 0; i < fValues.length; i++) { if (fValues[i].equals(selected)) { return fItems[i]; } } return ""; //$NON-NLS-1$ }
public String getSelectedItem() { final String selected= getPreferences().get(getKey()); for (int i= 0; i < fValues.length; i++) { if (fValues[i].equals(selected)) { return fItems[i]; } } return ""; //$NON-NLS-1$ }
protected void comboSelected(int index) { getPreferences().put(getKey(), fValues[index]); setChanged(); notifyObservers(fValues[index]); }
@Override public void widgetSelected(SelectionEvent e) { comboSelected(((Combo)e.widget).getSelectionIndex()); } });
protected ComboPreference createComboPref(Composite composite, int numColumns, String name, String key, String [] values, String [] items) { final ComboPreference pref= new ComboPreference(composite, numColumns, fWorkingValues, key, values, name, items); fDefaultFocusManager.add(pref); pref.addObserver(fUpdater); return pref; }
protected void updateWidget() { if (getKey() != null) { fCombo.setEnabled(getEnabled()); fCombo.setText(getSelectedItem()); } else { fCombo.setText(""); //$NON-NLS-1$ fCombo.setEnabled(false); } }