Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Making a Custom New Project Wizard
Making a Custom New Project Wizard [message #198025] Mon, 23 July 2007 19:12 Go to next message
Eclipse UserFriend
Originally posted by: chris.jamieson.rowebots.net

Hello,

I am currently attempting to make a custom New Project Wizard for my product
which is based on Eclipse for C/C++ Europa (CDT). After investigating how
CDT contributes it's new project wizard I have come accross the
org.eclipse.ui.newWizards externtion point. Now in CDT this extention point
is declared in org.eclipse.cdt.ui and it is said to use the class
org.eclipse.cdt.ui.wizards.CProjectWizard.

Now I have no problem telling my plugins new extention at
org.eclipse.ui.newWizards to use org.eclipse.cdt.ui.wizards.CProjectWizard
and this opens the same dialogue however I am having difficulty with making
my own class to run my own wizard. This is partially because I don't
understand what org.eclipse.cdt.ui.wizards.CProjectWizard. It is also
because there are a whole bunch more classes which I came accross which I
can't figure out. One of which is org.eclipse.cdt.ui.wizards.CNewWizard
which as I am writing this I can't remember how I came accross.

Basically I am looking for someone to give me a break down or at least point
me to some resources where I can figure out how to add a custom new project
wizard as I have been unsuccessful in finding them.

Thanks in advance,

Chris Jamieson
Re: Making a Custom New Project Wizard [message #198057 is a reply to message #198025] Tue, 24 July 2007 07:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dmsubs.NOSPAM.consertum.com

Look in the Managed Build Extensibility Document, which is part of the Help
supplied with CDT (SDK).

HTH
--
Derek


Chris Jamieson wrote:
> Hello,
>
> I am currently attempting to make a custom New Project Wizard for my product
> which is based on Eclipse for C/C++ Europa (CDT). After investigating how
> CDT contributes it's new project wizard I have come accross the
> org.eclipse.ui.newWizards externtion point. Now in CDT this extention point
> is declared in org.eclipse.cdt.ui and it is said to use the class
> org.eclipse.cdt.ui.wizards.CProjectWizard.
>
> Now I have no problem telling my plugins new extention at
> org.eclipse.ui.newWizards to use org.eclipse.cdt.ui.wizards.CProjectWizard
> and this opens the same dialogue however I am having difficulty with making
> my own class to run my own wizard. This is partially because I don't
> understand what org.eclipse.cdt.ui.wizards.CProjectWizard. It is also
> because there are a whole bunch more classes which I came accross which I
> can't figure out. One of which is org.eclipse.cdt.ui.wizards.CNewWizard
> which as I am writing this I can't remember how I came accross.
>
> Basically I am looking for someone to give me a break down or at least point
> me to some resources where I can figure out how to add a custom new project
> wizard as I have been unsuccessful in finding them.
>
> Thanks in advance,
>
> Chris Jamieson
>
>
Re: Making a Custom New Project Wizard [message #198168 is a reply to message #198057] Tue, 24 July 2007 20:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: chris.jamieson.rowebots.net

Hello Derek,

Thank you for responding and attempting to help me out.

I read thought most of the Extensibility Document and the changes in the
CDT Build System 4.0 document and while the information was helpful for
the long run it is not exactly what I am looking for.

I believe this is my fault though as I fear that I haven't been very
clear. What I am looking for is more information and guidance in
regards to making a more customized new project wizard. I would like to
ask the user for some more specific things and then generate a c project
from those responses.

For this it is my understanding (from additional reading I have done)
that I need to create a my own "New Project Wizard" by the extension
point org.eclipse.ui.newWizards and using my own class to extend Wizard
and implement INewWizard. However I am at a loss for what exactly to do
with these.

I discovered a plugin which made us of these and
WizardNewProjectCreationPage however I can manage to build it or resolve
the references to see where they are declared.

It is currently having issues with the code:

import org.eclipse.ui.*;

Which errors specifically with "org.eclipse" just like any other import
in the code. Now a number of plugs are listed as dependencies including
org.eclipse.ui.

Can any help me out with this issue or point me to resources which would
help me? Is there another more appropriate newsgroup then
eclipse.platform (I now realize that this doesn't belong in cdt however
I am posting this reply to tank Derek and for those who might follow my
questions in the future)?

Thanks again,

Chris Jamieson

Derek Morris wrote:
> Look in the Managed Build Extensibility Document, which is part of the
> Help supplied with CDT (SDK).
>
> HTH
Re: Making a Custom New Project Wizard [message #198184 is a reply to message #198168] Wed, 25 July 2007 06:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dmsubs.NOSPAM.consertum.com

Another clue - if you are using CDT4, you should be looking at 'templates'.

If using CDT3.1 (and 4.0? - I'm not sure, I haven't tried yet), you should be
looking at MBSCustomPage and MBSCustomPageManager - these let you add pages to
the C New Project Wizard.

--
Derek


Chris Jamieson wrote:
> Hello Derek,
>
> Thank you for responding and attempting to help me out.
>
> I read thought most of the Extensibility Document and the changes in the
> CDT Build System 4.0 document and while the information was helpful for
> the long run it is not exactly what I am looking for.
>
> I believe this is my fault though as I fear that I haven't been very
> clear. What I am looking for is more information and guidance in
> regards to making a more customized new project wizard. I would like to
> ask the user for some more specific things and then generate a c project
> from those responses.
>
> For this it is my understanding (from additional reading I have done)
> that I need to create a my own "New Project Wizard" by the extension
> point org.eclipse.ui.newWizards and using my own class to extend Wizard
> and implement INewWizard. However I am at a loss for what exactly to do
> with these.
>
> I discovered a plugin which made us of these and
> WizardNewProjectCreationPage however I can manage to build it or resolve
> the references to see where they are declared.
>
> It is currently having issues with the code:
>
> import org.eclipse.ui.*;
>
> Which errors specifically with "org.eclipse" just like any other import
> in the code. Now a number of plugs are listed as dependencies including
> org.eclipse.ui.
>
> Can any help me out with this issue or point me to resources which would
> help me? Is there another more appropriate newsgroup then
> eclipse.platform (I now realize that this doesn't belong in cdt however
> I am posting this reply to tank Derek and for those who might follow my
> questions in the future)?
>
> Thanks again,
>
> Chris Jamieson
>
> Derek Morris wrote:
>> Look in the Managed Build Extensibility Document, which is part of the
>> Help supplied with CDT (SDK).
>>
>> HTH
Re: Making a Custom New Project Wizard [message #198243 is a reply to message #198184] Wed, 25 July 2007 18:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: chris.jamieson.rowebots.net

That is exactly what I am looking for. Or so it seems. I am amazed I
missed that in my original read of the document.

However I am not at another problem. Where do I start with this? I
have seen a number of questions in this newsgroup but none point me to
an actual starting point or have any steps I can follow.

As it stands now I have a few blanks in my process.

1. Make a plugin.
2. Define an extension at org.eclipse.cdt.managedbuilder.ui.newWizardPages
3. Tell it to use a class based off
org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPage
4. ?
5. ?
?. Fill in content

I am quite unclear as to what I actually have to do to use this class
and the related MBSCustomPageManager to add the pages.

Also, does this allow me to add pages before the current ones? And can
I make this new wizard in different category then "C" or "C++"?

Thank you so much for all your help,

Chris


Derek Morris wrote:
> Another clue - if you are using CDT4, you should be looking at 'templates'.
>
> If using CDT3.1 (and 4.0? - I'm not sure, I haven't tried yet), you
> should be looking at MBSCustomPage and MBSCustomPageManager - these let
> you add pages to the C New Project Wizard.
>
Re: Making a Custom New Project Wizard [message #198263 is a reply to message #198243] Thu, 26 July 2007 06:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dmsubs.NOSPAM.consertum.com

4. Create (one or more):
public class MyCustomPage extends MBSCustomPage {...}
5. Create :
public class MyCustomPageRunnable extends Runnable {...}

Don't forget that you use the Page to collect information from the user and use
the Runnable to actually do the work. At the time the Page is run, the project
does *not* exist (user can cancel with no side effects). When the Runnable is
running, the project *does* exist and all of the 'standard' CDT project stuff is
set up.

You need to use MBSCustomPageManager#(s/g)etPageProperty to share data between
the page and the Runnable.

HTH
--
Derek


Chris Jamieson wrote:
> That is exactly what I am looking for. Or so it seems. I am amazed I
> missed that in my original read of the document.
>
> However I am not at another problem. Where do I start with this? I
> have seen a number of questions in this newsgroup but none point me to
> an actual starting point or have any steps I can follow.
>
> As it stands now I have a few blanks in my process.
>
> 1. Make a plugin.
> 2. Define an extension at org.eclipse.cdt.managedbuilder.ui.newWizardPages
> 3. Tell it to use a class based off
> org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPage
> 4. ?
> 5. ?
> ?. Fill in content
>
> I am quite unclear as to what I actually have to do to use this class
> and the related MBSCustomPageManager to add the pages.
>
> Also, does this allow me to add pages before the current ones? And can
> I make this new wizard in different category then "C" or "C++"?
>
> Thank you so much for all your help,
>
> Chris
>
>
> Derek Morris wrote:
>> Another clue - if you are using CDT4, you should be looking at
>> 'templates'.
>>
>> If using CDT3.1 (and 4.0? - I'm not sure, I haven't tried yet), you
>> should be looking at MBSCustomPage and MBSCustomPageManager - these
>> let you add pages to the C New Project Wizard.
>>
Re: Making a Custom New Project Wizard [message #198345 is a reply to message #198263] Thu, 26 July 2007 15:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: chris.jamieson.rowebots.net

(Removed eclipse.platform from this reply)

Excellent, thank you again.

I think my major disconnect is where to these classes actually get
instantiated and populated.

Basically when I am making my class which extends MBSCustomPage, from
where is the constructor called? Where do I define what wizard it
belongs to or what the pageID is?

Perhaps I am having difficulty thinking in Eclipse terms and not C++ terms.

Thanks yet again,

Chris

Derek Morris wrote:
> 4. Create (one or more):
> public class MyCustomPage extends MBSCustomPage {...}
> 5. Create :
> public class MyCustomPageRunnable extends Runnable {...}
>
> Don't forget that you use the Page to collect information from the user
> and use the Runnable to actually do the work. At the time the Page is
> run, the project does *not* exist (user can cancel with no side
> effects). When the Runnable is running, the project *does* exist and all
> of the 'standard' CDT project stuff is set up.
>
> You need to use MBSCustomPageManager#(s/g)etPageProperty to share data
> between the page and the Runnable.
>
> HTH
Re: Making a Custom New Project Wizard [message #198350 is a reply to message #198345] Thu, 26 July 2007 15:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dmsubs.NOSPAM.consertum.com

You define it to the MBS by having an entry in your plugin.xml, something like this:

<extension
point='org.eclipse.cdt.managedbuilder.ui.newWizardPages' >
<!-- this defines the Page and the Runnable -->
<wizardPage ID='MyCustomPage' operationClass='com.xxx.MyCustomPageRunnable'
pageClass='com.xxx.MyCustomPage' >
<!-- this defines which projecttype(s) it is valid for -->
<projectType projectTypeID='com.xxx.projecttype.exe' />
<projectType projectTypeID='com.xxx.projecttype.lib' />
</wizardPage>
</extension>

Then, the MBS will create your CustomPage (very early) and you get 'control'
when your setVisible method is called.

HTH
--
Derek


Chris Jamieson wrote:
> (Removed eclipse.platform from this reply)
>
> Excellent, thank you again.
>
> I think my major disconnect is where to these classes actually get
> instantiated and populated.
>
> Basically when I am making my class which extends MBSCustomPage, from
> where is the constructor called? Where do I define what wizard it
> belongs to or what the pageID is?
>
> Perhaps I am having difficulty thinking in Eclipse terms and not C++ terms.
>
> Thanks yet again,
>
> Chris
>
> Derek Morris wrote:
>> 4. Create (one or more):
>> public class MyCustomPage extends MBSCustomPage {...}
>> 5. Create :
>> public class MyCustomPageRunnable extends Runnable {...}
>>
>> Don't forget that you use the Page to collect information from the
>> user and use the Runnable to actually do the work. At the time the
>> Page is run, the project does *not* exist (user can cancel with no
>> side effects). When the Runnable is running, the project *does* exist
>> and all of the 'standard' CDT project stuff is set up.
>>
>> You need to use MBSCustomPageManager#(s/g)etPageProperty to share data
>> between the page and the Runnable.
>>
>> HTH
Re: Making a Custom New Project Wizard [message #198397 is a reply to message #198350] Thu, 26 July 2007 21:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: chris.jamieson.rowebots.net

Oh, I didn't realize that the MBS would pick up the class like that.
That is pretty cool.

Ok so now I have my extension pointing to my classes and my classes
extending their proper parents. My question now is how do I actually
make them do anything? Right now no extra pages show up and even if
they did I don't think anything would happen. I understand how to use
the MBSCustomPageData and the (s/g)etPageProperty so that I can get the
info and do things in the operation class but how do I actually get
things from the user?

For example how do I make a simple text box in my new page? Do I have
to make direct SWT calls? Is there a specific place to put this which
defines what the page looks like? All I have seen from looking through
the various classes (MBSCustomPage, MSBCustomPageData, etc.) is things
describing the page (i.e. pageID and wizard) and methods used when using
the page. However, I have seen nothing that actually specifies what the
page actually does.

I have been searching through all the different classes that extend
IWizardPage and IWizardPage itself and have come to the interface
IDialogPage and it's public void createControl(Composite parent);
method. I THINK this is what I will be using to make a text box but
I'll be damned if I know how to. The composite class has an array of
Control types. Now Control is implemented in a whole bunch of things
(such as Button, Label, and ProgressBar in org.eclipse.swt.widgets) but
I don't see a text box style control.

Also once I do have a text box type of control I am still not quite sure
how to use it. I am assuming that I will create a new instance of a
text box class and pass it to the createControl method. I also assume
that I will have to set a layout in it as that is specified in the
Composite class.

Am I on the right track? What am I missing? What is the actual
entering text class?

Thanks for all your assistance, it has been immensely helpful.

Chris

Derek Morris wrote:
> You define it to the MBS by having an entry in your plugin.xml,
> something like this:
>
> <extension
> point='org.eclipse.cdt.managedbuilder.ui.newWizardPages' >
> <!-- this defines the Page and the Runnable -->
> <wizardPage ID='MyCustomPage'
> operationClass='com.xxx.MyCustomPageRunnable'
> pageClass='com.xxx.MyCustomPage' >
> <!-- this defines which projecttype(s) it is valid for -->
> <projectType projectTypeID='com.xxx.projecttype.exe' />
> <projectType projectTypeID='com.xxx.projecttype.lib' />
> </wizardPage>
> </extension>
>
> Then, the MBS will create your CustomPage (very early) and you get
> 'control' when your setVisible method is called.
>
> HTH
Re: Making a Custom New Project Wizard [message #198404 is a reply to message #198397] Thu, 26 July 2007 21:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: chris.jamieson.rowebots.net

Ok here is an update. I found the Text class and used it to make an
instance and sent it to createControl. However I am not sure if this
will make the page show up. How do I specify where the page goes (i.e.
I want it to be the first page of the c wizard.

I also now get an error when attempting to run my plugin as an Eclipse
application.

The error is as follows:

org.eclipse.cdt.managedbuilder.core.BuildException: Plug-in <myplugin>
was unable to load class <myplugin>.test3.
at
org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManag er.loadWizardPage(MBSCustomPageManager.java:209)
at
org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManag er.loadExtensionsSynchronized(MBSCustomPageManager.java:165)
at
org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManag er.loadExtensions(MBSCustomPageManager.java:129)
at
org.eclipse.cdt.managedbuilder.ui.wizards.CDTConfigWizardPag e.addCustomPages(CDTConfigWizardPage.java:97)
at
org.eclipse.cdt.managedbuilder.ui.wizards.CDTConfigWizardPag e.getNextPage(CDTConfigWizardPage.java:335)
at
org.eclipse.jface.wizard.WizardPage.canFlipToNextPage(Wizard Page.java:115)
at
org.eclipse.jface.wizard.WizardDialog.updateButtons(WizardDi alog.java:1250)
at org.eclipse.jface.wizard.WizardPage.setPageComplete(WizardPa ge.java:299)
at
org.eclipse.cdt.managedbuilder.ui.wizards.CDTConfigWizardPag e.setVisible(CDTConfigWizardPage.java:277)
at
org.eclipse.jface.wizard.WizardDialog.updateForPage(WizardDi alog.java:1161)
at org.eclipse.jface.wizard.WizardDialog.access$2(WizardDialog. java:1139)
at org.eclipse.jface.wizard.WizardDialog$4.run(WizardDialog.jav a:1128)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
at org.eclipse.jface.wizard.WizardDialog.showPage(WizardDialog. java:1126)
at org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDial og.java:820)
at
org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDi alog.java:369)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.jav a:616)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:227)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:820 )
at org.eclipse.jface.window.Window.open(Window.java:796)
at
org.eclipse.ui.internal.actions.NewWizardShortcutAction.run( NewWizardShortcutAction.java:135)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498 )
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:545)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:490)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:402)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:153)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 504)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
at org.eclipse.equinox.launcher.Main.main(Main.java:1144)



Any ideas?



Chris Jamieson wrote:
> Oh, I didn't realize that the MBS would pick up the class like that.
> That is pretty cool.
>
> Ok so now I have my extension pointing to my classes and my classes
> extending their proper parents. My question now is how do I actually
> make them do anything? Right now no extra pages show up and even if
> they did I don't think anything would happen. I understand how to use
> the MBSCustomPageData and the (s/g)etPageProperty so that I can get the
> info and do things in the operation class but how do I actually get
> things from the user?
>
> For example how do I make a simple text box in my new page? Do I have
> to make direct SWT calls? Is there a specific place to put this which
> defines what the page looks like? All I have seen from looking through
> the various classes (MBSCustomPage, MSBCustomPageData, etc.) is things
> describing the page (i.e. pageID and wizard) and methods used when using
> the page. However, I have seen nothing that actually specifies what the
> page actually does.
>
> I have been searching through all the different classes that extend
> IWizardPage and IWizardPage itself and have come to the interface
> IDialogPage and it's public void createControl(Composite parent);
> method. I THINK this is what I will be using to make a text box but
> I'll be damned if I know how to. The composite class has an array of
> Control types. Now Control is implemented in a whole bunch of things
> (such as Button, Label, and ProgressBar in org.eclipse.swt.widgets) but
> I don't see a text box style control.
>
> Also once I do have a text box type of control I am still not quite sure
> how to use it. I am assuming that I will create a new instance of a
> text box class and pass it to the createControl method. I also assume
> that I will have to set a layout in it as that is specified in the
> Composite class.
>
> Am I on the right track? What am I missing? What is the actual
> entering text class?
>
> Thanks for all your assistance, it has been immensely helpful.
>
> Chris
>
> Derek Morris wrote:
>> You define it to the MBS by having an entry in your plugin.xml,
>> something like this:
>>
>> <extension
>> point='org.eclipse.cdt.managedbuilder.ui.newWizardPages' >
>> <!-- this defines the Page and the Runnable -->
>> <wizardPage ID='MyCustomPage'
>> operationClass='com.xxx.MyCustomPageRunnable'
>> pageClass='com.xxx.MyCustomPage' >
>> <!-- this defines which projecttype(s) it is valid for -->
>> <projectType projectTypeID='com.xxx.projecttype.exe' />
>> <projectType projectTypeID='com.xxx.projecttype.lib' />
>> </wizardPage>
>> </extension>
>>
>> Then, the MBS will create your CustomPage (very early) and you get
>> 'control' when your setVisible method is called.
>>
>> HTH
Re: Making a Custom New Project Wizard [message #198418 is a reply to message #198404] Fri, 27 July 2007 07:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dmsubs.NOSPAM.consertum.com

You really need to read about SWT. This is absolutely fundamental if you are
going to be doing any UI work in Eclipse.

One book I have found useful about Eclipse, including a little on SWT is:
http://www.qualityeclipse.com/

Specifically on your question: You have this the wrong way round. The framework
calls *your* createControl method and you instantiate your controls within there.

--
Derek


Chris Jamieson wrote:
> Ok here is an update. I found the Text class and used it to make an
> instance and sent it to createControl. However I am not sure if this
> will make the page show up. How do I specify where the page goes (i.e.
> I want it to be the first page of the c wizard.
>
> I also now get an error when attempting to run my plugin as an Eclipse
> application.
>
> The error is as follows:
>
> org.eclipse.cdt.managedbuilder.core.BuildException: Plug-in <myplugin>
> was unable to load class <myplugin>.test3.
> at
> org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManag er.loadWizardPage(MBSCustomPageManager.java:209)
>
> at
> org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManag er.loadExtensionsSynchronized(MBSCustomPageManager.java:165)
>
> at
> org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManag er.loadExtensions(MBSCustomPageManager.java:129)
>
> at
> org.eclipse.cdt.managedbuilder.ui.wizards.CDTConfigWizardPag e.addCustomPages(CDTConfigWizardPage.java:97)
>
> at
> org.eclipse.cdt.managedbuilder.ui.wizards.CDTConfigWizardPag e.getNextPage(CDTConfigWizardPage.java:335)
>
> at
> org.eclipse.jface.wizard.WizardPage.canFlipToNextPage(Wizard Page.java:115)
> at
> org.eclipse.jface.wizard.WizardDialog.updateButtons(WizardDi alog.java:1250)
> at
> org.eclipse.jface.wizard.WizardPage.setPageComplete(WizardPa ge.java:299)
> at
> org.eclipse.cdt.managedbuilder.ui.wizards.CDTConfigWizardPag e.setVisible(CDTConfigWizardPage.java:277)
>
> at
> org.eclipse.jface.wizard.WizardDialog.updateForPage(WizardDi alog.java:1161)
> at
> org.eclipse.jface.wizard.WizardDialog.access$2(WizardDialog. java:1139)
> at org.eclipse.jface.wizard.WizardDialog$4.run(WizardDialog.jav a:1128)
> at
> org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
> at
> org.eclipse.jface.wizard.WizardDialog.showPage(WizardDialog. java:1126)
> at
> org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDial og.java:820)
> at
> org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDi alog.java:369)
> at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.jav a:616)
> at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:227)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
> at org.eclipse.jface.window.Window.runEventLoop(Window.java:820 )
> at org.eclipse.jface.window.Window.open(Window.java:796)
> at
> org.eclipse.ui.internal.actions.NewWizardShortcutAction.run( NewWizardShortcutAction.java:135)
>
> at org.eclipse.jface.action.Action.runWithEvent(Action.java:498 )
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:545)
>
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:490)
>
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:402)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
> at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:153)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 504)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
>
>
>
> Any ideas?
>
>
>
> Chris Jamieson wrote:
>> Oh, I didn't realize that the MBS would pick up the class like that.
>> That is pretty cool.
>>
>> Ok so now I have my extension pointing to my classes and my classes
>> extending their proper parents. My question now is how do I actually
>> make them do anything? Right now no extra pages show up and even if
>> they did I don't think anything would happen. I understand how to use
>> the MBSCustomPageData and the (s/g)etPageProperty so that I can get
>> the info and do things in the operation class but how do I actually
>> get things from the user?
>>
>> For example how do I make a simple text box in my new page? Do I have
>> to make direct SWT calls? Is there a specific place to put this which
>> defines what the page looks like? All I have seen from looking
>> through the various classes (MBSCustomPage, MSBCustomPageData, etc.)
>> is things describing the page (i.e. pageID and wizard) and methods
>> used when using the page. However, I have seen nothing that actually
>> specifies what the page actually does.
>>
>> I have been searching through all the different classes that extend
>> IWizardPage and IWizardPage itself and have come to the interface
>> IDialogPage and it's public void createControl(Composite parent);
>> method. I THINK this is what I will be using to make a text box but
>> I'll be damned if I know how to. The composite class has an array of
>> Control types. Now Control is implemented in a whole bunch of things
>> (such as Button, Label, and ProgressBar in org.eclipse.swt.widgets)
>> but I don't see a text box style control.
>>
>> Also once I do have a text box type of control I am still not quite
>> sure how to use it. I am assuming that I will create a new instance
>> of a text box class and pass it to the createControl method. I also
>> assume that I will have to set a layout in it as that is specified in
>> the Composite class.
>>
>> Am I on the right track? What am I missing? What is the actual
>> entering text class?
>>
>> Thanks for all your assistance, it has been immensely helpful.
>>
>> Chris
>>
>> Derek Morris wrote:
>>> You define it to the MBS by having an entry in your plugin.xml,
>>> something like this:
>>>
>>> <extension
>>> point='org.eclipse.cdt.managedbuilder.ui.newWizardPages' >
>>> <!-- this defines the Page and the Runnable -->
>>> <wizardPage ID='MyCustomPage'
>>> operationClass='com.xxx.MyCustomPageRunnable'
>>> pageClass='com.xxx.MyCustomPage' >
>>> <!-- this defines which projecttype(s) it is valid for -->
>>> <projectType projectTypeID='com.xxx.projecttype.exe' />
>>> <projectType projectTypeID='com.xxx.projecttype.lib' />
>>> </wizardPage>
>>> </extension>
>>>
>>> Then, the MBS will create your CustomPage (very early) and you get
>>> 'control' when your setVisible method is called.
>>>
>>> HTH
Re: Making a Custom New Project Wizard [message #896088 is a reply to message #198404] Tue, 17 July 2012 08:42 Go to previous messageGo to next message
michael mercier is currently offline michael mercierFriend
Messages: 2
Registered: July 2012
Junior Member
This error comes from the fact that the constructor of your plugin custom page wizard call by the MBSCustomPageManager is the 0-argument constructor.
You need to create a 0-argument constructor in your WizardPage like this:
public MyWizardPage(){
super("myWyzardPage");
}
Re: Making a Custom New Project Wizard [message #896092 is a reply to message #896088] Tue, 17 July 2012 08:57 Go to previous message
michael mercier is currently offline michael mercierFriend
Messages: 2
Registered: July 2012
Junior Member
By the way I'm trying to create a default C project with some generated files inside but I want my project to be in special category and the templates way is not fitting my needs.
I think I can override some CDT project creation Wizard but I can't find the good one...
I tried to override org.eclipse.cdt.ui.wizards.NewCProjectWizard but the created project doesn't have Includes or Toolchains.
Any idea?

Edit:
I found the solution:
-Extends the org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard and add it to plugin.xml with the org.eclipse.ui.newWizards extension point
-add my custom wizard page to the wizard to get some specific information
-use this code found in ManagedBuildTestHelper in org.eclipse.cdt.managedbuilder.core.tests with new project created gy the extended wizard
		public IProject createNewManagedProject()
		{
			IProject newProjectHandle = getNewProject();
			final IPath location = getNewProject().getLocation();
			final String projectId = getNewProject().getName();
			//TODO make this platform dependent
			final String projectTypeId = "cdt.managedbuild.target.gnu.exe";
			final IWorkspace workspace = ResourcesPlugin.getWorkspace();
			IWorkspaceRoot root = workspace.getRoot();
			final IProject project = newProjectHandle;
			IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
				@Override
				public void run(IProgressMonitor monitor) throws CoreException {
					// Create the base project
					IWorkspaceDescription workspaceDesc = workspace.getDescription();
					//workspaceDesc.setAutoBuilding(false);
					workspace.setDescription(workspaceDesc);
					IProjectDescription description = workspace.newProjectDescription(project.getName());
					if (location != null) {
						description.setLocation(location);
					}
					CCorePlugin.getDefault().createCProject(description, project, monitor, projectId);
					// Add the managed build nature and builder
					addManagedBuildNature(project);

					// Find the base project type definition
					IProjectType projType = ManagedBuildManager.getProjectType(projectTypeId);
					Assert.assertNotNull(projType);

					// Create the managed-project (.cdtbuild) for our project that builds an executable.
					IManagedProject newProject = null;
					try {
						newProject = ManagedBuildManager.createManagedProject(project, projType);
					} catch (Exception e) {
						Assert.fail("Failed to create managed project for: " + project.getName());
						return;
					}
					Assert.assertEquals(newProject.getName(), projType.getName());
					Assert.assertFalse(newProject.equals(projType));
					ManagedBuildManager.setNewProjectVersion(project);
					// Copy over the configs
					IConfiguration defaultConfig = null;
					IConfiguration[] configs = projType.getConfigurations();
					for (int i = 0; i < configs.length; ++i) {
						// Make the first configuration the default
						if (i == 0) {
							defaultConfig = newProject.createConfiguration(configs[i], projType.getId() + "." + i);
						} else {
							newProject.createConfiguration(configs[i], projType.getId() + "." + i);
						}
					}
					ManagedBuildManager.setDefaultConfiguration(project, defaultConfig);
					IConfiguration cfgs[] = newProject.getConfigurations();
					for(int i = 0; i < cfgs.length; i++){
						cfgs[i].setArtifactName(newProject.getDefaultArtifactName());
					}
					
					ManagedBuildManager.getBuildInfo(project).setValid(true);
				}
			};
			NullProgressMonitor monitor = new NullProgressMonitor();
			try {
				workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, monitor);
			} catch (CoreException e2) {
				Assert.fail(e2.getLocalizedMessage());
			}
			// CDT opens the Project with BACKGROUND_REFRESH enabled which causes the
			// refresh manager to refresh the project 200ms later.  This Job interferes
			// with the resource change handler firing see: bug 271264
			try {
				// CDT opens the Project with BACKGROUND_REFRESH enabled which causes the
				// refresh manager to refresh the project 200ms later.  This Job interferes
				// with the resource change handler firing see: bug 271264
				Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null);
			} catch (Exception e) {
				// Ignore
			}

			// Initialize the path entry container
			IStatus initResult = ManagedBuildManager.initBuildInfoContainer(project);
			if (initResult.getCode() != IStatus.OK) {
				Assert.fail("Initializing build information failed for: " + project.getName() + " because: " + initResult.getMessage());
			}
			return project;
		}

		static private void addManagedBuildNature (IProject project) {
			// Create the buildinformation object for the project
			IManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
			Assert.assertNotNull(info);

			// Add the managed build nature
			try {
				ManagedCProjectNature.addManagedNature(project, new NullProgressMonitor());
				ManagedCProjectNature.addManagedBuilder(project, new NullProgressMonitor());
			} catch (CoreException e) {
				Assert.fail("Test failed on adding managed build nature or builder: " + e.getLocalizedMessage());
			}

			// Associate the project with the managed builder so the clients can get proper information
			ICDescriptor desc = null;
			try {
				desc = CCorePlugin.getDefault().getCProjectDescription(project, true);
				desc.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
				desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, ManagedBuildManager.INTERFACE_IDENTITY);
			} catch (CoreException e) {
				Assert.fail("Test failed on adding managed builder as scanner info provider: " + e.getLocalizedMessage());
				return;
			}
			try {
				desc.saveProjectData();
			} catch (CoreException e) {
				Assert.fail("Test failed on saving the ICDescriptor data: " + e.getLocalizedMessage());		}
			// Associate the project with the managed builder so the clients can get proper information data: " + e.getLocalizedMessage());		}	
		}


you must choose the right projectID in the list below to get the good toolchain:
cdt.managedbuild.target.gnu.cygwin.exe, cdt.managedbuild.target.gnu.cygwin.lib, cdt.managedbuild.target.gnu.cygwin.so, cdt.managedbuild.target.gnu.exe, cdt.managedbuild.target.gnu.lib, cdt.managedbuild.target.gnu.mingw.exe, cdt.managedbuild.target.gnu.mingw.lib, cdt.managedbuild.target.gnu.mingw.so, cdt.managedbuild.target.gnu.so, cdt.managedbuild.target.gnu.solaris.exe, cdt.managedbuild.target.gnu.solaris.lib, cdt.managedbuild.target.gnu.solaris.so, cdt.managedbuild.target.macosx.exe, cdt.managedbuild.target.macosx.lib, cdt.managedbuild.target.macosx.so


If someone have an idea to replace the deprecated part of addManagedBuildNature I haven't found the good way yet...

[Updated on: Wed, 18 July 2012 08:52]

Report message to a moderator

Previous Topic:Breakpoint Log Action Expression
Next Topic:Build Remote C/C++ Project problem
Goto Forum:
  


Current Time: Sat Apr 27 00:56:30 GMT 2024

Powered by FUDForum. Page generated in 0.04038 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top