/* * Copyright (c) 2008 Embedded Brains GmbH and others. * * Embedded Brains GmbH * Obere Lagerstr. 30 * D-82178 Puchheim * Germany * rtems@embedded-brains.de * * All rights reserved. This program and the accompanying materials are made * available under the terms of the Eclipse Public License Version 1.0 ("EPL") * which accompanies this distribution and is available at * * http://www.eclipse.org/legal/epl-v10.html * * For purposes of the EPL, "Program" will mean the Content. * * Contributors: * * Sebastian Huber (Embedded Brains GmbH) - Initial API and implementation. */ package org.rtems.cdt.build; import java.util.Iterator; import java.util.List; import java.util.Map; import org.eclipse.cdt.make.core.scannerconfig.InfoContext; import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3; import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes; import org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector; import org.eclipse.cdt.make.internal.core.scannerconfig.util.CygpathTranslator; import org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector; import org.eclipse.core.resources.IProject; /** * This class exists only to disable the specialized UI elements of the scanner configuration. * * See also 'org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGnuWinScannerInfoCollector'. */ public class CygwinScannerInfoCollector extends PerProjectSICollector implements IScannerInfoCollector3, IManagedScannerInfoCollector { private IProject mProject; public void contributeToScannerConfig( Object resource, Map scannerInfo) { List includes = (List) scannerInfo.get( ScannerInfoTypes.INCLUDE_PATHS); List translatedIncludes = CygpathTranslator.translateIncludePaths( mProject, includes); Iterator iter = translatedIncludes.listIterator(); while (iter.hasNext()) { String convertedPath = iter.next(); if (convertedPath.startsWith( "/")) { iter.remove(); } } scannerInfo.put( ScannerInfoTypes.INCLUDE_PATHS, translatedIncludes); super.contributeToScannerConfig( resource, scannerInfo); } public void setProject( IProject project) { mProject = project; super.setProject( project); } public void setInfoContext( InfoContext context) { mProject = context.getProject(); super.setInfoContext( context); } }