Org. Eclipse. UI. newwizards

Source: Internet
Author: User

Create wizard Extension: org. Eclipse. UI. newwizards
Description: This extension point is used to register the Resource Creation wizard extension. The create wizard appears as an option in the new dialog box. This wizard is usually used to create folders or files.
Class: Java class instance that implements org. Eclipse. UI. inewwizard
Project-indicates that the Wizard will create an optional attribute for iproject resources. The wizard is displayed as an option in the new project dialog box.
Now.
Finalperspective-optional attribute that identifies the perspective to be activated when an iproject resource is created.
Preferredperspectives-specifies the optional attributes of the perspective identity list separated by commas. If the current perspective is in this list

Eg:
<Extension
Point = "org. Eclipse. UI. newwizards">
<Category
Id = "net. SF. amateras. Air. Category"
Name = "Air gear"/>
<Wizard
Category = "net. SF. amateras. Air. Category"
Class = "net. SF. amateras. Air. Wizards. Project. newairhtmlprojectwizard"
Icon = "icons/airgear.gif"
Id = "net. SF. amateras. Air. Wizards. newairhtmlprojectwizard"
Finalperspective = "net. SF. amateras. Air. Perspective"
Preferredperspectives = "net. SF. amateras. Air. Perspective"
Name = "Air project (HTML )"
Project = "true"/>
<Wizard
Category = "net. SF. amateras. Air. Category"
Class = "net. SF. amateras. Air. Wizards. Project. newairflexprojectwizard"
Icon = "icons/airgear.gif"
Id = "net. SF. amateras. Air. Wizards. newairflexprojectwizard"
Finalperspective = "net. SF. amateras. Air. Perspective"
Preferredperspectives = "net. SF. amateras. Air. Perspective"
Name = "Air project (Flex )"
Project = "true"/>
<Wizard
Category = "net. SF. amateras. Air. Category"
Class = "net. SF. amateras. Air. Wizards. file. wizardnewmxmlfilecreation"
Icon = "icons/mxml.gif"
Id = "net. SF. amateras. Air. Wizards. file. wizardnewmxmlfilecreation"
Finalperspective = "net. SF. amateras. Air. Perspective"
Preferredperspectives = "net. SF. amateras. Air. Perspective"
Name = "mxml file"
Project = "true"/>
<Wizard
Category = "net. SF. amateras. Air. Category"
Class = "net. SF. amateras. Air. Wizards. file. wizardnewasfilecreation"
Icon = "icons/as.gif"
Id = "net. SF. amateras. Air. Wizards. file. wizardnewasfilecreation"
Finalperspective = "net. SF. amateras. Air. Perspective"
Preferredperspectives = "net. SF. amateras. Air. Perspective"
Name = "ActionScript file"
Project = "true"/>
</Extension>


Eg:
/**
*
* @ Author Naoki takezoe
*/
Public class newairhtmlprojectwizard extends actnewairprojectwizard {

Public newairhtmlprojectwizard (){
Setwindowtitle ("New Air HTML project ");
}

@ Override
Protected void addprojectspecificparameters (Map <string, string> Params ){
String mainhtml = (airhtmlprojectpropertieswizardpage) page2). getmainhtml ();
Params. Put (descriptorcontexttype. Content, mainhtml );
}

@ Override
Protected airprojectwizardpage createpage1 (){
Airprojectwizardpage page = new airprojectwizardpage ("new html air application project ",
Airprojectwizardpage. html_project );
Page. settitle ("new html air application project ");
Page. setdescription ("create new HTML based AIR application project .");
Return page;
}

@ Override
Protected registractairprojectpropertieswizardpage createpage2 (){
Airhtmlprojectpropertieswizardpage = new airhtmlprojectpropertieswizardpage ("HTML Project Properties ");
Page. settitle ("HTML Project Properties ");
Page. setdescription ("input your project properties .");
Return page;
}

@ Override
Protected void createprojectspecificresources (iproject project, string descriptortemplatename,
Map <string, string> Params, iprogressmonitor Monitor) throws exception {
// Make application Descriptor
Createfile (project, "application. xml", gettemplatecontents (descriptortemplatename), Params, monitor );

// Make main html
Createfile (Project, Params. Get (descriptorcontexttype. content), newairhtmlprojectwizard. Class
. Getresourceasstream ("main.html"), Params, monitor );

// Copy Javascript
Ipreferencestore store = airplugin. getdefault (). getpreferencestore ();
String sdkpath = store. getstring (airplugin. pref_air_sdk_path );
File JavaScript = new file (sdkpath, "frameworks/airaliases. js ");
If (! Javascript. exists ()){
Javascript = new file (sdkpath, "frameworks/libs/air/airaliases. js ");
}
If (Javascript. exists ()){
Createfile (project, "airaliases. js", new fileinputstream (JavaScript), null, monitor );
}
}

@ Override
Protected string getnatureid (){
Return airhtmlprojectnature. nature_id;
}

}

/**
* The Wizard Page to input air project name.
*
* @ Author Naoki takezoe
*/
Public class airprojectwizardpage extends actprojectwizardpage {

Public static final int html_project = 0;
Public static final int flex_project = 1;
Public static final int flex3_project = 3;

Private int projecttype;

/**
* Constructor.
*
* @ Param pagename the Page name
* @ Param projecttype {@ link airprojectwizardpage # html_project} or

* {@ Link airprojectwizardpage # flex_project}
*/
Public airprojectwizardpage (string pagename, int projecttype ){
Super (pagename );
This. projecttype = projecttype;
}

@ Override
Protected void modifytexttoprojetname (){
Abstractairprojectpropertieswizardpage nextpage = (abstractairprojectpropertieswizardpage) getnextpage ();
If (nextpage! = NULL ){
Nextpage. projectnamechanged (getprojectname ());
}
}

@ Override
Protected Boolean validatepage (){
Ipreferencestore store = airplugin. getdefault (). getpreferencestore ();
If (projecttype = html_project ){
If (store. getstring (airplugin. pref_air_sdk_path). Length () = 0 ){
Seterrormessage (airplugin. getresourcestring ("not_air_sdk_setting "));
Setpagecomplete (false );
Return false;
}
} Else if (projecttype = flex_project | projecttype = flex3_project ){
If (store. getstring (airplugin. pref_flex_sdk_path). Length () = 0 ){
Seterrormessage (airplugin. getresourcestring ("not_flex_sdk_setting "));
Setpagecomplete (false );
Return false;
}
}
Return super. validatepage ();
}

}

 

/**
* The Wizard Page to input air project name.
*
* @ Author Naoki takezoe
*/
Public abstract class abstractprojectwizardpage extends wizardnewprojectcreationpage {

/**
* Constructor.
*
* @ Param pagename the Page name
* @ Param projecttype {@ link abstractprojectwizardpage # html_project} or

* {@ Link abstractprojectwizardpage # flex_project}
*/
Public abstractprojectwizardpage (string pagename ){
Super (pagename );
}

@ Override
Public void createcontrol (composite parent ){
Super. createcontrol (parent );

Text text = (text) reflectionutil. getfield (this, "projectnamefield ");
Text. addmodifylistener (New modifylistener (){
Public void modifytext (modifyevent EVT ){
Modifytexttoprojetname ();
}
});

Validatepage ();
}

Protected abstract void modifytexttoprojetname ();

}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.