Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [pde-dev] New Target API not included for M5

Thanks a lot Darin. This will save me some time.

Regards,
Thomas Hallgren

On 01/28/2010 04:35 PM, Darin Wright wrote:
Is this present already? I would like to enable easy support for this in
Buckminster. I already have headless commands for defining and importing
target definitions, but so far, nothing for the API baselines. Ideally,
I'd like to add a command saying "make this TP the workspace baseline".

Pointers to relevant code would be very helpful. Nonofficial is OK :-)

Here is sample code to create an API baseline from a target definition
(from
/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/use/ApiUseLaunchDelegate.java)

         /**
          * Creates an API baseline from a target definition.
          *
          * @param definition
          * @param monitor progress monitor
          */
         private IApiBaseline createBaseline(ITargetDefinition definition,
IProgressMonitor monitor) throws CoreException {
                 SubMonitor localmonitor = SubMonitor.convert(monitor,
Messages.ApiUseScanJob_reading_target, 10);
                 definition.resolve(localmonitor.newChild(2));
                 Util.updateMonitor(localmonitor, 1);
                 IResolvedBundle[] bundles = definition.getBundles();
                 List components = new ArrayList();
                 IApiBaseline profile = ApiModelFactory.newApiBaseline
(definition.getName());
                 localmonitor.setWorkRemaining(bundles.length);
                 for (int i = 0; i<  bundles.length; i++) {
                         Util.updateMonitor(localmonitor, 1);
                         if (bundles[i].getStatus().isOK()&&
!bundles[i].isSourceBundle()) {
                                 IApiComponent component = ApiModelFactory.
newApiComponent(profile, URIUtil.toFile(
bundles[i].getBundleInfo().getLocation()).getAbsolutePath());
                                 if (component != null) {
                                         components.add(component);
                                 }
                         }
                 }
                 profile.addApiComponents((IApiComponent[])
components.toArray(new IApiComponent[components.size()]));
                 return profile;
         }

Darin
_______________________________________________
pde-dev mailing list
pde-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/pde-dev



Back to the top