cdt/cdt_5_0_x/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/PathEntryUtil.java
changeset 26 8717e2008e00
parent 25 68aa5b0d78d4
child 27 57a05dd59a20
equal deleted inserted replaced
25:68aa5b0d78d4 26:8717e2008e00
    10  *******************************************************************************/
    10  *******************************************************************************/
    11 
    11 
    12 package org.eclipse.cdt.internal.core.model;
    12 package org.eclipse.cdt.internal.core.model;
    13 
    13 
    14 import java.io.File;
    14 import java.io.File;
    15 import java.util.ArrayList;
    15 import java.util.*;
    16 import java.util.Arrays;
       
    17 import java.util.List;
       
    18 
    16 
    19 import org.eclipse.cdt.core.CCorePlugin;
    17 import org.eclipse.cdt.core.CCorePlugin;
    20 import org.eclipse.cdt.core.model.CModelException;
    18 import org.eclipse.cdt.core.model.CModelException;
    21 import org.eclipse.cdt.core.model.CoreModel;
    19 import org.eclipse.cdt.core.model.CoreModel;
    22 import org.eclipse.cdt.core.model.CoreModelUtil;
    20 import org.eclipse.cdt.core.model.CoreModelUtil;
   331 		}
   329 		}
   332 		return entry;
   330 		return entry;
   333 	}
   331 	}
   334 
   332 
   335 	public static ICModelStatus validatePathEntry(ICProject cProject, IPathEntry[] entries) {
   333 	public static ICModelStatus validatePathEntry(ICProject cProject, IPathEntry[] entries) {
   336 		// TODO restore this!!! only for performance testing since this seems to be a major bottleneck!!		
   334 		// Check duplication.
   337 		if (false) { // remove
   335 		Set<IPathEntry> entrySet = new HashSet<IPathEntry>(entries.length);
   338 			// Check duplication.
   336 		for (IPathEntry entry : entries) {
   339 			for (IPathEntry entry : entries) {
   337 			if (entry != null) {
   340 				if (entry == null) {
   338 				if (entrySet.contains(entry)) {
   341 					continue;
   339 					StringBuffer errMesg = new StringBuffer(CCorePlugin.getResourceString("CoreModel.PathEntry.DuplicateEntry")); //$NON-NLS-1$
   342 				}
   340 					return new CModelStatus(ICModelStatusConstants.INVALID_PATHENTRY, errMesg.toString());
   343 				for (IPathEntry otherEntry : entries) {
   341 				}
   344 					if (otherEntry == null) {
   342 				else {
   345 						continue;
   343 					entrySet.add(entry);
   346 					}
   344 				}
   347 					if (entry != otherEntry && otherEntry.equals(entry)) {
   345 			}
   348 						StringBuffer errMesg = new StringBuffer(CCorePlugin.getResourceString("CoreModel.PathEntry.DuplicateEntry")); //$NON-NLS-1$
   346 		}
   349 						return new CModelStatus(ICModelStatusConstants.INVALID_PATHENTRY, errMesg.toString());
   347 		
   350 					}
       
   351 				}
       
   352 			}
       
   353 		} // remove
       
   354 
       
   355 		// check duplication of sources
   348 		// check duplication of sources
   356 		List<IPathEntry> dups = checkForDuplication(Arrays.asList(entries), IPathEntry.CDT_SOURCE);
   349 		List<IPathEntry> dups = checkForDuplication(Arrays.asList(entries), IPathEntry.CDT_SOURCE);
   357 		if (dups.size() > 0) {
   350 		if (dups.size() > 0) {
   358 			ICModelStatus[] cmodelStatus = new ICModelStatus[dups.size()];
   351 			ICModelStatus[] cmodelStatus = new ICModelStatus[dups.size()];
   359 			for (int i = 0; i < dups.size(); ++i) {
   352 			for (int i = 0; i < dups.size(); ++i) {