You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
(41) |
Apr
(9) |
May
|
Jun
|
Jul
(39) |
Aug
(38) |
Sep
(135) |
Oct
(220) |
Nov
(75) |
Dec
(74) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(44) |
Feb
(160) |
Mar
(49) |
Apr
(69) |
May
(40) |
Jun
(52) |
Jul
(47) |
Aug
(51) |
Sep
(19) |
Oct
(22) |
Nov
(36) |
Dec
(76) |
| 2007 |
Jan
(154) |
Feb
(165) |
Mar
(186) |
Apr
(143) |
May
(175) |
Jun
(133) |
Jul
(203) |
Aug
(177) |
Sep
(136) |
Oct
|
Nov
|
Dec
|
|
From: Christopher W. <caw...@us...> - 2006-04-13 23:14:28
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12075/src/org/rubypeople/rdt/internal/core Modified Files: RubyScript.java Log Message: Fix ticket #806 from RadRails trac site. When two class with the same base name are created in separate files, editing the files and attempting to save would fail with a mysterious Update conflict message. The problem was that we stole the hashcode implementation from JDT, but we don't have the same model structure. So we hashed only on the classname (minus namespace). I changed it so that RubyScripts hash on the underlyingFile's hashCode (hopefully this won't introduce other errors where we somehow have a RubyScript without an underlying IFile.). Index: RubyScript.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** RubyScript.java 28 Mar 2006 23:15:43 -0000 1.20 --- RubyScript.java 13 Apr 2006 23:14:23 -0000 1.21 *************** *** 468,471 **** --- 468,475 ---- return this.owner.equals(other.owner) && super.equals(obj); } + + public int hashCode() { + return this.underlyingFile.hashCode(); + } public boolean exists() { |
|
From: Christopher W. <caw...@us...> - 2006-04-13 23:01:28
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1873/src/org/rubypeople/rdt/ui/wizards Modified Files: RubyNewClassWizard.java Log Message: move folding preferences to its own page (child of editor pref page), remove old tab for folding on editor pref page, define open editor command, Fix class wizard to handle namespaces in class names, fix class wizard to generate correct filename when class name has a namespace, Extract strings for Folding and syntax coloring preference pages (so they could be translated), Fix output of task tag name for default task tag in task tag preference page list Index: RubyNewClassWizard.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/wizards/RubyNewClassWizard.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RubyNewClassWizard.java 17 Feb 2006 20:38:53 -0000 1.2 --- RubyNewClassWizard.java 13 Apr 2006 23:00:38 -0000 1.3 *************** *** 154,157 **** --- 154,158 ---- */ private String classNameToFileName(String className) { + className = stripNamespace(className); StringBuffer buffer = new StringBuffer(); for (int i = 0; i < className.length(); i++) { *************** *** 167,171 **** } ! /** * We will initialize file contents with a sample text. * --- 168,180 ---- } ! private String stripNamespace(String className) { ! if (className == null || className.length() == 0) return className; ! if (className.lastIndexOf("::") != -1) { ! return className.substring(className.lastIndexOf("::") + 2); ! } ! return className; ! } ! ! /** * We will initialize file contents with a sample text. * |
|
From: Christopher W. <caw...@us...> - 2006-04-13 23:01:27
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1873/src/org/rubypeople/rdt/internal/ui/wizards Modified Files: RubyNewClassWizardPage.java Log Message: move folding preferences to its own page (child of editor pref page), remove old tab for folding on editor pref page, define open editor command, Fix class wizard to handle namespaces in class names, fix class wizard to generate correct filename when class name has a namespace, Extract strings for Folding and syntax coloring preference pages (so they could be translated), Fix output of task tag name for default task tag in task tag preference page list Index: RubyNewClassWizardPage.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/wizards/RubyNewClassWizardPage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RubyNewClassWizardPage.java 31 Jan 2006 20:29:53 -0000 1.1 --- RubyNewClassWizardPage.java 13 Apr 2006 23:00:38 -0000 1.2 *************** *** 1,4 **** --- 1,6 ---- package org.rubypeople.rdt.internal.ui.wizards; + import java.util.StringTokenizer; + import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IResource; *************** *** 216,219 **** --- 218,225 ---- if (!Character.isLowerCase(className.charAt(0)) && !Character.isLetter(className.charAt(0))) return false; + int namespaceDelimeterIndex = className.indexOf("::"); + if (namespaceDelimeterIndex != -1) { + return isConstant(className.substring(0, namespaceDelimeterIndex)) && isConstant(className.substring(namespaceDelimeterIndex+2)); + } for (int i = 0; i < className.length(); i++) { char c = className.charAt(i); |
|
From: Christopher W. <caw...@us...> - 2006-04-13 23:00:45
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1873/src/org/rubypeople/rdt/internal/ui/preferences Modified Files: TextEditorPreferencePage2.java PreferencesMessages.java TodoTaskConfigurationBlock.java FoldingConfigurationBlock.java PreferencesMessages.properties Added Files: FoldingPreferencePage.java Log Message: move folding preferences to its own page (child of editor pref page), remove old tab for folding on editor pref page, define open editor command, Fix class wizard to handle namespaces in class names, fix class wizard to generate correct filename when class name has a namespace, Extract strings for Folding and syntax coloring preference pages (so they could be translated), Fix output of task tag name for default task tag in task tag preference page list Index: PreferencesMessages.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PreferencesMessages.java 12 Apr 2006 21:26:25 -0000 1.5 --- PreferencesMessages.java 13 Apr 2006 23:00:38 -0000 1.6 *************** *** 101,104 **** --- 101,105 ---- public static String RubyEditorPreferencePage_empty_input; public static String RubyEditorPreferencePage_invalid_input; + public static String RubyEditorPreferencePage_folding_title; 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.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PreferencesMessages.properties 12 Apr 2006 21:26:25 -0000 1.8 --- PreferencesMessages.properties 13 Apr 2006 23:00:38 -0000 1.9 *************** *** 84,87 **** --- 84,88 ---- RubyEditorPreferencePage_invalid_input=''{0}'' is not a valid input. RubyEditorPreferencePage_enable= Enab&le + RubyEditorPreferencePage_folding_title= &Folding # coloring Index: TextEditorPreferencePage2.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/TextEditorPreferencePage2.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** TextEditorPreferencePage2.java 12 Apr 2006 21:26:25 -0000 1.24 --- TextEditorPreferencePage2.java 13 Apr 2006 23:00:38 -0000 1.25 *************** *** 18,22 **** import org.eclipse.jface.dialogs.DialogPage; import org.eclipse.jface.dialogs.IMessageProvider; - import org.eclipse.jface.preference.ColorFieldEditor; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; --- 18,21 ---- *************** *** 27,34 **** import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; - import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; - import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Link; --- 26,31 ---- *************** *** 45,49 **** import org.rubypeople.rdt.internal.ui.RubyUIMessages; import org.rubypeople.rdt.internal.ui.dialogs.StatusInfo; - import org.rubypeople.rdt.internal.ui.text.IRubyColorConstants; import org.rubypeople.rdt.ui.PreferenceConstants; --- 42,45 ---- *************** *** 77,83 **** }; - private org.rubypeople.rdt.internal.ui.preferences.FoldingConfigurationBlock fFoldingConfigurationBlock; - - public TextEditorPreferencePage2() { setDescription(RubyUIMessages.getString("RubyEditorPreferencePage.description")); //$NON-NLS-1$ --- 73,76 ---- *************** *** 167,174 **** * @see PreferencePage#createContents(Composite) */ ! protected Control createContents(Composite parent) { ! ! fFoldingConfigurationBlock= new FoldingConfigurationBlock(fOverlayStore); ! fOverlayStore.load(); fOverlayStore.start(); --- 160,164 ---- * @see PreferencePage#createContents(Composite) */ ! protected Control createContents(Composite parent) { fOverlayStore.load(); fOverlayStore.start(); *************** *** 185,192 **** item.setText(RubyUIMessages.getString("RubyEditorPropertyPage.codeFormatterTabTitle")); item.setControl(createCodeFormatterPage(folder)); - - item= new TabItem(folder, SWT.NONE); - item.setText(RubyUIMessages.getString("RubyEditorPreferencePage.folding.title")); //$NON-NLS-1$ - item.setControl(fFoldingConfigurationBlock.createControl(folder)); initialize(); --- 175,178 ---- *************** *** 196,203 **** private void initialize() { - initializeFields(); - - fFoldingConfigurationBlock.initialize(); } --- 182,186 ---- *************** *** 206,210 **** */ public boolean performOk() { - fFoldingConfigurationBlock.performOk(); fOverlayStore.propagate(); RubyPlugin.getDefault().savePluginPreferences(); --- 189,192 ---- *************** *** 221,226 **** initializeFields(); - fFoldingConfigurationBlock.performDefaults(); - super.performDefaults(); } --- 203,206 ---- *************** *** 229,235 **** * @see DialogPage#dispose() */ ! public void dispose() { ! fFoldingConfigurationBlock.dispose(); ! if (fOverlayStore != null) { fOverlayStore.stop(); --- 209,213 ---- * @see DialogPage#dispose() */ ! public void dispose() { if (fOverlayStore != null) { fOverlayStore.stop(); Index: TodoTaskConfigurationBlock.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/TodoTaskConfigurationBlock.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TodoTaskConfigurationBlock.java 10 Feb 2006 19:52:26 -0000 1.3 --- TodoTaskConfigurationBlock.java 13 Apr 2006 23:00:38 -0000 1.4 *************** *** 16,28 **** import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IStatus; - - import org.eclipse.swt.SWT; - import org.eclipse.swt.graphics.Font; - import org.eclipse.swt.graphics.Image; - import org.eclipse.swt.layout.GridData; - import org.eclipse.swt.layout.GridLayout; - import org.eclipse.swt.widgets.Composite; - import org.eclipse.swt.widgets.Control; - import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.viewers.IFontProvider; --- 16,19 ---- *************** *** 32,37 **** import org.eclipse.jface.viewers.ViewerSorter; import org.eclipse.jface.window.Window; ! import org.rubypeople.rdt.core.RubyCore; import org.rubypeople.rdt.internal.ui.dialogs.StatusInfo; import org.rubypeople.rdt.internal.ui.wizards.IStatusChangeListener; --- 23,35 ---- import org.eclipse.jface.viewers.ViewerSorter; import org.eclipse.jface.window.Window; ! import org.eclipse.swt.SWT; ! import org.eclipse.swt.graphics.Font; ! import org.eclipse.swt.graphics.Image; ! import org.eclipse.swt.layout.GridData; ! import org.eclipse.swt.layout.GridLayout; ! import org.eclipse.swt.widgets.Composite; ! import org.eclipse.swt.widgets.Control; import org.rubypeople.rdt.core.RubyCore; + import org.rubypeople.rdt.internal.corext.util.Messages; import org.rubypeople.rdt.internal.ui.dialogs.StatusInfo; import org.rubypeople.rdt.internal.ui.wizards.IStatusChangeListener; *************** *** 96,100 **** String name= task.name; if (isDefaultTask(task)) { ! name=PreferencesMessages.TodoTaskConfigurationBlock_tasks_default; } return name; --- 94,98 ---- String name= task.name; if (isDefaultTask(task)) { ! name=Messages.format(PreferencesMessages.TodoTaskConfigurationBlock_tasks_default, name); } return name; Index: FoldingConfigurationBlock.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/FoldingConfigurationBlock.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FoldingConfigurationBlock.java 5 Mar 2005 16:02:19 -0000 1.3 --- FoldingConfigurationBlock.java 13 Apr 2006 23:00:38 -0000 1.4 *************** *** 58,62 **** * @since 3.0 */ ! class FoldingConfigurationBlock { private static class ErrorPreferences implements IRubyFoldingPreferenceBlock { --- 58,62 ---- * @since 3.0 */ ! class FoldingConfigurationBlock implements IPreferenceConfigurationBlock { private static class ErrorPreferences implements IRubyFoldingPreferenceBlock { *************** *** 146,150 **** * @return the control for the preference page */ ! Control createControl(Composite parent) { Composite composite= new Composite(parent, SWT.NULL); --- 146,150 ---- * @return the control for the preference page */ ! public Control createControl(Composite parent) { Composite composite= new Composite(parent, SWT.NULL); *************** *** 312,320 **** } ! void initialize() { restoreFromPreferences(); } ! void performOk() { for (Iterator it= fProviderPreferences.values().iterator(); it.hasNext();) { IRubyFoldingPreferenceBlock prefs= (IRubyFoldingPreferenceBlock) it.next(); --- 312,320 ---- } ! public void initialize() { restoreFromPreferences(); } ! public void performOk() { for (Iterator it= fProviderPreferences.values().iterator(); it.hasNext();) { IRubyFoldingPreferenceBlock prefs= (IRubyFoldingPreferenceBlock) it.next(); *************** *** 323,327 **** } ! void performDefaults() { restoreFromPreferences(); for (Iterator it= fProviderPreferences.values().iterator(); it.hasNext();) { --- 323,327 ---- } ! public void performDefaults() { restoreFromPreferences(); for (Iterator it= fProviderPreferences.values().iterator(); it.hasNext();) { *************** *** 331,335 **** } ! void dispose() { for (Iterator it= fProviderPreferences.values().iterator(); it.hasNext();) { IRubyFoldingPreferenceBlock prefs= (IRubyFoldingPreferenceBlock) it.next(); --- 331,335 ---- } ! public void dispose() { for (Iterator it= fProviderPreferences.values().iterator(); it.hasNext();) { IRubyFoldingPreferenceBlock prefs= (IRubyFoldingPreferenceBlock) it.next(); --- NEW FILE: FoldingPreferencePage.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.rubypeople.rdt.internal.ui.preferences; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.rubypeople.rdt.internal.ui.RubyPlugin; /** * The page for setting the editor options. */ public final class FoldingPreferencePage extends AbstractConfigurationBlockPreferencePage { /* * @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#getHelpId() */ protected String getHelpId() { return null; // TOD) Uncomment when we have IRubyHelpContextIds // return IRubyHelpContextIds.RUBY_EDITOR_PREFERENCE_PAGE; } /* * @see org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setDescription() */ protected void setDescription() { String description= PreferencesMessages.RubyEditorPreferencePage_folding_title; setDescription(description); } /* * @see org.org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setPreferenceStore() */ protected void setPreferenceStore() { setPreferenceStore(RubyPlugin.getDefault().getPreferenceStore()); } protected Label createDescriptionLabel(Composite parent) { return null; // no description for new look. } /* * @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#createConfigurationBlock(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore) */ protected IPreferenceConfigurationBlock createConfigurationBlock(OverlayPreferenceStore overlayPreferenceStore) { return new FoldingConfigurationBlock(overlayPreferenceStore); } } |
|
From: Christopher W. <caw...@us...> - 2006-04-13 23:00:44
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1873 Modified Files: plugin.properties plugin.xml Log Message: move folding preferences to its own page (child of editor pref page), remove old tab for folding on editor pref page, define open editor command, Fix class wizard to handle namespaces in class names, fix class wizard to generate correct filename when class name has a namespace, Extract strings for Folding and syntax coloring preference pages (so they could be translated), Fix output of task tag name for default task tag in task tag preference page list Index: plugin.properties =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/plugin.properties,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** plugin.properties 12 Apr 2006 21:26:25 -0000 1.32 --- plugin.properties 13 Apr 2006 23:00:38 -0000 1.33 *************** *** 47,50 **** --- 47,53 ---- PropertyPageRubyProject.name=Ruby Project Properties + editorSyntaxColoringPage=Syntax Coloring + editorFoldingPage=Folding + EditorRubyFile.name=Ruby Editor EditorRubyFile.extension=rb, rbw, cgi, fcgi, rake, rjs, rxml *************** *** 118,120 **** memberSortPrefName=Members Sort Order ! codeFormatterPrefName=Formatter \ No newline at end of file --- 121,129 ---- memberSortPrefName=Members Sort Order ! codeFormatterPrefName=Formatter ! ! ########################################################################## ! # Navigate Menu ! ########################################################################## ! OpenAction.label=&Open ! OpenAction.tooltip=Open an Editor on the Selected Element \ No newline at end of file Index: plugin.xml =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/plugin.xml,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** plugin.xml 12 Apr 2006 21:26:25 -0000 1.79 --- plugin.xml 13 Apr 2006 23:00:38 -0000 1.80 *************** *** 61,65 **** </page> <page ! name="Syntax Coloring" category="org.rubypeople.rdt.ui.preferences.PreferencePageRubyEditor" class="org.rubypeople.rdt.internal.ui.preferences.RubyEditorColoringPreferencePage" --- 61,65 ---- </page> <page ! name="%editorSyntaxColoringPage" category="org.rubypeople.rdt.ui.preferences.PreferencePageRubyEditor" class="org.rubypeople.rdt.internal.ui.preferences.RubyEditorColoringPreferencePage" *************** *** 67,70 **** --- 67,77 ---- <keywordReference id="org.rubypeople.rdt.ui.syntaxcoloring"/> </page> + <page + name="%editorFoldingPage" + category="org.rubypeople.rdt.ui.preferences.PreferencePageRubyEditor" + class="org.rubypeople.rdt.internal.ui.preferences.FoldingPreferencePage" + id="org.rubypeople.rdt.ui.preferences.FoldingPreferencePage"> + <keywordReference id="org.rubypeople.rdt.ui.folding"/> + </page> </extension> <!-- =========================================================================== --> *************** *** 438,441 **** --- 445,454 ---- name="%ActionDefinition.gotoMatchingBracket.name"> </command> + <command + name="%ActionDefinition.openEditor.name" + description="%ActionDefinition.openEditor.description" + categoryId="org.eclipse.ui.category.navigate" + id="org.rubypeople.rdt.ui.edit.text.ruby.open.editor"> + </command> </extension> <extension |
|
From: Christopher W. <caw...@us...> - 2006-04-12 21:26:32
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25379/src/org/rubypeople/rdt/internal/ui/text/ruby Modified Files: AbstractRubyScanner.java Log Message: a number of changes: - Re-arrange the preferences - add ability to edit ruby editor font - whole new syntax coloring page - new underline/strikethrough options for syntax coloring - fix bug delaying preference changes from applying on syntax coloring to open editors. - Add hyperlink between syntax coloring and general text editor prefs (which apply to coloring/fonts/appearance) - Remove some deprecated code Index: AbstractRubyScanner.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/AbstractRubyScanner.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AbstractRubyScanner.java 2 Mar 2005 00:56:52 -0000 1.5 --- AbstractRubyScanner.java 12 Apr 2006 21:26:25 -0000 1.6 *************** *** 27,30 **** --- 27,32 ---- private String[] fPropertyNamesBold; private String[] fPropertyNamesItalic; + private String[] fPropertyNamesStrikethrough; + private String[] fPropertyNamesUnderline; private IColorManager fColorManager; private IPreferenceStore fPreferenceStore; *************** *** 92,112 **** fPropertyNamesBold = new String[length]; fPropertyNamesItalic = new String[length]; fNeedsLazyColorLoading = Display.getCurrent() == null; - for (int i = 0; i < length; i++) { - fPropertyNamesBold[i] = fPropertyNamesColor[i] + PreferenceConstants.EDITOR_BOLD_SUFFIX; - fPropertyNamesItalic[i] = fPropertyNamesColor[i] + PreferenceConstants.EDITOR_ITALIC_SUFFIX; if (fNeedsLazyColorLoading) ! addTokenWithProxyAttribute(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i]); else ! addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i]); } initializeRules(); } ! private void addTokenWithProxyAttribute(String colorKey, String boldKey, String italicKey) { ! fTokenMap.put(colorKey, new Token(createTextAttribute(null, boldKey, italicKey))); } --- 94,136 ---- fPropertyNamesBold = new String[length]; fPropertyNamesItalic = new String[length]; + fPropertyNamesStrikethrough = new String[length]; + fPropertyNamesUnderline = new String[length]; + for (int i= 0; i < length; i++) { + fPropertyNamesBold[i]= getBoldKey(fPropertyNamesColor[i]); + fPropertyNamesItalic[i]= getItalicKey(fPropertyNamesColor[i]); + fPropertyNamesStrikethrough[i]= getStrikethroughKey(fPropertyNamesColor[i]); + fPropertyNamesUnderline[i]= getUnderlineKey(fPropertyNamesColor[i]); + } + fNeedsLazyColorLoading = Display.getCurrent() == null; for (int i = 0; i < length; i++) { if (fNeedsLazyColorLoading) ! addTokenWithProxyAttribute(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); else ! addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); } initializeRules(); } + + protected String getBoldKey(String colorKey) { + return colorKey + PreferenceConstants.EDITOR_BOLD_SUFFIX; + } ! protected String getItalicKey(String colorKey) { ! return colorKey + PreferenceConstants.EDITOR_ITALIC_SUFFIX; ! } ! ! protected String getStrikethroughKey(String colorKey) { ! return colorKey + PreferenceConstants.EDITOR_STRIKETHROUGH_SUFFIX; ! } ! ! protected String getUnderlineKey(String colorKey) { ! return colorKey + PreferenceConstants.EDITOR_UNDERLINE_SUFFIX; ! } ! ! private void addTokenWithProxyAttribute(String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) { ! fTokenMap.put(colorKey, new Token(createTextAttribute(null, boldKey, italicKey, strikethroughKey, underlineKey))); } *************** *** 114,118 **** if (fNeedsLazyColorLoading && Display.getCurrent() != null) { for (int i = 0; i < fPropertyNamesColor.length; i++) { ! addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i]); } fNeedsLazyColorLoading = false; --- 138,142 ---- if (fNeedsLazyColorLoading && Display.getCurrent() != null) { for (int i = 0; i < fPropertyNamesColor.length; i++) { ! addToken(fPropertyNamesColor[i], fPropertyNamesBold[i], fPropertyNamesItalic[i], fPropertyNamesStrikethrough[i], fPropertyNamesUnderline[i]); } fNeedsLazyColorLoading = false; *************** *** 120,124 **** } ! private void addToken(String colorKey, String boldKey, String italicKey) { if (fColorManager != null && colorKey != null && fColorManager.getColor(colorKey) == null) { RGB rgb = PreferenceConverter.getColor(fPreferenceStore, colorKey); --- 144,148 ---- } ! private void addToken(String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) { if (fColorManager != null && colorKey != null && fColorManager.getColor(colorKey) == null) { RGB rgb = PreferenceConverter.getColor(fPreferenceStore, colorKey); *************** *** 131,138 **** if (!fNeedsLazyColorLoading) ! fTokenMap.put(colorKey, new Token(createTextAttribute(colorKey, boldKey, italicKey))); else { Token token = ((Token) fTokenMap.get(colorKey)); ! if (token != null) token.setData(createTextAttribute(colorKey, boldKey, italicKey)); } } --- 155,162 ---- if (!fNeedsLazyColorLoading) ! fTokenMap.put(colorKey, new Token(createTextAttribute(colorKey, boldKey, italicKey, strikethroughKey, underlineKey))); else { Token token = ((Token) fTokenMap.get(colorKey)); ! if (token != null) token.setData(createTextAttribute(colorKey, boldKey, italicKey, strikethroughKey, underlineKey)); } } *************** *** 153,165 **** * @param italicKey * the italic preference key * @return the created text attribute ! * @since 3.0 */ ! private TextAttribute createTextAttribute(String colorKey, String boldKey, String italicKey) { ! Color color = null; ! if (colorKey != null) color = fColorManager.getColor(colorKey); ! int style = fPreferenceStore.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL; ! if (fPreferenceStore.getBoolean(italicKey)) style |= SWT.ITALIC; return new TextAttribute(color, null, style); --- 177,201 ---- * @param italicKey * the italic preference key + * @param strikethroughKey + * the strikethrough preference key + * @param underlineKey + * the underline preference key * @return the created text attribute ! * @since 0.9.0 */ ! private TextAttribute createTextAttribute(String colorKey, String boldKey, String italicKey, String strikethroughKey, String underlineKey) { ! Color color= null; ! if (colorKey != null) ! color= fColorManager.getColor(colorKey); ! int style= fPreferenceStore.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL; ! if (fPreferenceStore.getBoolean(italicKey)) ! style |= SWT.ITALIC; ! ! if (fPreferenceStore.getBoolean(strikethroughKey)) ! style |= TextAttribute.STRIKETHROUGH; ! ! if (fPreferenceStore.getBoolean(underlineKey)) ! style |= TextAttribute.UNDERLINE; return new TextAttribute(color, null, style); *************** *** 179,183 **** else if (fPropertyNamesBold[index].equals(p)) adaptToStyleChange(token, event, SWT.BOLD); ! else if (fPropertyNamesItalic[index].equals(p)) adaptToStyleChange(token, event, SWT.ITALIC); } --- 215,224 ---- else if (fPropertyNamesBold[index].equals(p)) adaptToStyleChange(token, event, SWT.BOLD); ! else if (fPropertyNamesItalic[index].equals(p)) ! adaptToStyleChange(token, event, SWT.ITALIC); ! else if (fPropertyNamesStrikethrough[index].equals(p)) ! adaptToStyleChange(token, event, TextAttribute.STRIKETHROUGH); ! else if (fPropertyNamesUnderline[index].equals(p)) ! adaptToStyleChange(token, event, TextAttribute.UNDERLINE); } *************** *** 231,235 **** int length = fPropertyNamesColor.length; for (int i = 0; i < length; i++) { ! if (property.equals(fPropertyNamesColor[i]) || property.equals(fPropertyNamesBold[i]) || property.equals(fPropertyNamesItalic[i])) return i; } } --- 272,276 ---- int length = fPropertyNamesColor.length; for (int i = 0; i < length; i++) { ! if (property.equals(fPropertyNamesColor[i]) || property.equals(fPropertyNamesBold[i]) || property.equals(fPropertyNamesItalic[i]) || property.equals(fPropertyNamesStrikethrough[i]) || property.equals(fPropertyNamesUnderline[i])) return i; } } |
|
From: Christopher W. <caw...@us...> - 2006-04-12 21:26:30
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25379 Modified Files: plugin.properties plugin.xml Log Message: a number of changes: - Re-arrange the preferences - add ability to edit ruby editor font - whole new syntax coloring page - new underline/strikethrough options for syntax coloring - fix bug delaying preference changes from applying on syntax coloring to open editors. - Add hyperlink between syntax coloring and general text editor prefs (which apply to coloring/fonts/appearance) - Remove some deprecated code Index: plugin.properties =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/plugin.properties,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** plugin.properties 30 Mar 2006 03:12:34 -0000 1.31 --- plugin.properties 12 Apr 2006 21:26:25 -0000 1.32 *************** *** 104,107 **** --- 104,113 ---- Folding.label= F&olding + #--- presentation + rubyPresentation.label= Ruby + + rubyEditorFontDefiniton.label= Ruby Editor Text Font + rubyEditorFontDefintion.description= The Ruby editor text font is used by Ruby editors. + ########################################################################## # Rdoc Support Index: plugin.xml =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/plugin.xml,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** plugin.xml 30 Mar 2006 03:12:34 -0000 1.78 --- plugin.xml 12 Apr 2006 21:26:25 -0000 1.79 *************** *** 43,47 **** <page name="%PreferencePage.rdtTemplatePreferences" ! category="org.rubypeople.rdt.ui.preferences.PreferencePageRubyBase" class="org.rubypeople.rdt.internal.ui.preferences.RubyTemplatePreferencePage" id="org.rubypeople.rdt.ui.TemplatesPreferencePage"> --- 43,47 ---- <page name="%PreferencePage.rdtTemplatePreferences" ! category="org.rubypeople.rdt.ui.preferences.PreferencePageRubyEditor" class="org.rubypeople.rdt.internal.ui.preferences.RubyTemplatePreferencePage" id="org.rubypeople.rdt.ui.TemplatesPreferencePage"> *************** *** 60,63 **** --- 60,70 ---- <keywordReference id="org.rubypeople.rdt.ui.sortorder"/> </page> + <page + name="Syntax Coloring" + category="org.rubypeople.rdt.ui.preferences.PreferencePageRubyEditor" + class="org.rubypeople.rdt.internal.ui.preferences.RubyEditorColoringPreferencePage" + id="org.rubypeople.rdt.ui.preferences.RubyEditorColoringPreferencePage"> + <keywordReference id="org.rubypeople.rdt.ui.syntaxcoloring"/> + </page> </extension> <!-- =========================================================================== --> *************** *** 284,287 **** --- 291,295 ---- icon="icons/full/ctool16/ruby_page.gif" id="org.rubypeople.rdt.ui.EditorRubyFile" + symbolicFontName="org.rubypeople.rdt.ui.editors.textfont" name="%EditorRubyFile.name"> <contentTypeBinding contentTypeId="org.rubypeople.rdt.core.rubySource"/> *************** *** 293,296 **** --- 301,305 ---- contributorClass="org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditorActionContributor" class="org.rubypeople.rdt.internal.ui.rubyeditor.ExternalRubyEditor" + symbolicFontName="org.rubypeople.rdt.ui.editors.textfont" id="org.rubypeople.rdt.ui.ExternalRubyEditor"> </editor> *************** *** 754,757 **** --- 763,780 ---- </viewerContribution> </extension> + + <extension + point="org.eclipse.ui.themes"> + <themeElementCategory label="%rubyPresentation.label" id="org.rubypeople.rdt.ui.presentation"/> + <fontDefinition + label="%rubyEditorFontDefiniton.label" + defaultsTo="org.eclipse.jface.textfont" + categoryId="org.rubypeople.rdt.ui.presentation" + id="org.rubypeople.rdt.ui.editors.textfont"> + <description> + %rubyEditorFontDefintion.description + </description> + </fontDefinition> + </extension> </plugin> |
|
From: Christopher W. <caw...@us...> - 2006-04-12 21:26:30
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25379/src/org/rubypeople/rdt/internal/ui/rubyeditor Modified Files: RubyAbstractEditor.java EditorUtility.java RubyEditor.java Log Message: a number of changes: - Re-arrange the preferences - add ability to edit ruby editor font - whole new syntax coloring page - new underline/strikethrough options for syntax coloring - fix bug delaying preference changes from applying on syntax coloring to open editors. - Add hyperlink between syntax coloring and general text editor prefs (which apply to coloring/fonts/appearance) - Remove some deprecated code Index: RubyEditor.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** RubyEditor.java 8 Apr 2006 05:40:06 -0000 1.41 --- RubyEditor.java 12 Apr 2006 21:26:25 -0000 1.42 *************** *** 63,68 **** --- 63,71 ---- import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IPageLayout; + import org.eclipse.ui.IPartListener2; import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkbenchPage; + import org.eclipse.ui.IWorkbenchPartReference; + import org.eclipse.ui.IWorkbenchPartSite; import org.eclipse.ui.SelectionEnabler; import org.eclipse.ui.actions.ActionContext; *************** *** 134,137 **** --- 137,146 ---- private IMarker fLastMarkerTarget = null; + /** + * The folding runner. + * @since 0.9.0 + */ + private ToggleFoldingRunner fFoldingRunner; + /** The editor's bracket matcher */ protected RubyPairMatcher fBracketMatcher= new RubyPairMatcher(BRACKETS); *************** *** 639,642 **** --- 648,676 ---- } } + + ISourceViewer sourceViewer= getSourceViewer(); + if (sourceViewer == null) + return; + + if (PreferenceConstants.EDITOR_FOLDING_PROVIDER.equals(property)) { + if (sourceViewer instanceof ProjectionViewer) { + ProjectionViewer projectionViewer= (ProjectionViewer) sourceViewer; + if (fProjectionModelUpdater != null) + fProjectionModelUpdater.uninstall(); + // either freshly enabled or provider changed + fProjectionModelUpdater= RubyPlugin.getDefault().getFoldingStructureProviderRegistry().getCurrentFoldingProvider(); + if (fProjectionModelUpdater != null) { + fProjectionModelUpdater.install(this, projectionViewer); + } + } + return; + } + + if (PreferenceConstants.EDITOR_FOLDING_ENABLED.equals(property)) { + if (sourceViewer instanceof ProjectionViewer) { + new ToggleFoldingRunner().runWhenNextVisible(); + } + return; + } } *************** *** 1244,1246 **** --- 1278,1380 ---- return false; } + + /** + * Runner that will toggle folding either instantly (if the editor is + * visible) or the next time it becomes visible. If a runner is started when + * there is already one registered, the registered one is canceled as + * toggling folding twice is a no-op. + * <p> + * The access to the fFoldingRunner field is not thread-safe, it is assumed + * that <code>runWhenNextVisible</code> is only called from the UI thread. + * </p> + * + * @since 0.9.0 + */ + private final class ToggleFoldingRunner implements IPartListener2 { + /** + * The workbench page we registered the part listener with, or + * <code>null</code>. + */ + private IWorkbenchPage fPage; + + /** + * Does the actual toggling of projection. + */ + private void toggleFolding() { + ISourceViewer sourceViewer= getSourceViewer(); + if (sourceViewer instanceof ProjectionViewer) { + ProjectionViewer pv= (ProjectionViewer) sourceViewer; + if (pv.isProjectionMode() != isFoldingEnabled()) { + if (pv.canDoOperation(ProjectionViewer.TOGGLE)) + pv.doOperation(ProjectionViewer.TOGGLE); + } + } + } + + /** + * Makes sure that the editor's folding state is correct the next time + * it becomes visible. If it already is visible, it toggles the folding + * state. If not, it either registers a part listener to toggle folding + * when the editor becomes visible, or cancels an already registered + * runner. + */ + public void runWhenNextVisible() { + // if there is one already: toggling twice is the identity + if (fFoldingRunner != null) { + fFoldingRunner.cancel(); + return; + } + IWorkbenchPartSite site= getSite(); + if (site != null) { + IWorkbenchPage page= site.getPage(); + if (!page.isPartVisible(RubyEditor.this)) { + // if we're not visible - defer until visible + fPage= page; + fFoldingRunner= this; + page.addPartListener(this); + return; + } + } + // we're visible - run now + toggleFolding(); + } + + /** + * Remove the listener and clear the field. + */ + private void cancel() { + if (fPage != null) { + fPage.removePartListener(this); + fPage= null; + } + if (fFoldingRunner == this) + fFoldingRunner= null; + } + + /* + * @see org.eclipse.ui.IPartListener2#partVisible(org.eclipse.ui.IWorkbenchPartReference) + */ + public void partVisible(IWorkbenchPartReference partRef) { + if (RubyEditor.this.equals(partRef.getPart(false))) { + cancel(); + toggleFolding(); + } + } + + /* + * @see org.eclipse.ui.IPartListener2#partClosed(org.eclipse.ui.IWorkbenchPartReference) + */ + public void partClosed(IWorkbenchPartReference partRef) { + if (RubyEditor.this.equals(partRef.getPart(false))) { + cancel(); + } + } + + public void partActivated(IWorkbenchPartReference partRef) {} + public void partBroughtToTop(IWorkbenchPartReference partRef) {} + public void partDeactivated(IWorkbenchPartReference partRef) {} + public void partOpened(IWorkbenchPartReference partRef) {} + public void partHidden(IWorkbenchPartReference partRef) {} + public void partInputChanged(IWorkbenchPartReference partRef) {} + } } \ No newline at end of file Index: RubyAbstractEditor.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** RubyAbstractEditor.java 25 Mar 2006 02:37:44 -0000 1.24 --- RubyAbstractEditor.java 12 Apr 2006 21:26:25 -0000 1.25 *************** *** 1,11 **** --- 1,18 ---- package org.rubypeople.rdt.internal.ui.rubyeditor; + import java.util.ArrayList; import java.util.Iterator; + import java.util.List; + import org.eclipse.core.resources.ProjectScope; import org.eclipse.core.runtime.CoreException; + import org.eclipse.core.runtime.preferences.IEclipsePreferences; + import org.eclipse.core.runtime.preferences.IScopeContext; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.ITextViewerExtension5; import org.eclipse.jface.text.TextSelection; import org.eclipse.jface.text.source.ISourceViewer; + import org.eclipse.jface.util.IPropertyChangeListener; + import org.eclipse.jface.util.ListenerList; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.ISelection; *************** *** 14,17 **** --- 21,26 ---- import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.custom.StyledText; + import org.eclipse.swt.graphics.Point; + import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IPartService; *************** *** 20,35 **** --- 29,51 ---- import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.editors.text.TextEditor; + import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; import org.eclipse.ui.texteditor.ChainedPreferenceStore; import org.eclipse.ui.views.contentoutline.ContentOutline; import org.eclipse.ui.views.contentoutline.IContentOutlinePage; + import org.osgi.service.prefs.BackingStoreException; import org.rubypeople.rdt.core.IImportContainer; import org.rubypeople.rdt.core.IImportDeclaration; import org.rubypeople.rdt.core.IMember; import org.rubypeople.rdt.core.IRubyElement; + import org.rubypeople.rdt.core.IRubyProject; import org.rubypeople.rdt.core.IRubyScript; import org.rubypeople.rdt.core.ISourceRange; import org.rubypeople.rdt.core.ISourceReference; + import org.rubypeople.rdt.core.RubyCore; import org.rubypeople.rdt.core.RubyModelException; + import org.rubypeople.rdt.core.formatter.DefaultCodeFormatterConstants; import org.rubypeople.rdt.internal.ui.RubyPlugin; + import org.rubypeople.rdt.internal.ui.text.IRubyPartitions; + import org.rubypeople.rdt.internal.ui.text.PreferencesAdapter; import org.rubypeople.rdt.ui.IWorkingCopyManager; import org.rubypeople.rdt.ui.text.RubySourceViewerConfiguration; *************** *** 47,56 **** protected AbstractSelectionChangedListener fOutlineSelectionChangedListener = new OutlineSelectionChangedListener(); private RubyOutlinePage fOutlinePage; ! private IPreferenceStore createCombinedPreferenceStore() { ! IPreferenceStore rdtStore = RubyPlugin.getDefault().getPreferenceStore(); ! IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore(); ! return new ChainedPreferenceStore(new IPreferenceStore[] { rdtStore, generalTextStore}); ! } /** --- 63,89 ---- protected AbstractSelectionChangedListener fOutlineSelectionChangedListener = new OutlineSelectionChangedListener(); private RubyOutlinePage fOutlinePage; + + /** + * Creates and returns the preference store for this Ruby editor with the given input. + * + * @param input The editor input for which to create the preference store + * @return the preference store for this editor + * + * @since 0.9.0 + */ + private IPreferenceStore createCombinedPreferenceStore(IEditorInput input) { + List stores= new ArrayList(3); ! IRubyProject project= EditorUtility.getRubyProject(input); ! if (project != null) { ! stores.add(new EclipsePreferencesAdapter(new ProjectScope(project.getProject()), RubyCore.PLUGIN_ID)); ! } ! ! stores.add(RubyPlugin.getDefault().getPreferenceStore()); ! stores.add(new PreferencesAdapter(RubyCore.getPlugin().getPluginPreferences())); ! stores.add(EditorsUI.getPreferenceStore()); ! ! return new ChainedPreferenceStore((IPreferenceStore[]) stores.toArray(new IPreferenceStore[stores.size()])); ! } /** *************** *** 77,85 **** protected void initializeEditor() { super.initializeEditor(); ! setPreferenceStore(this.createCombinedPreferenceStore()); ! ! textTools = RubyPlugin.getDefault().getRubyTextTools(); ! setSourceViewerConfiguration(new RubySourceViewerConfiguration(textTools, this)); } /* --- 110,132 ---- protected void initializeEditor() { super.initializeEditor(); ! IPreferenceStore store= createCombinedPreferenceStore(null); ! setPreferenceStore(store); ! RubyTextTools textTools= RubyPlugin.getDefault().getRubyTextTools(); ! setSourceViewerConfiguration(new RubySourceViewerConfiguration(textTools.getColorManager(), store, this, IRubyPartitions.RUBY_PARTITIONING)); } + + /* + * @see org.eclipse.ui.texteditor.AbstractTextEditor#setPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) + * @since 0.9.0 + */ + protected void setPreferenceStore(IPreferenceStore store) { + super.setPreferenceStore(store); + if (getSourceViewerConfiguration() instanceof RubySourceViewerConfiguration) { + RubyTextTools textTools= RubyPlugin.getDefault().getRubyTextTools(); + setSourceViewerConfiguration(new RubySourceViewerConfiguration(textTools.getColorManager(), store, this, IRubyPartitions.RUBY_PARTITIONING)); + } + if (getSourceViewer() instanceof RubySourceViewer) + ((RubySourceViewer)getSourceViewer()).setPreferenceStore(store); + } /* *************** *** 125,128 **** --- 172,225 ---- } } + + protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { + + String property= event.getProperty(); + + if (AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH.equals(property)) { + /* + * Ignore tab setting since we rely on the formatter preferences. + * We do this outside the try-finally block to avoid that EDITOR_TAB_WIDTH + * is handled by the sub-class (AbstractDecoratedTextEditor). + */ + return; + } + + try { + + ISourceViewer sourceViewer= getSourceViewer(); + if (sourceViewer == null) + return; + + ((RubySourceViewerConfiguration)getSourceViewerConfiguration()).handlePropertyChangeEvent(event); + + if (DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE.equals(property) + || DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE.equals(property) + || DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR.equals(property)) { + StyledText textWidget= sourceViewer.getTextWidget(); + int tabWidth= getSourceViewerConfiguration().getTabWidth(sourceViewer); + if (textWidget.getTabs() != tabWidth) + textWidget.setTabs(tabWidth); + return; + } + + } finally { + super.handlePreferenceStoreChanged(event); + } + + if (AbstractDecoratedTextEditorPreferenceConstants.SHOW_RANGE_INDICATOR.equals(property)) { + // superclass already installed the range indicator + Object newValue= event.getNewValue(); + ISourceViewer viewer= getSourceViewer(); + if (newValue != null && viewer != null) { + if (Boolean.valueOf(newValue.toString()).booleanValue()) { + // adjust the highlightrange in order to get the magnet right after changing the selection + Point selection= viewer.getSelectedRange(); + adjustHighlightRange(selection.x, selection.y); + } + } + + } + } protected void handleOutlinePageSelection(SelectionChangedEvent event) { *************** *** 308,312 **** protected boolean affectsTextPresentation(PropertyChangeEvent event) { ! return textTools.affectsTextPresentation(event); } --- 405,409 ---- protected boolean affectsTextPresentation(PropertyChangeEvent event) { ! return ((RubySourceViewerConfiguration)getSourceViewerConfiguration()).affectsTextPresentation(event) || super.affectsTextPresentation(event); } *************** *** 390,392 **** --- 487,786 ---- protected abstract IRubyElement getElementAt(int offset); + /** + * Adapts an options {@link IEclipsePreferences} to {@link org.eclipse.jface.preference.IPreferenceStore}. + * <p> + * This preference store is read-only i.e. write access + * throws an {@link java.lang.UnsupportedOperationException}. + * </p> + * + * @since 3.1 + */ + private static class EclipsePreferencesAdapter implements IPreferenceStore { + + /** + * Preference change listener. Listens for events preferences + * fires a {@link org.eclipse.jface.util.PropertyChangeEvent} + * on this adapter with arguments from the received event. + */ + private class PreferenceChangeListener implements IEclipsePreferences.IPreferenceChangeListener { + + /** + * {@inheritDoc} + */ + public void preferenceChange(final IEclipsePreferences.PreferenceChangeEvent event) { + if (Display.getCurrent() == null) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + firePropertyChangeEvent(event.getKey(), event.getOldValue(), event.getNewValue()); + } + }); + } else { + firePropertyChangeEvent(event.getKey(), event.getOldValue(), event.getNewValue()); + } + } + } + + // TODO When we move to Eclipse 3.2 change ListenerList to eclipse.core.runtime.ListenerList + /** Listeners on on this adapter */ + private ListenerList fListeners= new ListenerList(); + + /** Listener on the node */ + private IEclipsePreferences.IPreferenceChangeListener fListener= new PreferenceChangeListener(); + + /** wrapped node */ + private final IScopeContext fContext; + private final String fQualifier; + + /** + * Initialize with the node to wrap + * + * @param context The context to access + */ + public EclipsePreferencesAdapter(IScopeContext context, String qualifier) { + fContext= context; + fQualifier= qualifier; + } + + private IEclipsePreferences getNode() { + return fContext.getNode(fQualifier); + } + + /** + * {@inheritDoc} + */ + public void addPropertyChangeListener(IPropertyChangeListener listener) { + if (fListeners.size() == 0) + getNode().addPreferenceChangeListener(fListener); + fListeners.add(listener); + } + + /** + * {@inheritDoc} + */ + public void removePropertyChangeListener(IPropertyChangeListener listener) { + fListeners.remove(listener); + if (fListeners.size() == 0) { + getNode().removePreferenceChangeListener(fListener); + } + } + + /** + * {@inheritDoc} + */ + public boolean contains(String name) { + return getNode().get(name, null) != null; + } + + /** + * {@inheritDoc} + */ + public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) { + PropertyChangeEvent event= new PropertyChangeEvent(this, name, oldValue, newValue); + Object[] listeners= fListeners.getListeners(); + for (int i= 0; i < listeners.length; i++) + ((IPropertyChangeListener) listeners[i]).propertyChange(event); + } + + /** + * {@inheritDoc} + */ + public boolean getBoolean(String name) { + return getNode().getBoolean(name, BOOLEAN_DEFAULT_DEFAULT); + } + + /** + * {@inheritDoc} + */ + public boolean getDefaultBoolean(String name) { + return BOOLEAN_DEFAULT_DEFAULT; + } + + /** + * {@inheritDoc} + */ + public double getDefaultDouble(String name) { + return DOUBLE_DEFAULT_DEFAULT; + } + + /** + * {@inheritDoc} + */ + public float getDefaultFloat(String name) { + return FLOAT_DEFAULT_DEFAULT; + } + + /** + * {@inheritDoc} + */ + public int getDefaultInt(String name) { + return INT_DEFAULT_DEFAULT; + } + + /** + * {@inheritDoc} + */ + public long getDefaultLong(String name) { + return LONG_DEFAULT_DEFAULT; + } + + /** + * {@inheritDoc} + */ + public String getDefaultString(String name) { + return STRING_DEFAULT_DEFAULT; + } + + /** + * {@inheritDoc} + */ + public double getDouble(String name) { + return getNode().getDouble(name, DOUBLE_DEFAULT_DEFAULT); + } + + /** + * {@inheritDoc} + */ + public float getFloat(String name) { + return getNode().getFloat(name, FLOAT_DEFAULT_DEFAULT); + } + + /** + * {@inheritDoc} + */ + public int getInt(String name) { + return getNode().getInt(name, INT_DEFAULT_DEFAULT); + } + + /** + * {@inheritDoc} + */ + public long getLong(String name) { + return getNode().getLong(name, LONG_DEFAULT_DEFAULT); + } + + /** + * {@inheritDoc} + */ + public String getString(String name) { + return getNode().get(name, STRING_DEFAULT_DEFAULT); + } + + /** + * {@inheritDoc} + */ + public boolean isDefault(String name) { + return false; + } + + /** + * {@inheritDoc} + */ + public boolean needsSaving() { + try { + return getNode().keys().length > 0; + } catch (BackingStoreException e) { + // ignore + } + return true; + } + + /** + * {@inheritDoc} + */ + public void putValue(String name, String value) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public void setDefault(String name, double value) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public void setDefault(String name, float value) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public void setDefault(String name, int value) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public void setDefault(String name, long value) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public void setDefault(String name, String defaultObject) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public void setDefault(String name, boolean value) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public void setToDefault(String name) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public void setValue(String name, double value) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public void setValue(String name, float value) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public void setValue(String name, int value) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public void setValue(String name, long value) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public void setValue(String name, String value) { + throw new UnsupportedOperationException(); + } + + /** + * {@inheritDoc} + */ + public void setValue(String name, boolean value) { + throw new UnsupportedOperationException(); + } + + } } \ No newline at end of file Index: EditorUtility.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/EditorUtility.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EditorUtility.java 30 Mar 2006 03:09:31 -0000 1.2 --- EditorUtility.java 12 Apr 2006 21:26:25 -0000 1.3 *************** *** 5,8 **** --- 5,9 ---- import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; + import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; *************** *** 28,34 **** --- 29,37 ---- import org.rubypeople.rdt.core.IMember; import org.rubypeople.rdt.core.IRubyElement; + import org.rubypeople.rdt.core.IRubyProject; import org.rubypeople.rdt.core.IRubyScript; import org.rubypeople.rdt.core.ISourceRange; import org.rubypeople.rdt.core.ISourceReference; + import org.rubypeople.rdt.core.RubyCore; import org.rubypeople.rdt.core.RubyModelException; import org.rubypeople.rdt.internal.corext.util.RubyModelUtil; *************** *** 235,238 **** --- 238,263 ---- } } + + /** + * Returns the Ruby project for a given editor input or <code>null</code> if no corresponding + * Ruby project exists. + * + * @param input the editor input + * @return the corresponding Ruby project + * + * @since 0.9.0 + */ + public static IRubyProject getRubyProject(IEditorInput input) { + IRubyProject rProject= null; + if (input instanceof IFileEditorInput) { + IProject project= ((IFileEditorInput)input).getFile().getProject(); + if (project != null) { + rProject= RubyCore.create(project); + if (!rProject.exists()) + rProject= null; + } + } + return rProject; + } } |
|
From: Christopher W. <caw...@us...> - 2006-04-12 21:26:29
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25379/src/org/rubypeople/rdt/ui Modified Files: StandardRubyElementContentProvider.java PreferenceConstants.java Log Message: a number of changes: - Re-arrange the preferences - add ability to edit ruby editor font - whole new syntax coloring page - new underline/strikethrough options for syntax coloring - fix bug delaying preference changes from applying on syntax coloring to open editors. - Add hyperlink between syntax coloring and general text editor prefs (which apply to coloring/fonts/appearance) - Remove some deprecated code Index: PreferenceConstants.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PreferenceConstants.java 30 Mar 2006 03:05:01 -0000 1.14 --- PreferenceConstants.java 12 Apr 2006 21:26:25 -0000 1.15 *************** *** 281,285 **** --- 281,298 ---- */ public static final String LINK_BROWSING_MEMBERS_TO_EDITOR= "org.rubypeople.rdt.ui.browsing.memberstoeditor"; //$NON-NLS-1$ + + /** + * Preference key suffix for strikethrough text style preference keys. + * + * @since 0.9.0 + */ + public static final String EDITOR_STRIKETHROUGH_SUFFIX= "_strikethrough"; //$NON-NLS-1$ + /** + * Preference key suffix for underline text style preference keys. + * + * @since 0.9.0 + */ + public static final String EDITOR_UNDERLINE_SUFFIX= "_underline"; //$NON-NLS-1$ public static void initializeDefaultValues(IPreferenceStore store) { Index: StandardRubyElementContentProvider.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/StandardRubyElementContentProvider.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StandardRubyElementContentProvider.java 25 Mar 2006 02:37:43 -0000 1.1 --- StandardRubyElementContentProvider.java 12 Apr 2006 21:26:25 -0000 1.2 *************** *** 16,27 **** import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; - import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; - import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.Viewer; ! ! import org.rubypeople.rdt.core.*; /** --- 16,32 ---- import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.Viewer; ! import org.rubypeople.rdt.core.IParent; ! import org.rubypeople.rdt.core.IRubyElement; ! import org.rubypeople.rdt.core.IRubyElementDelta; ! import org.rubypeople.rdt.core.IRubyModel; ! import org.rubypeople.rdt.core.IRubyProject; ! import org.rubypeople.rdt.core.IRubyScript; ! import org.rubypeople.rdt.core.ISourceReference; ! import org.rubypeople.rdt.core.RubyCore; ! import org.rubypeople.rdt.core.RubyModelException; /** |
|
From: Christopher W. <caw...@us...> - 2006-04-12 21:26:29
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25379/src/org/rubypeople/rdt/ui/text Modified Files: RubyTextTools.java RubySourceViewerConfiguration.java Log Message: a number of changes: - Re-arrange the preferences - add ability to edit ruby editor font - whole new syntax coloring page - new underline/strikethrough options for syntax coloring - fix bug delaying preference changes from applying on syntax coloring to open editors. - Add hyperlink between syntax coloring and general text editor prefs (which apply to coloring/fonts/appearance) - Remove some deprecated code Index: RubyTextTools.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubyTextTools.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RubyTextTools.java 18 Feb 2006 17:29:33 -0000 1.1 --- RubyTextTools.java 12 Apr 2006 21:26:25 -0000 1.2 *************** *** 127,133 **** if (fCorePreferenceStore != null) fCorePreferenceStore.addPropertyChangeListener(fPreferenceListener); - - // fJavaDocScanner= new JavaDocScanner(fColorManager, store, coreStore); - // fPartitionScanner= new FastJavaPartitionScanner(); } --- 127,130 ---- *************** *** 150,155 **** if (fRegexpScanner.affectsBehavior(event)) fRegexpScanner.adaptToPreferenceChange(event); if (fCommandScanner.affectsBehavior(event)) fCommandScanner.adaptToPreferenceChange(event); - // if (fJavaDocScanner.affectsBehavior(event)) - // fJavaDocScanner.adaptToPreferenceChange(event); } --- 147,150 ---- Index: RubySourceViewerConfiguration.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RubySourceViewerConfiguration.java 18 Feb 2006 17:29:33 -0000 1.3 --- RubySourceViewerConfiguration.java 12 Apr 2006 21:26:25 -0000 1.4 *************** *** 111,140 **** initializeScanners(); } - - /** - * Creates a new Ruby source viewer configuration for viewers in the given - * editor using the given Ruby tools. - * - * @param tools - * the Ruby text tools to be used - * @param editor - * the editor in which the configured viewer(s) will reside, or - * <code>null</code> if none - * @see RubyTextTools - * @deprecated As of 0.8.0, replaced by - * {@link RubySourceViewerConfiguration#JavaSourceViewerConfiguration(IColorManager, IPreferenceStore, ITextEditor, String)} - */ - public RubySourceViewerConfiguration(RubyTextTools tools, RubyAbstractEditor editor) { - super(createPreferenceStore(tools)); - textTools = tools; - fColorManager = tools.getColorManager(); - fCodeScanner = (AbstractRubyScanner) textTools.getCodeScanner(); - fMultilineCommentScanner = (AbstractRubyScanner) textTools.getMultilineCommentScanner(); - fSinglelineCommentScanner = (AbstractRubyScanner) textTools.getSinglelineCommentScanner(); - fStringScanner = (AbstractRubyScanner) textTools.getStringScanner(); - fRegexpScanner = (SingleTokenRubyCodeScanner) textTools.getRegexpScanner(); - fCommandScanner = (SingleTokenRubyCodeScanner) textTools.getCommandScanner(); - fTextEditor = editor; - } /* --- 111,114 ---- |
|
From: Christopher W. <caw...@us...> - 2006-04-12 21:26:29
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25379/src/org/rubypeople/rdt/internal/ui Modified Files: RubyUIMessages.properties Log Message: a number of changes: - Re-arrange the preferences - add ability to edit ruby editor font - whole new syntax coloring page - new underline/strikethrough options for syntax coloring - fix bug delaying preference changes from applying on syntax coloring to open editors. - Add hyperlink between syntax coloring and general text editor prefs (which apply to coloring/fonts/appearance) - Remove some deprecated code Index: RubyUIMessages.properties =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.properties,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** RubyUIMessages.properties 30 Mar 2006 02:57:27 -0000 1.14 --- RubyUIMessages.properties 12 Apr 2006 21:26:25 -0000 1.15 *************** *** 49,68 **** RubyEditorPropertyPage.highlighting.group=Highlighting RubyEditorPropertyPage.property=Property - RubyEditorPropertyPage.color=Color - RubyEditorPropertyPage.bold=Bold - RubyEditorPropertyPage.italic=Italics - RubyEditorPropertyPage.color_ruby_default=Others - RubyEditorPropertyPage.color_ruby_keyword=Keywords - RubyEditorPropertyPage.color_ruby_string=Strings - RubyEditorPropertyPage.color_ruby_multiline_comment=Multi-line comments - RubyEditorPropertyPage.color_ruby_singleline_comment=Single-line comments - RubyEditorPropertyPage.color_ruby_task=Task Tags - RubyEditorPropertyPage.color_ruby_regexp=Regular Expressions - RubyEditorPropertyPage.color_ruby_command=Shell Commands - RubyEditorPropertyPage.color_ruby_fixnum=Fixnums - RubyEditorPropertyPage.color_ruby_character=Character Values - RubyEditorPropertyPage.color_ruby_symbol=Symbols - RubyEditorPropertyPage.color_ruby_global=Global variables - RubyEditorPropertyPage.color_ruby_instance_variable=Instance and Class Variables RubyEditorPropertyPage.indentation=Characters per indentation level: RubyEditorPropertyPage.useTab=Use tab (if disabled, typed tabs are also converted to spaces) --- 49,52 ---- |
|
From: Christopher W. <caw...@us...> - 2006-04-12 21:26:29
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/rubyeditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25379/src/org/rubypeople/rdt/ui/rubyeditor Modified Files: RubyEditorPreferences.properties Log Message: a number of changes: - Re-arrange the preferences - add ability to edit ruby editor font - whole new syntax coloring page - new underline/strikethrough options for syntax coloring - fix bug delaying preference changes from applying on syntax coloring to open editors. - Add hyperlink between syntax coloring and general text editor prefs (which apply to coloring/fonts/appearance) - Remove some deprecated code Index: RubyEditorPreferences.properties =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/rubyeditor/RubyEditorPreferences.properties,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RubyEditorPreferences.properties 18 Feb 2006 17:28:55 -0000 1.6 --- RubyEditorPreferences.properties 12 Apr 2006 21:26:26 -0000 1.7 *************** *** 1 **** ! keywords=BEGIN,END,alias,begin,do,end,yield,if,unless,elsif,else,while,unless,for,in,super,retry,redo,break,case,when,throw,and,or,not,raise,rescue,ensure,new,each,def,class,module,return \ No newline at end of file --- 1 ---- ! keywords=BEGIN,END,alias,begin,do,end,yield,if,unless,elsif,else,while,unless,for,in,super,retry,redo,break,case,when,throw,and,or,not,raise,rescue,ensure,new,each,def,class,module,return,false,true,nil \ No newline at end of file |
|
From: Christopher W. <caw...@us...> - 2006-04-12 21:26:29
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25379/src/org/rubypeople/rdt/internal/ui/preferences Modified Files: TextEditorPreferencePage2.java PreferencesMessages.java PreferencesMessages.properties Added Files: AbstractConfigurationBlock.java RubyEditorColoringPreferencePage.java ColorSettingPreviewCode.txt IPreferenceConfigurationBlock.java RubyEditorColoringConfigurationBlock.java AbstractConfigurationBlockPreferencePage.java Log Message: a number of changes: - Re-arrange the preferences - add ability to edit ruby editor font - whole new syntax coloring page - new underline/strikethrough options for syntax coloring - fix bug delaying preference changes from applying on syntax coloring to open editors. - Add hyperlink between syntax coloring and general text editor prefs (which apply to coloring/fonts/appearance) - Remove some deprecated code Index: PreferencesMessages.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/PreferencesMessages.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PreferencesMessages.java 30 Mar 2006 02:56:45 -0000 1.4 --- PreferencesMessages.java 12 Apr 2006 21:26:25 -0000 1.5 *************** *** 75,78 **** --- 75,104 ---- public static String AppearancePreferencePage_stackViewsVerticallyInTheRubyBrowsingPerspective; public static String AppearancePreferencePage_description; + public static String RubyEditorColoringConfigurationBlock_link; + public static String RubyEditorPreferencePage_coloring_element; + public static String RubyEditorPreferencePage_enable; + public static String RubyEditorPreferencePage_color; + public static String RubyEditorPreferencePage_bold; + public static String RubyEditorPreferencePage_italic; + public static String RubyEditorPreferencePage_strikethrough; + public static String RubyEditorPreferencePage_underline; + public static String RubyEditorPreferencePage_preview; + public static String RubyEditorPreferencePage_multiLineComment; + public static String RubyEditorPreferencePage_coloring_category_ruby; + public static String RubyEditorPreferencePage_singleLineComment; + public static String RubyEditorPreferencePage_rubyCommentTaskTags; + public static String RubyEditorPreferencePage_keywords; + public static String RubyEditorPreferencePage_strings; + public static String RubyEditorPreferencePage_characters; + public static String RubyEditorPreferencePage_commands; + public static String RubyEditorPreferencePage_fixnums; + public static String RubyEditorPreferencePage_globals; + public static String RubyEditorPreferencePage_regular_expressions; + public static String RubyEditorPreferencePage_symbols; + public static String RubyEditorPreferencePage_variables; + public static String RubyEditorPreferencePage_others; + public static String RubyEditorPreferencePage_colors; + public static String RubyEditorPreferencePage_empty_input; + public static String RubyEditorPreferencePage_invalid_input; 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.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PreferencesMessages.properties 30 Mar 2006 02:56:45 -0000 1.7 --- PreferencesMessages.properties 12 Apr 2006 21:26:25 -0000 1.8 *************** *** 80,81 **** --- 80,110 ---- AppearancePreferencePage_preferenceOnlyEffectiveForNewPerspectives=This preference will only take effect on new perspectives + RubyEditorPreferencePage_colors=Synta&x + RubyEditorPreferencePage_empty_input=Empty input + RubyEditorPreferencePage_invalid_input=''{0}'' is not a valid input. + RubyEditorPreferencePage_enable= Enab&le + + # coloring + RubyEditorPreferencePage_coloring_category_ruby=Ruby + RubyEditorColoringConfigurationBlock_link= Default colors and font can be configured on the <a href=\"org.eclipse.ui.preferencePages.GeneralTextEditor\">Text Editors</a> and on the <a href=\"org.eclipse.ui.preferencePages.ColorsAndFonts\">Colors and Fonts</a> preference page. + RubyEditorPreferencePage_coloring_element=&Element: + RubyEditorPreferencePage_color= C&olor: + RubyEditorPreferencePage_bold= &Bold + RubyEditorPreferencePage_italic= &Italic + RubyEditorPreferencePage_strikethrough=&Strikethrough + RubyEditorPreferencePage_underline=&Underline + RubyEditorPreferencePage_preview= Previe&w: + + RubyEditorPreferencePage_multiLineComment= Multi-line comment + RubyEditorPreferencePage_singleLineComment= Single-line comment + RubyEditorPreferencePage_rubyCommentTaskTags= Task Tags + RubyEditorPreferencePage_keywords= Keywords + RubyEditorPreferencePage_strings= Strings + RubyEditorPreferencePage_others= Others + RubyEditorPreferencePage_characters= Characters + RubyEditorPreferencePage_commands= Commands + RubyEditorPreferencePage_fixnums= Fixnums + RubyEditorPreferencePage_globals= Globals + RubyEditorPreferencePage_regular_expressions= Regular Expressions + RubyEditorPreferencePage_symbols= Symbols + RubyEditorPreferencePage_variables= Variables \ No newline at end of file --- NEW FILE: ColorSettingPreviewCode.txt --- =begin This is about ClassName. =end class ClassName < SuperClass CLASS_CONSTANT = 123 $global = 'around the world' # This comment may span only this line @@class_variable = "some string" def initialize(value) @field = value end # TASK: refactor def foo(parameter) abstract_method() string = 'Blah blah blah' string.gsub!(/ah/, 'eet') local = 42 * hash_code() static_method() return bar(local) + parameter end end Index: TextEditorPreferencePage2.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/TextEditorPreferencePage2.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** TextEditorPreferencePage2.java 10 Feb 2006 19:52:26 -0000 1.23 --- TextEditorPreferencePage2.java 12 Apr 2006 21:26:25 -0000 1.24 *************** *** 15,19 **** import org.eclipse.core.runtime.IStatus; - import org.eclipse.debug.internal.ui.actions.StatusInfo; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.DialogPage; --- 15,18 ---- *************** *** 45,48 **** --- 44,48 ---- import org.rubypeople.rdt.internal.ui.RubyPlugin; import org.rubypeople.rdt.internal.ui.RubyUIMessages; + import org.rubypeople.rdt.internal.ui.dialogs.StatusInfo; import org.rubypeople.rdt.internal.ui.text.IRubyColorConstants; import org.rubypeople.rdt.ui.PreferenceConstants; *************** *** 58,75 **** public class TextEditorPreferencePage2 extends RubyAbstractPreferencePage implements IWorkbenchPreferencePage { - protected TextPropertyWidget[] textPropertyWidgets; protected Text indentationWidget; ! protected final String[] colorProperties = { ! IRubyColorConstants.RUBY_KEYWORD, ! IRubyColorConstants.RUBY_MULTI_LINE_COMMENT, ! IRubyColorConstants.RUBY_SINGLE_LINE_COMMENT, ! IRubyColorConstants.RUBY_STRING, IRubyColorConstants.TASK_TAG, ! IRubyColorConstants.RUBY_REGEXP, IRubyColorConstants.RUBY_COMMAND, ! IRubyColorConstants.RUBY_FIXNUM, ! IRubyColorConstants.RUBY_CHARACTER, ! IRubyColorConstants.RUBY_SYMBOL, ! IRubyColorConstants.RUBY_INSTANCE_VARIABLE, ! IRubyColorConstants.RUBY_GLOBAL, ! IRubyColorConstants.RUBY_DEFAULT }; private ModifyListener fTextFieldListener = new ModifyListener() { --- 58,63 ---- public class TextEditorPreferencePage2 extends RubyAbstractPreferencePage implements IWorkbenchPreferencePage { protected Text indentationWidget; ! private ModifyListener fTextFieldListener = new ModifyListener() { *************** *** 197,204 **** item.setText(RubyUIMessages.getString("RubyEditorPropertyPage.codeFormatterTabTitle")); item.setControl(createCodeFormatterPage(folder)); - - item = new TabItem(folder, SWT.NONE); - item.setText("Syntax"); - item.setControl(createSyntaxPage(folder)); item= new TabItem(folder, SWT.NONE); --- 185,188 ---- *************** *** 211,264 **** } - /** - * @param folder - * @return - */ - private Control createSyntaxPage(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); - composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL)); - - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.marginWidth = 0; - layout.marginHeight = 0; - layout.verticalSpacing = 10; - - composite.setLayout(layout); - - Group colorComposite = new Group(composite, SWT.NONE); - layout = new GridLayout(); - layout.numColumns = 4; - layout.horizontalSpacing = 10; - layout.verticalSpacing = 8; - layout.marginWidth = 10; - layout.marginHeight = 10; - - colorComposite.setLayout(layout); - colorComposite.setText(RubyUIMessages.getString("RubyEditorPropertyPage.highlighting.group")); //$NON-NLS-1$ - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalSpan = 2; - colorComposite.setLayoutData(data); - - Label header = new Label(colorComposite, SWT.BOLD); - header.setText(RubyUIMessages.getString("RubyEditorPropertyPage.property")); - header = new Label(colorComposite, SWT.BOLD); - header.setText(RubyUIMessages.getString("RubyEditorPropertyPage.color")); - header.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); - header = new Label(colorComposite, SWT.BOLD); - header.setText(RubyUIMessages.getString("RubyEditorPropertyPage.bold")); - header.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); - header = new Label(colorComposite, SWT.BOLD); - header.setText(RubyUIMessages.getString("RubyEditorPropertyPage.italic")); - header.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - textPropertyWidgets = new TextPropertyWidget[colorProperties.length]; - for (int i = 0; i < colorProperties.length; i++) { - textPropertyWidgets[i] = new TextPropertyWidget(colorComposite, colorProperties[i]); - } - - return composite; - } - private void initialize() { --- 195,198 ---- *************** *** 272,281 **** */ public boolean performOk() { - for (int i = 0; i < textPropertyWidgets.length; i++) { - TextPropertyWidget widget = textPropertyWidgets[i]; - widget.stringColorEditor.store(); - RubyPlugin.getDefault().getPreferenceStore().setValue(widget.property + PreferenceConstants.EDITOR_BOLD_SUFFIX, widget.boldCheckBox.getSelection()); - RubyPlugin.getDefault().getPreferenceStore().setValue(widget.property + PreferenceConstants.EDITOR_ITALIC_SUFFIX, widget.italicCheckBox.getSelection()); - } fFoldingConfigurationBlock.performOk(); fOverlayStore.propagate(); --- 206,209 ---- *************** *** 293,300 **** initializeFields(); - for (int i = 0; i < textPropertyWidgets.length; i++) { - textPropertyWidgets[i].loadDefault(); - } - fFoldingConfigurationBlock.performDefaults(); --- 221,224 ---- *************** *** 401,437 **** } } - - class TextPropertyWidget { - - protected ColorFieldEditor stringColorEditor; - protected Button boldCheckBox; - protected Button italicCheckBox; - protected String property; - - TextPropertyWidget(Composite parent, String property) { - this.property = property; - Label label = new Label(parent, SWT.NORMAL); - label.setText(RubyUIMessages.getString("RubyEditorPropertyPage." + property)); - - Composite dummyComposite = new Composite(parent, SWT.NONE); - // ColorFieldEditor sets its parent composite to 2 columns, - // therefore a dummyComposite is used here - stringColorEditor = new ColorFieldEditor(property, "", dummyComposite); - stringColorEditor.setPreferenceStore(getPreferenceStore()); - stringColorEditor.load(); - - boldCheckBox = new Button(parent, SWT.CHECK); - boldCheckBox.setSelection(getPreferenceStore().getBoolean(property + PreferenceConstants.EDITOR_BOLD_SUFFIX)); - boldCheckBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); - - italicCheckBox = new Button(parent, SWT.CHECK); - italicCheckBox.setSelection(getPreferenceStore().getBoolean(property + PreferenceConstants.EDITOR_ITALIC_SUFFIX)); - italicCheckBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - } - - public void loadDefault() { - stringColorEditor.loadDefault(); - boldCheckBox.setSelection(getPreferenceStore().getBoolean(property + PreferenceConstants.EDITOR_BOLD_SUFFIX)); - } - } } \ No newline at end of file --- 325,327 ---- --- NEW FILE: AbstractConfigurationBlockPreferencePage.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.rubypeople.rdt.internal.ui.preferences; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import org.eclipse.ui.PlatformUI; import org.rubypeople.rdt.internal.ui.RubyPlugin; /** * Abstract preference page which is used to wrap a * {@link org.rubypeople.rdt.internal.ui.preferences.IPreferenceConfigurationBlock}. * * @since 0.9.0 */ public abstract class AbstractConfigurationBlockPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { private IPreferenceConfigurationBlock fConfigurationBlock; private OverlayPreferenceStore fOverlayStore; /** * Creates a new preference page. */ public AbstractConfigurationBlockPreferencePage() { setDescription(); setPreferenceStore(); fOverlayStore= new OverlayPreferenceStore(getPreferenceStore(), new OverlayPreferenceStore.OverlayKey[] {}); fConfigurationBlock= createConfigurationBlock(fOverlayStore); } protected abstract IPreferenceConfigurationBlock createConfigurationBlock(OverlayPreferenceStore overlayPreferenceStore); protected abstract String getHelpId(); protected abstract void setDescription(); protected abstract void setPreferenceStore(); /* * @see IWorkbenchPreferencePage#init() */ public void init(IWorkbench workbench) { } /* * @see PreferencePage#createControl(Composite) */ public void createControl(Composite parent) { super.createControl(parent); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), getHelpId()); } /* * @see PreferencePage#createContents(Composite) */ protected Control createContents(Composite parent) { fOverlayStore.load(); fOverlayStore.start(); Control content= fConfigurationBlock.createControl(parent); initialize(); Dialog.applyDialogFont(content); return content; } private void initialize() { fConfigurationBlock.initialize(); } /* * @see PreferencePage#performOk() */ public boolean performOk() { fConfigurationBlock.performOk(); fOverlayStore.propagate(); RubyPlugin.getDefault().savePluginPreferences(); return true; } /* * @see PreferencePage#performDefaults() */ public void performDefaults() { fOverlayStore.loadDefaults(); fConfigurationBlock.performDefaults(); super.performDefaults(); } /* * @see DialogPage#dispose() */ public void dispose() { fConfigurationBlock.dispose(); if (fOverlayStore != null) { fOverlayStore.stop(); fOverlayStore= null; } super.dispose(); } } --- NEW FILE: AbstractConfigurationBlock.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.rubypeople.rdt.internal.ui.preferences; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.text.Assert; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.forms.events.ExpansionAdapter; import org.eclipse.ui.forms.events.ExpansionEvent; import org.eclipse.ui.forms.widgets.ExpandableComposite; import org.rubypeople.rdt.internal.corext.util.Messages; import org.rubypeople.rdt.internal.ui.dialogs.StatusInfo; import org.rubypeople.rdt.internal.ui.dialogs.StatusUtil; import org.rubypeople.rdt.internal.ui.util.PixelConverter; /** * Configures Java Editor typing preferences. * * @since 3.1 */ abstract class AbstractConfigurationBlock implements IPreferenceConfigurationBlock { /** * Use as follows: * * <pre> * SectionManager manager= new SectionManager(); * Composite composite= manager.createSectionComposite(parent); * * Composite xSection= manager.createSection("section X")); * xSection.setLayout(new FillLayout()); * new Button(xSection, SWT.PUSH); // add controls to section.. * * [...] * * return composite; // return main composite * </pre> */ protected final class SectionManager { /** The preference setting for keeping no section open. */ private static final String __NONE= "__none"; //$NON-NLS-1$ private Set fSections= new HashSet(); private boolean fIsBeingManaged= false; private ExpansionAdapter fListener= new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { ExpandableComposite source= (ExpandableComposite) e.getSource(); updateSectionStyle(source); if (fIsBeingManaged) return; if (e.getState()) { try { fIsBeingManaged= true; for (Iterator iter= fSections.iterator(); iter.hasNext();) { ExpandableComposite composite= (ExpandableComposite) iter.next(); if (composite != source) composite.setExpanded(false); } } finally { fIsBeingManaged= false; } if (fLastOpenKey != null && fDialogSettingsStore != null) fDialogSettingsStore.setValue(fLastOpenKey, source.getText()); } else { if (!fIsBeingManaged && fLastOpenKey != null && fDialogSettingsStore != null) fDialogSettingsStore.setValue(fLastOpenKey, __NONE); } ExpandableComposite exComp= getParentExpandableComposite(source); if (exComp != null) exComp.layout(true, true); ScrolledPageContent parentScrolledComposite= getParentScrolledComposite(source); if (parentScrolledComposite != null) { parentScrolledComposite.reflow(true); } } }; private Composite fBody; private final String fLastOpenKey; private final IPreferenceStore fDialogSettingsStore; private ExpandableComposite fFirstChild= null; /** * Creates a new section manager. */ public SectionManager() { this(null, null); } /** * Creates a new section manager. */ public SectionManager(IPreferenceStore dialogSettingsStore, String lastOpenKey) { fDialogSettingsStore= dialogSettingsStore; fLastOpenKey= lastOpenKey; } private void manage(ExpandableComposite section) { if (section == null) throw new NullPointerException(); if (fSections.add(section)) section.addExpansionListener(fListener); makeScrollableCompositeAware(section); } /** * Creates a new composite that can contain a set of expandable * sections. A <code>ScrolledPageComposite</code> is created and a new * composite within that, to ensure that expanding the sections will * always have enough space, unless there already is a * <code>ScrolledComposite</code> along the parent chain of * <code>parent</code>, in which case a normal <code>Composite</code> * is created. * <p> * The receiver keeps a reference to the inner body composite, so that * new sections can be added via <code>createSection</code>. * </p> * * @param parent the parent composite * @return the newly created composite */ public Composite createSectionComposite(Composite parent) { Assert.isTrue(fBody == null); boolean isNested= isNestedInScrolledComposite(parent); Composite composite; if (isNested) { composite= new Composite(parent, SWT.NONE); fBody= composite; } else { composite= new ScrolledPageContent(parent); fBody= ((ScrolledPageContent) composite).getBody(); } fBody.setLayout(new GridLayout()); return composite; } /** * Creates an expandable section within the parent created previously by * calling <code>createSectionComposite</code>. Controls can be added * directly to the returned composite, which has no layout initially. * * @param label the display name of the section * @return a composite within the expandable section */ public Composite createSection(String label) { Assert.isNotNull(fBody); final ExpandableComposite excomposite= new ExpandableComposite(fBody, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.COMPACT); if (fFirstChild == null) fFirstChild= excomposite; excomposite.setText(label); String last= null; if (fLastOpenKey != null && fDialogSettingsStore != null) last= fDialogSettingsStore.getString(fLastOpenKey); if (fFirstChild == excomposite && !__NONE.equals(last) || label.equals(last)) { excomposite.setExpanded(true); if (fFirstChild != excomposite) fFirstChild.setExpanded(false); } else { excomposite.setExpanded(false); } excomposite.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false)); updateSectionStyle(excomposite); manage(excomposite); Composite contents= new Composite(excomposite, SWT.NONE); excomposite.setClient(contents); return contents; } } protected static final int INDENT= 20; private OverlayPreferenceStore fStore; private Map fCheckBoxes= new HashMap(); private SelectionListener fCheckBoxListener= new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { Button button= (Button) e.widget; fStore.setValue((String) fCheckBoxes.get(button), button.getSelection()); } }; private Map fTextFields= new HashMap(); private ModifyListener fTextFieldListener= new ModifyListener() { public void modifyText(ModifyEvent e) { Text text= (Text) e.widget; fStore.setValue((String) fTextFields.get(text), text.getText()); } }; private ArrayList fNumberFields= new ArrayList(); private ModifyListener fNumberFieldListener= new ModifyListener() { public void modifyText(ModifyEvent e) { numberFieldChanged((Text) e.widget); } }; /** * List of master/slave listeners when there's a dependency. * * @see #createDependency(Button, Control) * @since 3.0 */ private ArrayList fMasterSlaveListeners= new ArrayList(); private StatusInfo fStatus; private final PreferencePage fMainPage; public AbstractConfigurationBlock(OverlayPreferenceStore store) { Assert.isNotNull(store); fStore= store; fMainPage= null; } public AbstractConfigurationBlock(OverlayPreferenceStore store, PreferencePage mainPreferencePage) { Assert.isNotNull(store); Assert.isNotNull(mainPreferencePage); fStore= store; fMainPage= mainPreferencePage; } protected final ScrolledPageContent getParentScrolledComposite(Control control) { Control parent= control.getParent(); while (!(parent instanceof ScrolledPageContent) && parent != null) { parent= parent.getParent(); } if (parent instanceof ScrolledPageContent) { return (ScrolledPageContent) parent; } return null; } private final ExpandableComposite getParentExpandableComposite(Control control) { Control parent= control.getParent(); while (!(parent instanceof ExpandableComposite) && parent != null) { parent= parent.getParent(); } if (parent instanceof ExpandableComposite) { return (ExpandableComposite) parent; } return null; } protected void updateSectionStyle(ExpandableComposite excomposite) { excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); } private void makeScrollableCompositeAware(Control control) { ScrolledPageContent parentScrolledComposite= getParentScrolledComposite(control); if (parentScrolledComposite != null) { parentScrolledComposite.adaptChild(control); } } private boolean isNestedInScrolledComposite(Composite parent) { return getParentScrolledComposite(parent) != null; } protected Button addCheckBox(Composite parent, String label, String key, int indentation) { Button checkBox= new Button(parent, SWT.CHECK); checkBox.setText(label); GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent= indentation; gd.horizontalSpan= 2; checkBox.setLayoutData(gd); checkBox.addSelectionListener(fCheckBoxListener); makeScrollableCompositeAware(checkBox); fCheckBoxes.put(checkBox, key); return checkBox; } /** * Returns an array of size 2: * - first element is of type <code>Label</code> * - second element is of type <code>Text</code> * Use <code>getLabelControl</code> and <code>getTextControl</code> to get the 2 controls. * * @param composite the parent composite * @param label the text field's label * @param key the preference key * @param textLimit the text limit * @param indentation the field's indentation * @param isNumber <code>true</code> iff this text field is used to e4dit a number * @return the controls added */ protected Control[] addLabelledTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) { PixelConverter pixelConverter= new PixelConverter(composite); Label labelControl= new Label(composite, SWT.NONE); labelControl.setText(label); GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent= indentation; labelControl.setLayoutData(gd); Text textControl= new Text(composite, SWT.BORDER | SWT.SINGLE); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.widthHint= pixelConverter.convertWidthInCharsToPixels(textLimit + 1); textControl.setLayoutData(gd); textControl.setTextLimit(textLimit); fTextFields.put(textControl, key); if (isNumber) { fNumberFields.add(textControl); textControl.addModifyListener(fNumberFieldListener); } else { textControl.addModifyListener(fTextFieldListener); } return new Control[]{labelControl, textControl}; } protected void createDependency(final Button master, final Control slave) { createDependency(master, new Control[] {slave}); } protected void createDependency(final Button master, final Control[] slaves) { Assert.isTrue(slaves.length > 0); indent(slaves[0]); SelectionListener listener= new SelectionListener() { public void widgetSelected(SelectionEvent e) { boolean state= master.getSelection(); for (int i= 0; i < slaves.length; i++) { slaves[i].setEnabled(state); } } public void widgetDefaultSelected(SelectionEvent e) {} }; master.addSelectionListener(listener); fMasterSlaveListeners.add(listener); } protected static void indent(Control control) { ((GridData) control.getLayoutData()).horizontalIndent+= INDENT; } public void initialize() { initializeFields(); } private void initializeFields() { Iterator iter= fCheckBoxes.keySet().iterator(); while (iter.hasNext()) { Button b= (Button) iter.next(); String key= (String) fCheckBoxes.get(b); b.setSelection(fStore.getBoolean(key)); } iter= fTextFields.keySet().iterator(); while (iter.hasNext()) { Text t= (Text) iter.next(); String key= (String) fTextFields.get(t); t.setText(fStore.getString(key)); } // Update slaves iter= fMasterSlaveListeners.iterator(); while (iter.hasNext()) { SelectionListener listener= (SelectionListener)iter.next(); listener.widgetSelected(null); } updateStatus(new StatusInfo()); } public void performOk() { } public void performDefaults() { initializeFields(); } IStatus getStatus() { if (fStatus == null) fStatus= new StatusInfo(); return fStatus; } /* * @see org.eclipse.jdt.internal.ui.preferences.IPreferenceConfigurationBlock#dispose() * @since 3.0 */ public void dispose() { } private void numberFieldChanged(Text textControl) { String number= textControl.getText(); IStatus status= validatePositiveNumber(number); if (!status.matches(IStatus.ERROR)) fStore.setValue((String) fTextFields.get(textControl), number); updateStatus(status); } private IStatus validatePositiveNumber(String number) { StatusInfo status= new StatusInfo(); if (number.length() == 0) { status.setError(PreferencesMessages.RubyEditorPreferencePage_empty_input); } else { try { int value= Integer.parseInt(number); if (value < 0) status.setError(Messages.format(PreferencesMessages.RubyEditorPreferencePage_invalid_input, number)); } catch (NumberFormatException e) { status.setError(Messages.format(PreferencesMessages.RubyEditorPreferencePage_invalid_input, number)); } } return status; } protected void updateStatus(IStatus status) { if (fMainPage == null) return; fMainPage.setValid(status.isOK()); StatusUtil.applyToStatusLine(fMainPage, status); } protected final OverlayPreferenceStore getPreferenceStore() { return fStore; } protected Composite createSubsection(Composite parent, SectionManager manager, String label) { if (manager != null) { return manager.createSection(label); } else { Group group= new Group(parent, SWT.SHADOW_NONE); group.setText(label); GridData data= new GridData(SWT.FILL, SWT.CENTER, true, false); group.setLayoutData(data); return group; } } } --- NEW FILE: RubyEditorColoringPreferencePage.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.rubypeople.rdt.internal.ui.preferences; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.rubypeople.rdt.internal.ui.RubyPlugin; /** * Quick Diff preference page. * <p> * Note: Must be public since it is referenced from plugin.xml * </p> * * @since 0.9.0 */ public class RubyEditorColoringPreferencePage extends AbstractConfigurationBlockPreferencePage { /* * @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#getHelpId() */ protected String getHelpId() { return null; // TODO Fix when we have IRubyHelpContextIds //return IRubyHelpContextIds.RUBY_EDITOR_PREFERENCE_PAGE; } /* * @see org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setDescription() */ protected void setDescription() { String description= PreferencesMessages.RubyEditorPreferencePage_colors; setDescription(description); } protected Label createDescriptionLabel(Composite parent) { return null; } /* * @see org.org.eclipse.ui.internal.editors.text.AbstractConfigurationBlockPreferencePage#setPreferenceStore() */ protected void setPreferenceStore() { setPreferenceStore(RubyPlugin.getDefault().getPreferenceStore()); } /* * @see org.eclipse.ui.internal.editors.text.AbstractConfigureationBlockPreferencePage#createConfigurationBlock(org.eclipse.ui.internal.editors.text.OverlayPreferenceStore) */ protected IPreferenceConfigurationBlock createConfigurationBlock(OverlayPreferenceStore overlayPreferenceStore) { return new RubyEditorColoringConfigurationBlock(overlayPreferenceStore); } } --- NEW FILE: IPreferenceConfigurationBlock.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.rubypeople.rdt.internal.ui.preferences; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; /** * Interface for preference configuration blocks which can either be * wrapped by a {@link org.rubypeople.rdt.internal.ui.preferences.AbstractConfigurationBlockPreferencePage} * or be included some preference page. * <p> * Clients may implement this interface. * </p> * * @since 0.9.0 */ public interface IPreferenceConfigurationBlock { /** * Creates the preference control. * * @param parent the parent composite to which to add the preferences control * @return the control that was added to <code>parent</code> */ Control createControl(Composite parent); /** * Called after creating the control. Implementations should load the * preferences values and update the controls accordingly. */ void initialize(); /** * Called when the <code>OK</code> button is pressed on the preference * page. Implementations should commit the configured preference settings * into their form of preference storage. */ void performOk(); /** * Called when the <code>Defaults</code> button is pressed on the * preference page. Implementation should reset any preference settings to * their default values and adjust the controls accordingly. */ void performDefaults(); /** * Called when the preference page is being disposed. Implementations should * free any resources they are holding on to. */ void dispose(); } --- NEW FILE: RubyEditorColoringConfigurationBlock.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.rubypeople.rdt.internal.ui.preferences; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Iterator; import org.eclipse.core.runtime.Preferences; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.preference.ColorSelector; import org.eclipse.jface.preference.IPreferenceStore; 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; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerSorter; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontMetrics; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Link; import org.eclipse.swt.widgets.ScrollBar; import org.eclipse.swt.widgets.Scrollable; import org.eclipse.ui.dialogs.PreferencesUtil; import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.texteditor.ChainedPreferenceStore; import org.rubypeople.rdt.core.RubyCore; import org.rubypeople.rdt.internal.ui.RubyPlugin; import org.rubypeople.rdt.internal.ui.rubyeditor.RubySourceViewer; import org.rubypeople.rdt.internal.ui.text.IRubyColorConstants; import org.rubypeople.rdt.internal.ui.text.IRubyPartitions; import org.rubypeople.rdt.internal.ui.text.PreferencesAdapter; import org.rubypeople.rdt.internal.ui.text.RubyColorManager; import org.rubypeople.rdt.internal.ui.text.SimpleRubySourceViewerConfiguration; import org.rubypeople.rdt.internal.ui.util.PixelConverter; import org.rubypeople.rdt.ui.PreferenceConstants; import org.rubypeople.rdt.ui.text.IColorManager; /** * Configures Ruby Editor hover preferences. * * @since 0.9.0 */ class RubyEditorColoringConfigurationBlock extends AbstractConfigurationBlock { /** * Item in the highlighting color list. * * @since 0.9.0 */ private static class HighlightingColorListItem { /** Display name */ private String fDisplayName; /** Color preference key */ private String fColorKey; /** Bold preference key */ private String fBoldKey; /** Italic preference key */ private String fItalicKey; /** * Strikethrough preference key. * @since 3.1 */ private String fStrikethroughKey; /** Underline preference key. * @since 3.1 */ private String fUnderlineKey; /** * 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 * @param strikethroughKey the strikethrough preference key * @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; fStrikethroughKey= strikethroughKey; fUnderlineKey= underlineKey; } /** * @return the bold preference key */ public String getBoldKey() { return fBoldKey; } /** * @return the bold preference key */ public String getItalicKey() { return fItalicKey; } /** * @return the strikethrough preference key * @since 3.1 */ public String getStrikethroughKey() { return fStrikethroughKey; } /** * @return the underline preference key * @since 3.1 */ public String getUnderlineKey() { return fUnderlineKey; } /** * @return the color preference key */ public String getColorKey() { return fColorKey; } /** * @return the display name */ public String getDisplayName() { return fDisplayName; } } private static class SemanticHighlightingColorListItem extends HighlightingColorListItem { /** Enablement preference key */ private final String fEnableKey; /** * 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 * @param strikethroughKey the strikethroughKey preference key * @param underlineKey the underlineKey preference key * @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; } /** * @return the enablement preference key */ public String getEnableKey() { return fEnableKey; } } /** * Color list label provider. * * @since 3.0 */ private class ColorListLabelProvider extends LabelProvider { /* * @see org.eclipse.jface.viewers.ILabelProvider#getText(ruby.lang.Object) */ public String getText(Object element) { if (element instanceof String) return (String) element; return ((HighlightingColorListItem)element).getDisplayName(); } } /** * Color list content provider. * * @since 3.0 */ private class ColorListContentProvider implements ITreeContentProvider { /* * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(ruby.lang.Object) */ public Object[] getElements(Object inputElement) { return new String[] {fRubyCategory}; } /* * @see org.eclipse.jface.viewers.IContentProvider#dispose() */ public void dispose() { } /* * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, ruby.lang.Object, ruby.lang.Object) */ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } public Object[] getChildren(Object parentElement) { if (parentElement instanceof String) { String entry= (String) parentElement; if (fRubyCategory.equals(entry)) return fListModel.toArray(); } return new Object[0]; } public Object getParent(Object element) { if (element instanceof String) return null; return fRubyCategory; } public boolean hasChildren(Object element) { return element instanceof String; } } private static final String BOLD= PreferenceConstants.EDITOR_BOLD_SUFFIX; /** * Preference key suffix for italic preferences. * @since 0.9.0 */ private static final String ITALIC= PreferenceConstants.EDITOR_ITALIC_SUFFIX; /** * Preference key suffix for strikethrough preferences. * @since 0.9.0 */ private static final String STRIKETHROUGH= PreferenceConstants.EDITOR_STRIKETHROUGH_SUFFIX; /** * Preference key suffix for underline preferences. * @since 0.9.0 */ private static final String UNDERLINE= PreferenceConstants.EDITOR_UNDERLINE_SUFFIX; private static final String COMPILER_TASK_TAGS= RubyCore.COMPILER_TASK_TAGS; /** * The keys of the overlay store. */ private final String[][] fSyntaxColorListModel= new String[][] { { PreferencesMessages.RubyEditorPreferencePage_multiLineComment, IRubyColorConstants.RUBY_MULTI_LINE_COMMENT }, { PreferencesMessages.RubyEditorPreferencePage_singleLineComment, IRubyColorConstants.RUBY_SINGLE_LINE_COMMENT }, { PreferencesMessages.RubyEditorPreferencePage_rubyCommentTaskTags, IRubyColorConstants.TASK_TAG }, { PreferencesMessages.RubyEditorPreferencePage_keywords, IRubyColorConstants.RUBY_KEYWORD }, { PreferencesMessages.RubyEditorPreferencePage_strings, IRubyColorConstants.RUBY_STRING }, { PreferencesMessages.RubyEditorPreferencePage_characters, IRubyColorConstants.RUBY_CHARACTER }, { PreferencesMessages.RubyEditorPreferencePage_commands, IRubyColorConstants.RUBY_COMMAND }, { PreferencesMessages.RubyEditorPreferencePage_fixnums, IRubyColorConstants.RUBY_FIXNUM }, { PreferencesMessages.RubyEditorPreferencePage_globals, IRubyColorConstants.RUBY_GLOBAL }, { PreferencesMessages.RubyEditorPreferencePage_regular_expressions, IRubyColorConstants.RUBY_REGEXP }, { PreferencesMessages.RubyEditorPreferencePage_symbols, IRubyColorConstants.RUBY_SYMBOL }, { PreferencesMessages.RubyEditorPreferencePage_variables, IRubyColorConstants.RUBY_INSTANCE_VARIABLE }, { PreferencesMessages.RubyEditorPreferencePage_others, IRubyColorConstants.RUBY_DEFAULT } }; private final String fRubyCategory= PreferencesMessages.RubyEditorPreferencePage_coloring_category_ruby; private ColorSelector fSyntaxForegroundColorEditor; private Label fColorEditorLabel; private Button fBoldCheckBox; private Button fEnableCheckbox; /** * Check box for italic preference. * @since 3.0 */ private Button fItalicCheckBox; /** * Check box for strikethrough preference. * @since 3.1 */ private Button fStrikethroughCheckBox; /** * Check box for underline preference. * @since 3.1 */ private Button fUnderlineCheckBox; /** * Highlighting color list * @since 3.0 */ private final java.util.List fListModel= new ArrayList(); /** * Highlighting color list viewer * @since 3.0 */ private StructuredViewer fListViewer; /** * The previewer. * @since 3.0 */ private RubySourceViewer fPreviewViewer; /** * The color manager. * @since 3.1 */ private IColorManager fColorManager; /** * The font metrics. * @since 3.1 */ private FontMetrics fFontMetrics; public RubyEditorColoringConfigurationBlock(OverlayPreferenceStore store) { super(store); fColorManager= new RubyColorManager(false); 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()); } private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() { ArrayList overlayKeys= new ArrayList(); for (int i= 0, n= fListModel.size(); i < n; i++) { HighlightingColorListItem item= (HighlightingColorListItem) fListModel.get(i); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, item.getColorKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, item.getBoldKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, item.getItalicKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, item.getStrikethroughKey())); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, item.getUnderlineKey())); if (item instanceof SemanticHighlightingColorListItem) overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, ((SemanticHighlightingColorListItem) item).getEnableKey())); } OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()]; overlayKeys.toArray(keys); return keys; } /** * Creates page for hover preferences. * * @param parent the parent composite * @return the control for the preference page */ public Control createControl(Composite parent) { initializeDialogUnits(parent); return createSyntaxPage(parent); } /** * Returns the number of pixels corresponding to the width of the given * number of characters. * <p> * This method may only be called after <code>initializeDialogUnits</code> * has been called. * </p> * <p> * Clients may call this framework method, but should not override it. * </p> * * @param chars * the number of characters * @return the number of pixels */ private int convertWidthInCharsToPixels(int chars) { // test for failure to initialize for backward compatibility if (fFontMetrics == null) return 0; return Dialog.convertWidthInCharsToPixels(fFontMetrics, chars); } /** * Returns the number of pixels corresponding to the height of the given * number of characters. * <p> * This method may only be called after <code>initializeDialogUnits</code> * has been called. * </p> * <p> * Clients may call this framework method, but should not override it. * </p> * * @param chars * the number of characters * @return the number of pixels */ private int convertHeightInCharsToPixels(int chars) { // test for failure to initialize for backward compatibility if (fFontMetrics == null) return 0; return Dialog.convertHeightInCharsToPixels(fFontMetrics, chars); } public void initialize() { super.initialize(); fListViewer.setInput(fListModel); fListViewer.setSelection(new StructuredSelection(fRubyCategory)); } public void performDefaults() { super.performDefaults(); handleSyntaxColorListSelection(); fPreviewViewer.invalidateTextPresentation(); } /* * @see org.eclipse.jdt.internal.ui.preferences.IPreferenceConfigurationBlock#dispose() */ public void dispose() { fColorManager.dispose(); super.dispose(); } private void handleSyntaxColorListSelection() { HighlightingColorListItem item= getHighlightingColorListItem(); if (item == null) { fEnableCheckbox.setEnabled(false); fSyntaxForegroundColorEditor.getButton().setEnabled(false); fColorEditorLabel.setEnabled(false); fBoldCheckBox.setEnabled(false); fItalicCheckBox.setEnabled(false); fStrikethroughCheckBox.setEnabled(false); fUnderlineCheckBox.setEnabled(false); return; } RGB rgb= PreferenceConverter.getColor(getPreferenceStore(), item.getColorKey()); fSyntaxForegroundColorEditor.setColorValue(rgb); fBoldCheckBox.setSelection(getPreferenceStore().getBoolean(item.getBoldKey())); fItalicCheckBox.setSelection(getPreferenceStore().getBoolean(item.getItalicKey())); fStrikethroughCheckBox.setSelection(getPreferenceStore().getBoolean(item.getStrikethroughKey())); fUnderlineCheckBox.setSelection(getPreferenceStore().getBoolean(item.getUnderlineKey())); if (item instanceof SemanticHighlightingColorListItem) { fEnableCheckbox.setEnabled(true); boolean enable= getPreferenceStore().getBoolean(((SemanticHighlightingColorListItem) item).getEnableKey()); fEnableCheckbox.setSelection(enable); fSyntaxForegroundColorEditor.getButton().setEnabled(enable); fColorEditorLabel.setEnabled(enable); fBoldCheckBox.setEnabled(enable); fItalicCheckBox.setEnabled(enable); fStrikethroughCheckBox.setEnabled(enable); fUnderlineCheckBox.setEnabled(enable); } else { fSyntaxForegroundColorEditor.getButton().setEnabled(true); fColorEditorLabel.setEnabled(true); fBoldCheckBox.setEnabled(true); fItalicCheckBox.setEnabled(true); fStrikethroughCheckBox.setEnabled(true); fUnderlineCheckBox.setEnabled(true); fEnableCheckbox.setEnabled(false); fEnableCheckbox.setSelection(true); } } private Control createSyntaxPage(final Composite parent) { Composite colorComposite= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; colorComposite.setLayout(layout); Link link= new Link(colorComposite, SWT.NONE); link.setText(PreferencesMessages.RubyEditorColoringConfigurationBlock_link); link.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { PreferencesUtil.createPreferenceDialogOn(parent.getShell(), e.text, null, null); } }); // TODO replace by link-specific tooltips when // bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=88866 gets fixed // link.setToolTipText(PreferencesMessages.RubyEditorColoringConfigurationBlock_link_tooltip); GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint= 150; // only expand further if anyone else requires it gridData.horizontalSpan= 2; link.setLayoutData(gridData); addFiller(colorComposite, 1); Label label; label= new Label(colorComposite, SWT.LEFT); label.setText(PreferencesMessages.RubyEditorPreferencePage_coloring_element); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite editorComposite= new Composite(colorComposite, SWT.NONE); layout= new GridLayout(); layout.numColumns= 2; layout.marginHeight= 0; layout.marginWidth= 0; editorComposite.setLayout(layout); GridData gd= new GridData(SWT.FILL, SWT.BEGINNING, true, false); editorComposite.setLayoutData(gd); fListViewer= new TreeViewer(editorComposite, SWT.SINGLE | SWT.BORDER); fListViewer.setLabelProvider(new ColorListLabelProvider()); fListViewer.setContentProvider(new ColorListContentProvider()); fListViewer.setSorter(new ViewerSorter() { public int category(Object element) { // don't sort the top level categories if (fRubyCategory.equals(element)) return 0; // to sort semantic settings after partition based ones: // if (element instanceof SemanticHighlightingColorListItem) // return 1; return 0; } }); gd= new GridData(SWT.BEGINNING, SWT.BEGINNING, false, true); gd.heightHint= convertHeightInCharsToPixels(9); int maxWidth= 0; for (Iterator it= fListModel.iterator(); it.hasNext();) { HighlightingColorListItem item= (HighlightingColorListItem) it.next(); maxWidth= Math.max(maxWidth, convertWidthInCharsToPixels(item.getDisplayName().length())); } ScrollBar vBar= ((Scrollable) fListViewer.getControl()).getVerticalBar(); if (vBar != null) maxWidth += vBar.getSize().x * 3; // scrollbars and tree indentation guess gd.widthHint= maxWidth; fListViewer.getControl().setLayoutData(gd); Composite stylesComposite= new Composite(editorComposite, SWT.NONE); layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; layout.numColumns= 2; stylesComposite.setLayout(layout); stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); fEnableCheckbox= new Button(stylesComposite, SWT.CHECK); fEnableCheckbox.setText(PreferencesMessages.RubyEditorPreferencePage_enable); gd= new GridData(GridData.FILL_HORIZONTAL); gd.horizontalAlignment= GridData.BEGINNING; gd.horizontalSpan= 2; fEnableCheckbox.setLayoutData(gd); fColorEditorLabel= new Label(stylesComposite, SWT.LEFT); fColorEditorLabel.setText(PreferencesMessages.RubyEditorPreferencePage_color); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent= 20; fColorEditorLabel.setLayoutData(gd); fSyntaxForegroundColorEditor= new ColorSelector(stylesComposite); Button foregroundColorButton= fSyntaxForegroundColorEditor.getButton(); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); foregroundColorButton.setLayoutData(gd); fBoldCheckBox= new Button(stylesComposite, SWT.CHECK); fBoldCheckBox.setText(PreferencesMessages.RubyEditorPreferencePage_bold); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent= 20; gd.horizontalSpan= 2; fBoldCheckBox.setLayoutData(gd); fItalicCheckBox= new Button(stylesComposite, SWT.CHECK); fItalicCheckBox.setText(PreferencesMessages.RubyEditorPreferencePage_italic); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent= 20; gd.horizontalSpan= 2; fItalicCheckBox.setLayoutData(gd); fStrikethroughCheckBox= new Button(stylesComposite, SWT.CHECK); fStrikethroughCheckBox.setText(PreferencesMessages.RubyEditorPreferencePage_strikethrough); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent= 20; gd.horizontalSpan= 2; fStrikethroughCheckBox.setLayoutData(gd); fUnderlineCheckBox= new Button(stylesComposite, SWT.CHECK); fUnderlineCheckBox.setText(PreferencesMessages.RubyEditorPreferencePage_underline); gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); gd.horizontalIndent= 20; gd.horizontalSpan= 2; fUnderlineCheckBox.setLayoutData(gd); label= new Label(colorComposite, SWT.LEFT); label.setText(PreferencesMessages.RubyEditorPreferencePage_preview); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Control previewer= createPreviewer(colorComposite); gd= new GridData(GridData.FILL_BOTH); gd.widthHint= convertWidthInCharsToPixels(20); gd.heightHint= convertHeightInCharsToPixels(5); previewer.setLayoutData(gd); fListViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { handleSyntaxColorListSelection(); } }); foregroundColorButton.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { // do nothing } public void widgetSelected(SelectionEvent e) { HighlightingColorListItem item= getHighlightingColorListItem(); PreferenceConverter.setValue(getPreferenceStore(), item.getColorKey(), fSyntaxForegroundColorEditor.getColorValue()); } }); fBoldCheckBox.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { // do nothing } public void widgetSelected(SelectionEvent e) { HighlightingColorListItem item= getHighlightingColorListItem(); getPreferenceStore().setValue(item.getBoldKey(), fBoldCheckBox.getSelection()); } }); fItalicCheckBox.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { // do nothing } public void widgetSelected(SelectionEvent e) { HighlightingColorListItem item= getHighlightingColorListItem(); getPreferenceStore().setValue(item.getItalicKey(), fItalicCheckBox.getSelection()); } }); fStrikethroughCheckBox.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { // do nothing } public void widgetSelected(SelectionEvent e) { HighlightingColorListItem item= getHighlightingColorListItem(); getPreferenceStore().setValue(item.getStrikethroughKey(), fStrikethroughCheckBox.getSelection()); } }); fUnderlineCheckBox.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { // do nothing } public void widgetSelected(SelectionEvent e) { HighlightingColorListItem item= getHighlightingColorListItem(); getPreferenceStore().setValue(item.getUnderlineKey(), fUnderlineCheckBox.getSelection()); } }); fEnableCheckbox.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { // do nothing } public void widgetSelected(SelectionEvent e) { HighlightingColorListItem item= getHighlightingColorListItem(); if (item instanceof SemanticHighlightingColorListItem) { boolean enable= fEnableCheckbox.getSelection(); getPreferenceStore().setValue(((SemanticHighlightingColorListItem) item).getEnableKey(), enable); ... [truncated message content] |
|
From: Markus B. <mba...@us...> - 2006-04-09 23:42:48
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.build/cruiseControl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31978 Modified Files: build-RDT.xml Log Message: added deploy-sourceforge target Index: build-RDT.xml =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.build/cruiseControl/build-RDT.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** build-RDT.xml 9 Apr 2006 22:39:19 -0000 1.4 --- build-RDT.xml 9 Apr 2006 23:42:44 -0000 1.5 *************** *** 156,158 **** --- 156,167 ---- passphrase=""/> </target> + + <target name="deploy-sourceforge" if="label"> + <property name="buildDirectory" value="/tmp/rdt-${label}/dist"/> + <ftp server="upload.sf.net" remotedir="incoming" userid="anonymous" password="mba...@us..."> + <fileset dir="${buildDirectory}"> + <include name="org.rubypeople.rdt-${label}.zip"/> + </fileset> + </ftp> + </target> </project> |
|
From: Markus B. <mba...@us...> - 2006-04-09 22:39:25
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.build/cruiseControl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6444 Modified Files: build-RDT.xml Added Files: build.sh Log Message: added target for 0.8.0 RC in build-RDT.xml, new file build.sh for further automating integration and release builds --- NEW FILE: build.sh --- #!/bin/sh if [ "$1" == "" ]; then echo "call with release or integration build target in build-RDT.xml" ; exit 1 fi #echo "Make sure xvfb is running - otherwise the tests won't run. Start with" Xvfb :1 & export DISPLAY=localhost:1 cmd="ant -f build-RDT.xml $1" logfile=build.$1.log echo Starting build: $cmd, see $logfile $cmd > $logfile Index: build-RDT.xml =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.build/cruiseControl/build-RDT.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** build-RDT.xml 20 Jan 2006 01:52:39 -0000 1.3 --- build-RDT.xml 9 Apr 2006 22:39:19 -0000 1.4 *************** *** 60,63 **** --- 60,69 ---- </target> + <target name="0.8.0.RC1"> + <property name="cvsLabel" value="R2006-04-09_0-8-0_RC1"/> + <property name="label" value="0.8.0.604092300RC1"/> + <antcall target="integration"/> + </target> + <target name="0.7.0.RC1"> <property name="cvsLabel" value="R2005-12-22_0-7-0_RC1"/> |
|
From: Christopher W. <caw...@us...> - 2006-04-09 12:53:48
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28495 Modified Files: Changelog.txt Log Message: Index: Changelog.txt =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt/Changelog.txt,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Changelog.txt 25 Mar 2006 19:43:17 -0000 1.21 --- Changelog.txt 9 Apr 2006 12:53:36 -0000 1.22 *************** *** 6,9 **** --- 6,12 ---- * Distinct syntax highlighting of instance/class variables * Goto matching bracket action + * Right-clicking on "ruler" to left of ruby file's contents now allows user to add bookmark or task + * Attempts to set ruby interpreter to common install location if no interpreter has been set + * A number of bugfixes (see http://rubyeclipse.mktec.com/cgi-bin/trac.py/query?status=closed&milestone=0.8.0&type=defect&order=priority) Release 0.7.0: |
|
From: Kyle S. <kyl...@us...> - 2006-04-08 06:18:03
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32763/src/org/rubypeople/rdt/internal/ui/text/ruby Modified Files: RubyCodeScanner.java Added Files: RubyNumberRule.java Log Message: Fixed syntax highlighting of fixnums --- NEW FILE: RubyNumberRule.java --- package org.rubypeople.rdt.internal.ui.text.ruby; import org.eclipse.jface.text.rules.ICharacterScanner; import org.eclipse.jface.text.rules.IToken; import org.eclipse.jface.text.rules.NumberRule; import org.eclipse.jface.text.rules.Token; public class RubyNumberRule extends NumberRule { public RubyNumberRule(IToken token){ super(token); } /* * @see IRule#evaluate(ICharacterScanner) */ public IToken evaluate(ICharacterScanner scanner) { int c= scanner.read(); if (Character.isDigit((char)c)) { scanner.unread(); scanner.unread(); c = scanner.read(); if ( Character.isLetter((char)c)){ do { c= scanner.read(); } while (Character.isDigit((char) c)); scanner.unread(); return Token.UNDEFINED; } c = scanner.read(); if (fColumn == UNDEFINED || (fColumn == scanner.getColumn() - 1)) { do { c= scanner.read(); } while (Character.isDigit((char) c)); if ( Character.isLetter((char)c) ){ scanner.unread(); return Token.UNDEFINED; } scanner.unread(); return fToken; } } scanner.unread(); return Token.UNDEFINED; } } Index: RubyCodeScanner.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyCodeScanner.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RubyCodeScanner.java 18 Feb 2006 17:29:33 -0000 1.11 --- RubyCodeScanner.java 8 Apr 2006 06:17:58 -0000 1.12 *************** *** 54,58 **** IToken fixnumToken = getToken(IRubyColorConstants.RUBY_FIXNUM); ! rules.add(new NumberRule(fixnumToken)); rules.add(new SymbolRule(getToken(IRubyColorConstants.RUBY_SYMBOL))); --- 54,58 ---- IToken fixnumToken = getToken(IRubyColorConstants.RUBY_FIXNUM); ! rules.add(new RubyNumberRule(fixnumToken)); rules.add(new SymbolRule(getToken(IRubyColorConstants.RUBY_SYMBOL))); |
|
From: Kyle S. <kyl...@us...> - 2006-04-08 05:40:10
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8580/src/org/rubypeople/rdt/internal/ui/rubyeditor Modified Files: RubyEditor.java Log Message: Fixed to be compatible with Eclipse 3.2 AbstractDecoratedTextEditor on: gotoAnnotation - Modified to return Annotation type isNavigationTarget - changed to protected Index: RubyEditor.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** RubyEditor.java 7 Apr 2006 21:23:55 -0000 1.40 --- RubyEditor.java 8 Apr 2006 05:40:06 -0000 1.41 *************** *** 357,366 **** * "Go to Next/Previous Annotation" actions * * @param annotation the annotation * @return <code>true</code> if this is a target, <code>false</code> * otherwise ! * @since 3.0 */ ! private boolean isNavigationTarget(Annotation annotation) { Preferences preferences= EditorsUI.getPluginPreferences(); AnnotationPreference preference= getAnnotationPreferenceLookup().getAnnotationPreference(annotation); --- 357,369 ---- * "Go to Next/Previous Annotation" actions * + * CHANGED TO WORK WITH 3.2 (Non-breaking in 3.1) + * Method couldn't be restricted to private, changed to protected + * * @param annotation the annotation * @return <code>true</code> if this is a target, <code>false</code> * otherwise ! * @since 3.2 */ ! protected boolean isNavigationTarget(Annotation annotation) { Preferences preferences= EditorsUI.getPluginPreferences(); AnnotationPreference preference= getAnnotationPreferenceLookup().getAnnotationPreference(annotation); *************** *** 376,382 **** * Next/Previous tool bar drop down menu and if it is checked. * * @param forward <code>true</code> if search direction is forward, <code>false</code> if backward */ ! public void gotoAnnotation(boolean forward) { ITextSelection selection= (ITextSelection) getSelectionProvider().getSelection(); Position position= new Position(0, 0); --- 379,390 ---- * Next/Previous tool bar drop down menu and if it is checked. * + * CHANGED TO WORK WITH 3.2 (Non-breaking in 3.1) + * Annotation type must be returned + * * @param forward <code>true</code> if search direction is forward, <code>false</code> if backward + * @since 3.2 */ ! public Annotation gotoAnnotation(boolean forward) { ! Annotation annotation = null; ITextSelection selection= (ITextSelection) getSelectionProvider().getSelection(); Position position= new Position(0, 0); *************** *** 385,389 **** selectAndReveal(position.getOffset(), position.getLength()); } else /* no delay - see bug 18316 */ { ! Annotation annotation= getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position); setStatusLineErrorMessage(null); setStatusLineMessage(null); --- 393,397 ---- selectAndReveal(position.getOffset(), position.getLength()); } else /* no delay - see bug 18316 */ { ! annotation= getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position); setStatusLineErrorMessage(null); setStatusLineMessage(null); *************** *** 394,397 **** --- 402,406 ---- } } + return annotation; } |
|
From: Christopher W. <caw...@us...> - 2006-04-07 21:25:39
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14692/src/org/rubypeople/rdt/internal/launching Modified Files: RubyRuntime.java Log Message: Close Ticket #100 - Auto-detect ruby interpreter. If no file with interpreters exists, just try common install location for ruby depending on platform (\ruby\bin\ruby.exe for Win32, /usr/local/bin/ruby for everything else) Index: RubyRuntime.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyRuntime.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RubyRuntime.java 8 Aug 2005 23:27:26 -0000 1.8 --- RubyRuntime.java 7 Apr 2006 21:25:25 -0000 1.9 *************** *** 19,22 **** --- 19,23 ---- import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; + import org.eclipse.core.runtime.Platform; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; *************** *** 126,129 **** --- 127,131 ---- Reader fileReader = this.getRuntimeConfigurationReader() ; if (fileReader == null) { + autoDetectRubyInterpreter(); return ; } *************** *** 134,137 **** --- 136,151 ---- } + private void autoDetectRubyInterpreter() { + IPath path = null; + if (Platform.getOS().equals(Platform.OS_WIN32)) { + path = new Path("/ruby/bin/ruby.exe"); + } else { + path = new Path("/usr/local/bin/ruby"); + } + RubyInterpreter interpreter = new RubyInterpreter("Default Ruby Interpreter", path); + installedInterpreters.add(interpreter); + selectedInterpreter = interpreter; + } + protected Reader getRuntimeConfigurationReader() { try { |
|
From: Christopher W. <caw...@us...> - 2006-04-07 21:24:03
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13528/src/org/rubypeople/rdt/internal/ui/rubyeditor Modified Files: RubyEditor.java Log Message: Fix Ticket # 92 - Error when adjusting use tab preference with open ruby editor Index: RubyEditor.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** RubyEditor.java 24 Feb 2006 20:06:47 -0000 1.39 --- RubyEditor.java 7 Apr 2006 21:23:55 -0000 1.40 *************** *** 46,49 **** --- 46,50 ---- import org.eclipse.jface.text.source.ICharacterPairMatcher; import org.eclipse.jface.text.source.ISourceViewer; + import org.eclipse.jface.text.source.ISourceViewerExtension2; import org.eclipse.jface.text.source.IVerticalRuler; import org.eclipse.jface.text.source.SourceViewerConfiguration; *************** *** 624,628 **** // for rereading the indentPrefixes for shift left/right from the // RubySourceViewerConfiguration ! this.getSourceViewer().configure(this.getSourceViewerConfiguration()); } } --- 625,632 ---- // for rereading the indentPrefixes for shift left/right from the // RubySourceViewerConfiguration ! if (getSourceViewer() instanceof ISourceViewerExtension2) { ! ((ISourceViewerExtension2) getSourceViewer()).unconfigure(); ! this.getSourceViewer().configure(this.getSourceViewerConfiguration()); ! } } } |
|
From: Christopher W. <caw...@us...> - 2006-04-07 16:43:59
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18806/src/org/rubypeople/rdt/internal/core Modified Files: RubySingletonMethod.java Log Message: report singleton method names in a consistent way Index: RubySingletonMethod.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubySingletonMethod.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RubySingletonMethod.java 10 Feb 2006 18:29:16 -0000 1.2 --- RubySingletonMethod.java 7 Apr 2006 16:43:54 -0000 1.3 *************** *** 40,43 **** --- 40,47 ---- return true; } + + public String getElementName() { + return parent.getElementName() + "." + this.name; + } } |
|
From: Christopher W. <caw...@us...> - 2006-04-07 16:42:56
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18040/src/org/rubypeople/rdt/internal/core Modified Files: RubyModelManager.java RubyScriptStructureBuilder.java RubyProject.java Log Message: fix a nasty infinite loop that showe dup when using the RubyBrowsingPerspective. Also fix the source range/position for singleton/class methods. Index: RubyProject.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** RubyProject.java 29 Mar 2006 22:46:22 -0000 1.21 --- RubyProject.java 7 Apr 2006 16:42:45 -0000 1.22 *************** *** 725,727 **** --- 725,731 ---- } + public IRubyScript getRubyScript(IFile file) { + return new RubyScript(this, file, file.getName(), DefaultWorkingCopyOwner.PRIMARY); + } + } Index: RubyScriptStructureBuilder.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScriptStructureBuilder.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** RubyScriptStructureBuilder.java 6 Apr 2006 22:26:09 -0000 1.21 --- RubyScriptStructureBuilder.java 7 Apr 2006 16:42:45 -0000 1.22 *************** *** 817,820 **** --- 817,824 ---- if (node instanceof HashNode) return "{}"; + if (node instanceof SelfNode) + return "self"; + if (node instanceof ConstNode) + return ((ConstNode)node).getName(); if (node instanceof ZArrayNode) return "[]"; *************** *** 879,888 **** * method; end end will give us: A.method method in the Outline View. */ ! String name; ! if (parentInfo instanceof RubyTypeElementInfo) { ! name = new String(((RubyTypeElementInfo) parentInfo).getName()) ! + "." + iVisited.getName(); } else { ! name = iVisited.getName(); } --- 883,892 ---- * method; end end will give us: A.method method in the Outline View. */ ! String fullName; ! String receiver = stringRepresentation(iVisited.getReceiverNode()); ! if (receiver != null && receiver.trim().length() > 0) { ! fullName = receiver + "." + iVisited.getName(); } else { ! fullName = iVisited.getName(); } *************** *** 894,898 **** // Get the type of the current parent element RubyElement type = getCurrentType(); ! RubyMethod method = new RubySingletonMethod(type, name, parameterNames); modelStack.push(method); --- 898,902 ---- // Get the type of the current parent element RubyElement type = getCurrentType(); ! RubyMethod method = new RubySingletonMethod(type, iVisited.getName(), parameterNames); modelStack.push(method); *************** *** 904,908 **** infoStack.push(info); ISourcePosition pos = iVisited.getPosition(); ! setKeywordRange("def", pos, info, name); info.setArgumentNames(parameterNames); --- 908,912 ---- infoStack.push(info); ISourcePosition pos = iVisited.getPosition(); ! setKeywordRange("def", pos, info, fullName); info.setArgumentNames(parameterNames); Index: RubyModelManager.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RubyModelManager.java 4 Apr 2006 23:06:22 -0000 1.8 --- RubyModelManager.java 7 Apr 2006 16:42:45 -0000 1.9 *************** *** 748,751 **** --- 748,776 ---- } } + + public static IRubyElement create(IFile file, IRubyProject project) { + if (file == null) { + return null; + } + if (project == null) { + project = RubyCore.create(file.getProject()); + } + + if (file.getFileExtension() != null) { + String name = file.getName(); + if (org.rubypeople.rdt.internal.core.util.Util.isRubyLikeFileName(name)) + return createRubyScriptFrom(file, project); + } + return null; + } + + public static IRubyElement createRubyScriptFrom(IFile file, IRubyProject project) { + if (file == null) return null; + + if (project == null) { + project = RubyCore.create(file.getProject()); + } + return project.getRubyScript(file); + } } |
|
From: Christopher W. <caw...@us...> - 2006-04-07 16:42:49
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18040/src/org/rubypeople/rdt/core Modified Files: IRubyProject.java Log Message: fix a nasty infinite loop that showe dup when using the RubyBrowsingPerspective. Also fix the source range/position for singleton/class methods. Index: IRubyProject.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyProject.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IRubyProject.java 29 Mar 2006 22:46:21 -0000 1.7 --- IRubyProject.java 7 Apr 2006 16:42:45 -0000 1.8 *************** *** 28,31 **** --- 28,32 ---- import java.util.Map; + import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; *************** *** 109,112 **** --- 110,115 ---- public abstract boolean isOnLoadpath(IRubyScript element); + + public IRubyScript getRubyScript(IFile file); } \ No newline at end of file |
|
From: Christopher W. <caw...@us...> - 2006-04-06 22:26:19
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23159/src/org/rubypeople/rdt/internal/core Modified Files: RubyScriptStructureBuilder.java Log Message: try to pick up and handle null pointers more gracefully Index: RubyScriptStructureBuilder.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScriptStructureBuilder.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** RubyScriptStructureBuilder.java 5 Apr 2006 02:09:41 -0000 1.20 --- RubyScriptStructureBuilder.java 6 Apr 2006 22:26:09 -0000 1.21 *************** *** 759,762 **** --- 759,763 ---- */ private String[] getArgs(Node argsNode) { + if (argsNode == null) return new String[0]; ArgsNode args = (ArgsNode) argsNode; boolean hasRest = false; *************** *** 791,794 **** --- 792,796 ---- private List getArguments(ListNode argList) { + if (argList == null) return new ArrayList(); List arguments = new ArrayList(); for (Iterator iter = argList.iterator(); iter.hasNext();) { *************** *** 812,815 **** --- 814,818 ---- private String stringRepresentation(Node node) { + if (node == null) return ""; if (node instanceof HashNode) return "{}"; |
|
From: David C. <dc...@us...> - 2006-04-06 01:04:58
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.testunit/ruby In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2668/ruby Modified Files: RemoteTestRunner.rb Log Message: Fixed to ignore TestCases with zero default test methods when running without a classname. Index: RemoteTestRunner.rb =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.testunit/ruby/RemoteTestRunner.rb,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RemoteTestRunner.rb 28 Mar 2005 23:23:24 -0000 1.11 --- RemoteTestRunner.rb 6 Apr 2006 01:04:47 -0000 1.12 *************** *** 193,209 **** module RDT def self.buildSuite name suite = TestSuite.new(name) sub_suites = [] ! ::ObjectSpace.each_object(Class) do |klass| ! if(Test::Unit::TestCase > klass) sub_suites << klass.suite end end ! sub_suites.sort! {|a,b| a.name <=> b.name } sub_suites.each {|s| suite << s} ! suite end --- 193,214 ---- module RDT + def self.has_tests klass + method_names = klass.public_instance_methods(true) + method_names.any? {|method_name| method_name =~ /^test./} + end + def self.buildSuite name suite = TestSuite.new(name) sub_suites = [] ! ::ObjectSpace.each_object(Class) do |klass| ! if (Test::Unit::TestCase > klass && has_tests(klass)) sub_suites << klass.suite end end ! sub_suites.sort! {|a,b| a.name <=> b.name } sub_suites.each {|s| suite << s} ! suite end |