Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » How To Make A Customized Project Wizard By Extending ModifyFacetedProjectWizard
How To Make A Customized Project Wizard By Extending ModifyFacetedProjectWizard [message #233610] Mon, 13 July 2009 16:49 Go to next message
Eclipse User
Originally posted by: runzhou.li.gmail.com

Hi,

What I need to do is to simply make a customized project, and its own
wizard. After spending a good amount of time, I figured out that it's not
easy to directly extend the Dynamic Web Project / Static Web Project wizards
(which are what our custimezed project essentially is), and it's not easy to
get all the natures/builders I wanted either.

So I came across the faceted project, but have no clue on how to properlly
extend it.

In short, my ultimate goal is to have a customized project type (with its
own wizard) that is actually a clone of either Dynamic/Static Web Project
with all the natures/builders. Please help.

I'm also curious to know if there is a better way than extending
ModifyFacetedProjectWizard?

Any suggestions and help are greatly appreciated :)

--
Runzhou Li
Re: How To Make A Customized Project Wizard By Extending ModifyFacetedProjectWizard [message #233617 is a reply to message #233610] Mon, 13 July 2009 17:53 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 940
Registered: July 2009
Senior Member
WTP project creation wizards are extensible without need to subclass or
define cloned wizards that create slightly different configurations. Take
a look at the facets tutorial for more information.

http://www.eclipse.org/articles/Article-BuildingProjectFacet s/tutorial.html

Most scenarios that involve extending WTP projects are solved by writing a
facet.

- Konstantin
Re: How To Make A Customized Project Wizard By Extending ModifyFacetedProjectWizard [message #233648 is a reply to message #233617] Tue, 14 July 2009 09:13 Go to previous messageGo to next message
Eclipse User
Originally posted by: runzhou.li.gmail.com

Hi Konstantin,

Thank you so much for the reply.

I read through that tutorial, but all it does is to add a facet into the
faceted project. However, I would like to have my unique project that stands
there like Java project and all others. Another reason is that the project
type itself would be a clone of static/dynamic web project, with a different
name and icon, so I checked out the class WebProjectWizard, which does
something that involves internal packages that I cannot use.

Need further help, and in the mean while I'll go through everything related
to facets.

"Konstantin Komissarchik" <konstantin.komissarchik@oracle.com> wrote in
message news:d940c16a1dac5404fe8b2589fb22ed09$1@www.eclipse.org...
> WTP project creation wizards are extensible without need to subclass or
> define cloned wizards that create slightly different configurations. Take
> a look at the facets tutorial for more information.
>
> http://www.eclipse.org/articles/Article-BuildingProjectFacet s/tutorial.html
>
> Most scenarios that involve extending WTP projects are solved by writing a
> facet.
>
> - Konstantin
>
Re: How To Make A Customized Project Wizard By Extending ModifyFacetedProjectWizard [message #233664 is a reply to message #233648] Tue, 14 July 2009 11:51 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 940
Registered: July 2009
Senior Member
> I read through that tutorial, but all it does is to add a facet into the
> faceted project.

That's exactly the point. While I certainly appreciate the "me too"
tendencies that we all experience, it is important to understand that we
often overestimate the importance of a whatever we are working on to the
user and desire to place it as prominently as possible. When you consider
the breadth of tools coming from Eclipse.org combined with all the tools
available in the broader ecosystem, it is easy to create a very cluttered
workbench experience which is detrimental to user's productivity.

The reason for facets is that it allows you to reduce the number of
project wizards to a few core types that the user can easily enhance by
selecting from a number of available technologies represented by optional
facets.

> name and icon, so I checked out the class WebProjectWizard, which does
> something that involves internal packages that I cannot use.

The WTP project wizards (like WebProjectWizard) have really not been
designed for subclassing. It is possible and I know of people who've done
it, but it is not pretty and you will not be able to avoid using internal
code.

On the other hand, the base faceted project wizard that they all extend
has a fairly stable API. The downside, is that if you will get generic
functionality, with none of the web project specific enhancements (such as
ability to add project to an EAR or to pick spec version without opening
the facet selection page). You can get an idea of what you would get by
extending that class if you take a look at the "Faceted Project" wizard
located under "General" category.

- Konstantin
Re: How To Make A Customized Project Wizard By Extending ModifyFacetedProjectWizard [message #233805 is a reply to message #233664] Fri, 17 July 2009 10:40 Go to previous message
Eclipse User
Originally posted by: runzhou.li.gmail.com

Thank you so much Konstantin.

I listened to your advice and spent some time to study the IFacetedProject
interface, and there I got what I want. I'm posting it now so hopefully
it'll be helpful for those who had the same needs:

public void convertProject(IProject project, String facet) {
try {
IFacetedProject facetedProject = ProjectFacetsManager.create(project,
true, null);
IFacetedProjectWorkingCopy workingCopy =
facetedProject.createWorkingCopy();
IProjectFacet iFacet = ProjectFacetsManager.getProjectFacet(facet);

workingCopy.addProjectFacet(iFacet.getDefaultVersion());
workingCopy.commitChanges(null);
workingCopy.dispose();
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

Note 1: I used a dumb method ProjectFacetsManager.getProjectFacets() to
check out what facets are available.
Note 2: It's named convertProject, but really it's
"adding-facet-module-to-project".

Cheers :)

"Konstantin Komissarchik" <konstantin.komissarchik@oracle.com> wrote in
message news:f45b43f95f8cf1b97019654b25eb79fc$1@www.eclipse.org...
>> I read through that tutorial, but all it does is to add a facet into the
>> faceted project.
>
> That's exactly the point. While I certainly appreciate the "me too"
> tendencies that we all experience, it is important to understand that we
> often overestimate the importance of a whatever we are working on to the
> user and desire to place it as prominently as possible. When you consider
> the breadth of tools coming from Eclipse.org combined with all the tools
> available in the broader ecosystem, it is easy to create a very cluttered
> workbench experience which is detrimental to user's productivity.
>
> The reason for facets is that it allows you to reduce the number of
> project wizards to a few core types that the user can easily enhance by
> selecting from a number of available technologies represented by optional
> facets.
>> name and icon, so I checked out the class WebProjectWizard, which does
>> something that involves internal packages that I cannot use.
>
> The WTP project wizards (like WebProjectWizard) have really not been
> designed for subclassing. It is possible and I know of people who've done
> it, but it is not pretty and you will not be able to avoid using internal
> code.
>
> On the other hand, the base faceted project wizard that they all extend
> has a fairly stable API. The downside, is that if you will get generic
> functionality, with none of the web project specific enhancements (such as
> ability to add project to an EAR or to pick spec version without opening
> the facet selection page). You can get an idea of what you would get by
> extending that class if you take a look at the "Faceted Project" wizard
> located under "General" category.
>
> - Konstantin
>
Previous Topic:How to install JAX-WS tools?
Next Topic:Default VM settings in the .launch file for Tomcat server.
Goto Forum:
  


Current Time: Mon Sep 01 03:50:34 EDT 2014

Powered by FUDForum. Page generated in 0.02763 seconds