| Dynamic web projects [message #212774] |
Tue, 22 April 2008 04:32  |
Klaus Schaefers Messages: 24 Registered: July 2009 |
Junior Member |
|
|
Hi,
I need to program a plugin that generates a HTML file. The HTML file
should be stored in a dynamic web project. Before the generation starts,
the user should be able to select an existing dynamic web project and
create a new one.This leads me to my two questoins:
1) How can I determine if a project a a dynamic webproject? Which natures
/ facets must be installed?
2) How can I call the "Create Dynamic Web Project" wizard? I could not fin
dthe class.
Thanks a lot,
Klaus
|
|
|
| Re: Dynamic web projects [message #212846 is a reply to message #212774] |
Wed, 23 April 2008 14:28   |
|
Originally posted by: david_whiteman.us.ibm.com
Klausen wrote:
> Hi,
>
> I need to program a plugin that generates a HTML file. The HTML file
> should be stored in a dynamic web project. Before the generation starts,
> the user should be able to select an existing dynamic web project and
> create a new one.This leads me to my two questoins:
>
> 1) How can I determine if a project a a dynamic webproject? Which
> natures / facets must be installed?
>
> 2) How can I call the "Create Dynamic Web Project" wizard? I could not
> fin dthe class.
>
> Thanks a lot,
>
>
> Klaus
>
Do you want to programmatically generate a dynamic web project? If so
you can use ProjectFacetsManager.create() to create the project, the
getProjectFacet() method to get the facet, and
IFacetedProject.installProjectFacet() to install it.
If you are just wanting to add special behavior to existing dynamic web
projects for generating HTML files, then you can build your own facet
using the framework. See the following article:
http://www.eclipse.org/articles/Article-BuildingProjectFacet s/tutorial.html
HTH,
David
|
|
|
| Re: Dynamic web projects [message #212854 is a reply to message #212774] |
Wed, 23 April 2008 15:17  |
Jason Henriksen Messages: 231 Registered: July 2009 |
Senior Member |
|
|
I liked the idea of just launching the wizard when people need to create
a new web project. That way, I can't 'forget' any required tasks.
Here's how I do it: (inputName is a String passed in by the user from a
previous dialog)
try{
WebProjectWizard wpw = new WebProjectWizard();
org.eclipse.wst.common.frameworks.datamodel.IDataModel dm =
wpw.getDataModel();
dm.setProperty("IProjectCreationPropertiesNew.PROJECT_NAME", inputName);
dm.setProperty(" IJ2EEFacetProjectCreationDataModelProperties.EAR_PROJECT_NAM E ",inputName+"EAR");
final Listener l = new Listener () {
public void handleEvent (Event event) {
WSDLTool.confirmedSetProject(projectName);
}
};
WizardDialog dialog = new WizardDialog(shell, wpw) {
@Override
protected void createButtonsForButtonBar(Composite parent) {
super.createButtonsForButtonBar(parent);
Button finishButton = getButton(IDialogConstants.FINISH_ID);
finishButton.setText(IDialogConstants.OK_LABEL);
finishButton.addListener(SWT.Selection,l);
}
};
dialog.open();
}
catch(Exception e){
e.printStackTrace();
}
|
|
|
Powered by
FUDForum. Page generated in 0.01566 seconds