Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Applied [HEAD] Re: [cdt-patch] Updated Scanner Info Discovery Mechanism

Get off my back Bogdan.

JohnC




Sean Evoy/Ottawa/IBM@IBMCA 
Sent by: cdt-patch-admin@xxxxxxxxxxx
08/13/2003 12:33 PM
Please respond to
cdt-patch@xxxxxxxxxxx


To
cdt-patch@xxxxxxxxxxx
cc

Subject
[cdt-patch] Updated Scanner Info Discovery Mechanism






Hi All,
This is an involved patch. I sent out a detailed explanation of the work 
yesterday on the dev list. I have included that information below. I have 
done a quick test on Solaris, and a detailed list of changes can be found 
in the change logs. I will likely have to replace the code in the new 
project wizards with a COwner that does the same work, but that's less 
important for now than unblocking the model information client.

In order to work through CExtensionPoint mechanism, I have to change the 
existing extension point entries for the Managed and Standard builders to 
the following (all future builders will have to conform to this as well):
   <extension
         id="ManagedBuildManager"
         point="org.eclipse.cdt.core.ScannerInfoProvider">
      <cextension>
         <run
 class="org.eclipse.cdt.core.build.managed.ManagedBuildManager">
         </run>
      </cextension>
   </extension>

   <extension
         id="StandardBuildManager"
         point="org.eclipse.cdt.core.ScannerInfoProvider">
      <cextension>
         <run
 class="org.eclipse.cdt.core.build.standard.StandardBuildManager">
         </run>
      </cextension>
   </extension>

As well, the ManagedBuildManager and StandardBuildManager must extend 
AbstractCExtension.

The new project wizards for managed and standard projects have to be 
modified to register the right class as the scanner info providers for the 

project. The example below shows the managed project wizard code, but the 
standard project wizard is similar.
try {
        ICDescriptor desc = 
CCorePlugin.getDefault().getCProjectDescription(project);
        desc.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
        desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, 
ManagedBuildManager.INTERFACE_IDENTITY);
} <snip>


Clients use a new method defined in CCorePlugin 

public IScannerInfoProvider getScannerInfoProvider(IProject project) {
        IScannerInfoProvider provider = null;
        if (project != null) {
                try {
                        ICDescriptor desc = (ICDescriptor) 
getCProjectDescription(project);
                        ICExtensionReference[] extensions = 
desc.get(BUILD_SCANNER_INFO_UNIQ_ID);
                        if (extensions.length > 0)
                                provider = (IScannerInfoProvider) 
extensions[0].createExtension();
                } catch (CoreException e) {
                }
        }
        return provider;
}

to get the information provider as shown in the updated JUnit test code 
below:
// Find the first IScannerInfoProvider that supplies build info for the 
project
IScannerInfoProvider provider = 
CCorePlugin.getDefault().getScannerInfoProvider(project);
assertNotNull(provider);

As is the case now, clients implement the IScannerInfoChangeListener 
interface and pass themselves to the provider in a subscription message. 
There is also a new method on the IScannerInfoProvider interface that 
allows the client to get information immediately as shown below:
IScannerInfo currentSettings = provider.getScannerInformation(project); 

The ManagedBuildManager::getScannerInfo(IResource) method will be 
deprecated, then removed before the end of this release cycle.


Sean Evoy
Rational Software - IBM Software Group
Ottawa, Ontario, Canada
[attachment "cdt-core-patch.txt" deleted by John Camelon/Ottawa/IBM] 
[attachment "cdt-core-tests-patch.txt" deleted by John Camelon/Ottawa/IBM] 
[attachment "cdt-ui-patch.txt" deleted by John Camelon/Ottawa/IBM] 



Back to the top