mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Removed use of a deprecated class.
Change-Id: I2f0bb36c79974e62fcf06a77ca78954f8103a150
This commit is contained in:
parent
be08c70459
commit
0be1934cec
1 changed files with 19 additions and 38 deletions
|
@ -47,7 +47,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubMonitor;
|
||||||
|
|
||||||
public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
||||||
/**
|
/**
|
||||||
|
@ -100,35 +100,32 @@ public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
||||||
try {
|
try {
|
||||||
PDOMManager pdomManager= CCoreInternals.getPDOMManager();
|
PDOMManager pdomManager= CCoreInternals.getPDOMManager();
|
||||||
|
|
||||||
// wait for indexer
|
// Wait for indexer.
|
||||||
monitor.beginTask("", 100); //$NON-NLS-1$
|
SubMonitor progress = SubMonitor.convert(monitor, 100);
|
||||||
pdomManager.joinIndexer(Integer.MAX_VALUE, subMonitor(monitor, 1));
|
pdomManager.joinIndexer(Integer.MAX_VALUE, progress.split(1));
|
||||||
checkMonitor(monitor);
|
|
||||||
|
|
||||||
// create index
|
// Create index.
|
||||||
IIndexLocationConverter converter= new PDOMProjectIndexLocationConverter(fProject.getProject(), true);
|
IIndexLocationConverter converter= new PDOMProjectIndexLocationConverter(fProject.getProject(), true);
|
||||||
pdomManager.exportProjectPDOM(fProject, tmpPDOM, converter, monitor);
|
pdomManager.exportProjectPDOM(fProject, tmpPDOM, converter, progress.split(50));
|
||||||
checkMonitor(monitor);
|
|
||||||
monitor.worked(5);
|
monitor.worked(5);
|
||||||
|
|
||||||
// create checksums
|
// Create checksums.
|
||||||
PDOM pdom= new PDOM(tmpPDOM, converter, LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
PDOM pdom= new PDOM(tmpPDOM, converter, LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
||||||
pdom.acquireReadLock();
|
pdom.acquireReadLock();
|
||||||
try {
|
try {
|
||||||
monitor.setTaskName(Messages.Checksums_taskComputeChecksums);
|
progress.setTaskName(Messages.Checksums_taskComputeChecksums);
|
||||||
createChecksums(fProject, pdom, tmpChecksums, subMonitor(monitor, 94));
|
createChecksums(fProject, pdom, tmpChecksums, progress.split(49));
|
||||||
pdom.db.setExclusiveLock(); // The tmpPDOM is all ours.
|
pdom.db.setExclusiveLock(); // The tmpPDOM is all ours.
|
||||||
pdom.close();
|
pdom.close();
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
pdom.releaseReadLock();
|
pdom.releaseReadLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
// create archive
|
// Create archive.
|
||||||
createArchive(tmpPDOM, tmpChecksums);
|
createArchive(tmpPDOM, tmpChecksums);
|
||||||
|
|
||||||
// store preferences
|
// Store preferences.
|
||||||
monitor.setTaskName(Messages.TeamPDOMExportOperation_taskExportIndex);
|
progress.setTaskName(Messages.TeamPDOMExportOperation_taskExportIndex);
|
||||||
IndexerPreferences.setIndexImportLocation(fProject.getProject(), fTargetLocation.toString());
|
IndexerPreferences.setIndexImportLocation(fProject.getProject(), fTargetLocation.toString());
|
||||||
|
|
||||||
// store resource snapshot
|
// store resource snapshot
|
||||||
|
@ -140,9 +137,7 @@ public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
return;
|
} finally {
|
||||||
}
|
|
||||||
finally {
|
|
||||||
if (tmpPDOM != null) {
|
if (tmpPDOM != null) {
|
||||||
tmpPDOM.delete();
|
tmpPDOM.delete();
|
||||||
}
|
}
|
||||||
|
@ -190,8 +185,7 @@ public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
||||||
fullPaths.add(fullPath);
|
fullPaths.add(fullPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
pdom.releaseReadLock();
|
pdom.releaseReadLock();
|
||||||
}
|
}
|
||||||
int i=0;
|
int i=0;
|
||||||
|
@ -211,8 +205,7 @@ public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
||||||
out.writeObject(map);
|
out.writeObject(map);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new CoreException(CCorePlugin.createStatus(Messages.TeamPDOMExportOperation_errorWriteTempFile, e));
|
throw new CoreException(CCorePlugin.createStatus(Messages.TeamPDOMExportOperation_errorWriteTempFile, e));
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
close(out);
|
close(out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,11 +239,9 @@ public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
||||||
out.setLevel(Deflater.BEST_COMPRESSION);
|
out.setLevel(Deflater.BEST_COMPRESSION);
|
||||||
writeEntry(out, TeamPDOMImportOperation.INDEX_NAME, tmpPDOM);
|
writeEntry(out, TeamPDOMImportOperation.INDEX_NAME, tmpPDOM);
|
||||||
writeEntry(out, TeamPDOMImportOperation.CHECKSUMS_NAME, tmpChecksums);
|
writeEntry(out, TeamPDOMImportOperation.CHECKSUMS_NAME, tmpChecksums);
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
throw new CoreException(CCorePlugin.createStatus(Messages.TeamPDOMExportOperation_errorCreateArchive, e));
|
throw new CoreException(CCorePlugin.createStatus(Messages.TeamPDOMExportOperation_errorCreateArchive, e));
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
close(out);
|
close(out);
|
||||||
}
|
}
|
||||||
IFile[] wsResource= ResourceLookup.findFilesForLocation(new Path(fTargetLocationFile.getAbsolutePath()));
|
IFile[] wsResource= ResourceLookup.findFilesForLocation(new Path(fTargetLocationFile.getAbsolutePath()));
|
||||||
|
@ -275,14 +266,4 @@ public class TeamPDOMExportOperation implements IWorkspaceRunnable {
|
||||||
close(in);
|
close(in);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private SubProgressMonitor subMonitor(IProgressMonitor monitor, int ticks) {
|
|
||||||
return new SubProgressMonitor(monitor, ticks);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkMonitor(IProgressMonitor monitor) {
|
|
||||||
if (monitor.isCanceled()) {
|
|
||||||
throw new OperationCanceledException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue