1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-11-12 11:57:47 -08:00
parent a48e822d59
commit 9883a156f5
3 changed files with 22 additions and 28 deletions

View file

@ -6,9 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.index; package org.eclipse.cdt.internal.core.index;
import org.eclipse.cdt.core.index.IIndexManager; import org.eclipse.cdt.core.index.IIndexManager;
@ -16,7 +15,6 @@ import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
public interface IWritableIndexManager extends IIndexManager { public interface IWritableIndexManager extends IIndexManager {
/** /**
* Returns a writable index or <code>null</code> if the project does not exist or is not yet * Returns a writable index or <code>null</code> if the project does not exist or is not yet
* registered with the pdom manager. * registered with the pdom manager.

View file

@ -6,18 +6,16 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Markus Schorn - initial API and implementation * Markus Schorn - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.pdom; package org.eclipse.cdt.internal.core.pdom;
public class IndexerProgress { public class IndexerProgress {
public int fRequestedFilesCount; public int fRequestedFilesCount;
public int fCompletedSources; public int fCompletedSources;
public int fPrimaryHeaderCount; // headers parsed that were actually requested public int fPrimaryHeaderCount; // Headers parsed that were actually requested
public int fCompletedHeaders; // all headers including those found through inclusions public int fCompletedHeaders; // All headers including those found through inclusions
public int fTimeEstimate; // fall-back for the time where no file-count is available public int fTimeEstimate; // Fall-back for the time where no file-count is available
public IndexerProgress() { public IndexerProgress() {
} }

View file

@ -111,9 +111,7 @@ import org.eclipse.core.runtime.preferences.InstanceScope;
import com.ibm.icu.text.MessageFormat; import com.ibm.icu.text.MessageFormat;
/** /**
* The PDOM Provider. This is likely temporary since I hope * Manages PDOM updates and events associated with them. Provides methods for index access.
* to integrate the PDOM directly into the core once it has
* stabilized.
*/ */
public class PDOMManager implements IWritableIndexManager, IListener { public class PDOMManager implements IWritableIndexManager, IListener {
private static final String TRACE_INDEXER_SETUP = CCorePlugin.PLUGIN_ID + "/debug/indexer/setup"; //$NON-NLS-1$ private static final String TRACE_INDEXER_SETUP = CCorePlugin.PLUGIN_ID + "/debug/indexer/setup"; //$NON-NLS-1$
@ -697,10 +695,10 @@ public class PDOMManager implements IWritableIndexManager, IListener {
} else { } else {
if (fCurrentTask != null) { if (fCurrentTask != null) {
IndexerProgress info= fCurrentTask.getProgressInformation(); IndexerProgress info= fCurrentTask.getProgressInformation();
fSourceCount+= info.fCompletedSources; fSourceCount += info.fCompletedSources;
fHeaderCount+= info.fCompletedHeaders; fHeaderCount += info.fCompletedHeaders;
// for the ticks we don't consider additional headers // for the ticks we don't consider additional headers
fTickCount+= info.fCompletedSources + info.fPrimaryHeaderCount; fTickCount += info.fCompletedSources + info.fPrimaryHeaderCount;
} }
result= fCurrentTask= fTaskQueue.removeFirst(); result= fCurrentTask= fTaskQueue.removeFirst();
} }
@ -1138,26 +1136,26 @@ public class PDOMManager implements IWritableIndexManager, IListener {
int sourceCount, sourceEstimate, headerCount, tickCount, tickEstimate; int sourceCount, sourceEstimate, headerCount, tickCount, tickEstimate;
String detail= null; String detail= null;
synchronized (fTaskQueue) { synchronized (fTaskQueue) {
// add historic data // Add historic data.
sourceCount= sourceEstimate= fSourceCount; sourceCount= sourceEstimate= fSourceCount;
headerCount= fHeaderCount; headerCount= fHeaderCount;
tickCount= tickEstimate= fTickCount; tickCount= tickEstimate= fTickCount;
// add future data // Add future data.
for (IPDOMIndexerTask task : fTaskQueue) { for (IPDOMIndexerTask task : fTaskQueue) {
final IndexerProgress info= task.getProgressInformation(); final IndexerProgress info= task.getProgressInformation();
sourceEstimate+= info.fRequestedFilesCount; sourceEstimate += info.fRequestedFilesCount;
tickEstimate+= info.getEstimatedTicks(); tickEstimate += info.getEstimatedTicks();
} }
// add current data // Add current data.
if (fCurrentTask != null) { if (fCurrentTask != null) {
final IndexerProgress info= fCurrentTask.getProgressInformation(); final IndexerProgress info= fCurrentTask.getProgressInformation();
sourceCount+= info.fCompletedSources; sourceCount += info.fCompletedSources;
sourceEstimate+= info.fRequestedFilesCount - info.fPrimaryHeaderCount; sourceEstimate += info.fRequestedFilesCount - info.fPrimaryHeaderCount;
headerCount+= info.fCompletedHeaders; headerCount += info.fCompletedHeaders;
// for the ticks we don't consider additional headers // For the ticks we don't consider additional headers.
tickCount+= info.fCompletedSources + info.fPrimaryHeaderCount; tickCount += info.fCompletedSources + info.fPrimaryHeaderCount;
tickEstimate+= info.getEstimatedTicks(); tickEstimate += info.getEstimatedTicks();
detail= PDOMIndexerJob.sMonitorDetail; detail= PDOMIndexerJob.sMonitorDetail;
} }
} }
@ -1171,9 +1169,9 @@ public class PDOMManager implements IWritableIndexManager, IListener {
job.subTask(msg); job.subTask(msg);
if (tickCount > 0 && tickCount <= tickEstimate) { if (tickCount > 0 && tickCount <= tickEstimate) {
int newTick= tickCount*base/tickEstimate; int newTick= tickCount * base / tickEstimate;
if (newTick > currentTicks) { if (newTick > currentTicks) {
job.worked(newTick-currentTicks); job.worked(newTick - currentTicks);
return newTick; return newTick;
} }
} }