1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 06:32:10 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2014-05-09 18:35:04 -07:00
parent 720771095c
commit 01ac823ccb
4 changed files with 46 additions and 35 deletions

View file

@ -184,6 +184,7 @@ public interface IIndexManager extends IPDOMManager {
/**
* Returns the index for the given project.
*
* @param project the project to get the index for
* @return an index for the project
* @throws CoreException
@ -192,6 +193,7 @@ public interface IIndexManager extends IPDOMManager {
/**
* Returns the index for the given projects.
*
* @param projects the projects to get the index for
* @return an index for the projects
* @throws CoreException
@ -203,7 +205,7 @@ public interface IIndexManager extends IPDOMManager {
* projects.
*
* @param project the project to get the index for
* @param options <code>0</code> or a combination of {@link #ADD_DEPENDENCIES} and
* @param options {@code 0} or a combination of {@link #ADD_DEPENDENCIES} and
* {@link #ADD_DEPENDENT}.
* @return an index for the project
* @throws CoreException
@ -213,8 +215,9 @@ public interface IIndexManager extends IPDOMManager {
/**
* Returns the index for the given projects. You can specify to add dependencies or dependent
* projects.
*
* @param projects the projects to get the index for
* @param options <code>0</code> or a combination of {@link #ADD_DEPENDENCIES} and
* @param options {@code 0} or a combination of {@link #ADD_DEPENDENCIES} and
* {@link #ADD_DEPENDENT}.
* @return an index for the projects
* @throws CoreException
@ -223,6 +226,7 @@ public interface IIndexManager extends IPDOMManager {
/**
* Registers a listener that will be notified whenever the indexer go idle.
*
* @param listener the listener to register.
*/
void addIndexChangeListener(IIndexChangeListener listener);
@ -235,12 +239,14 @@ public interface IIndexManager extends IPDOMManager {
/**
* Registers a listener that will be notified whenever the indexer changes its state.
*
* @param listener the listener to register.
*/
void addIndexerStateListener(IIndexerStateListener listener);
/**
* Removes a previously registered indexer state listener.
*
* @param listener the listener to unregister.
*/
void removeIndexerStateListener(IIndexerStateListener listener);
@ -249,15 +255,17 @@ public interface IIndexManager extends IPDOMManager {
* Joins the indexer and reports progress.
* @param waitMaxMillis time limit in milliseconds after which the method returns with
* {@code false}, or {@link #FOREVER}.
*
* @param monitor a monitor to report progress.
* @return <code>true</code>, if the indexer went idle in the given time.
* @return {@code true}, if the indexer went idle in the given time.
*/
boolean joinIndexer(int waitMaxMillis, IProgressMonitor monitor);
/**
* Checks whether the indexer is currently idle. The indexer is idle, when there is currently no request
* to update files of an index and no initialization for a project is performed. However, the indexer becomes
* idle, when the setup of a project is postponed (check with {@link #isIndexerSetupPostponed(ICProject)}).
* Checks whether the indexer is currently idle. The indexer is idle, when there is currently
* no request to update files of an index and no initialization for a project is performed.
* However, the indexer becomes idle, when the setup of a project is postponed
* (check with {@link #isIndexerSetupPostponed(ICProject)}).
*/
boolean isIndexerIdle();
@ -268,8 +276,10 @@ public interface IIndexManager extends IPDOMManager {
boolean isProjectIndexed(ICProject proj);
/**
* Return whether the indexer-setup for a project is currently postponed. Note,
* that a postponed setup does not prevent the indexer from becoming idle ({@link #isIndexerIdle()}.
* Returns whether the indexer-setup for a project is currently postponed. Note,
* that a postponed setup does not prevent the indexer from becoming idle
* ({@link #isIndexerIdle()}.
* <p>
* The fact that the indexer-setup for a project is no longer postponed, will be reported using
* {@link IndexerSetupParticipant#onIndexerSetup(ICProject)}.
*/
@ -296,20 +306,22 @@ public interface IIndexManager extends IPDOMManager {
public void reindex(ICProject project);
/**
* Updates the index for the given selection of translation units considering
* the options supplied. The selection is defined by an array of translation
* units, containers and projects. For containers and projects all recursively
* nested translation units are considered.
* Updates the index for the given selection of translation units considering the options
* supplied. The selection is defined by an array of translation units, containers and projects.
* For containers and projects all recursively nested translation units are considered.
*
* @param tuSelection the translation units to update.
* @param options one of {@link #UPDATE_ALL} or {@link #UPDATE_CHECK_TIMESTAMPS} optionally
* combined with {@link #UPDATE_EXTERNAL_FILES_FOR_PROJECT} and {@link #UPDATE_CHECK_CONTENTS_HASH}.
* combined with {@link #UPDATE_EXTERNAL_FILES_FOR_PROJECT} and
* {@link #UPDATE_CHECK_CONTENTS_HASH}.
* @throws CoreException
* @since 4.0
*/
public void update(ICElement[] tuSelection, int options) throws CoreException;
/**
* Export index for usage within a team.
* Exports index for usage within a team.
*
* @param project a project for which the PDOM is to be exported.
* @param location the target location for the database.
* @param options currently none are supported.

View file

@ -651,7 +651,7 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
final boolean regularContent = isRequiredInIndex(tu, ifl, isSourceUnit);
final boolean indexedUnconditionally = fResolver.isIndexedUnconditionally(ifl);
if (regularContent || indexedUnconditionally) {
// Headers or sources required with a specific linkage
// Headers or sources required with a specific linkage.
final UpdateKind updateKind = isSourceUnit ? UpdateKind.REQUIRED_SOURCE
: regularContent && both ? UpdateKind.REQUIRED_HEADER : UpdateKind.ONE_LINKAGE_HEADER;
if (regularContent || indexFiles.length == 0) {

View file

@ -18,7 +18,7 @@ import java.util.HashMap;
* @param <T> Type of the objects contained in the set.
*/
public class AtomicMultiSet<T> {
private final HashMap<T, Integer> map = new HashMap<T, Integer>();
private final HashMap<T, Integer> map = new HashMap<>();
/**
* Adds object to the set if it was not present, or increments its reference count otherwise.

View file

@ -145,26 +145,26 @@ public class PDOMManager implements IWritableIndexManager, IListener {
ILinkage.C_LINKAGE_ID, ILinkage.CPP_LINKAGE_ID, ILinkage.FORTRAN_LINKAGE_ID
};
private final ArrayDeque<ICProject> fProjectQueue= new ArrayDeque<ICProject>();
private final ArrayDeque<ICProject> fProjectQueue= new ArrayDeque<>();
private final PDOMSetupJob fSetupJob;
/**
* Protects fIndexerJob, fCurrentTask and fTaskQueue.
*/
private final ArrayDeque<IPDOMIndexerTask> fTaskQueue = new ArrayDeque<IPDOMIndexerTask>();
private final ArrayDeque<IPDOMIndexerTask> fTaskQueue = new ArrayDeque<>();
private final PDOMIndexerJob fIndexerJob;
private IPDOMIndexerTask fCurrentTask;
private int fSourceCount, fHeaderCount, fTickCount;
private final ArrayDeque<Runnable> fChangeEvents= new ArrayDeque<Runnable>();
private final ArrayDeque<Runnable> fChangeEvents= new ArrayDeque<>();
private final Job fNotificationJob;
private final AtomicMultiSet<IIndexFileLocation> fFilesIndexedUnconditionlly= new AtomicMultiSet<IIndexFileLocation>();
private final AtomicMultiSet<IIndexFileLocation> fFilesIndexedUnconditionlly= new AtomicMultiSet<>();
/**
* Stores mapping from pdom to project, used to serialize creation of new pdoms.
*/
private Map<IProject, IPDOM> fProjectToPDOM= new HashMap<IProject, IPDOM>();
private Map<File, ICProject> fFileToProject= new HashMap<File, ICProject>();
private Map<IProject, IPDOM> fProjectToPDOM= new HashMap<>();
private Map<File, ICProject> fFileToProject= new HashMap<>();
private ListenerList fChangeListeners= new ListenerList();
private ListenerList fStateListeners= new ListenerList();
@ -185,12 +185,12 @@ public class PDOMManager implements IWritableIndexManager, IListener {
* Serializes creation of new indexer, when acquiring the lock you are
* not allowed to hold a lock on fPDOMs.
*/
private Map<ICProject, IndexUpdatePolicy> fUpdatePolicies= new HashMap<ICProject, IndexUpdatePolicy>();
private Set<String> fClosingProjects= new HashSet<String>();
private Map<ICProject, IndexUpdatePolicy> fUpdatePolicies= new HashMap<>();
private Set<String> fClosingProjects= new HashSet<>();
private Map<IProject, PCL> fPrefListeners= new HashMap<IProject, PCL>();
private List<IndexerSetupParticipant> fSetupParticipants= new ArrayList<IndexerSetupParticipant>();
private Set<ICProject> fPostponedProjects= new HashSet<ICProject>();
private Map<IProject, PCL> fPrefListeners= new HashMap<>();
private List<IndexerSetupParticipant> fSetupParticipants= new ArrayList<>();
private Set<ICProject> fPostponedProjects= new HashSet<>();
private int fLastNotifiedState= IndexerStateEvent.STATE_IDLE;
private boolean fInShutDown;
@ -1210,7 +1210,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
@Override
public IIndex getIndex(ICProject project) throws CoreException {
return fIndexFactory.getIndex(new ICProject[] {project}, 0);
return fIndexFactory.getIndex(new ICProject[] { project }, 0);
}
@Override
@ -1220,7 +1220,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
@Override
public IIndex getIndex(ICProject project, int options) throws CoreException {
return fIndexFactory.getIndex(new ICProject[] {project}, options);
return fIndexFactory.getIndex(new ICProject[] { project }, options);
}
@Override
@ -1245,8 +1245,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
boolean deleted= targetLocation.delete();
if (!deleted) {
throw new IllegalArgumentException(
MessageFormat.format(Messages.PDOMManager_ExistingFileCollides,
targetLocation ));
MessageFormat.format(Messages.PDOMManager_ExistingFileCollides, targetLocation));
}
}
try {
@ -1383,17 +1382,17 @@ public class PDOMManager implements IWritableIndexManager, IListener {
* set of folders and files specifying the selection.
*/
private Map<ICProject, List<ICElement>> splitSelection(ICElement[] tuSelection) {
HashMap<ICProject, List<ICElement>> result= new HashMap<ICProject, List<ICElement>>();
HashMap<ICProject, List<ICElement>> result= new HashMap<>();
allElements: for (int i = 0; i < tuSelection.length; i++) {
ICElement element = tuSelection[i];
if (element instanceof ICProject || element instanceof ICContainer || element instanceof ITranslationUnit) {
ICProject project= element.getCProject();
List<ICElement> set= result.get(project);
if (set == null) {
set= new ArrayList<ICElement>();
set= new ArrayList<>();
result.put(project, set);
}
for (int j= 0; j<set.size(); j++) {
for (int j= 0; j < set.size(); j++) {
ICElement other= set.get(j);
if (contains(other, element)) {
continue allElements;
@ -1558,7 +1557,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
if (!"true".equals(IndexerPreferences.get(cproject.getProject(), IndexerPreferences.KEY_INDEX_ALL_FILES, null))) //$NON-NLS-1$
return null; // No check is performed in this case
Set<ITranslationUnit> sources= new HashSet<ITranslationUnit>();
Set<ITranslationUnit> sources= new HashSet<>();
cproject.accept(new TranslationUnitCollector(sources, null, new NullProgressMonitor()));
IStatus syncStatus = null;