1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-13 12:05:21 +02:00

Bug 398550. An attempt to make

MBSLanguageSettingsProvider.getSettingEntries method faster.
This commit is contained in:
Sergey Prigogin 2013-01-18 15:18:50 -08:00
parent ede6b65479
commit e52c23235a

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009, 2011 Andrew Gvozdev and others. * Copyright (c) 2009, 2013 Andrew Gvozdev and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,7 +12,9 @@
package org.eclipse.cdt.managedbuilder.internal.language.settings.providers; package org.eclipse.cdt.managedbuilder.internal.language.settings.providers;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import org.eclipse.cdt.core.AbstractExecutableExtensionBase; import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
@ -59,7 +61,7 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
languageSettings = getLanguageSettings(rcDescription); languageSettings = getLanguageSettings(rcDescription);
} }
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>(); Set<ICLanguageSettingEntry> set = new LinkedHashSet<ICLanguageSettingEntry>();
if (languageSettings != null) { if (languageSettings != null) {
for (ICLanguageSetting langSetting : languageSettings) { for (ICLanguageSetting langSetting : languageSettings) {
@ -86,8 +88,8 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager(); IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager();
String projectRootedPath = mngr.generateVariableExpression("workspace_loc", rc.getProject().getName()) + Path.SEPARATOR + pathStr; //$NON-NLS-1$ String projectRootedPath = mngr.generateVariableExpression("workspace_loc", rc.getProject().getName()) + Path.SEPARATOR + pathStr; //$NON-NLS-1$
ICLanguageSettingEntry projectRootedEntry = (ICLanguageSettingEntry) CDataUtil.createEntry(kind, projectRootedPath, projectRootedPath, null, entry.getFlags()); ICLanguageSettingEntry projectRootedEntry = (ICLanguageSettingEntry) CDataUtil.createEntry(kind, projectRootedPath, projectRootedPath, null, entry.getFlags());
if (! list.contains(projectRootedEntry)) { if (!set.contains(projectRootedEntry)) {
list.add(projectRootedEntry); set.add(projectRootedEntry);
} }
} }
} catch (CdtVariableException e) { } catch (CdtVariableException e) {
@ -97,8 +99,8 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
} }
} }
if (! list.contains(entry)) { if (!set.contains(entry)) {
list.add(entry); set.add(entry);
} }
} }
} }
@ -107,7 +109,7 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
} }
} }
} }
return LanguageSettingsStorage.getPooledList(list); return LanguageSettingsStorage.getPooledList(new ArrayList<ICLanguageSettingEntry>(set));
} }
/** /**