1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Clean up the Null indexer's reindexing.

This commit is contained in:
Doug Schaefer 2006-04-24 18:36:57 +00:00
parent c7708b4e2b
commit 126b76f557
2 changed files with 52 additions and 3 deletions

View file

@ -34,9 +34,7 @@ public class PDOMNullIndexer implements IPDOMIndexer {
}
public void reindex() throws CoreException {
// Just clear out the old index
pdom.clear();
((PDOM)pdom).fireChange();
new PDOMNullReindex((PDOM)pdom).schedule();
}
}

View file

@ -0,0 +1,51 @@
/*******************************************************************************
* Copyright (c) 2006 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.indexer.nulli;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.internal.core.pdom.PDOM;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
/**
* @author Doug Schaefer
*
*/
public class PDOMNullReindex extends Job {
private final PDOM pdom;
public PDOMNullReindex(PDOM pdom) {
super("Null Indexer: " + pdom.getProject().getElementName());
this.pdom = pdom;
setRule(CCorePlugin.getPDOMManager().getIndexerSchedulingRule());
}
protected IStatus run(IProgressMonitor monitor) {
try {
pdom.acquireWriteLock();
pdom.clear();
pdom.fireChange();
} catch (CoreException e) {
return e.getStatus();
} catch (InterruptedException e) {
return Status.CANCEL_STATUS;
} finally {
pdom.releaseWriteLock();
}
return Status.OK_STATUS;
}
}