Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » new proj wizard
new proj wizard [message #203504] Fri, 02 November 2007 17:49 Go to next message
John Kenny is currently offline John KennyFriend
Messages: 62
Registered: July 2009
Member
I want to write my own custom new proj wizard. The wizard will ask a
minimal set of questions - I want the output to be a "Dynamic Web
Project" plus a few artifact I manually add.

What is the right way to create a project from my wizard and set it up
appropriately as a dynamic web project?
Re: new proj wizard [message #203512 is a reply to message #203504] Fri, 02 November 2007 18:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kosta.bea.com

Rather than building a completely new wizard, you may want to consider
creating a project facet that would add your artifacts to the project.
There is a tutorial on making new project facets that you can follow...

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

- Konstantin
Re: new proj wizard [message #203519 is a reply to message #203512] Fri, 02 November 2007 18:15 Go to previous messageGo to next message
John Kenny is currently offline John KennyFriend
Messages: 62
Registered: July 2009
Member
Thanks for the tutorial link - need to read it, but my idea is to
simplify the existing wizard. I dan't want to confuse my users with all
the normal wizard questions. For example - I know the targeted runtime
ahead of time so I don't want the user to have to answer that question.

Konstantin Komissarchik wrote:

> Rather than building a completely new wizard, you may want to consider
> creating a project facet that would add your artifacts to the project.
> There is a tutorial on making new project facets that you can follow...
>
> http://www.eclipse.org/articles/Article-BuildingProjectFacet s/tutorial.html
>
> - Konstantin
Re: new proj wizard [message #203526 is a reply to message #203519] Fri, 02 November 2007 18:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kosta.bea.com

Ok. The api that you want is available in the following package:

org.eclipse.wst.common.project.facet.core.*

A dynamic web project is basically a project with at least "jst.java"
and "jst.web" facets installed.

The following class is an entry point to the API with a bunch of static
methods:

org.eclipse.wst.common.project.facet.core.ProjectFacetsManag er

You will want to call one of the create methods on ProjectFacetsManager
to get an IFacetedProject object. That object has methods for setting
the runtime, installing facets, etc.

- Konstantin
Re: new proj wizard [message #203540 is a reply to message #203526] Fri, 02 November 2007 19:23 Go to previous messageGo to next message
John Kenny is currently offline John KennyFriend
Messages: 62
Registered: July 2009
Member
Thanks again - without the newsgroup - where is the best place to go to
find out about api's like this?


Konstantin Komissarchik wrote:

> Ok. The api that you want is available in the following package:
>
> org.eclipse.wst.common.project.facet.core.*
>
> A dynamic web project is basically a project with at least "jst.java"
> and "jst.web" facets installed.
>
> The following class is an entry point to the API with a bunch of static
> methods:
>
> org.eclipse.wst.common.project.facet.core.ProjectFacetsManag er
>
> You will want to call one of the create methods on ProjectFacetsManager
> to get an IFacetedProject object. That object has methods for setting
> the runtime, installing facets, etc.
>
> - Konstantin
Re: new proj wizard [message #203548 is a reply to message #203540] Fri, 02 November 2007 19:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kosta.bea.com

If you get the sdk version of WTP from the download site, it contains
the source code as well as documentation for extenders. This includes
documentation about the extension points as well javadoc. Of course, the
trouble with looking at javadoc for something as large as WTP, is that
you kinda have to know which way to look first. :)

- Konstantin
Re: new proj wizard [message #203556 is a reply to message #203548] Fri, 02 November 2007 20:04 Go to previous messageGo to next message
John Kenny is currently offline John KennyFriend
Messages: 62
Registered: July 2009
Member
Gotcha - hopefully one last thing - I am creating the project - but how
do I set the "Default Server" used by Run on Server - so that the
project is readly to deploy in the servers view right after creation?

Right now - I don't see a Server entry at all in the project properties.



Konstantin Komissarchik wrote:

> If you get the sdk version of WTP from the download site, it contains
> the source code as well as documentation for extenders. This includes
> documentation about the extension points as well javadoc. Of course, the
> trouble with looking at javadoc for something as large as WTP, is that
> you kinda have to know which way to look first. :)
>
> - Konstantin
Re: new proj wizard [message #203563 is a reply to message #203556] Fri, 02 November 2007 20:17 Go to previous messageGo to next message
John Kenny is currently offline John KennyFriend
Messages: 62
Registered: July 2009
Member
Nevermind - this seems to work:

IFacetedProject fp = ProjectFacetsManager.create(proj, true, monitor);
fp.installProjectFacet(ProjectFacetsManager.getProjectFacet( "jst.java")
.getDefaultVersion(), null, monitor);
fp.installProjectFacet(ProjectFacetsManager.getProjectFacet( "jst.web")
.getDefaultVersion(), null, monitor);



jkenny wrote:

> Gotcha - hopefully one last thing - I am creating the project - but how
> do I set the "Default Server" used by Run on Server - so that the
> project is readly to deploy in the servers view right after creation?
>
> Right now - I don't see a Server entry at all in the project properties.
>
>
>
> Konstantin Komissarchik wrote:
>
>> If you get the sdk version of WTP from the download site, it contains
>> the source code as well as documentation for extenders. This includes
>> documentation about the extension points as well javadoc. Of course,
>> the trouble with looking at javadoc for something as large as WTP, is
>> that you kinda have to know which way to look first. :)
>>
>> - Konstantin
Re: new proj wizard [message #203570 is a reply to message #203556] Fri, 02 November 2007 20:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kosta.bea.com

You need to definite a server runtime. You can do that using api located
in this package:

org.eclipse.wst.server.core

The starting class for that api is called ServerCore.

Once you have create the runtime, you will be able to see it in the
Targeted Runtimes properties page of your project, but it will not be
selected, you can go back to the faceted project api.

Use the following method to find the runtime. Note that this IRuntime is
different than server.core's IRuntime.

org.eclipse.wst.common.project.facet.core.runtime.RuntimeMan ager.getRuntime(
<name>)

Then you will want to call
IFacetedProject.setTargetedRuntimes(List<IRuntime>) on your project.

- Konstantin
Re: new proj wizard [message #203822 is a reply to message #203570] Tue, 06 November 2007 21:19 Go to previous messageGo to next message
John Kenny is currently offline John KennyFriend
Messages: 62
Registered: July 2009
Member
I can see in ServerCore where I can query the installed servers and
runtimes but how would I add a new runtime or server?



Konstantin Komissarchik wrote:

> You need to definite a server runtime. You can do that using api located
> in this package:
>
> org.eclipse.wst.server.core
>
> The starting class for that api is called ServerCore.
>
> Once you have create the runtime, you will be able to see it in the
> Targeted Runtimes properties page of your project, but it will not be
> selected, you can go back to the faceted project api.
>
> Use the following method to find the runtime. Note that this IRuntime is
> different than server.core's IRuntime.
>
> org.eclipse.wst.common.project.facet.core.runtime.RuntimeMan ager.getRuntime(
> <name>)
>
> Then you will want to call
> IFacetedProject.setTargetedRuntimes(List<IRuntime>) on your project.
>
> - Konstantin
>
Re: new proj wizard [message #203829 is a reply to message #203822] Tue, 06 November 2007 21:29 Go to previous messageGo to next message
John Kenny is currently offline John KennyFriend
Messages: 62
Registered: July 2009
Member
found this from Konstantin online (I'll try it out):

The API that you need is in org.eclipse.wst.server.core. You first need
to retrieve the IRuntimeType object that corresponds to the tomcat
runtime of the appropriate version. You can do that using the ServerCore
class. Once you have the IRuntimeType object, it has a factory method
for creating an IRuntimeWorkingCopy. You create the working copy, fill
it out and use the save method to persist your changes. That adds the
runtime to the workspace. Also, make sure to call validate prior to
calling save to make sure that you are not saving a mis-configured runtime.
Re: new proj wizard [message #203915 is a reply to message #203829] Wed, 07 November 2007 16:55 Go to previous messageGo to next message
John Kenny is currently offline John KennyFriend
Messages: 62
Registered: July 2009
Member
I am having trouble setting the install dir of my server runtime. I use
setLocation() on the server runtime working copy but the result in the
debugger shows this on the RuntimeWorkingCopy instance map member (which
I can't access directly because it is discouraged):

{generic_server_instance_properties={serverRootDirectory=/yo ur_server_root/appservers/jboss-4.0.3},
id-set=true, location=D:/PROGRA~1/NORTEL~1/SCE/Jboss/jboss-4.0.2,
name=JBoss v4.0, id=org.eclipse.jst.server.generic.runtime.jboss4}

It is not obvious how I set the serverRootDirectory. Any ideas?



jkenny wrote:

> found this from Konstantin online (I'll try it out):
>
> The API that you need is in org.eclipse.wst.server.core. You first need
> to retrieve the IRuntimeType object that corresponds to the tomcat
> runtime of the appropriate version. You can do that using the ServerCore
> class. Once you have the IRuntimeType object, it has a factory method
> for creating an IRuntimeWorkingCopy. You create the working copy, fill
> it out and use the save method to persist your changes. That adds the
> runtime to the workspace. Also, make sure to call validate prior to
> calling save to make sure that you are not saving a mis-configured runtime.
Re: new proj wizard [message #203921 is a reply to message #203915] Wed, 07 November 2007 17:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kosta.bea.com

This is an aspect of how the JBoss adapter works. I am not 100%
positive, but you may have to cast down to the internal
RuntimeWorkingCopy class in order to access that configuration.

- Konstantin
Re: new proj wizard [message #203964 is a reply to message #203526] Wed, 07 November 2007 22:16 Go to previous messageGo to next message
John Kenny is currently offline John KennyFriend
Messages: 62
Registered: July 2009
Member
Why does adding the facets occasionally (not every time) give me a
"CoreException: One or more constraints have not been staisfied"?


2007-11-07 17:12:41,791 ERROR [org.eclipse.core.runtime.CoreException:
One or more constraints have not been satisfied.]
2007-11-07 17:12:41,791 ERROR [ @
org.eclipse.wst.common.project.facet.core.internal.FacetedPr oject.modifyInternal(FacetedProject.java:282)]
2007-11-07 17:12:41,791 ERROR [ @
org.eclipse.wst.common.project.facet.core.internal.FacetedPr oject.access$2(FacetedProject.java:264)]
2007-11-07 17:12:41,791 ERROR [ @
org.eclipse.wst.common.project.facet.core.internal.FacetedPr oject$1.run(FacetedProject.java:249)]
2007-11-07 17:12:41,791 ERROR [ @
org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1737)]
2007-11-07 17:12:41,791 ERROR [ @
org.eclipse.wst.common.project.facet.core.internal.FacetedPr oject.modify(FacetedProject.java:259)]
2007-11-07 17:12:41,791 ERROR [ @
org.eclipse.wst.common.project.facet.core.internal.FacetedPr oject.installProjectFacet(FacetedProject.java:216)]
2007-11-07 17:12:41,791 ERROR [ @
com.jk.applications.sce.ui.wizards.ProjectCreationAction.add EclipseProjectFacets(ProjectCreationAction.java:428)]



Konstantin Komissarchik wrote:

> Ok. The api that you want is available in the following package:
>
> org.eclipse.wst.common.project.facet.core.*
>
> A dynamic web project is basically a project with at least "jst.java"
> and "jst.web" facets installed.
>
> The following class is an entry point to the API with a bunch of static
> methods:
>
> org.eclipse.wst.common.project.facet.core.ProjectFacetsManag er
>
> You will want to call one of the create methods on ProjectFacetsManager
> to get an IFacetedProject object. That object has methods for setting
> the runtime, installing facets, etc.
>
> - Konstantin
Re: new proj wizard [message #203971 is a reply to message #203964] Wed, 07 November 2007 22:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kosta.bea.com

Are you installing facets in the right order (and always in the same order)?
Re: new proj wizard [message #204319 is a reply to message #203971] Tue, 13 November 2007 13:44 Go to previous messageGo to next message
John Kenny is currently offline John KennyFriend
Messages: 62
Registered: July 2009
Member
// add the java and web facets
IFacetedProject fp = ProjectFacetsManager.create(proj, true, null);
fp.installProjectFacet(ProjectFacetsManager.getProjectFacet( "jst.java")
.getDefaultVersion(), null, null);
fp.installProjectFacet(ProjectFacetsManager.getProjectFacet( "jst.web")
.getDefaultVersion(), null, null);



Konstantin Komissarchik wrote:

> Are you installing facets in the right order (and always in the same
> order)?
Re: new proj wizard [message #204416 is a reply to message #203526] Wed, 14 November 2007 20:49 Go to previous message
John Kenny is currently offline John KennyFriend
Messages: 62
Registered: July 2009
Member
It looks like WebFacetInstallDelegate.execute is using
WebArtifactEdit.createDeploymentDescriptor which based on what I see in
the debugger is going through a bunch of calls and eventually going
out to the internet to get the
http://www.ibm.com/webservices/wsd/j2ee_web_services_client_ 1_1.xsd
schema.

How can I include this schema in a plugin so the internet is not
ncessary to add the facet.
Previous Topic:Q about EnterpriseBean.getEjbClass()
Next Topic:Dependent project setup
Goto Forum:
  


Current Time: Fri Dec 19 20:27:27 GMT 2014

Powered by FUDForum. Page generated in 0.02510 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software