Bug 414565 - [JFace][snippets] Update JFace snippets general cleanup
Summary: [JFace][snippets] Update JFace snippets general cleanup
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.4 RC3   Edit
Assignee: Jeanderson Candido CLA
QA Contact:
URL:
Whiteboard:
Keywords: example
: 417582 (view as bug list)
Depends on: 414559
Blocks: 435475
  Show dependency tree
 
Reported: 2013-08-07 06:56 EDT by Hendrik Still CLA
Modified: 2015-05-22 07:28 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hendrik Still CLA 2013-08-07 06:56:36 EDT
We should update the JFace snippets to show the use of the generified viewers.
Comment 1 Thomas Schindl CLA 2013-08-07 07:02:35 EDT
Can we do that in a branch - and switch once 4.4 is released? If we push it to master all people copying the code will be broken because 4.3 is not generified?
Comment 2 Hendrik Still CLA 2013-08-07 07:25:52 EDT
Sure! Are there any naming conventions for branches?
Comment 3 Paul Webster CLA 2013-08-07 10:50:49 EDT
(In reply to comment #1)
> Can we do that in a branch - and switch once 4.4 is released? If we push it
> to master all people copying the code will be broken because 4.3 is not
> generified?

I'm not sure I understand.  master will match what's in JFace's master branch (and all of the Milestone builds), and we want the snippets to evolve in lock-step with the JFace changes.

If people want Kepler compatible snippets they have to use the R4_3 tag or R4_3_maintenance branch, no?

PW
Comment 4 Thomas Schindl CLA 2013-08-07 12:07:38 EDT
The problem is that they are all linked from the wiki - and people coming using the snippets are often not the hardcore devs who are able to check out stuff from the the git-repo
Comment 5 Paul Webster CLA 2013-08-07 12:15:45 EDT
(In reply to comment #4)
> The problem is that they are all linked from the wiki - and people coming
> using the snippets are often not the hardcore devs who are able to check out
> stuff from the the git-repo

The wiki links can be updated to include the R4_3 tag if that's what someone wants.

PW
Comment 6 Hendrik Still CLA 2013-08-07 12:17:44 EDT
This sounds good, I could do that.
Comment 7 Paul Webster CLA 2013-08-07 12:21:09 EDT
As an example, http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/dialogs/Snippet058VistaProgressBars.java?id=R4_3

I'd prefer this than trying to have generification in the main branch in JFace but in a side branch in JFace snippets, since that would preclude building them in our build.

PW
Comment 8 Lars Vogel CLA 2013-08-08 04:54:59 EDT
+1 for changing the wiki, should be easy to update it again after the Eclipse 4.4 release with search and replace.
Comment 9 Hendrik Still CLA 2013-08-08 07:35:13 EDT
I've updated the JFace Snippets Wiki with the following regex:

Search: (http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/.*.java)

Replace:
$1?id=R4_3
Comment 10 Hendrik Still CLA 2013-08-08 07:57:07 EDT
I've uploaded a patch for the ComboViewer Snippet(Snippet063ComboViewer.java)
https://git.eclipse.org/r/#/c/15243/
Comment 11 Paul Webster CLA 2013-08-12 14:36:22 EDT
(In reply to comment #10)
> I've uploaded a patch for the ComboViewer Snippet(Snippet063ComboViewer.java)
> https://git.eclipse.org/r/#/c/15243/

Released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=5ccf110dcd23225e36764b336e3a6b1ab8987f08

PW
Comment 12 Lars Vogel CLA 2013-10-16 12:50:02 EDT
*** Bug 417582 has been marked as a duplicate of this bug. ***
Comment 13 Lars Vogel CLA 2013-10-16 12:55:34 EDT
I plan to update the JFace snippets to the latest state of the JFace Generics  work. 

I also plan to general clean-up of the snippets:

- Align copyright notes (move all to the header)
- Remove unnecessary casts
- Clean-up unnecessary whitespace
- Fix / remove incorrect Javadoc
- Remove unnecessary imports
- Get rid of generic warning
- Remove unnecessary else statements
- Replace (non-Javadoc) with @Override whenever possible

All in all only trivial changes.
Comment 14 Lars Vogel CLA 2013-10-16 13:05:41 EDT
Also the Snippet032TableTreeViewer should be deprecated as TableTreeViewer is deprecated
Comment 15 Lars Vogel CLA 2013-11-05 15:14:31 EST
I plan to clean-up the snippets in master. We can afterwards do the generification via an additional bug, I think that will make the review easier.
Comment 18 Jeanderson Candido CLA 2014-04-29 17:36:47 EDT
More cleanings to remove unnecessary comments, warnings, and performed simple refactorings to make code easier to understand: https://git.eclipse.org/r/25759
Comment 19 Jeanderson Candido CLA 2014-04-29 18:52:33 EDT
It took a while to understand this code. Motivated by my problem, I thought the code could be improved to make it easier to understand and modify it later: https://git.eclipse.org/r/25762.
Comment 20 Jeanderson Candido CLA 2014-05-05 19:25:22 EDT
After talking to Lars and Hendrik, we concluded that we should remove out-dated snippets. In case someone want's to see any excluded snippet, they can browser the Project UI repository.

This information should be added in the wiki page.

Patch: https://git.eclipse.org/r/#/c/25762/3
Comment 23 Lars Vogel CLA 2014-05-06 06:06:22 EDT
At the moment I think we have no open Gerrit reviews. Any new ones should be added here.
Comment 25 Jeanderson Candido CLA 2014-05-06 11:05:39 EDT
Minor refactorings on 058 and 059: https://git.eclipse.org/r/#/c/26058/
Comment 26 Jeanderson Candido CLA 2014-05-06 12:21:37 EDT
More cleanups https://git.eclipse.org/r/26062
Comment 27 Lars Vogel CLA 2014-05-06 14:22:05 EDT
(In reply to Jeanderson Candido from comment #25)
> Minor refactorings on 058 and 059: https://git.eclipse.org/r/#/c/26058/

Applied with http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=d8eeae022b7e7ada61ac7c54a61a837816193fae
Comment 29 Jeanderson Candido CLA 2014-05-06 17:35:01 EDT
More cleanups: https://git.eclipse.org/r/#/c/26078/
Comment 30 Jeanderson Candido CLA 2014-05-06 17:40:23 EDT
MyLabelProvaider is a nested class that inherits LabelProvider.
There's a version duplicated into snippets 045, 027, and 045. Another version is duplicated into 036 and 044.

Is this the case which we could move them out (e.g. MyLabelProviderType1 and MyLabelProviderType2) and delete nested classes from their snippets?
Comment 31 Jeanderson Candido CLA 2014-05-06 23:30:30 EDT
Cleanups for snippet 031 and 047: https://git.eclipse.org/r/26085
Comment 32 Lars Vogel CLA 2014-05-08 05:25:22 EDT
(In reply to Jeanderson Candido from comment #29)
> More cleanups: https://git.eclipse.org/r/#/c/26078/

Thanks. Merged with https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=9ad2c3d502297ea40ba62f339111f786970e29b8
Comment 33 Lars Vogel CLA 2014-05-08 05:26:33 EDT
(In reply to Jeanderson Candido from comment #31)
> Cleanups for snippet 031 and 047: https://git.eclipse.org/r/26085

Merged with https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=e2c23633b1f8ebcd26906fa9685c417d32e6511e
Comment 34 Jeanderson Candido CLA 2014-05-08 23:13:50 EDT
More cleanings for Snippet 039, 040, 041, 043: https://git.eclipse.org/r/#/c/26248/
Comment 35 Jeanderson Candido CLA 2014-05-09 00:30:56 EDT
The following snippets demonstrates deprecated API (CellEditor in 3.2, for 3.3 and above it's recommended to use the EditingSupport class):

034 - https://git.eclipse.org/r/#/c/26249/
036 - https://git.eclipse.org/r/#/c/26250/
038 - https://git.eclipse.org/r/#/c/26251/

I think we should explicit deprecate CellEditor since EditingSupport is newer and recommended to edit cells.

If everyone accept this change, I will update the wiki page.

Thanks.
Comment 36 Lars Vogel CLA 2014-05-09 01:42:33 EDT
I suggest to open a separate bug for the deprecation of CellEditor. As long as this does not happen we must maintain the snippets. Maybe the snippets for the old API can be combined?
Comment 37 Jeanderson Candido CLA 2014-05-09 01:53:58 EDT
(In reply to Lars Vogel from comment #36)
> I suggest to open a separate bug for the deprecation of CellEditor. As long
> as this does not happen we must maintain the snippets. Maybe the snippets
> for the old API can be combined?

Deprecating CellEditor allow us to delete those out-dated snippets? In this case, do you mind opening an issue for depreaction of CellEditor? I could work on that.

Considering the purpose of this current issue (cleaning JFace snippets) and the fact that we already deleted a very old snippet, I think we should be consistent and delete the mentioned snippets.

Finally, by combining snippets for old API, you mean a separated package for them?
Comment 38 Lars Vogel CLA 2014-05-09 02:40:27 EDT
(In reply to Jeanderson Candido from comment #37)
> Deprecating CellEditor allow us to delete those out-dated snippets? In this
> case, do you mind opening an issue for depreaction of CellEditor? I could
> work on that.

I expect that lots of people will object in deprecating CellEditor, AFAIK it is still widely use. Please open a bug report on this and see what the initial reaction will be. This will only be possible for Eclipse 4.5. if at all.

> Considering the purpose of this current issue (cleaning JFace snippets) and
> the fact that we already deleted a very old snippet, I think we should be
> consistent and delete the mentioned snippets.

As long as CellEditor is valid API (not deprecated) we should not delete the snippets. The other snippet was a different case, it demonstrated something which was a workaround for missing API.

> Finally, by combining snippets for old API, you mean a separated package for
> them?

No, I don't mean that. I did not look at the snippets but in case they demonstrate almost the same functionality we could have one snippet showing all uses cases. This would allow us to delete two of them. As CellEditor is not "recommended" I think that would be OK. But again, I did not look at the snippets, so you have to review them and decide on this.
Comment 39 Jeanderson Candido CLA 2014-05-10 08:21:40 EDT
(In reply to Lars Vogel from comment #38)
> (In reply to Jeanderson Candido from comment #37)
> > Deprecating CellEditor allow us to delete those out-dated snippets? In this
> > case, do you mind opening an issue for depreaction of CellEditor? I could
> > work on that.
> 
> I expect that lots of people will object in deprecating CellEditor, AFAIK it
> is still widely use. Please open a bug report on this and see what the
> initial reaction will be. This will only be possible for Eclipse 4.5. if at
> all.
> 
> > Considering the purpose of this current issue (cleaning JFace snippets) and
> > the fact that we already deleted a very old snippet, I think we should be
> > consistent and delete the mentioned snippets.
> 
> As long as CellEditor is valid API (not deprecated) we should not delete the
> snippets. The other snippet was a different case, it demonstrated something
> which was a workaround for missing API.
> 
> > Finally, by combining snippets for old API, you mean a separated package for
> > them?
> 
> No, I don't mean that. I did not look at the snippets but in case they
> demonstrate almost the same functionality we could have one snippet showing
> all uses cases. This would allow us to delete two of them. As CellEditor is
> not "recommended" I think that would be OK. But again, I did not look at the
> snippets, so you have to review them and decide on this.

Changes have been abandoned but I will prepare a bug report for CellEditor deprecation.
Comment 40 Jeanderson Candido CLA 2014-05-10 10:52:12 EDT
We are discussing about CellEditor here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=434574
Comment 41 Jeanderson Candido CLA 2014-05-12 23:43:43 EDT
More cleanings for snippets 25, 26, 27, 29, 31, 34, 36, and 38: https://git.eclipse.org/r/#/c/26415/
Comment 42 Jeanderson Candido CLA 2014-05-13 13:38:21 EDT
Cleanings for snippet 19, 21, and 24: https://git.eclipse.org/r/#/c/26470/
Comment 43 Lars Vogel CLA 2014-05-13 23:32:44 EDT
(In reply to Jeanderson Candido from comment #42)
> Cleanings for snippet 19, 21, and 24: https://git.eclipse.org/r/#/c/26470/

Merged with https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=e5524df50f148dea4262b507fa9db024d11cd0d1
Comment 44 Lars Vogel CLA 2014-05-13 23:36:44 EDT
(In reply to Jeanderson Candido from comment #42)
> Cleanings for snippet 19, 21, and 24: https://git.eclipse.org/r/#/c/26470/

Thanks. Merged with https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=7ea3d826a45b3b678c3ba33ba63e8b1d367a0c8d
Comment 47 Jeanderson Candido CLA 2014-05-20 12:51:37 EDT
With this patch we removed almost all warnings from the snippets:   https://git.eclipse.org/r/26951

There are only 2 snippets with warnings due to a deprecated method (not included in this patch).
Comment 48 Lars Vogel CLA 2014-05-22 04:33:30 EDT
(In reply to Jeanderson Candido from comment #47)
> With this patch we removed almost all warnings from the snippets:  
> https://git.eclipse.org/r/26951
> 
> There are only 2 snippets with warnings due to a deprecated method (not
> included in this patch).

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

I think we can close this bug. In case we want to do more work in the snippets, we should open a new bug.

Thanks a lot Jeanderson for your contributions.
Comment 49 Lars Vogel CLA 2014-05-22 04:33:42 EDT
.