Community
Participate
Working Groups
i would like to see some additional formats for the 'last modified' date in the text decorations preference page. mm/dd/yyyy yyyy/mm/dd etc would be nice, but at the moment i'm interested in something less verbose the the current option. many thanks!
Hi I would like to implement this. I think it's easy but I don't know how to configure it in the preference page. Tell me how do you think the additional formats must be configured in the ui and I will try to develop this feature. Thomas
Hi Thomas, firstly, thank you for your interest in our project. Of course your help is welcome and will be appreciated. But you must take into consideration that the code you are going to contribute should correspond the EPL license (http://www.eclipse.org/legal/epl-v10.html). I suggest to add this option to the SVNTeamPreferencesPage to the View Settings tab group (createViewSettingsPage method). You can add another groupbox, named "Date Formats", containing the combobox with the following items - Locale short, Locale medium, Locale long, Custom. Also the edit box should be provided with the preview of a format, containing the text mask of the selected format (not editable for standard Locale date formats, and editable for a custom one). For the custom date format the validation should be provided. You can do it using the "attachTo" method, giving the edit box as a first param and the implementation of AbstractVerifier (maybe it should be the CompositeVerifier, just think about it). Also the preview should be provided, showing the current date in the selected format. SVNTeamPreferences class has the formatDate(Date date) method, which now returns only the default locale format. So your task is to return the String, formatted using saved preference format. To work with preferences you should provide the name of the stored preference and its default value. You can choose the most easy to use for you storing format. For the example of storing the preferences see the same SVNTeamPreferences class. The SVNTeamPreferencesPage has saveValues method, where you should also save this preference, just like the others are saved. The same thing with loadValues and loadDefaultValues methods. In the SVNTeamPreferences setDefaultValues should be extended to set also the default value of this preference. I think, that's quite enough for you to develop this. If some questions are still left, please fill free to ask them. Best regards.
Oh, sorry, about UI, I have forgotten one thing:). You can view the preference page I'm talking about in 'Window->Preferences->Team->SVN' page on 'View Setting' tab group
Created attachment 100920 [details] First patch Hello Alexei I have mad a patch with all things that you told me. It is my first patch for an eclipse project, so tell me if there are problems. I will correct them. Thomas
Hi Thomas, great work! But I have several remarks - really small ones:). Firstly, and the main thing you should follow making patches for Eclipse projects. To specify, that you are providing a code that is developed under EPL license you should paste to your created files the header (ex. can be found in any our file) that says that the content is under EPL. So you should copypaste any our header to your fresh files and change the name and surname to your ones. Without such header the content is not applicable. So, about some (really not critical) mistakes. 1. You should not change NonEmptyFieldVerifier code, but use AbstractVerifierProxy, which has method isVerificationEnabled. So you should override it and make the enablement check there. (the example can be found in ProjectLocationSelectionPage). That's my fault that I haven't told you about it. 2. The preference store should be passed to SVNTeamPreferences from outside as an argument of your methods, and you are trying to get the instance of it right inside the class. 3. You should add to propertyChange(PropertyChangeEvent event) method of SVNHistoryPage the code, handling the change of the date format to refresh UI in history view. 4. The smallest one - I think a result of copypaste:). In the switch of getDateFormat "case SVNTeamPreferences.DATE_FORMAT_MODE_LONG:" sets MEDIUM format;). We can correct these ones by ourselves - it's not a problem, but you should at least include the headers I wrote about for the patch to be applied. So that's the case:). Waiting for an answer. Hope to hear from you soon.
Hi Thank you very much for you help. It is the first time that the other developer of a project help me as much. I have a problem with the second point : If the preference store is passed to SVNTeamPreferences from outside as an argument of getDateFormat method, its definition method is becoming : DateFormat getDateFormat(IPreferenceStore store) So, the formatDate method will be : String formatDate(Date date, IPreferenceStore store) So, I must change all calls of the formatDate method (there are actually 14 calls of this methode in the project) . Are you ok with that ? Thomas
Hello, Thomas. So, as I can see, both formatDate methods are used only from ui package (and that's quite logically:)). So my proposition is to create an utility class in org.eclipse.team.svn.ui.utility. For example we'll call it DateFormater. The constructor should be private and the class final, as usual for an utility classes. So it will contain both formatDate static calls without the preference store as an argument. And the code in the "String formatDate(Date date)" should get the preference store and pass it to getDateFormat of a SVNTeamPreferences. Am I clear?
> > Am I clear? > Very clear. :)
Created attachment 101033 [details] Second patch Hi Before comments about the patch, I have readen the developer documentation about contribution, so : I, Thomas Champagne, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. About the patch : * I had the header about licence EPL in every new files ; * I reverted NonEmptyFieldVerifier file and I used AbstractVerifierProxy for checking the enablement ; * I created the DateFormatter utility class ; * I added code in the propertyChange method in property view and in the decoration preview preferences for update UI. Thank you for your help. I will try to correct another bug soon. Thomas
Thank's again for your patch. It will be processed and applied as soon as possible. Great work. Best regards:).
The patch is approved and applied. So, closing the bug. Thank you once again, Thomas.