These are Eclipse customization technique, to add our own projects to the Eclipse plugin.
Project Wizard is the one used to create a new project in
Eclipse. All the project that are plugged in with Eclipse will list down at
this project Wizard. If you want to create a Java project you can choose ‘Java
Project’ and it will load libraries and folder structure for that are requires
for that Java project.
Similarly you can create a new your own plugin project
(Integration of a new tool to Eclipse, parsing of files etc) and integrate with
Eclipse. If you want to add a new our own project in to the Eclipse, the first
step to add a new project Wizard.
project Wizard
Window:
If you want to create a project, you can go to Eclipse
project wizard (File-> New-> Other)
Then the project Wizard Window will be displayed with all the project list that are plugin to that Eclipse version.
If you create a new Eclipse Project Wizard, then that also
will list down in the above list.
Steps for creating the new plugin-project in
eclipse
- Choose File > New > Project to select a project wizard.
- Under Plug-in
Development, select Plug-in Project, as shown below.
- Click Next
to advance to the next step.
- Add a
project name (TestWizard). Click Next.
- After you have filled in the information
as shown below, click Next.
- Choose
Custom plug-in wizard. Click Next.
- In the
Template Selection window, click Deselect All to unselect all the options.
Then, choose New File Wizard, as shown below. Click Next
- The
Eclipse wizard prompts you for some information about the new wizard
you're creating. Make sure you update the package name, ideally to the
same name that you used for the Activator (testwizard). Update the Wizard
Category Name to the name of the folder for the new wizard. The Wizard
Class Name is a Java class name for the class that inherits from Wizard
and implements the INewWizard interface. The Wizard Page Class Name
extends the WizardPage class.
- Click
Finish. Eclipse adds your new project with the necessary classes and
libraries.
It will automatically create NewWizard and NewWizardPage
and Plugin.xml.
1.
Go to Plugin.xml
, extension tab, there you will be able to view the new wizard that we added.
If required, we can change the category name and
wizard name here.
New Wizard Class structure
If you click on the class link (class*) it will go to the
default class ‘TestNewWizard’.
(addPages,
performFinish, doFinish, openContentStream, throwCoreException,init are the method inside
this class)
We can add new pages
to the testNewWizard.java
addPages - The
addPages()
method adds pages to the wizard.
We can create our
own wizard pages or use existing in wizard pages and add that pages to the
wizard using the addpage (wizardpage) method.
private WizardNewProjectCreationPage wizardPage;
public void addPages() {
wizardPage = new WizardNewProjectCreationPage("NewTestProject");
wizardPage.setDescription("Create a new Test Project.");
wizardPage.setTitle("New Test Project");
addPage(wizardPage);
}
|
Testing the New Wizard
To launch your plug-in project, right-click on the
Plugin.xaml, and select Run As > Eclipse Application as shown in below
Figure. A new instance of Eclipse starts up.
- In that new Eclipse got
to the Choose File > New > Others to select a project wizard.
- Where you
will be able to view the your Wizard Test Wizards(Category name in
extension tab of pulgin.xml) and Test Wizard(Wizard name in extension tab
of pulgin.xml), (Note: If you
change this name in extension tab it will reflect here)
When you select
TestWizard, the ‘Next’ icon will be enabled and you will be able to go to the
new project wizard selection page as shown below:
Here you will be
able to give name of your new Test Project. Then finish button will be enabled.
No comments:
Post a Comment