Bug 457165 - Duplicate code in AbstractTemplateCompletionProposalComputer implementations
Summary: Duplicate code in AbstractTemplateCompletionProposalComputer implementations
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.5   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: api, investigate
Depends on:
Blocks:
 
Reported: 2015-01-09 14:39 EST by Simon Scholz CLA
Modified: 2015-08-11 07:24 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Scholz CLA 2015-01-09 14:39:44 EST
Besides the (default) TemplateCompletionProposalComputer implementation a SWTTemplateCompletionProposalComputer and an E4TemplateCompletionProposalComputer has been created.
Those implementations are nearly the same, so that we have redundant code here. And the AbstractTemplateCompletionProposalComputer is internal so that the E4TemplateCompletionProposalComputer also uses the @SuppressWarnings("restriction") annotation.

In a customer project we also have another implementation of the AbstractTemplateCompletionProposalComputer, and therefore even more redundant code.

I like to implement another abstract class in between with default behaviour for those at least 3 pretty similar implementations in order to avoid this redundant code.

Another issue is that I like to make this class API so that we do not need the @SuppressWarnings("restriction") annotation in other project, but this would be a different bug.

What do you think about my plans?
Comment 1 Simon Scholz CLA 2015-01-09 19:18:47 EST
Here is my proposed improvement: https://git.eclipse.org/r/#/c/39338/
Comment 2 Dani Megert CLA 2015-04-01 10:10:31 EDT
(In reply to Simon Scholz from comment #0)
> Besides the (default) TemplateCompletionProposalComputer implementation a
> SWTTemplateCompletionProposalComputer and an
> E4TemplateCompletionProposalComputer has been created.

In which project? Does that depend on JDT?
Comment 3 Simon Scholz CLA 2015-04-13 19:52:36 EDT
The E4TemplateCompletionProposalComputer(In reply to Dani Megert from comment #2)
> (In reply to Simon Scholz from comment #0)
> > Besides the (default) TemplateCompletionProposalComputer implementation a
> > SWTTemplateCompletionProposalComputer and an
> > E4TemplateCompletionProposalComputer has been created.
> 
> In which project? Does that depend on JDT?

The E4TemplateCompletionProposalComputer is part of the org.eclipse.e4.tools.core project and shares common code, which would be reduced by using the AbstractClasspathDependendTemplateCompletionProposalComputer class.

And I think it is a great feature to only show template proposals in case certain artifacts are in the classpath, like SWT, E4, JFace and more.
Comment 4 Lars Vogel CLA 2015-08-11 04:16:35 EDT
Can this be reviewed for 4.6 M2?
Comment 5 Dani Megert CLA 2015-08-11 07:24:28 EDT
(In reply to Lars Vogel from comment #4)
> Can this be reviewed for 4.6 M2?

There is no new change after my review from April.