Home > Eclipse development, Software Development, Testing > Writing an Eclipse Plug-in (Part 2): Creating a custom project in Eclipse – Adding to the New Project Wizard

Writing an Eclipse Plug-in (Part 2): Creating a custom project in Eclipse – Adding to the New Project Wizard

Last time I discussed this I mentioned that the steps to create the custom project will be:

  • Open the New Wizard dialog.
  • Open the Custom Project folder
  • Select the Custom Project item
  • Press Next
  • Enter the name of the project and a location in which to put it
  • Press Finish
  • A custom perspective will open displaying a custom navigator.

In this entry I will not be implementing any behavior. Soon. However, the GUI pieces leading to the desired workflow will be implemented.

Let’s get to work.

Assumptions: Eclipse 3.4.

1. Create a Plug-in Project

  • Name: customplugin
  • Eclipse version: 3.4
  • Click Next
  • Execution environment: JavaSE-1.6
  • Would you like to create a rich client application? No.
  • Click Finish

The only class that should have been generated was customplugin.Activator. It can be ignored for now.

2. In the Extension tab:

  • Click Add
  • Type new and select the org.eclipse.ui.newWizards extension (do not choose any available templates)
  • Click Finish.
  • Right click on org.eclipse.ui.newWizards and select New –> Category
  • With the “name (category)” selected enter an id of customplugin.category.wizards
  • Name: Custom Wizards
  • Save the file
  • Right click on org.eclipse.ui.newWizards and select New –> Wizard
  • With the “name (wizard)” selected enter:
    • id: customplugin.wizard.new.custom
    • name: Custom Project
    • class: customplugin.wizards.CustomProjectNewWizard
    • category: customplugin.category.wizards
  • Save the file

3. Create the CustomProjectWizard class

  • Click on the class link for customplugin.wizards.CustomProjectNewWizard to open the New Class Wizard.
  • In the New Class Wizard click Finish.
  • The CustomProjectNewWizard class will open in the workspace.

Believe it or not this is enough for a quick test of the plug-in:

  • Right click on the customplugin label in the Package Explorer and select Run As –> Run Configurations.
  • Right click on Eclipse Applications and select New
    • Name: customplugin
  • Click on the Plug-ins tab to the right
  • Launch with: Plug-ins selected below
  • Uncheck the Workspace folder
  • Check the customplugin project
  • Click Run

When the runtime workbench opens press Ctrl+N. The Custom Wizards folder should be under the General folder and the Custom Project item should be in the Custom Wizards folder.

Clicking Next will do nothing. That is fine; we will take care of that next. Quit the runtime workbench.

4. Add the WizardNewProjectCreationPage to the CustomProjectWizard

  • Add a private field to the CustomProjectWizard:
        private WizardNewProjectCreationPage _pageOne;
  • You will get a compile error. Return to the plugin.xml file and select the Dependencies tab.
  • Click Add and select org.eclipse.ui.ide. Click Finish.
  • Return to CustomProjectWizard. Press Ctrl+Shift+O to add any missing imports.
  • Save the file. The compile error should disappear.
  • Override addPages() (defined in the parent Wizard class):
    public void addPages() {

        _pageOne = new WizardNewProjectCreationPage("From Scratch Project Wizard");
        _pageOne.setTitle("From Scratch Project");
        _pageOne.setDescription("Create something from scratch.");

  • Have performFinish() return true.
  • Have the constructor set the title field.
  •     public CustomProjectNewWizard() {
  • Save the file.

Time for a manual test:

  1. Start the runtime workbench.
  2. Press Ctrl+N.
  3. Open the Custom Project folder.
  4. Select the Custom Project item and click Next.
  5. Enter a project name and click Finish.
  6. Whatever perspective you started with will still be there.
  7. Quit the runtime workbench.

Not bad for one extension with two entries and two Java files that were mostly (except for the wizard file) untouched by us.

Next, create a custom navigator using the Common Navigator framework. The Common Navigator View template will create a fully functioning navigator which will be ideal for our purposes.

In the Extension tab:

  • Click Add, click the Extension Wizards tab and select the Common Navigator View template.
  • Click Next
  • Enter the following:
    • View Id: customplugin.navigator
    • View Name: Custom Plug-in Navigator
    • Uncheck Add to Resource Perspective
  • Click Finish.
  • If a dialog opens requesting to save changes click Yes. Two extensions have been added as well as three dependencies.

Run the runtime workbench again. From the main menu select Window –> Show View. When the Show View dialog opens select the Other folder. The Custom Plug-in Navigator is found there. If you select it, the navigator will open in the current perspective. If you want to see something displayed in this navigator you can create a general project and create an empty file. Close the navigator before you exit the runtime workbench.

Time to create a custom perspective.

1. In the Extensions tab:

  • Add the perspectives extension
  • Click Add
  • Type “pers” (no quotes) and select the org.eclipse.ui.perspectives extension (do not choose any available templates)
  • Click Finish.
  • Enter the following:
    • id: customplugin.perspective
    • name: Custom Plug-in Perspective
    • class: customplugin.perspectives.Perspective
  • Save the plugin.xml
  • Click the class link and click Finish in the New Java Class wizard. Ignore the generated code (or better yet, close the Java editor)
  • Add the perspectiveExtensions extension
    • Click Add
    • Type “pers” (no quotes) and select the org.eclipse.ui.perspectiveExtensions extension
    • Click Finish.
  • Select the “* (perspectiveExtension)
  • targetID: customplugin.perspective
  • Save the file
  • Right click on “customplugin.perspective (perspectiveExtension)” and select New –> View
    • id: customplugin.navigator
    • relationship: left
    • relative: org.eclipse.ui.editorss
    • ratio: 0.25

Open the runtime workbench. Select Window –> Open Perspective –> Other –> Custom Plug-in Perspective. The perspective should have the custom navigator open and over to the left.

Cool, isn’t it? Open the Resource perspective before exiting the runtime workbench. When we add behavior Eclipse will automatically open our new Custom perspective.

This was not that hard; that is the point of of the Eclipse plug-in architecture. The problem is that Eclipse is large and non-trivial and more than half the battle is knowing what is already available to get things done.

Next time: adding testable behavior to the plug-in to create a custom project.

  1. madmarcos
    August 24, 2010 at 11:50 pm

    in step 2.9, item “class: customplugin.wizards.CustomProjectNewWizard”,
    I had to use “customplugin.CustomProjectNewWizard” for it to work. not sure why.
    I am using Eclipse 3.6. And the Custom Wizards shows at the same level (topmost) as General

    • cvalcarcel
      August 29, 2010 at 4:24 pm

      Step 2.9 was correct. The next step says (3.1) to create customplugin.CustomProjectNewWizard as the fully qualified class name when it should have read customplugin.wizards.CustomProjectNewWizard. I have corrected it above.

      Thanks for spotting that!

  2. Venkata Subbarao
    September 28, 2010 at 2:15 am


    This tutorial helped me a lot in adding a custom project to new project wizard. Further I would like to retain only my toolchain and project types in eclipse CDT.
    More precisely, when I click on File -> New I should see the following.

    Project XXXX, Project YYYY, Project, Folder, Source File, Other (where Project XXXX and Project YYYY are two different major custom project types)

    Further if I click File -> New -> Project, I should see only my project types and tool chains. Can you give some hint to proceed on this ?


    • cvalcarcel
      September 29, 2010 at 11:17 pm

      You probably want to read Parts 20-24 which discuss how to configure Eclipse to display menu items. Worked for me, anyway.

  3. Shyam
    December 9, 2010 at 11:44 am

    Hello Carlos,

    I have to come up with a plugin with custom editor as a part of school project, much like the Schema Diagram editor [http://www.eclipse.org/articles/Article-GEF-editor/gef-schema-editor.html] . However, I am not at all sure where to start from because the website only highlights some of the code. Where can I get a detailed information on creating a plugin using GEF?

  4. Carl
    March 10, 2011 at 9:21 am

    You need to update this tutorial for 3.5 (or add a tutorial parallel to this). You lost me when creating a wizard 😦

  5. March 11, 2011 at 3:52 pm


    you might want to add a note to 2.4: (If you only have New->Generic, install “Eclipse SDK” and retry. This will also fix other warnings about missing schemas.)

    Thanks for the article. BTW, is there a TOC for this series?

    • July 6, 2017 at 2:36 am

      How do I install Eclipse SDK?

  6. zuveniles
    July 26, 2011 at 5:05 am

    Hi there,

    The tutorial doesn’t work for me after step 4. There are errors while using WizardNewProjectCreationPage, it seems it doesn’t find it. Step4.3 and 4.4 don’t solves the errors. Could you please tell me what could be the problems? I am using eclipse 3.4.

    • February 15, 2013 at 3:04 pm

      Add org.eclipse.ui.ide to the plug-in dependencies.

    • freely
      February 17, 2014 at 12:42 am

      me too have the same error.. i add org.eclipse.ui.ide to plugin dependencies

  7. December 11, 2011 at 5:13 pm

    Might be a slight typo… I suspect that ‘Add the WizardNewProjectCreationPage to the CustomProjectWizard’ should be ‘Add the WizardNewProjectCreationPage to the CustomProjectNewWizard’ – but not entirely sure…

  8. April 17, 2012 at 9:30 pm

    this tutorial is so cool!!

  9. April 17, 2012 at 9:32 pm

    this tutorial is so cool

  10. September 18, 2012 at 6:03 am

    I am just confused with CustomProjectNewWizard. Is it a typo error as said by Joseph Reddington.

    Its not clear. Could please help me.

  11. December 27, 2013 at 6:58 am

    I keep getting errors when running customplugin although i followed all the proper steps.. what could be the problem ?

  12. April 8, 2016 at 1:42 am

    Thank you ~! It is very helpful to me ^^ ~!

  13. Radhakrishna
    August 1, 2016 at 6:23 am

    But if we create a project in non workspace location it is showing error like, “The description file(.project) for my project is missing”.

  14. August 20, 2016 at 5:52 pm

    In case someone gets a schema not found for any plugin, you may install the Eclipse SDK & Eclipse Platform SDK from your eclipse site

  15. bujji
    November 15, 2018 at 6:20 am

    can you please tell me how to create my own project in FIle->new->project in eclipse.

  1. January 17, 2013 at 9:25 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: