The perspective is refreshed after you create your own project during Eclipse plug-in development.

Source: Internet
Author: User

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

 

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.