Bug 222118 - Prompts before Variables page in XLC project properties can be loaded
Summary: Prompts before Variables page in XLC project properties can be loaded
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build (show other bugs)
Version: 5.0   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: cdt-build-inbox@eclipse.org CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
: 235666 235700 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-10 16:53 EDT by Vivian Kong CLA
Modified: 2020-09-04 15:21 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vivian Kong CLA 2008-03-10 16:53:56 EDT
Four input prompts appear whenever the Variables properties page for a XLC project is accessed.  This behaves differently from other CDT projects.  To reproduce, create a XLC executable project and access its Variables properties page.
Comment 1 Vivian Kong CLA 2008-06-05 10:58:16 EDT
*** Bug 235700 has been marked as a duplicate of this bug. ***
Comment 2 Vivian Kong CLA 2008-06-05 11:52:05 EDT
*** Bug 235666 has been marked as a duplicate of this bug. ***
Comment 3 ZhangYi CLA 2008-07-15 07:35:27 EDT
Hi Kong,

   I have a problem to reproduce this bug. As I choose the XLC executable project in the wizard, the button of "Finish" is disabled and so that I could not create a project of this kind. Could you offer me some info about that?

Thank you,
Yi
Comment 4 ZhangYi CLA 2008-08-27 07:15:20 EDT
Hi,

I found the problem of this bug. 
In method “checkIntegrity()” of the class org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver, it would get all the macros using SupplierBasedCdtVariableManager.getVariables().
But different with other kinds of projects, the macros returned of XLC executable project have wrappers that wrap them. The wrapper is BuildMacroProvider.VariableWrapper. And In the mothod checkVariableIntegrity() of the class org.eclipse.cdt.internal.core.cdtvariables.CdtVariableManager, the method resolveMacro() is override. And when the macro is an instance of EclipseVariablesVariableSupplier.EclipseVarMacro, it will return a new instance of ResolveMacro, otherwise it will call super.resolveMacro(macro). The problem of this bug is, when the macro is string_prompt, folder_prompt, file_prompt or password_prompt (they are instance of EclipseVariablesVariableSupplier.EclipseVarMacro), it would call super.resolveMacro(macro), because the real type of the macro is BuildMacroProvider.VariableWrapper. That is wrong logically. It should return a new instance of ResolveMacro. But actually it calls super.resolveMacro(macro) and a prompt will jump out to get the stringValue of the macro.

The code is shown below:

protected ResolvedMacro resolveMacro(ICdtVariable macro) throws CdtVariableException {
	if(macro instanceof EclipseVariablesVariableSupplier.EclipseVarMacro)
		return new ResolvedMacro(macro.getName(),""); //$NON-NLS-1$
	return super.resolveMacro(macro);
}

Since the BuildMacroProvider.VariableWrapper is a private inner class of package org.eclipse.cdt.managedbuilder.internal.macros, we could not access it. So I have no idea of correcting this bug right now.

Thanks,
Yi
Comment 5 Vivian Kong CLA 2008-08-28 09:43:35 EDT
(In reply to comment #4)
Thanks for your investigation Yi.  That's how far I got in my own investigation as well.  

My questions right now are...

Why does the build macro get wrapped in BuildMacroProvider.getMacro()?  And is there a documentation that describes the new project model as a whole?
Comment 6 ZhangYi CLA 2008-08-29 02:47:05 EDT
(In reply to comment #5)
> (In reply to comment #4)
> Thanks for your investigation Yi.  That's how far I got in my own investigation
> as well.  
> 
> My questions right now are...
> 
> Why does the build macro get wrapped in BuildMacroProvider.getMacro()?  And is
> there a documentation that describes the new project model as a whole?
> 

For the first question, I think, it might have something related with the XLCProjectMacroSupplier or other class only for XLC project. But the codes of this kind of classes could not be seen. I think it is special for XLC project.

For the second question, it's a shame, we do not have such docs. There are only some rough docs describing some parts of the model of CDT. I don't know whether you have them. If you haven't, I could attach them to the bug. But in fact I think they have no idea with this bug.

However, I still would try to find a way to modify this bug.


Thanks,
Yi