|
From: Christopher W. <caw...@us...> - 2006-05-05 21:45:08
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10971/src/org/rubypeople/rdt/internal/ui/preferences Modified Files: PreferencesMessages.java PreferencesMessages.properties ColorSettingPreviewCode.txt RubyEditorColoringConfigurationBlock.java Log Message: add ability to set background color on a token basis (ticket #122) Index: PreferencesMessages.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PreferencesMessages.java 21 Apr 2006 21:13:28 -0000 1.7 --- PreferencesMessages.java 5 May 2006 21:44:59 -0000 1.8 *************** *** 119,122 **** --- 119,123 ---- public static String RubyEditorPreferencePage_closeBrackets; public static String RubyEditorPreferencePage_closeBraces; + public static String RubyEditorPreferencePage_background_color; static { Index: PreferencesMessages.properties =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.properties,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PreferencesMessages.properties 23 Apr 2006 19:58:24 -0000 1.11 --- PreferencesMessages.properties 5 May 2006 21:44:59 -0000 1.12 *************** *** 91,94 **** --- 91,95 ---- RubyEditorPreferencePage_coloring_element=&Element: RubyEditorPreferencePage_color= C&olor: + RubyEditorPreferencePage_background_color= Background Color: RubyEditorPreferencePage_bold= &Bold RubyEditorPreferencePage_italic= &Italic Index: ColorSettingPreviewCode.txt =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/ColorSettingPreviewCode.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ColorSettingPreviewCode.txt 12 Apr 2006 21:26:25 -0000 1.1 --- ColorSettingPreviewCode.txt 5 May 2006 21:44:59 -0000 1.2 *************** *** 3,7 **** =end class ClassName < SuperClass ! CLASS_CONSTANT = 123 $global = 'around the world' # This comment may span only this line --- 3,7 ---- =end class ClassName < SuperClass ! CLASS_CONSTANT = 123 $global = 'around the world' # This comment may span only this line *************** *** 10,13 **** --- 10,14 ---- def initialize(value) @field = value + @char = ?a end Index: RubyEditorColoringConfigurationBlock.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/RubyEditorColoringConfigurationBlock.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RubyEditorColoringConfigurationBlock.java 12 Apr 2006 21:26:25 -0000 1.1 --- RubyEditorColoringConfigurationBlock.java 5 May 2006 21:44:59 -0000 1.2 *************** *** 23,30 **** import org.eclipse.jface.preference.PreferenceConverter; import org.eclipse.jface.resource.JFaceResources; - import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; - import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; --- 23,28 ---- *************** *** 88,91 **** --- 86,91 ---- /** Bold preference key */ private String fBoldKey; + /** Background preference key */ + private String fBackgroundKey; /** Italic preference key */ private String fItalicKey; *************** *** 103,107 **** * Initialize the item with the given values. * @param displayName the display name ! * @param colorKey the color preference key * @param boldKey the bold preference key * @param italicKey the italic preference key --- 103,108 ---- * Initialize the item with the given values. * @param displayName the display name ! * @param colorKey the color preference key\ ! * @param bgColorKey the color preference key * @param boldKey the bold preference key * @param italicKey the italic preference key *************** *** 109,115 **** * @param underlineKey the underline preference key */ ! public HighlightingColorListItem(String displayName, String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) { fDisplayName= displayName; fColorKey= colorKey; fBoldKey= boldKey; fItalicKey= italicKey; --- 110,117 ---- * @param underlineKey the underline preference key */ ! public HighlightingColorListItem(String displayName, String colorKey, String bgColorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) { fDisplayName= displayName; fColorKey= colorKey; + fBackgroundKey = bgColorKey; fBoldKey= boldKey; fItalicKey= italicKey; *************** *** 126,129 **** --- 128,138 ---- /** + * @return the background preference key + */ + public String getBackgroundKey() { + return fBackgroundKey; + } + + /** * @return the bold preference key */ *************** *** 172,175 **** --- 181,185 ---- * @param displayName the display name * @param colorKey the color preference key + * @param bgColorKey the color preference key * @param boldKey the bold preference key * @param italicKey the italic preference key *************** *** 178,183 **** * @param enableKey the enable preference key */ ! public SemanticHighlightingColorListItem(String displayName, String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey, String enableKey) { ! super(displayName, colorKey, boldKey, italicKey, strikethroughKey, underlineKey); fEnableKey= enableKey; } --- 188,193 ---- * @param enableKey the enable preference key */ ! public SemanticHighlightingColorListItem(String displayName, String colorKey, String bgColorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey, String enableKey) { ! super(displayName, colorKey, bgColorKey, boldKey, italicKey, strikethroughKey, underlineKey); fEnableKey= enableKey; } *************** *** 254,257 **** --- 264,268 ---- private static final String BOLD= PreferenceConstants.EDITOR_BOLD_SUFFIX; + private static final String BACKGROUND= PreferenceConstants.EDITOR_BG_SUFFIX; /** * Preference key suffix for italic preferences. *************** *** 293,297 **** --- 304,310 ---- private ColorSelector fSyntaxForegroundColorEditor; + private ColorSelector fSyntaxBackgroundColorEditor; private Label fColorEditorLabel; + private Label fBackgroundColorEditorLabel; private Button fBoldCheckBox; private Button fEnableCheckbox; *************** *** 343,347 **** for (int i= 0, n= fSyntaxColorListModel.length; i < n; i++) ! fListModel.add(new HighlightingColorListItem (fSyntaxColorListModel[i][0], fSyntaxColorListModel[i][1], fSyntaxColorListModel[i][1] + BOLD, fSyntaxColorListModel[i][1] + ITALIC, fSyntaxColorListModel[i][1] + STRIKETHROUGH, fSyntaxColorListModel[i][1] + UNDERLINE)); store.addKeys(createOverlayStoreKeys()); --- 356,360 ---- for (int i= 0, n= fSyntaxColorListModel.length; i < n; i++) ! fListModel.add(new HighlightingColorListItem (fSyntaxColorListModel[i][0], fSyntaxColorListModel[i][1], fSyntaxColorListModel[i][1] + BACKGROUND, fSyntaxColorListModel[i][1] + BOLD, fSyntaxColorListModel[i][1] + ITALIC, fSyntaxColorListModel[i][1] + STRIKETHROUGH, fSyntaxColorListModel[i][1] + UNDERLINE)); store.addKeys(createOverlayStoreKeys()); *************** *** 453,456 **** --- 466,470 ---- fEnableCheckbox.setEnabled(false); fSyntaxForegroundColorEditor.getButton().setEnabled(false); + fSyntaxBackgroundColorEditor.getButton().setEnabled(false); fColorEditorLabel.setEnabled(false); fBoldCheckBox.setEnabled(false); *************** *** 461,465 **** } RGB rgb= PreferenceConverter.getColor(getPreferenceStore(), item.getColorKey()); ! fSyntaxForegroundColorEditor.setColorValue(rgb); fBoldCheckBox.setSelection(getPreferenceStore().getBoolean(item.getBoldKey())); fItalicCheckBox.setSelection(getPreferenceStore().getBoolean(item.getItalicKey())); --- 475,482 ---- } RGB rgb= PreferenceConverter.getColor(getPreferenceStore(), item.getColorKey()); ! fSyntaxForegroundColorEditor.setColorValue(rgb); ! rgb= PreferenceConverter.getColor(getPreferenceStore(), item.getBackgroundKey()); ! // TODO If we get back default color, show the default text editor bg color. ! fSyntaxBackgroundColorEditor.setColorValue(rgb); fBoldCheckBox.setSelection(getPreferenceStore().getBoolean(item.getBoldKey())); fItalicCheckBox.setSelection(getPreferenceStore().getBoolean(item.getItalicKey())); *************** *** 471,474 **** --- 488,492 ---- fEnableCheckbox.setSelection(enable); fSyntaxForegroundColorEditor.getButton().setEnabled(enable); + fSyntaxBackgroundColorEditor.getButton().setEnabled(enable); fColorEditorLabel.setEnabled(enable); fBoldCheckBox.setEnabled(enable); *************** *** 478,481 **** --- 496,500 ---- } else { fSyntaxForegroundColorEditor.getButton().setEnabled(true); + fSyntaxBackgroundColorEditor.getButton().setEnabled(true); fColorEditorLabel.setEnabled(true); fBoldCheckBox.setEnabled(true); *************** *** 582,585 **** --- 601,620 ---- foregroundColorButton.setLayoutData(gd); + + // Background color + // TODO Create an enable/system default checkbox for background + fBackgroundColorEditorLabel= new Label(stylesComposite, SWT.LEFT); + fBackgroundColorEditorLabel.setText(PreferencesMessages.RubyEditorPreferencePage_background_color); + gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); + gd.horizontalIndent= 20; + fBackgroundColorEditorLabel.setLayoutData(gd); + + fSyntaxBackgroundColorEditor= new ColorSelector(stylesComposite); + Button backgroundColorButton= fSyntaxBackgroundColorEditor.getButton(); + gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); + backgroundColorButton.setLayoutData(gd); + + + fBoldCheckBox= new Button(stylesComposite, SWT.CHECK); fBoldCheckBox.setText(PreferencesMessages.RubyEditorPreferencePage_bold); *************** *** 635,638 **** --- 670,683 ---- } }); + + backgroundColorButton.addSelectionListener(new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + // do nothing + } + public void widgetSelected(SelectionEvent e) { + HighlightingColorListItem item= getHighlightingColorListItem(); + PreferenceConverter.setValue(getPreferenceStore(), item.getBackgroundKey(), fSyntaxBackgroundColorEditor.getColorValue()); + } + }); fBoldCheckBox.addSelectionListener(new SelectionListener() { *************** *** 686,689 **** --- 731,735 ---- fEnableCheckbox.setSelection(enable); fSyntaxForegroundColorEditor.getButton().setEnabled(enable); + fSyntaxBackgroundColorEditor.getButton().setEnabled(enable); fColorEditorLabel.setEnabled(enable); fBoldCheckBox.setEnabled(enable); |