private void insertIntoMap(Map wrappingMap, Map indentMap, Map forceMap, Category category) { final String value= (String)fWorkingValues.get(category.key); Integer wrappingStyle; Integer indentStyle; Boolean forceWrapping; try { wrappingStyle= new Integer(DefaultCodeFormatterConstants.getWrappingStyle(value)); indentStyle= new Integer(DefaultCodeFormatterConstants.getIndentStyle(value)); forceWrapping= new Boolean(DefaultCodeFormatterConstants.getForceWrapping(value)); } catch (IllegalArgumentException e) { forceWrapping= new Boolean(false); indentStyle= new Integer(DefaultCodeFormatterConstants.INDENT_DEFAULT); wrappingStyle= new Integer(DefaultCodeFormatterConstants.WRAP_NO_SPLIT); } increaseMapEntry(wrappingMap, wrappingStyle); increaseMapEntry(indentMap, indentStyle); increaseMapEntry(forceMap, forceWrapping); }
private void insertIntoMap(Map<Object, Integer> wrappingMap, Map<Object, Integer> indentMap, Map<Object, Integer> forceMap, Category category) { final String value= fWorkingValues.get(category.key); Integer wrappingStyle; Integer indentStyle; Boolean forceWrapping; try { wrappingStyle= new Integer(DefaultCodeFormatterConstants.getWrappingStyle(value)); indentStyle= new Integer(DefaultCodeFormatterConstants.getIndentStyle(value)); forceWrapping= Boolean.valueOf(DefaultCodeFormatterConstants.getForceWrapping(value)); } catch (IllegalArgumentException e) { forceWrapping= Boolean.FALSE; indentStyle= new Integer(DefaultCodeFormatterConstants.INDENT_DEFAULT); wrappingStyle= new Integer(DefaultCodeFormatterConstants.WRAP_NO_SPLIT); } increaseMapEntry(wrappingMap, wrappingStyle); increaseMapEntry(indentMap, indentStyle); increaseMapEntry(forceMap, forceWrapping); }
protected boolean valueMatches(StringMatcher matcher) { String value= getPreferences().get(getKey()); int wrappingStyle= DefaultCodeFormatterConstants.getWrappingStyle(value); MenuItem wrapStyleItem= updateMenuItem(fWrapStyleItems, wrappingStyle); if (matcher.match(wrapStyleItem.getText())) return true; if (wrappingStyle == DefaultCodeFormatterConstants.WRAP_NO_SPLIT) return false; boolean forceWrapping= DefaultCodeFormatterConstants.getForceWrapping(value); if (forceWrapping && matcher.match(fForceSplitItem.getToolTipText())) return true; MenuItem indentStyleItem= updateMenuItem(fIndentationItems, DefaultCodeFormatterConstants.getIndentStyle(value)); if (matcher.match(indentStyleItem.getText())) return true; if (fWrapBeforeKey != null) { int wrapBeforeAfterValue= WRAP_BEFORE_PREF_VALUES.indexOf(getPreferences().get(fWrapBeforeKey)); MenuItem wrapBeforeAfterItem= updateMenuItem(fWrapBeforeAfterItems, wrapBeforeAfterValue); if (matcher.match(wrapBeforeAfterItem.getText())) return true; } return false; }
@Override protected void updateWidget() { String value= getPreferences().get(getKey()); int wrappingStyle= DefaultCodeFormatterConstants.getWrappingStyle(value); boolean wrapEnabled= wrappingStyle != DefaultCodeFormatterConstants.WRAP_NO_SPLIT; MenuItem wrapStyleItem= updateMenuItem(fWrapStyleItems, wrappingStyle); fWrapStyleDropDown.setToolTipText(FormatterMessages.FormatterModifyDialog_lineWrap_wrapping_policy_label + wrapStyleItem.getText()); fWrapStyleDropDown.setImage(wrapStyleItem.getImage()); boolean forceWrapping= DefaultCodeFormatterConstants.getForceWrapping(value); fForceSplitItem.setSelection(forceWrapping); fForceSplitItem.setEnabled(wrapEnabled); MenuItem indentStyleItem= updateMenuItem(fIndentationItems, DefaultCodeFormatterConstants.getIndentStyle(value)); fIndentationDropDown.setToolTipText(FormatterMessages.FormatterModifyDialog_lineWrap_indentation_policy_label + indentStyleItem.getText()); fIndentationDropDown.setImage(indentStyleItem.getImage()); fIndentationDropDown.setDisabledImage((Image) indentStyleItem.getData(DATA_IMAGE_DISABLED)); fIndentationDropDown.setEnabled(wrapEnabled); if (fWrapBeforeKey != null) { int wrapBeforeAfterValue= WRAP_BEFORE_PREF_VALUES.indexOf(getPreferences().get(fWrapBeforeKey)); MenuItem wrapBeforeAfterItem= updateMenuItem(fWrapBeforeAfterItems, wrapBeforeAfterValue); fWrapBeforeAfterDropDown.setToolTipText(wrapBeforeAfterItem.getText()); fWrapBeforeAfterDropDown.setImage(wrapBeforeAfterItem.getImage()); fWrapBeforeAfterDropDown.setDisabledImage((Image) wrapBeforeAfterItem.getData(DATA_IMAGE_DISABLED)); fWrapBeforeAfterDropDown.setEnabled(wrapEnabled); } }