Bug 502868 - operationClass not supported properly by "new" new project wizard
Summary: operationClass not supported properly by "new" new project wizard
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build (show other bugs)
Version: 8.8.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: cdt-build-inbox@eclipse.org CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
: 502869 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-09-30 09:48 EDT by Marina Gorshkova CLA
Modified: 2020-09-04 15:23 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marina Gorshkova CLA 2016-09-30 09:48:21 EDT
Steps to reproduce:
1. Create a C/C++ project (New -> C(C++) Project -> Executable -> Hello World ANSI C Project)
2. Cross GCC toolchain
3. Set the correct Path to gcc

Project is created.
Problems view contains:

Description	Resource	Path	Location	Type
Program "gcc" not found in PATH	test2		Project Properties, C++ Preprocessor Include.../Providers, [CDT Cross GCC Built-in Compiler Settings] options	C/C++ Scanner Discovery Problem
Description	Resource	Path	Location	Type
Program "g++" not found in PATH	test2		Project Properties, C++ Preprocessor Include.../Providers, [CDT Cross GCC Built-in Compiler Settings] options	C/C++ Scanner Discovery Problem

Do any changes in PATH variable of the project -> Apply - > OK

Indexer works again -> errors disappear
Comment 1 Marc-André Laperle CLA 2016-09-30 10:18:30 EDT
I think I can reproduce this. Which of the new project wizard did you use exactly? It looks like the new C/C++ Project wizard broke this. So in summary:

- New C Project: works
- New C++ Project: works
- New C/C++ Project: doesn't work
Comment 2 Marc-André Laperle CLA 2016-10-02 23:00:37 EDT
Doug, is it possible that the new wizard does not use operationClass attribute properly?

In the case of Cross GCC, I'm talking about:

   <extension
         point="org.eclipse.cdt.managedbuilder.ui.newWizardPages">
      <wizardPage
            ID="org.eclipse.cdt.build.crossgcc.setcCrossCommandWizardPage"
this one ->            operationClass="org.eclipse.cdt.internal.build.crossgcc.SetCrossCommandOperation"
            pageClass="org.eclipse.cdt.internal.build.crossgcc.SetCrossCommandWizardPage">
         <toolchain


MBSCustomPageManager.java:

	/**
	 *  attribute for the operation that is run for a wizardPage during the wizard's DoRunEpilogue() method
	 */
	public static final String OPERATION_CLASS = "operationClass"; //$NON-NLS-1$
Comment 3 Nathan Ridge CLA 2016-10-10 22:41:00 EDT
*** Bug 502869 has been marked as a duplicate of this bug. ***
Comment 4 Liviu Ionescu CLA 2017-02-15 13:03:13 EST
The GNU ARM Eclipse plug-ins are also affected, the new wizard does not initialise properly the created projects and builds are simply not possible.

The wizard uses "org.eclipse.cdt.managedbuilder.ui.newWizardPages" with custom operationClass and pageClass.

Both are mandatory for the correctness of the created project.

The functionality of the pageClass seems ok, since I can see the extra page asking for the toolchain name/path.

Could you check if the operationClass is properly used?
Comment 5 Liviu Ionescu CLA 2017-02-21 08:18:07 EST
the problem is actually trickier, and is caused by a change in the logic to invoke, or, for the new wizard, **not** to invoke the SetCrossCommandWizardPage, custom to the Cross wizard (and similarly in the GNU ARM Eclipse wizard).

if the user navigates through all pages, including the Cross GCC Command page, the project is generated correctly with both wizards.

if the user clicks the Finish button earlier, with the new wizard there is an internal exception and the project is not generated completely.


in more detail:

- the SetCrossCommandOperation.run() method starts by getting the projectName from the SetCrossCommandWizardPage via:

		String projectName = (String) MBSCustomPageManager.getPageProperty(SetCrossCommandWizardPage.PAGE_ID, SetCrossCommandWizardPage.CROSS_PROJECT_NAME);

when used by the old wizard, this property is correctly set; when used by the new wizard, this property is null.

a few lines down the road, the projectName is used to get the project object:

		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);

the getProject() method throws an AssertionFailedException, which prematurely terminates the project creation.

- the CROSS_PROJECT_NAME property is set in SetCrossCommandWizardPage.isCustomPageComplete(); for the old wizard, this method is called early when the wizard is created:

SetCrossCommandWizardPage.isCustomPageComplete() line: 83	
SetCrossCommandWizardPage(MBSCustomPage).isPageComplete() line: 126	
MBSWizardHandler.canFinish() line: 880	
CCProjectWizard(CDTCommonProjectWizard).canFinish() line: 359	
WizardDialog.updateButtons() line: 1300	
WizardDialog.update() line: 1291	
WizardDialog.showStartingPage() line: 1244	
WizardDialog.createContents(Composite) line: 590	
WizardDialog(Window).create() line: 426	
WizardDialog(Dialog).create() line: 1095	

for the new wizard, this method is no longer called during wizard creation, but only if the Cross GCC Command page is entered explicitly; finishing the wizard without entering the Cross GCC Command page leaves this property not initialised.


the solution would be to update the new wizard and ensure that the custom wizard page is created and the isCustomPageComplete() called before getting the property.

unfortunately I could not identify the place where to do this, and help from a more knowledgable committer is badly needed.
Comment 6 Liviu Ionescu CLA 2017-02-22 04:36:51 EST
the cause of this bug is described in bug 512550, which is even worse.