Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342818 - Code duplication for PluginTemplateProjectWizard and PluginProjectWizard
Summary: Code duplication for PluginTemplateProjectWizard and PluginProjectWizard
Status: CLOSED FIXED
Alias: None
Product: AMP
Classification: Modeling
Component: AMF UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Miles Parker CLA
QA Contact: Miles Parker CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-14 05:56 EDT by Jonas Ruttimann CLA
Modified: 2011-06-07 08:57 EDT (History)
0 users

See Also:


Attachments
Proposed refactoring (152.60 KB, patch)
2011-04-14 06:00 EDT, Jonas Ruttimann CLA
no flags Details | Diff
Proposed refactoring (46.06 KB, patch)
2011-04-15 04:20 EDT, Jonas Ruttimann CLA
no flags Details | Diff
Proposed Refactoring (82.89 KB, patch)
2011-04-19 10:03 EDT, Jonas Ruttimann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonas Ruttimann CLA 2011-04-14 05:56:43 EDT
The super classes for Project wizards exist twice. Code has been duplicated:

PluginTemplateProjectWizard.java
PluginProjectWizard.java

I propose to refactor. Eliminated code duplication, pull up a new abstract class into org.eclipse.amp.amf.ide.
Comment 1 Jonas Ruttimann CLA 2011-04-14 06:00:48 EDT
Created attachment 193236 [details]
Proposed refactoring

This is the poposed refactoring. This includes the "newProjectWizardConfigurations" extension point having to be moved to org.eclipse.amp.amf.ide. Code duplication will be eliminated.
Comment 2 Miles Parker CLA 2011-04-14 12:47:47 EDT
I *think* there might have been a reason that I had to do things this way at the time. Something to do with not creating un neccessary dependencies. Ah... I think it is because we use the same technique for creating new Ascape projects and there shouldn't be any AMF dependencies there. IOTW, you should be able to work with Ascape and Escape java projects without having to have any of the AMF stuff. Is there a way to still support that?
Comment 3 Jonas Ruttimann CLA 2011-04-15 04:17:57 EDT
All right. I still think code duplication is a bad idea. So how about this...

Keep generic Wizards in org.eclipse.amp.amf.gen.ide. Move EscapeJavaPluginProjectWizard to org.eclipse.amp.escape.amf.ide (instead of org.eclipse.amp.escape.ide). 

Now, there might still be a problem in org.eclipse.amp.escape.testing.ide. EscapeJavaPluginProjectWizard is not available in this plugin anymore. Should it?


(In reply to comment #2)
> I *think* there might have been a reason that I had to do things this way at
> the time. Something to do with not creating un neccessary dependencies. Ah... I
> think it is because we use the same technique for creating new Ascape projects
> and there shouldn't be any AMF dependencies there. IOTW, you should be able to
> work with Ascape and Escape java projects without having to have any of the AMF
> stuff. Is there a way to still support that?
Comment 4 Jonas Ruttimann CLA 2011-04-15 04:20:41 EDT
Created attachment 193331 [details]
Proposed refactoring
Comment 5 Jonas Ruttimann CLA 2011-04-15 04:23:13 EDT
Forgot to mention this:
This refactoring will cause no new dependencies. Ascape still has no dependencies to AMF!

Sometimes code speaks more than thousand words. I've attached a patch...
Comment 6 Miles Parker CLA 2011-04-15 14:29:12 EDT
(In reply to comment #3)
> All right. I still think code duplication is a bad idea. So how about this...

Agreed.

> 
> Keep generic Wizards in org.eclipse.amp.amf.gen.ide. Move
> EscapeJavaPluginProjectWizard to org.eclipse.amp.escape.amf.ide (instead of
> org.eclipse.amp.escape.ide). 

But that means that Escape (Pure Java Version) still has a dependency on AMF. == not good because we want people to be able to create pure Java projects. Worst case, I think we'll have to move this into a little separate project of its own.
Comment 7 Jonas Ruttimann CLA 2011-04-18 03:01:01 EDT
Ok, I see.

The greatest common denominator in the AMP universe between "org.eclipse.amp.amf.ide.ascape" and "org.eclipse.amp.escape.amf.ide" seems to be "org.eclipse.amp.amf.gen.ide". Including "org.eclipse.amp.escape.ide" I think it's "org.ascape.core". And that one shouldn't have any user interface. In that case I only see the solution of a new plugin. One more again, but still better than duplicated code.

Another idea...
I can see that only "org.eclipse.amp.escape.ide" requires "org.ascape.ui.amp". How about moving all basic project wizard classes into this plugin and make "org.eclipse.amp.amf.ide.ascape" and "org.eclipse.amp.escape.amf.ide" dependent on "org.eclipse.amp.escape.ide"?


(In reply to comment #6)
> (In reply to comment #3)
> > All right. I still think code duplication is a bad idea. So how about this...
> 
> Agreed.
> 
> > 
> > Keep generic Wizards in org.eclipse.amp.amf.gen.ide. Move
> > EscapeJavaPluginProjectWizard to org.eclipse.amp.escape.amf.ide (instead of
> > org.eclipse.amp.escape.ide). 
> 
> But that means that Escape (Pure Java Version) still has a dependency on AMF.
> == not good because we want people to be able to create pure Java projects.
> Worst case, I think we'll have to move this into a little separate project of
> its own.
Comment 8 Miles Parker CLA 2011-04-18 12:47:09 EDT
(In reply to comment #7)
> Another idea...
> I can see that only "org.eclipse.amp.escape.ide" requires "org.ascape.ui.amp".
> How about moving all basic project wizard classes into this plugin and make
> "org.eclipse.amp.amf.ide.ascape" and "org.eclipse.amp.escape.amf.ide" dependent
> on "org.eclipse.amp.escape.ide"?

Yes, that makes sense! I think.. Obviously if this creates any circular dependencies you'll see them.

BTW -- in case this is confusing -- the amp.amf.ide.ascape stuff is to produce non-Eclipse based Ascape model code. For example, you can create a model applet w/ approximately 8MB code base. But as long as we don't introduce any runtime dependencies that won't be a concern.
Comment 9 Jonas Ruttimann CLA 2011-04-19 10:03:42 EDT
Created attachment 193583 [details]
Proposed Refactoring

All right. Here's another try. Done as discussed above. I think this way we could get around introducing a new plugin...
Comment 10 Jonas Ruttimann CLA 2011-05-26 10:16:08 EDT
Proposed changes committed to repository.
Comment 11 Jonas Ruttimann CLA 2011-06-07 08:57:35 EDT
Committed bug fix.