mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
clean up warnings
This commit is contained in:
parent
9f5355c7f6
commit
183e8317a8
17 changed files with 166 additions and 162 deletions
|
@ -63,7 +63,7 @@ public class LanguageManager {
|
||||||
|
|
||||||
private static LanguageManager instance;
|
private static LanguageManager instance;
|
||||||
private Map fLanguageCache = new HashMap();
|
private Map fLanguageCache = new HashMap();
|
||||||
private Map fPDOMLinkageFactoryCache= new HashMap();
|
private Map<String, IPDOMLinkageFactory> fPDOMLinkageFactoryCache= new HashMap<String, IPDOMLinkageFactory>();
|
||||||
private Map fContentTypeToLanguageCache= new HashMap();
|
private Map fContentTypeToLanguageCache= new HashMap();
|
||||||
private Map fLanguageConfigurationCache = new HashMap();
|
private Map fLanguageConfigurationCache = new HashMap();
|
||||||
private boolean fIsFullyCached;
|
private boolean fIsFullyCached;
|
||||||
|
@ -300,7 +300,7 @@ public class LanguageManager {
|
||||||
* @return a map.
|
* @return a map.
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public Map getPDOMLinkageFactoryMappings() {
|
public Map<String, IPDOMLinkageFactory> getPDOMLinkageFactoryMappings() {
|
||||||
if (!fPDOMLinkageFactoryCache.isEmpty())
|
if (!fPDOMLinkageFactoryCache.isEmpty())
|
||||||
return Collections.unmodifiableMap(fPDOMLinkageFactoryCache);
|
return Collections.unmodifiableMap(fPDOMLinkageFactoryCache);
|
||||||
|
|
||||||
|
|
|
@ -24,33 +24,32 @@ import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An IExportProjectProvider suitable for subclassing. It provides convenience methods
|
* An IExportProjectProvider implementation intended to be sub-classed by clients. It
|
||||||
* for obtaining options and their parameters from the command-line.
|
* provides convenience methods for obtaining options and their parameters from the
|
||||||
|
* command-line.
|
||||||
*
|
*
|
||||||
* @see ExternalExportProjectProvider for usage scenarios
|
* @see ExternalExportProjectProvider for usage scenarios
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractExportProjectProvider implements IExportProjectProvider {
|
public abstract class AbstractExportProjectProvider implements IExportProjectProvider {
|
||||||
public static final IProgressMonitor NPM= new NullProgressMonitor();
|
public static final IProgressMonitor NPM= new NullProgressMonitor();
|
||||||
|
|
||||||
private Map arguments;
|
private Map<String, List<String>> arguments;
|
||||||
private String[] appArguments;
|
private String[] appArguments;
|
||||||
|
|
||||||
public AbstractExportProjectProvider() {}
|
public AbstractExportProjectProvider() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @return the application arguments
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
protected String[] getApplicationArguments() {
|
protected String[] getApplicationArguments() {
|
||||||
return (String[]) appArguments.clone();
|
return appArguments.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.index.export.IExportProjectProvider#setApplicationArguments(java.lang.String[])
|
* @see org.eclipse.cdt.core.index.export.IExportProjectProvider#setApplicationArguments(java.lang.String[])
|
||||||
*/
|
*/
|
||||||
public void setApplicationArguments(String[] arguments) {
|
public void setApplicationArguments(String[] arguments) {
|
||||||
this.appArguments= (String[]) arguments.clone();
|
this.appArguments= arguments.clone();
|
||||||
this.arguments= Collections.unmodifiableMap(CLIUtil.parseToMap(arguments));
|
this.arguments= Collections.unmodifiableMap(CLIUtil.parseToMap(arguments));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ public abstract class AbstractExportProjectProvider implements IExportProjectPro
|
||||||
* the mapping option=>[p1,p2,p3] will be present in the map
|
* the mapping option=>[p1,p2,p3] will be present in the map
|
||||||
* @return a mapping from string option to parameter string list
|
* @return a mapping from string option to parameter string list
|
||||||
*/
|
*/
|
||||||
protected Map getParsedArgs() {
|
protected Map<String,List<String>> getParsedArgs() {
|
||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,17 +73,16 @@ public abstract class AbstractExportProjectProvider implements IExportProjectPro
|
||||||
* not be present, or if it does not have exactly one parameter
|
* not be present, or if it does not have exactly one parameter
|
||||||
*/
|
*/
|
||||||
public String getSingleString(String option) throws CoreException {
|
public String getSingleString(String option) throws CoreException {
|
||||||
return (String) CLIUtil.getArg(arguments, option, 1).get(0);
|
return CLIUtil.getArg(arguments, option, 1).get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param option
|
* @param option
|
||||||
* @return
|
* @return the list of parameters given with this option
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public List getParameters(String option) {
|
public List<String> getParameters(String option) {
|
||||||
return (List) arguments.get(option);
|
return arguments.get(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,7 +103,7 @@ public abstract class AbstractExportProjectProvider implements IExportProjectPro
|
||||||
* @return
|
* @return
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public List getParameters(String option, int expected) throws CoreException {
|
public List<String> getParameters(String option, int expected) throws CoreException {
|
||||||
return CLIUtil.getArg(arguments, option, expected);
|
return CLIUtil.getArg(arguments, option, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -82,7 +81,7 @@ public class ExternalExportProjectProvider extends AbstractExportProjectProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
// -include
|
// -include
|
||||||
List includeFiles= new ArrayList();
|
List<String> includeFiles= new ArrayList<String>();
|
||||||
if(isPresent(OPT_INCLUDE)) {
|
if(isPresent(OPT_INCLUDE)) {
|
||||||
includeFiles.addAll(getParameters(OPT_INCLUDE));
|
includeFiles.addAll(getParameters(OPT_INCLUDE));
|
||||||
}
|
}
|
||||||
|
@ -112,7 +111,7 @@ public class ExternalExportProjectProvider extends AbstractExportProjectProvider
|
||||||
private ICProject createCCProject(
|
private ICProject createCCProject(
|
||||||
final String projectName,
|
final String projectName,
|
||||||
final File location,
|
final File location,
|
||||||
final List includeFiles
|
final List<String> includeFiles
|
||||||
) throws CoreException {
|
) throws CoreException {
|
||||||
final IWorkspace ws = ResourcesPlugin.getWorkspace();
|
final IWorkspace ws = ResourcesPlugin.getWorkspace();
|
||||||
final ICProject newProject[] = new ICProject[1];
|
final ICProject newProject[] = new ICProject[1];
|
||||||
|
@ -136,11 +135,10 @@ public class ExternalExportProjectProvider extends AbstractExportProjectProvider
|
||||||
content.createLink(new Path(location.getAbsolutePath()), IResource.NONE, null);
|
content.createLink(new Path(location.getAbsolutePath()), IResource.NONE, null);
|
||||||
|
|
||||||
// Setup path entries
|
// Setup path entries
|
||||||
List entries= new ArrayList(Arrays.asList(CoreModel.getRawPathEntries(cproject)));
|
List<IPathEntry> entries= new ArrayList<IPathEntry>(Arrays.asList(CoreModel.getRawPathEntries(cproject)));
|
||||||
|
|
||||||
// pre-include files
|
// pre-include files
|
||||||
for(Iterator j= includeFiles.iterator(); j.hasNext(); ) {
|
for(String path : includeFiles) {
|
||||||
String path= (String) j.next();
|
|
||||||
entries.add(CoreModel.newIncludeFileEntry(project.getFullPath(), new Path(path)));
|
entries.add(CoreModel.newIncludeFileEntry(project.getFullPath(), new Path(path)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +148,7 @@ public class ExternalExportProjectProvider extends AbstractExportProjectProvider
|
||||||
// any additional entries
|
// any additional entries
|
||||||
entries.addAll(getAdditionalRawEntries());
|
entries.addAll(getAdditionalRawEntries());
|
||||||
|
|
||||||
cproject.setRawPathEntries((IPathEntry[]) entries.toArray(new IPathEntry[entries.size()]),
|
cproject.setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]),
|
||||||
new NullProgressMonitor()
|
new NullProgressMonitor()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -168,8 +166,8 @@ public class ExternalExportProjectProvider extends AbstractExportProjectProvider
|
||||||
* Get additional raw entries (above those added as part of the ExternalExportProjectProvider functionality)
|
* Get additional raw entries (above those added as part of the ExternalExportProjectProvider functionality)
|
||||||
* @return a list of additional entries to add to the project
|
* @return a list of additional entries to add to the project
|
||||||
*/
|
*/
|
||||||
protected List getAdditionalRawEntries() {
|
protected List<IPathEntry> getAdditionalRawEntries() {
|
||||||
List entries= new ArrayList();
|
List<IPathEntry> entries= new ArrayList<IPathEntry>();
|
||||||
entries.add(CoreModel.newIncludeEntry(content.getProjectRelativePath(), null, content.getLocation(), true));
|
entries.add(CoreModel.newIncludeEntry(content.getProjectRelativePath(), null, content.getLocation(), true));
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +179,6 @@ public class ExternalExportProjectProvider extends AbstractExportProjectProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.index.export.IExportProjectProvider#getLocationConverter(org.eclipse.cdt.core.model.ICProject)
|
* @see org.eclipse.cdt.core.index.export.IExportProjectProvider#getLocationConverter(org.eclipse.cdt.core.model.ICProject)
|
||||||
*/
|
*/
|
||||||
public IIndexLocationConverter getLocationConverter(final ICProject cproject) {
|
public IIndexLocationConverter getLocationConverter(final ICProject cproject) {
|
||||||
|
@ -189,11 +186,10 @@ public class ExternalExportProjectProvider extends AbstractExportProjectProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.index.export.IExportProjectProvider#getExportProperties()
|
* @see org.eclipse.cdt.core.index.export.IExportProjectProvider#getExportProperties()
|
||||||
*/
|
*/
|
||||||
public Map getExportProperties() {
|
public Map<String,String> getExportProperties() {
|
||||||
Map properties= new HashMap();
|
Map<String,String> properties= new HashMap<String,String>();
|
||||||
Date now= Calendar.getInstance().getTime();
|
Date now= Calendar.getInstance().getTime();
|
||||||
properties.put(ORG_ECLIPSE_CDT_CORE_INDEX_EXPORT_DATESTAMP,
|
properties.put(ORG_ECLIPSE_CDT_CORE_INDEX_EXPORT_DATESTAMP,
|
||||||
DateFormat.getDateInstance().format(now)
|
DateFormat.getDateInstance().format(now)
|
||||||
|
|
|
@ -13,8 +13,11 @@ package org.eclipse.cdt.core.index.export;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.index.IIndexLocationConverter;
|
import org.eclipse.cdt.core.index.IIndexLocationConverter;
|
||||||
|
import org.eclipse.cdt.core.index.ResourceContainerRelativeLocationConverter;
|
||||||
|
import org.eclipse.cdt.core.index.URIRelativeLocationConverter;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An IExportProjectProvider provides a configured ICProject suitable set up for
|
* An IExportProjectProvider provides a configured ICProject suitable set up for
|
||||||
|
@ -62,5 +65,5 @@ public interface IExportProjectProvider {
|
||||||
* @return a Map of String typed key value pairs representing ISV specific properties. This
|
* @return a Map of String typed key value pairs representing ISV specific properties. This
|
||||||
* may return null.
|
* may return null.
|
||||||
*/
|
*/
|
||||||
public Map/*<String,String>*/ getExportProperties();
|
public Map<String,String> getExportProperties();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,16 +20,13 @@ import org.eclipse.cdt.internal.core.parser.token.KeywordSets;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ParserFactory {
|
public class ParserFactory {
|
||||||
|
private static IParserLogService defaultLogService = new DefaultLogService();
|
||||||
public static IParserLogService createDefaultLogService()
|
|
||||||
{
|
public static IParserLogService createDefaultLogService() {
|
||||||
return defaultLogService;
|
return defaultLogService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set getKeywordSet( KeywordSetKey key, ParserLanguage language )
|
public static Set<String> getKeywordSet(KeywordSetKey key, ParserLanguage language) {
|
||||||
{
|
|
||||||
return KeywordSets.getKeywords( key, language );
|
return KeywordSets.getKeywords( key, language );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IParserLogService defaultLogService = new DefaultLogService();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 QNX Software Systems and others.
|
* Copyright (c) 2007, 2008 QNX Software Systems 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
|
||||||
|
@ -47,6 +47,7 @@ public class CPPTypedefClone implements ITypedef, ITypeContainer, IIndexType, IC
|
||||||
public IScope getScope() throws DOMException {
|
public IScope getScope() throws DOMException {
|
||||||
return delegate.getScope();
|
return delegate.getScope();
|
||||||
}
|
}
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public Object getAdapter(Class adapter) {
|
public Object getAdapter(Class adapter) {
|
||||||
return delegate.getAdapter(adapter);
|
return delegate.getAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2008 Wind River Systems, Inc. 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
|
||||||
|
@ -16,7 +16,6 @@ import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -57,12 +56,11 @@ public class IndexFactory {
|
||||||
boolean addDependent= (options & ADD_DEPENDENT) != 0;
|
boolean addDependent= (options & ADD_DEPENDENT) != 0;
|
||||||
boolean skipProvided= (options & SKIP_PROVIDED) != 0;
|
boolean skipProvided= (options & SKIP_PROVIDED) != 0;
|
||||||
|
|
||||||
HashMap map= new HashMap();
|
HashMap<IProject, Integer> map= new HashMap<IProject, Integer>();
|
||||||
Collection selectedProjects= getProjects(projects, addDependencies, addDependent, map, new Integer(1));
|
Collection<ICProject> selectedProjects= getProjects(projects, addDependencies, addDependent, map, new Integer(1));
|
||||||
|
|
||||||
HashMap fragments= new LinkedHashMap();
|
HashMap<String, IIndexFragment> fragments= new LinkedHashMap<String, IIndexFragment>();
|
||||||
for (Iterator iter = selectedProjects.iterator(); iter.hasNext(); ) {
|
for(ICProject cproject : selectedProjects) {
|
||||||
ICProject cproject = (ICProject) iter.next();
|
|
||||||
IIndexFragment pdom= fPDOMManager.getPDOM(cproject);
|
IIndexFragment pdom= fPDOMManager.getPDOM(cproject);
|
||||||
if (pdom != null) {
|
if (pdom != null) {
|
||||||
safeAddFragment(fragments, pdom);
|
safeAddFragment(fragments, pdom);
|
||||||
|
@ -79,12 +77,11 @@ public class IndexFactory {
|
||||||
int primaryFragmentCount= fragments.size();
|
int primaryFragmentCount= fragments.size();
|
||||||
|
|
||||||
if (!addDependencies) {
|
if (!addDependencies) {
|
||||||
projects= (ICProject[]) selectedProjects.toArray(new ICProject[selectedProjects.size()]);
|
projects= selectedProjects.toArray(new ICProject[selectedProjects.size()]);
|
||||||
selectedProjects.clear();
|
selectedProjects.clear();
|
||||||
// don't clear the map, so projects are not selected again
|
// don't clear the map, so projects are not selected again
|
||||||
selectedProjects= getProjects(projects, true, false, map, new Integer(2));
|
selectedProjects= getProjects(projects, true, false, map, new Integer(2));
|
||||||
for (Iterator iter = selectedProjects.iterator(); iter.hasNext(); ) {
|
for(ICProject cproject : selectedProjects) {
|
||||||
ICProject cproject = (ICProject) iter.next();
|
|
||||||
IIndexFragment pdom= fPDOMManager.getPDOM(cproject);
|
IIndexFragment pdom= fPDOMManager.getPDOM(cproject);
|
||||||
safeAddFragment(fragments, pdom);
|
safeAddFragment(fragments, pdom);
|
||||||
|
|
||||||
|
@ -94,12 +91,12 @@ public class IndexFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection pdoms= fragments.values();
|
Collection<IIndexFragment> pdoms= fragments.values();
|
||||||
return new CIndex((IIndexFragment[]) pdoms.toArray(new IIndexFragment[pdoms.size()]), primaryFragmentCount);
|
return new CIndex(pdoms.toArray(new IIndexFragment[pdoms.size()]), primaryFragmentCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IWritableIndex getWritableIndex(ICProject project) throws CoreException {
|
public IWritableIndex getWritableIndex(ICProject project) throws CoreException {
|
||||||
Map readOnlyFrag= new LinkedHashMap();
|
Map<String, IIndexFragment> readOnlyFrag= new LinkedHashMap<String, IIndexFragment>();
|
||||||
IWritableIndexFragment pdom= (IWritableIndexFragment) fPDOMManager.getPDOM(project);
|
IWritableIndexFragment pdom= (IWritableIndexFragment) fPDOMManager.getPDOM(project);
|
||||||
if (pdom == null) {
|
if (pdom == null) {
|
||||||
throw new CoreException(CCorePlugin.createStatus(
|
throw new CoreException(CCorePlugin.createStatus(
|
||||||
|
@ -107,23 +104,21 @@ public class IndexFactory {
|
||||||
}
|
}
|
||||||
safeAddProvidedFragments(project, readOnlyFrag);
|
safeAddProvidedFragments(project, readOnlyFrag);
|
||||||
|
|
||||||
Collection selectedProjects= getProjects(new ICProject[] {project}, true, false, new HashMap(), new Integer(1));
|
Collection<ICProject> selectedProjects= getProjects(new ICProject[] {project}, true, false, new HashMap<IProject, Integer>(), new Integer(1));
|
||||||
selectedProjects.remove(project);
|
selectedProjects.remove(project);
|
||||||
|
|
||||||
for (Iterator iter = selectedProjects.iterator(); iter.hasNext(); ) {
|
for(ICProject cproject : selectedProjects) {
|
||||||
ICProject cproject = (ICProject) iter.next();
|
|
||||||
safeAddFragment(readOnlyFrag, fPDOMManager.getPDOM(cproject));
|
safeAddFragment(readOnlyFrag, fPDOMManager.getPDOM(cproject));
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection roPdoms= readOnlyFrag.values();
|
Collection<IIndexFragment> roPdoms= readOnlyFrag.values();
|
||||||
return new WritableCIndex(pdom, (IIndexFragment[]) roPdoms.toArray(new IIndexFragment[roPdoms.size()]) );
|
return new WritableCIndex(pdom, roPdoms.toArray(new IIndexFragment[roPdoms.size()]) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection getProjects(ICProject[] projects, boolean addDependencies, boolean addDependent, HashMap map, Integer markWith) {
|
private Collection<ICProject> getProjects(ICProject[] projects, boolean addDependencies, boolean addDependent, HashMap<IProject, Integer> map, Integer markWith) {
|
||||||
List projectsToSearch= new ArrayList();
|
List<IProject> projectsToSearch= new ArrayList<IProject>();
|
||||||
|
|
||||||
for (int i = 0; i < projects.length; i++) {
|
for(ICProject cproject : projects) {
|
||||||
ICProject cproject = projects[i];
|
|
||||||
IProject project= cproject.getProject();
|
IProject project= cproject.getProject();
|
||||||
checkAddProject(project, map, projectsToSearch, markWith);
|
checkAddProject(project, map, projectsToSearch, markWith);
|
||||||
projectsToSearch.add(project);
|
projectsToSearch.add(project);
|
||||||
|
@ -131,7 +126,7 @@ public class IndexFactory {
|
||||||
|
|
||||||
if (addDependencies || addDependent) {
|
if (addDependencies || addDependent) {
|
||||||
for (int i=0; i<projectsToSearch.size(); i++) {
|
for (int i=0; i<projectsToSearch.size(); i++) {
|
||||||
IProject project= (IProject) projectsToSearch.get(i);
|
IProject project= projectsToSearch.get(i);
|
||||||
IProject[] nextLevel;
|
IProject[] nextLevel;
|
||||||
try {
|
try {
|
||||||
if (addDependencies) {
|
if (addDependencies) {
|
||||||
|
@ -154,11 +149,10 @@ public class IndexFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreModel cm= CoreModel.getDefault();
|
CoreModel cm= CoreModel.getDefault();
|
||||||
Collection result= new ArrayList();
|
Collection<ICProject> result= new ArrayList<ICProject>();
|
||||||
for (Iterator iter= map.entrySet().iterator(); iter.hasNext(); ) {
|
for(Map.Entry<IProject, Integer> entry : map.entrySet()) {
|
||||||
Map.Entry entry= (Map.Entry) iter.next();
|
|
||||||
if (entry.getValue() == markWith) {
|
if (entry.getValue() == markWith) {
|
||||||
ICProject cproject= cm.create((IProject) entry.getKey());
|
ICProject cproject= cm.create(entry.getKey());
|
||||||
if (cproject != null) {
|
if (cproject != null) {
|
||||||
result.add(cproject);
|
result.add(cproject);
|
||||||
}
|
}
|
||||||
|
@ -167,7 +161,7 @@ public class IndexFactory {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkAddProject(IProject project, HashMap map, List projectsToSearch, Integer markWith) {
|
private void checkAddProject(IProject project, HashMap<IProject, Integer> map, List<IProject> projectsToSearch, Integer markWith) {
|
||||||
if (map.get(project) == null) {
|
if (map.get(project) == null) {
|
||||||
if (project.isOpen()) {
|
if (project.isOpen()) {
|
||||||
map.put(project, markWith);
|
map.put(project, markWith);
|
||||||
|
@ -185,7 +179,7 @@ public class IndexFactory {
|
||||||
* @param id2fragment the map to add the entry to
|
* @param id2fragment the map to add the entry to
|
||||||
* @param fragment the fragment or null (which will result in no action)
|
* @param fragment the fragment or null (which will result in no action)
|
||||||
*/
|
*/
|
||||||
private void safeAddFragment(Map id2fragment, IIndexFragment fragment) {
|
private void safeAddFragment(Map<String, IIndexFragment> id2fragment, IIndexFragment fragment) {
|
||||||
if(fragment!=null) {
|
if(fragment!=null) {
|
||||||
try {
|
try {
|
||||||
fragment.acquireReadLock();
|
fragment.acquireReadLock();
|
||||||
|
@ -210,7 +204,7 @@ public class IndexFactory {
|
||||||
* @param cproject
|
* @param cproject
|
||||||
* @param fragments
|
* @param fragments
|
||||||
*/
|
*/
|
||||||
private void safeAddProvidedFragments(ICProject cproject, Map fragments) {
|
private void safeAddProvidedFragments(ICProject cproject, Map<String, IIndexFragment> fragments) {
|
||||||
ICProjectDescription pd= CoreModel.getDefault().getProjectDescription(cproject.getProject(), false);
|
ICProjectDescription pd= CoreModel.getDefault().getProjectDescription(cproject.getProject(), false);
|
||||||
if(pd!=null) {
|
if(pd!=null) {
|
||||||
IndexProviderManager ipm = CCoreInternals.getPDOMManager().getIndexProviderManager();
|
IndexProviderManager ipm = CCoreInternals.getPDOMManager().getIndexProviderManager();
|
||||||
|
@ -218,8 +212,8 @@ public class IndexFactory {
|
||||||
if (cfg != null) {
|
if (cfg != null) {
|
||||||
try {
|
try {
|
||||||
IIndexFragment[] pFragments= ipm.getProvidedIndexFragments(cfg);
|
IIndexFragment[] pFragments= ipm.getProvidedIndexFragments(cfg);
|
||||||
for(int i=0; i<pFragments.length; i++) {
|
for(IIndexFragment fragment : pFragments) {
|
||||||
safeAddFragment(fragments, pFragments[i]);
|
safeAddFragment(fragments, fragment);
|
||||||
}
|
}
|
||||||
} catch(CoreException ce) {
|
} catch(CoreException ce) {
|
||||||
CCorePlugin.log(ce);
|
CCorePlugin.log(ce);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
* Copyright (c) 2007, 2008 Symbian Software Systems 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
|
||||||
|
@ -29,7 +29,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractCompositeFactory implements ICompositesFactory {
|
public abstract class AbstractCompositeFactory implements ICompositesFactory {
|
||||||
protected IIndex index;
|
protected IIndex index;
|
||||||
private Comparator fragmentComparator;
|
private Comparator<IIndexFragmentBinding> fragmentComparator;
|
||||||
|
|
||||||
public AbstractCompositeFactory(IIndex index) {
|
public AbstractCompositeFactory(IIndex index) {
|
||||||
this.index= index;
|
this.index= index;
|
||||||
|
@ -42,7 +42,6 @@ public abstract class AbstractCompositeFactory implements ICompositesFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.index.composite.ICompositesFactory#getCompositeBindings(org.eclipse.cdt.core.index.IIndex, org.eclipse.cdt.internal.core.index.IIndexFragmentBinding[])
|
* @see org.eclipse.cdt.internal.core.index.composite.ICompositesFactory#getCompositeBindings(org.eclipse.cdt.core.index.IIndex, org.eclipse.cdt.internal.core.index.IIndexFragmentBinding[])
|
||||||
*/
|
*/
|
||||||
public final IIndexBinding[] getCompositeBindings(IIndexFragmentBinding[] bindings) {
|
public final IIndexBinding[] getCompositeBindings(IIndexFragmentBinding[] bindings) {
|
||||||
|
@ -52,7 +51,7 @@ public abstract class AbstractCompositeFactory implements ICompositesFactory {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see org.eclipse.cdt.internal.core.index.composite.cpp.ICompositesFactory#getComposites(org.eclipse.cdt.core.index.IIndex, org.eclipse.cdt.internal.core.index.IIndexFragmentBinding[][])
|
* @see org.eclipse.cdt.internal.core.index.composite.cpp.ICompositesFactory#getComposites(org.eclipse.cdt.core.index.IIndex, org.eclipse.cdt.internal.core.index.IIndexFragmentBinding[][])
|
||||||
*/
|
*/
|
||||||
public final IIndexBinding[] getCompositeBindings(IIndexFragmentBinding[][] fragmentBindings) {
|
public final IIndexBinding[] getCompositeBindings(IIndexFragmentBinding[][] fragmentBindings) {
|
||||||
|
@ -66,11 +65,11 @@ public abstract class AbstractCompositeFactory implements ICompositesFactory {
|
||||||
* @return an array of unique bindings
|
* @return an array of unique bindings
|
||||||
*/
|
*/
|
||||||
protected IIndexFragmentBinding[] mergeBindingArrays(IIndexFragmentBinding[][] fragmentBindings) {
|
protected IIndexFragmentBinding[] mergeBindingArrays(IIndexFragmentBinding[][] fragmentBindings) {
|
||||||
TreeSet ts = new TreeSet(fragmentComparator);
|
TreeSet<IIndexFragmentBinding> ts = new TreeSet<IIndexFragmentBinding>(fragmentComparator);
|
||||||
for(int i=0; i<fragmentBindings.length; i++)
|
for(int i=0; i<fragmentBindings.length; i++)
|
||||||
for(int j=0; j<fragmentBindings[i].length; j++)
|
for(int j=0; j<fragmentBindings[i].length; j++)
|
||||||
ts.add(fragmentBindings[i][j]);
|
ts.add(fragmentBindings[i][j]);
|
||||||
return (IIndexFragmentBinding[]) ts.toArray(new IIndexFragmentBinding[ts.size()]);
|
return ts.toArray(new IIndexFragmentBinding[ts.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,23 +97,18 @@ public abstract class AbstractCompositeFactory implements ICompositesFactory {
|
||||||
throw new CompositingNotImplementedError();
|
throw new CompositingNotImplementedError();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class FragmentBindingComparator implements Comparator {
|
private static class FragmentBindingComparator implements Comparator<IIndexFragmentBinding> {
|
||||||
private IIndexFragmentBindingComparator[] comparators;
|
private IIndexFragmentBindingComparator[] comparators;
|
||||||
|
|
||||||
FragmentBindingComparator(IIndexFragmentBindingComparator[] comparators) {
|
FragmentBindingComparator(IIndexFragmentBindingComparator[] comparators) {
|
||||||
this.comparators= comparators;
|
this.comparators= comparators;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compare(Object o1, Object o2) {
|
public int compare(IIndexFragmentBinding f1, IIndexFragmentBinding f2) {
|
||||||
if(o1 instanceof IIndexFragmentBinding && o2 instanceof IIndexFragmentBinding) {
|
for(int i=0; i<comparators.length; i++) {
|
||||||
IIndexFragmentBinding f1= (IIndexFragmentBinding) o1;
|
int cmp= comparators[i].compare(f1, f2);
|
||||||
IIndexFragmentBinding f2= (IIndexFragmentBinding) o2;
|
if(cmp!=Integer.MIN_VALUE) {
|
||||||
|
return cmp;
|
||||||
for(int i=0; i<comparators.length; i++) {
|
|
||||||
int cmp= comparators[i].compare(f1, f2);
|
|
||||||
if(cmp!=Integer.MIN_VALUE) {
|
|
||||||
return cmp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
|
|
|
@ -18,7 +18,6 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||||
import org.eclipse.cdt.core.index.IIndexFile;
|
import org.eclipse.cdt.core.index.IIndexFile;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexScope;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,7 +72,7 @@ public abstract class CompositeIndexBinding implements IIndexBinding {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IScope getScope() throws DOMException {
|
public IScope getScope() throws DOMException {
|
||||||
return cf.getCompositeScope((IIndexScope)rbinding.getScope());
|
return cf.getCompositeScope(rbinding.getScope());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasDefinition() throws CoreException {
|
public boolean hasDefinition() throws CoreException {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
* Copyright (c) 2007, 2008 Symbian Software Systems 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
|
||||||
|
@ -67,8 +67,8 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
private static final String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$
|
private static final String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$
|
||||||
|
|
||||||
private IIndexFragmentProvider[] allProviders;
|
private IIndexFragmentProvider[] allProviders;
|
||||||
private Map/*<List,Boolean>*/ provisionMap;
|
private Map<ProvisionMapKey,Boolean> provisionMap;
|
||||||
private Set/*<String>*/ compatibleFragmentUnavailable;
|
private Set<String> compatibleFragmentUnavailable;
|
||||||
private VersionRange pdomVersionRange;
|
private VersionRange pdomVersionRange;
|
||||||
|
|
||||||
public IndexProviderManager() {
|
public IndexProviderManager() {
|
||||||
|
@ -88,13 +88,13 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
*/
|
*/
|
||||||
public void reset(VersionRange pdomVersionRange) {
|
public void reset(VersionRange pdomVersionRange) {
|
||||||
this.allProviders= new IIndexFragmentProvider[0];
|
this.allProviders= new IIndexFragmentProvider[0];
|
||||||
this.provisionMap= new HashMap();
|
this.provisionMap= new HashMap<ProvisionMapKey,Boolean>();
|
||||||
this.pdomVersionRange= pdomVersionRange;
|
this.pdomVersionRange= pdomVersionRange;
|
||||||
this.compatibleFragmentUnavailable= new HashSet();
|
this.compatibleFragmentUnavailable= new HashSet<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startup() {
|
public void startup() {
|
||||||
List providers = new ArrayList();
|
List<IIndexProvider> providers = new ArrayList<IIndexProvider>();
|
||||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||||
IExtensionPoint indexProviders = registry.getExtensionPoint(CCorePlugin.INDEX_UNIQ_ID);
|
IExtensionPoint indexProviders = registry.getExtensionPoint(CCorePlugin.INDEX_UNIQ_ID);
|
||||||
IExtension[] extensions = indexProviders.getExtensions();
|
IExtension[] extensions = indexProviders.getExtensions();
|
||||||
|
@ -123,7 +123,7 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreModel.getDefault().addElementChangedListener(this);
|
CoreModel.getDefault().addElementChangedListener(this);
|
||||||
this.allProviders = (IIndexFragmentProvider[]) providers.toArray(new IIndexFragmentProvider[providers.size()]);
|
this.allProviders = providers.toArray(new IIndexFragmentProvider[providers.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,7 +135,7 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
* @return the array of IIndexFragment objects for the current state
|
* @return the array of IIndexFragment objects for the current state
|
||||||
*/
|
*/
|
||||||
public IIndexFragment[] getProvidedIndexFragments(ICConfigurationDescription config) throws CoreException {
|
public IIndexFragment[] getProvidedIndexFragments(ICConfigurationDescription config) throws CoreException {
|
||||||
Map id2fragment = new HashMap();
|
Map<String, IIndexFragment> id2fragment = new HashMap<String, IIndexFragment>();
|
||||||
|
|
||||||
IProject project= config.getProjectDescription().getProject();
|
IProject project= config.getProjectDescription().getProject();
|
||||||
for(int i=0; i<allProviders.length; i++) {
|
for(int i=0; i<allProviders.length; i++) {
|
||||||
|
@ -158,11 +158,10 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make log entries for any fragments which have no compatible equivalents
|
// Make log entries for any fragments which have no compatible equivalents
|
||||||
List preresult= new ArrayList();
|
List<IIndexFragment> preresult= new ArrayList<IIndexFragment>();
|
||||||
for(Iterator i=id2fragment.entrySet().iterator(); i.hasNext(); ) {
|
for(Map.Entry<String, IIndexFragment> entry : id2fragment.entrySet()) {
|
||||||
Map.Entry entry= (Map.Entry) i.next();
|
|
||||||
if(entry.getValue()==null) {
|
if(entry.getValue()==null) {
|
||||||
String key= (String) entry.getKey();
|
String key= entry.getKey();
|
||||||
if(!compatibleFragmentUnavailable.contains(key)) {
|
if(!compatibleFragmentUnavailable.contains(key)) {
|
||||||
String msg= MessageFormat.format(
|
String msg= MessageFormat.format(
|
||||||
Messages.IndexProviderManager_NoCompatibleFragmentsAvailable,
|
Messages.IndexProviderManager_NoCompatibleFragmentsAvailable,
|
||||||
|
@ -176,7 +175,7 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
preresult.add(entry.getValue());
|
preresult.add(entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (IIndexFragment[]) preresult.toArray(new IIndexFragment[preresult.size()]);
|
return preresult.toArray(new IIndexFragment[preresult.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -201,7 +200,7 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
* @param id2fragment
|
* @param id2fragment
|
||||||
* @param candidate
|
* @param candidate
|
||||||
*/
|
*/
|
||||||
private void processCandidate(Map id2fragment, IIndexFragment candidate) throws InterruptedException, CoreException {
|
private void processCandidate(Map<String, IIndexFragment> id2fragment, IIndexFragment candidate) throws InterruptedException, CoreException {
|
||||||
String cid= null, csver= null, cformatID= null;
|
String cid= null, csver= null, cformatID= null;
|
||||||
try {
|
try {
|
||||||
candidate.acquireReadLock();
|
candidate.acquireReadLock();
|
||||||
|
@ -214,7 +213,7 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
assert cid!=null && csver!=null && cformatID!=null;
|
assert cid!=null && csver!=null && cformatID!=null;
|
||||||
|
|
||||||
Version cver= Version.parseVersion(csver); // illegal argument exception
|
Version cver= Version.parseVersion(csver); // illegal argument exception
|
||||||
IIndexFragment existing= (IIndexFragment) id2fragment.get(cid);
|
IIndexFragment existing= id2fragment.get(cid);
|
||||||
|
|
||||||
if(getCurrentlySupportedVersionRangeForFormat(cformatID).isIncluded(cver)) {
|
if(getCurrentlySupportedVersionRangeForFormat(cformatID).isIncluded(cver)) {
|
||||||
if(existing != null) {
|
if(existing != null) {
|
||||||
|
@ -284,9 +283,7 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean providesForProject(IIndexProvider provider, IProject project) {
|
private boolean providesForProject(IIndexProvider provider, IProject project) {
|
||||||
List key = new ArrayList();
|
ProvisionMapKey key= new ProvisionMapKey(provider, project);
|
||||||
key.add(provider);
|
|
||||||
key.add(project);
|
|
||||||
|
|
||||||
if(!provisionMap.containsKey(key)) {
|
if(!provisionMap.containsKey(key)) {
|
||||||
try {
|
try {
|
||||||
|
@ -298,7 +295,7 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((Boolean) provisionMap.get(key)).booleanValue();
|
return provisionMap.get(key).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void elementChanged(ElementChangedEvent event) {
|
public void elementChanged(ElementChangedEvent event) {
|
||||||
|
@ -324,18 +321,46 @@ public final class IndexProviderManager implements IElementChangedListener {
|
||||||
final ICProject cproject = (ICProject)delta.getElement();
|
final ICProject cproject = (ICProject)delta.getElement();
|
||||||
switch (delta.getKind()) {
|
switch (delta.getKind()) {
|
||||||
case ICElementDelta.REMOVED:
|
case ICElementDelta.REMOVED:
|
||||||
List toRemove = new ArrayList();
|
List<ProvisionMapKey> toRemove = new ArrayList<ProvisionMapKey>();
|
||||||
for(Iterator i = provisionMap.keySet().iterator(); i.hasNext(); ) {
|
for(Iterator<ProvisionMapKey> i = provisionMap.keySet().iterator(); i.hasNext(); ) {
|
||||||
List key = (List) i.next();
|
ProvisionMapKey key = i.next();
|
||||||
if(key.contains(cproject.getProject())) {
|
if(key.getProject().equals(cproject.getProject())) {
|
||||||
toRemove.add(key);
|
toRemove.add(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(Iterator i = toRemove.iterator(); i.hasNext(); ) {
|
for(ProvisionMapKey key : toRemove) {
|
||||||
provisionMap.remove(i.next());
|
provisionMap.remove(key);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class ProvisionMapKey {
|
||||||
|
private final IIndexProvider provider;
|
||||||
|
private final IProject project;
|
||||||
|
|
||||||
|
ProvisionMapKey(IIndexProvider provider, IProject project) {
|
||||||
|
this.provider= provider;
|
||||||
|
this.project= project;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if(obj instanceof ProvisionMapKey) {
|
||||||
|
ProvisionMapKey other= (ProvisionMapKey) obj;
|
||||||
|
return other.project.equals(project) && other.provider.equals(provider);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return project.hashCode() ^ provider.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IProject getProject() {
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
* Copyright (c) 2007, 2008 Symbian Software Systems 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
|
||||||
|
@ -26,13 +26,13 @@ import org.eclipse.core.runtime.IPath;
|
||||||
* Internal singleton map maintained for non-project PDOM objects
|
* Internal singleton map maintained for non-project PDOM objects
|
||||||
*/
|
*/
|
||||||
class PDOMCache {
|
class PDOMCache {
|
||||||
private Map/*<File, PDOM>*/ path2pdom; // gives the PDOM for a particular path
|
private Map<File, PDOM> path2pdom; // gives the PDOM for a particular path
|
||||||
|
|
||||||
private static PDOMCache singleton;
|
private static PDOMCache singleton;
|
||||||
private static Object singletonMutex = new Object();
|
private static Object singletonMutex = new Object();
|
||||||
|
|
||||||
private PDOMCache() {
|
private PDOMCache() {
|
||||||
this.path2pdom = new HashMap();
|
this.path2pdom = new HashMap<File, PDOM>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,11 +61,11 @@ class PDOMCache {
|
||||||
|
|
||||||
synchronized(path2pdom) {
|
synchronized(path2pdom) {
|
||||||
if(path2pdom.containsKey(file)) {
|
if(path2pdom.containsKey(file)) {
|
||||||
result = (PDOM) path2pdom.get(file);
|
result= path2pdom.get(file);
|
||||||
}
|
}
|
||||||
if(result==null) {
|
if(result==null) {
|
||||||
try {
|
try {
|
||||||
result = new PDOM(file, converter, LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
result= new PDOM(file, converter, LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
||||||
path2pdom.put(file, result);
|
path2pdom.put(file, result);
|
||||||
} catch(CoreException ce) {
|
} catch(CoreException ce) {
|
||||||
CCorePlugin.log(ce);
|
CCorePlugin.log(ce);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
* Copyright (c) 2007, 2008 Symbian Software Systems 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
|
||||||
|
@ -28,24 +28,24 @@ public class ReadOnlyPDOMProviderBridge implements IIndexFragmentProvider {
|
||||||
protected IReadOnlyPDOMProvider opp;
|
protected IReadOnlyPDOMProvider opp;
|
||||||
|
|
||||||
public ReadOnlyPDOMProviderBridge(IReadOnlyPDOMProvider opp) {
|
public ReadOnlyPDOMProviderBridge(IReadOnlyPDOMProvider opp) {
|
||||||
this.opp = opp;
|
this.opp= opp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIndexFragment[] getIndexFragments(ICConfigurationDescription config) throws CoreException {
|
public IIndexFragment[] getIndexFragments(ICConfigurationDescription config) throws CoreException {
|
||||||
IPDOMDescriptor[] descs = opp.getDescriptors(config);
|
IPDOMDescriptor[] descriptions = opp.getDescriptors(config);
|
||||||
|
|
||||||
List preresult = new ArrayList();
|
List<PDOM> result = new ArrayList<PDOM>();
|
||||||
|
|
||||||
if(descs!=null) {
|
if(descriptions!=null) {
|
||||||
for(int i=0; i<descs.length; i++) {
|
for(IPDOMDescriptor dsc : descriptions) {
|
||||||
PDOM pdom= PDOMCache.getInstance().getPDOM(descs[i].getLocation(), descs[i].getIndexLocationConverter());
|
PDOM pdom= PDOMCache.getInstance().getPDOM(dsc.getLocation(), dsc.getIndexLocationConverter());
|
||||||
if(pdom!=null) {
|
if(pdom!=null) {
|
||||||
preresult.add(pdom);
|
result.add(pdom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (IIndexFragment[]) preresult.toArray(new IIndexFragment[preresult.size()]);
|
return result.toArray(new IIndexFragment[result.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean providesFor(ICProject cproject) throws CoreException {
|
public boolean providesFor(ICProject cproject) throws CoreException {
|
||||||
|
|
|
@ -368,7 +368,6 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private Map<String, IPDOMLinkageFactory> getLinkageFactories() {
|
private Map<String, IPDOMLinkageFactory> getLinkageFactories() {
|
||||||
return LanguageManager.getInstance().getPDOMLinkageFactoryMappings();
|
return LanguageManager.getInstance().getPDOMLinkageFactoryMappings();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Symbian Software Systems and others.
|
* Copyright (c) 2007, 2008 Symbian Software Systems 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
|
||||||
|
@ -80,11 +80,11 @@ public class DBProperties {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a Set of property names (Strings) stored in this object
|
* Returns the Set of property names stored in this object
|
||||||
* @return a Set of property names (Strings) stored in this object
|
* @return the Set of property names stored in this object
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public Set getKeySet() throws CoreException {
|
public Set<String> getKeySet() throws CoreException {
|
||||||
return DBProperty.getKeySet(db, index);
|
return DBProperty.getKeySet(db, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,8 +225,8 @@ public class DBProperties {
|
||||||
return result[0];
|
return result[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Set getKeySet(final Database db, final BTree index) throws CoreException {
|
public static Set<String> getKeySet(final Database db, final BTree index) throws CoreException {
|
||||||
final Set result= new HashSet();
|
final Set<String> result= new HashSet<String>();
|
||||||
index.accept(new IBTreeVisitor(){
|
index.accept(new IBTreeVisitor(){
|
||||||
public int compare(int record) throws CoreException {
|
public int compare(int record) throws CoreException {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -36,8 +36,8 @@ public class CLIUtil {
|
||||||
* @return
|
* @return
|
||||||
* @throws CoreException if the number of parameters is not the specified expected number
|
* @throws CoreException if the number of parameters is not the specified expected number
|
||||||
*/
|
*/
|
||||||
public static List getArg(Map arguments, String opt, int number) throws CoreException {
|
public static List<String> getArg(Map<String, List<String>> arguments, String opt, int number) throws CoreException {
|
||||||
List list = (List) arguments.get(opt);
|
List<String> list = arguments.get(opt);
|
||||||
if(list==null || list.size()!=number) {
|
if(list==null || list.size()!=number) {
|
||||||
String msg= MessageFormat.format(Messages.CLIUtil_OptionParametersMismatch, new Object[] {opt, ""+number}); //$NON-NLS-1$
|
String msg= MessageFormat.format(Messages.CLIUtil_OptionParametersMismatch, new Object[] {opt, ""+number}); //$NON-NLS-1$
|
||||||
GeneratePDOMApplication.fail(msg);
|
GeneratePDOMApplication.fail(msg);
|
||||||
|
@ -51,19 +51,19 @@ public class CLIUtil {
|
||||||
* @param args
|
* @param args
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Map/*<String,List<String>>*/ parseToMap(String[] args) {
|
public static Map<String,List<String>> parseToMap(String[] args) {
|
||||||
Map result = new HashMap();
|
Map<String,List<String>> result = new HashMap<String,List<String>>();
|
||||||
String current = null;
|
String current = null;
|
||||||
for(int i=0; i<args.length; i++) {
|
for(int i=0; i<args.length; i++) {
|
||||||
if(args[i].startsWith("-")) { //$NON-NLS-1$
|
if(args[i].startsWith("-")) { //$NON-NLS-1$
|
||||||
current = args[i];
|
current = args[i];
|
||||||
result.put(current, new ArrayList());
|
result.put(current, new ArrayList<String>());
|
||||||
} else {
|
} else {
|
||||||
if(current==null) {
|
if(current==null) {
|
||||||
current= UNQUALIFIED_PARAMETERS;
|
current= UNQUALIFIED_PARAMETERS;
|
||||||
result.put(current, new ArrayList());
|
result.put(current, new ArrayList<String>());
|
||||||
}
|
}
|
||||||
((List) result.get(current)).add(args[i]);
|
(result.get(current)).add(args[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.pdom.export;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -34,8 +33,8 @@ import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
* An ISafeRunnable which
|
* An ISafeRunnable which
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Creates a project for export
|
* <li>Creates a project for export
|
||||||
* <li>Exports the pdom
|
* <li>Exports the PDOM
|
||||||
* <li>Writes new properties to the pdom
|
* <li>Writes new properties to the PDOM
|
||||||
* <ul>
|
* <ul>
|
||||||
*/
|
*/
|
||||||
public class GeneratePDOM implements ISafeRunnable {
|
public class GeneratePDOM implements ISafeRunnable {
|
||||||
|
@ -82,11 +81,10 @@ public class GeneratePDOM implements ISafeRunnable {
|
||||||
WritablePDOM exportedPDOM= new WritablePDOM(targetLocation, converter, LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
WritablePDOM exportedPDOM= new WritablePDOM(targetLocation, converter, LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
||||||
exportedPDOM.acquireWriteLock(0);
|
exportedPDOM.acquireWriteLock(0);
|
||||||
try {
|
try {
|
||||||
Map exportProperties= pm.getExportProperties();
|
Map<String,String> exportProperties= pm.getExportProperties();
|
||||||
if(exportProperties!=null) {
|
if(exportProperties!=null) {
|
||||||
for(Iterator i = exportProperties.entrySet().iterator(); i.hasNext(); ) {
|
for(Map.Entry<String,String> entry : exportProperties.entrySet()) {
|
||||||
Map.Entry entry = (Map.Entry) i.next();
|
exportedPDOM.setProperty(entry.getKey(), entry.getValue());
|
||||||
exportedPDOM.setProperty((String) entry.getKey(), (String) entry.getValue());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// fake PDOM-version to that which can be safely read by the CDT-version
|
// fake PDOM-version to that which can be safely read by the CDT-version
|
||||||
|
@ -104,7 +102,6 @@ public class GeneratePDOM implements ISafeRunnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleException(Throwable exception) {
|
public void handleException(Throwable exception) {
|
||||||
// subclass for custom behaviour
|
|
||||||
CCorePlugin.log(exception);
|
CCorePlugin.log(exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.io.File;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -53,7 +54,7 @@ public class GeneratePDOMApplication implements IApplication {
|
||||||
*/
|
*/
|
||||||
public static final int ECODE_EXPECTED_FAILURE= 1;
|
public static final int ECODE_EXPECTED_FAILURE= 1;
|
||||||
|
|
||||||
private static Map/*<String,IProjectForExportManager>*/ projectInitializers;
|
private static Map<String,IExportProjectProvider> projectInitializers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts this application
|
* Starts this application
|
||||||
|
@ -76,7 +77,7 @@ public class GeneratePDOMApplication implements IApplication {
|
||||||
|
|
||||||
private Object startImpl(IApplicationContext context) throws CoreException {
|
private Object startImpl(IApplicationContext context) throws CoreException {
|
||||||
String[] appArgs= (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS);
|
String[] appArgs= (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS);
|
||||||
Map arguments= CLIUtil.parseToMap(appArgs);
|
Map<String,List<String>> arguments= CLIUtil.parseToMap(appArgs);
|
||||||
output(Messages.GeneratePDOMApplication_Initializing);
|
output(Messages.GeneratePDOMApplication_Initializing);
|
||||||
|
|
||||||
setupCLIProgressProvider();
|
setupCLIProgressProvider();
|
||||||
|
@ -86,17 +87,17 @@ public class GeneratePDOMApplication implements IApplication {
|
||||||
output(MessageFormat.format(Messages.GeneratePDOMApplication_UsingDefaultProjectProvider, new Object[] {DEFAULT_PROJECT_PROVIDER}));
|
output(MessageFormat.format(Messages.GeneratePDOMApplication_UsingDefaultProjectProvider, new Object[] {DEFAULT_PROJECT_PROVIDER}));
|
||||||
pproviderFQN= DEFAULT_PROJECT_PROVIDER;
|
pproviderFQN= DEFAULT_PROJECT_PROVIDER;
|
||||||
} else {
|
} else {
|
||||||
pproviderFQN= (String) CLIUtil.getArg(arguments, OPT_PROJECTPROVIDER, 1).get(0);
|
pproviderFQN= CLIUtil.getArg(arguments, OPT_PROJECTPROVIDER, 1).get(0);
|
||||||
}
|
}
|
||||||
String target= (String) CLIUtil.getArg(arguments, OPT_TARGET, 1).get(0);
|
String target= CLIUtil.getArg(arguments, OPT_TARGET, 1).get(0);
|
||||||
boolean quiet= arguments.get(OPT_QUIET)!=null;
|
boolean quiet= arguments.get(OPT_QUIET)!=null;
|
||||||
|
|
||||||
String indexerID= IPDOMManager.ID_FAST_INDEXER;
|
String indexerID= IPDOMManager.ID_FAST_INDEXER;
|
||||||
String[] indexerIDs= (String[]) arguments.get(OPT_INDEXER_ID);
|
List<String> indexerIDs= arguments.get(OPT_INDEXER_ID);
|
||||||
if(indexerIDs!=null) {
|
if(indexerIDs!=null) {
|
||||||
if(indexerIDs.length==1) {
|
if(indexerIDs.size()==1) {
|
||||||
indexerID= indexerIDs[0];
|
indexerID= indexerIDs.get(0);
|
||||||
} else if(indexerIDs.length>1) {
|
} else if(indexerIDs.size()>1) {
|
||||||
fail(MessageFormat.format(Messages.GeneratePDOMApplication_InvalidIndexerID, new Object[] {OPT_INDEXER_ID}));
|
fail(MessageFormat.format(Messages.GeneratePDOMApplication_InvalidIndexerID, new Object[] {OPT_INDEXER_ID}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,7 +150,7 @@ public class GeneratePDOMApplication implements IApplication {
|
||||||
*/
|
*/
|
||||||
private static synchronized IExportProjectProvider getExportProjectProvider(String fqn) {
|
private static synchronized IExportProjectProvider getExportProjectProvider(String fqn) {
|
||||||
if(projectInitializers==null) {
|
if(projectInitializers==null) {
|
||||||
projectInitializers = new HashMap();
|
projectInitializers = new HashMap<String, IExportProjectProvider>();
|
||||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||||
IExtensionPoint indexExtensions = registry.getExtensionPoint(CCorePlugin.INDEX_UNIQ_ID);
|
IExtensionPoint indexExtensions = registry.getExtensionPoint(CCorePlugin.INDEX_UNIQ_ID);
|
||||||
IExtension[] extensions = indexExtensions.getExtensions();
|
IExtension[] extensions = indexExtensions.getExtensions();
|
||||||
|
@ -170,12 +171,12 @@ public class GeneratePDOMApplication implements IApplication {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IExportProjectProvider initer = (IExportProjectProvider) projectInitializers.get(fqn);
|
IExportProjectProvider initer = projectInitializers.get(fqn);
|
||||||
return initer;
|
return initer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In this application, the usual progress reports are redirected to stdoutt
|
* In this application, the usual progress reports are redirected to standard out
|
||||||
*/
|
*/
|
||||||
private void setupCLIProgressProvider() {
|
private void setupCLIProgressProvider() {
|
||||||
ProgressProvider pp = new ProgressProvider() {
|
ProgressProvider pp = new ProgressProvider() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue