Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Add custom page to wizard as starting page(How do I set my custom page as wizard starting page ?)
Add custom page to wizard as starting page [message #1755732] Tue, 07 March 2017 05:09 Go to next message
Eclipse UserFriend
Hello,

I'm able to contribute to new C/C++ project wizard adding some custom pages thanks extension point usage what's fine !

Now my need is to promote one of such custom pages as wizard starting page ... how do I ?

Feel free to comment.
Thks for help !
Br,
Re: Add custom page to wizard as starting page [message #1755757 is a reply to message #1755732] Tue, 07 March 2017 10:04 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I think we'll need a bit more info. It sounds like you want your own wizard if you are trying to change the entry point. Although I suspect you are beyond this stage, have you looked at http://www.vogella.com/tutorials/EclipseWizards/article.html?



Jonah
icon5.gif  Re: Add custom page to wizard as starting page [message #1755785 is a reply to message #1755757] Wed, 08 March 2017 03:18 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

Thanks for considering my concern !

In one way, yes I want my own wizard but as building by the end some new C/C++ project I'm expecting obviously to rely on nice CDT existing material.

CDT Managed Build System related wizard is fine to me:
+ Preventing to deal by myself with toolchain, project nature etc ...
+ Relying on org.eclipse.cdt.managedbuilder.ui.newWizardPages extension point to add at no pain some custom pages by the end of wizard
+ ...

But I'm expecting to promote as addon my own page as first wizard page ...
So yes my first guess idea was to build my own wizard extending CDTCommonProjectWizard class relying on org.eclipse.ui.newWizards extension point. Overriding then public void addPages() method I'm able to get some custom page as first wizard page.

First guess all sounds running fine but I'm starting facing some trouble due to MBSWizardHandler class.

All MBSWizardHandler constructors are invoking some private method void setWizard(IWizard w).
/**
 * This object is created per each Project type
 *
 * It is responsible for:
 * - corresponding line in left pane of 1st wizard page
 * - whole view of right pane, including
 *
 * @noextend This class is not intended to be subclassed by clients.
 * @noinstantiate This class is not intended to be instantiated by clients.
 */
public class MBSWizardHandler extends CWizardHandler {
		...
		...
private void setWizard(IWizard w) {
	if (w != null) {
		wizard = w;
		...
		...
		startingPage = w.getStartingPage();
	}
}

protected IWizardPage getStartingPage(){
	return startingPage;
}

public Map<String, String> getMainPageData() {
	WizardNewProjectCreationPage page = (WizardNewProjectCreationPage) getStartingPage();
	...
	...
}


(WizardNewProjectCreationPage) getStartingPage() cast within getMainPageData() method is obviously forcing first wizard page type ... what's not helping me ...

I'm even more disappointed as just introducing a basic very dirty hack as proof of concept I'm able to achieve my goal ...
/*
 * (non-Javadoc)
 * @see org.eclipse.jface.wizard.Wizard#getStartingPage()
 */
@Override
public IWizardPage getStartingPage() {
	if (Thread.currentThread().getStackTrace()[2].getMethodName().equals("setWizard")) {
		return getPages()[1]; // Assuming second wizard page is common CDT WizardNewProjectCreationPage type page
	} else {
		return getPages()[0]; // Assuming first wizard page is my custom page
	}
}


But as dirty hack I cannot for sure rely on thinking any production code ... so I'm stucked.

Any help / advice more than welcome!

Br,

[Updated on: Mon, 13 March 2017 13:56] by Moderator

icon5.gif  Re: Add custom page to wizard as starting page [message #1756216 is a reply to message #1755785] Tue, 14 March 2017 02:55 Go to previous messageGo to next message
Eclipse UserFriend
Any help ??
Thanks a lot !
Br,
Re: Add custom page to wizard as starting page [message #1756305 is a reply to message #1756216] Wed, 15 March 2017 05:13 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I am sorry that I don't have much more of an answer. Please provide a pull request if you think an change of signature would make it easier to extend/reuse CDT.

It may also be worth looking at org.eclipse.cdt.internal.ui.wizards.project.NewCDTProjectWizard which provides a new first page for C/C++ project wizards, but does reuse existing code.

HTH
Jonah
Re: Add custom page to wizard as starting page [message #1757830 is a reply to message #1756305] Mon, 20 March 2017 09:23 Go to previous message
Eclipse UserFriend
Hello,

Ok. I've setup pull request. Unfortunately I'm struggling with ECA validation within such process Sad

I've set "signed-off by" by the end of my commit message, according my account profile I've an up to date ECA ... but ... validation is failing Sad.

https://github.com/eclipse/cdt/pull/6/commits/49219e3e17c9687f5e03e5290340c19b024be28b

Any help / advice about is welcome back !
Previous Topic:lost patience with visual studio integration [denglish]
Next Topic:Cannot Debug GPIO in (Linux) Eclipse CDT Luna - Debug fails: Permission denied /dev/mem
Goto Forum:
  


Current Time: Wed Jul 16 06:46:38 EDT 2025

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

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

Back to the top