1. Add extension points in plugin. xml
<Extension
Point = "org. Eclipse. UI. Perspectives">
<Perspective
Class = "com. ABC. XX. Perspective. favoritesperspectivefactory"
Icon = "icons/newn. ICO"
Id = "com. ABC. myperspective"
Name = "myperspective">
</Perspective>
</Extension>
2. Refresh the perspective when creating a self-defined project:
Add:
Updateperspective ();
Basicnewprojectresourcewizard.Selectandreveal(Project, workbench. getactiveworkbenchwindow ());
Updateperspective () method:
Protected VoidUpdateperspective (){
Iworkbenchpage = workbench. getactiveworkbenchwindow (). getactivepage ();
Workbench = platformui.Getworkbench();
Iperspectivedescriptor perspective = workbench. getperspectiveregistry (). findperspectivewithid ("com. ABC. myperspective"); // perspective ID
Iworkbenchpage. setperspective (Perspective );
}
}
Alternatively, add the "finalperspective" field when creating the Project Wizard in plugin. xml,
<Wizard
Category = "ngcwizard"
Class = "com. HP. kbwizards. newkbprojectwizard"
Finalperspective = "com. HP. NGC. ngcperspective"
Icon = "icons/project_wizard.gif"
Id = "com. HP. kbwizards. newprojectwizard"
Name = "% new. Project. Name"
Project = "true">
<Description>
% New. Project. DESC
</Description>
</Wizard>
You can use the perfomfinish () method in the created Project's wizard class.
Basicnewprojectresourcewizard. updateperspective (config );
To initialize the Perspective