1 | /* |
---|
2 | * Copyright (c) 2008 |
---|
3 | * Embedded Brains GmbH |
---|
4 | * Obere Lagerstr. 30 |
---|
5 | * D-82178 Puchheim |
---|
6 | * Germany |
---|
7 | * rtems@embedded-brains.de |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be found in the file |
---|
10 | * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE. |
---|
11 | */ |
---|
12 | |
---|
13 | package org.rtems.cdt.build; |
---|
14 | |
---|
15 | import java.util.Iterator; |
---|
16 | import java.util.List; |
---|
17 | import java.util.Map; |
---|
18 | |
---|
19 | import org.eclipse.cdt.make.core.scannerconfig.InfoContext; |
---|
20 | import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3; |
---|
21 | import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes; |
---|
22 | import org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector; |
---|
23 | import org.eclipse.cdt.make.internal.core.scannerconfig.util.CygpathTranslator; |
---|
24 | import org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector; |
---|
25 | import org.eclipse.core.resources.IProject; |
---|
26 | |
---|
27 | /** |
---|
28 | * This class exists only to disable the specialized UI elements of the scanner configuration. |
---|
29 | * |
---|
30 | * See also 'org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGnuWinScannerInfoCollector'. |
---|
31 | */ |
---|
32 | public class CygwinScannerInfoCollector extends PerProjectSICollector implements IScannerInfoCollector3, IManagedScannerInfoCollector { |
---|
33 | private IProject mProject; |
---|
34 | |
---|
35 | public void contributeToScannerConfig( Object resource, Map scannerInfo) { |
---|
36 | List<String> includes = (List<String>) scannerInfo.get( ScannerInfoTypes.INCLUDE_PATHS); |
---|
37 | List<String> translatedIncludes = CygpathTranslator.translateIncludePaths( mProject, includes); |
---|
38 | |
---|
39 | Iterator<String> iter = translatedIncludes.listIterator(); |
---|
40 | while (iter.hasNext()) { |
---|
41 | String convertedPath = iter.next(); |
---|
42 | if (convertedPath.startsWith( "/")) { |
---|
43 | iter.remove(); |
---|
44 | } |
---|
45 | } |
---|
46 | scannerInfo.put( ScannerInfoTypes.INCLUDE_PATHS, translatedIncludes); |
---|
47 | |
---|
48 | super.contributeToScannerConfig( resource, scannerInfo); |
---|
49 | } |
---|
50 | |
---|
51 | public void setProject( IProject project) { |
---|
52 | mProject = project; |
---|
53 | super.setProject( project); |
---|
54 | } |
---|
55 | |
---|
56 | public void setInfoContext( InfoContext context) { |
---|
57 | mProject = context.getProject(); |
---|
58 | super.setInfoContext( context); |
---|
59 | } |
---|
60 | } |
---|