Bug 430873 - Cleanup JFace code in preparation for GSoc
Summary: Cleanup JFace code in preparation for GSoc
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 4.4 M7   Edit
Assignee: Lars Vogel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 420779
  Show dependency tree
 
Reported: 2014-03-21 09:01 EDT by Lars Vogel CLA
Modified: 2014-05-06 00:39 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2014-03-21 09:01:02 EDT
I issued again a GSoC project to generify JFace. Last year the student was fighting with losts of whitespace changes missing Overrides etc. 

To avoid loosing again lots of efficiency I suggest to clean the code up once so that he can work efficiently.
Comment 1 Paul Webster CLA 2014-03-21 18:14:22 EDT
We don't do random white space changes in the code base (that's why we don't run general clean up on the code, it issues a "most lines have changed even if they haven't).

jface should have the "format only lines that change" save action enabled, however.

PW
Comment 2 Lars Vogel CLA 2014-03-24 04:56:29 EDT
Jeanderson, can you provide a patch to remove all (Non-Javadoc) in the viewers package?
Comment 3 Jeanderson Candido CLA 2014-03-24 10:22:25 EDT
(In reply to Lars Vogel from comment #2)
> Jeanderson, can you provide a patch to remove all (Non-Javadoc) in the
> viewers package?

Hi Lars,

Just a clarification: If a method has javadoc and it has an @Override annotation, is it okay to remove it too or only (Non-Javadoc) should be removed (in the first case, it would not be removed)?

Thanks in advance!
Comment 4 Lars Vogel CLA 2014-03-24 10:27:13 EDT
(In reply to Jeanderson Candido from comment #3)
> Just a clarification: If a method has javadoc and it has an @Override
> annotation, is it okay to remove it too or only (Non-Javadoc) should be
> removed (in the first case, it would not be removed)?
> 
> Thanks in advance!

I would leave normal Javadoc in, except it is just a copy of the Javadoc from the super method. If in doubt, leave it in, you don't have to check all the super Javadoc.
Comment 5 Jeanderson Candido CLA 2014-03-24 16:20:14 EDT
(In reply to Lars Vogel from comment #4)
> (In reply to Jeanderson Candido from comment #3)
> > Just a clarification: If a method has javadoc and it has an @Override
> > annotation, is it okay to remove it too or only (Non-Javadoc) should be
> > removed (in the first case, it would not be removed)?
> > 
> > Thanks in advance!
> 
> I would leave normal Javadoc in, except it is just a copy of the Javadoc
> from the super method. If in doubt, leave it in, you don't have to check all
> the super Javadoc.

That's what I thought... Some comments are like an "specialization" of the super Javadoc and maybe it would not be good to remove them.

Here is my review: https://git.eclipse.org/r/#/c/23821/

A few notes:
- I'm using 4.4M6 (so far, a solid rock on Windows) and apparently (I don't recall pressing CRTL+SHIFT+F) it automatically organizes the imports:

Before:
import org.eclipse.swt.graphics.*;

After:
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;

..And it also organizes imports by lexical order.

I just realized it when I was looking on Gerrit and I'm aware that I may have to undo this imports.

Finally, it was a large commit. I changed all files from jface.viewers.* and maybe it would be better to break it into small commits if necessary.

Thanks Lars and Paul.

I added Lars and Paul to review it.
Thanks in advance.
Comment 9 Jeanderson Candido CLA 2014-03-25 23:36:47 EDT
Deprecated all public entities of TableTreeViewer: https://git.eclipse.org/r/23905
Comment 10 Lars Vogel CLA 2014-03-26 05:00:47 EDT
Jeanderson added @Deprecated to all public fields and methods of TableTreeViewer

https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=f0639997c1f6a2fab1fa1fc9f4615b8a02b00fdf
Comment 11 Markus Keller CLA 2014-03-26 06:40:48 EDT
You've deleted these API Javadocs:
org.eclipse.jface.viewers.AbstractListViewer#setLabelProvider(IBaseLabelProvider)
org.eclipse.jface.viewers.StyledString#toString()

... and this interesting comment:
org.eclipse.jface.viewers.AbstractTreeViewer#handleDoubleSelect(SelectionEvent)

Please restore.
Comment 12 Lars Vogel CLA 2014-03-26 06:51:44 EDT
(In reply to Markus Keller from comment #11)
> You've deleted these API Javadocs:
> org.eclipse.jface.viewers.
> AbstractListViewer#setLabelProvider(IBaseLabelProvider)
> org.eclipse.jface.viewers.StyledString#toString()
> 
> ... and this interesting comment:
> org.eclipse.jface.viewers.
> AbstractTreeViewer#handleDoubleSelect(SelectionEvent)
> 
> Please restore.

Thanks Markus, restored with https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=534a4ce8282ebf762fb1102ba5acfb21fdd2709a
Comment 13 Lars Vogel CLA 2014-03-27 15:35:34 EDT
Using foreach loop in ComboViewer, TableViewer and Viewer https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=36c8bf2418a7b38c1115a58e91b85546c1ce7d58
Comment 14 Lars Vogel CLA 2014-03-27 15:39:25 EDT
Enhanced for loop for TreeViewer https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=beaeda9df8e02d0bc032b5dd0f20414ec6d49f92

I think I mark this bug as fixed for now, code looks much nicer to me already. Hopefully this will make the GSoC a bit smoother.
Comment 15 Lars Vogel CLA 2014-03-27 16:01:19 EDT
(In reply to Lars Vogel from comment #13)
> Using foreach loop in ComboViewer, TableViewer and Viewer
> https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=36c8bf2418a7b38c1115a58e91b85546c1ce7d58

Sorry that one was https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=4e61992bddbcc4508556d441a50e9f18fcd7f9a3
Comment 16 Jeanderson Candido CLA 2014-03-30 00:44:00 EDT
I simplified some loops from ToolBarManager  using "for each" sintax and removed some temporary variables. In addition, the code had spaces and tabs mixed. I fixed that too.

Review: https://git.eclipse.org/r/#/c/24162/2
Comment 17 Jeanderson Candido CLA 2014-03-30 00:46:48 EDT
(In reply to Lars Vogel from comment #14)
> Enhanced for loop for TreeViewer
> https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=beaeda9df8e02d0bc032b5dd0f20414ec6d49f92
> 
> I think I mark this bug as fixed for now, code looks much nicer to me
> already. Hopefully this will make the GSoC a bit smoother.

Lars, is there any other clean up that I should do? We could use this thread to for gerrit reviews related to cleaning up JFace code. I just sent a review for another class.

Indeed, the code looks much better now. Thanks!

JBC
Comment 18 Lars Vogel CLA 2014-03-31 05:45:24 EDT
(In reply to Jeanderson Candido from comment #16)
> I simplified some loops from ToolBarManager  using "for each" sintax and
> removed some temporary variables. In addition, the code had spaces and tabs
> mixed. I fixed that too.
> 
> Review: https://git.eclipse.org/r/#/c/24162/2

Applied with https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=a8d443f68d0a87ac1d5922ce76d86bf8d99165f4
Comment 19 Jeanderson Candido CLA 2014-04-25 20:32:38 EDT
Started to clean up JFace Test Suite code: https://git.eclipse.org/r/#/c/25602/
Should we keep it in this issue or open a file a new bug for JFace tests?
Comment 20 Jeanderson Candido CLA 2014-04-26 16:33:28 EDT
Unnecessary comments in AbstractFieldAssistTestCase: https://git.eclipse.org/r/25616
Comment 21 Jeanderson Candido CLA 2014-04-26 18:44:37 EDT
More cleanup: https://git.eclipse.org/r/#/c/25618/
Comment 22 Lars Vogel CLA 2014-04-27 15:40:13 EDT
(In reply to Jeanderson Candido from comment #19)
> Started to clean up JFace Test Suite code:
> https://git.eclipse.org/r/#/c/25602/
> Should we keep it in this issue or open a file a new bug for JFace tests?

I think a new bug would be good for future Gerrit review. (Clean JFace Unit tests). I handle the existing Gerrit reviews via this bug.
Comment 24 Jeanderson Candido CLA 2014-04-27 19:53:09 EDT
(In reply to Lars Vogel from comment #23)
> Test clean-ups applied with 
> https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=1cc4022ce3bdef3bde83b76e725cd51b04f07d2c
> https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=e50354c09431846715749bc8ab4812e636c25703
> https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=5225722a5a5012d68c424d7cc56f6a2145db7b0c

Thank you Lars! By the way, I'm not sure but I guess you forgot to merge two verified patches:

1. https://git.eclipse.org/r/#/c/25616/
2. https://git.eclipse.org/r/#/c/25602/

Thanks in advance.
Comment 25 Lars Vogel CLA 2014-04-28 00:43:51 EDT
(In reply to Jeanderson Candido from comment #24)

> Thank you Lars! By the way, I'm not sure but I guess you forgot to merge two
> verified patches:
> 
> 1. https://git.eclipse.org/r/#/c/25616/
> 2. https://git.eclipse.org/r/#/c/25602/
> 
> Thanks in advance.

Merged with 
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=eb715d5602d518231277f645e3217faa73159fee
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=25d51df514902194702b3b017ba6967788befc09

Thanks
Comment 26 Lars Vogel CLA 2014-05-06 00:39:56 EDT
Verified in Git