Eclipse perspective Development of "teach you the Eclipse plugin development"

Source: Internet
Author: User
Tags stub

Eclipse has a lot of perspectives, such as Debug, or Java. The following are debug, and Java perspective, it can be found that their structure is not the same, showing the user's picture is not the same.

Let's get down to the chase and develop our own perspective.

Prepare an environment for plug-in engineering to add our own perspective.

Create a new plug-in project

Enter the name of our project

Modify the properties you want to modify by default.

Next, Eclipse automatically generates a plug-in project for us.

Create a Perspective class and add your own view style.

We are starting to really develop a perspective class at this time. Create a class named Firstper

  

Let this class inherit iperspectivefactory and implement its inheritance method.

1  Packagecom.test.myperspective;2 3 Importorg.eclipse.ui.IPageLayout;4 Importorg.eclipse.ui.IPerspectiveFactory;5 6  Public classFirstperImplementsIperspectivefactory {7 8 @Override9      Public voidcreateinitiallayout (ipagelayout layout) {Ten         //TODO auto-generated Method Stub One          A     } -  -}

  

To see the effect, we define a outline view, a problerm view, and close the edit view when initializing.

 Packagecom.test.myperspective;Importorg.eclipse.ui.IFolderLayout;Importorg.eclipse.ui.IPageLayout;Importorg.eclipse.ui.IPerspectiveFactory; Public classFirstperImplementsiperspectivefactory {@Override Public voidcreateinitiallayout (ipagelayout layout) {//TODO auto-generated Method StubString Editorarea =Layout.geteditorarea (); Layout.seteditorareavisible (false); Layout.addview (Ipagelayout.id_outline, Ipagelayout.left,0.25f, Editorarea); Ifolderlayout Bottom= Layout.createfolder ("Bottom", Ipagelayout.bottom,0.66f, Editorarea);    Bottom.addview (Ipagelayout.id_problem_view); }}

Create an icon folder and place our own perspective icon.

Add a new folder to your project and store an icon image.

Add a perspective extension point and add the Perspective class, and the icon to the extension Point property bar.

In the Properties Preview view, in the extension Point page extension, add a view extension point.

  

Find the org.eclipse.ui.perspectives class, Add.

  

Eclipse will automatically help us generate a new view to add below this extension point

  

Modify the attributes of the extension point element to match the Firstper class that we just created, and don't forget to save When you're done modifying it.

Run the plug-in project to view the perspective diagram

Now is the time to witness the results. Run the project as an Eclipse application.

In the right-most open Perspective button, choose your own perspective, you can see only one outline, and problerms 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.