Lines 421-426
Link Here
|
421 |
* an exception if the project could not be restored. |
421 |
* an exception if the project could not be restored. |
422 |
*/ |
422 |
*/ |
423 |
protected void restore(Project project, IProgressMonitor monitor) throws CoreException { |
423 |
protected void restore(Project project, IProgressMonitor monitor) throws CoreException { |
|
|
424 |
long start = System.currentTimeMillis(); |
424 |
monitor = Policy.monitorFor(monitor); |
425 |
monitor = Policy.monitorFor(monitor); |
425 |
try { |
426 |
try { |
426 |
monitor.beginTask(null, 40); |
427 |
monitor.beginTask(null, 40); |
Lines 436-447
Link Here
|
436 |
} finally { |
437 |
} finally { |
437 |
monitor.done(); |
438 |
monitor.done(); |
438 |
} |
439 |
} |
|
|
440 |
if (Policy.DEBUG_RESTORE) { |
441 |
System.out.println("Full restore for " + project.getFullPath() + ": " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
442 |
} |
439 |
} |
443 |
} |
440 |
/** |
444 |
/** |
441 |
* Restores the state of this workspace by opening the projects |
445 |
* Restores the state of this workspace by opening the projects |
442 |
* which were open when it was last saved. |
446 |
* which were open when it was last saved. |
443 |
*/ |
447 |
*/ |
444 |
protected void restore(IProgressMonitor monitor) throws CoreException { |
448 |
protected void restore(IProgressMonitor monitor) throws CoreException { |
|
|
449 |
long start = System.currentTimeMillis(); |
445 |
monitor = Policy.monitorFor(monitor); |
450 |
monitor = Policy.monitorFor(monitor); |
446 |
try { |
451 |
try { |
447 |
monitor.beginTask(null, 50); |
452 |
monitor.beginTask(null, 50); |
Lines 482-487
Link Here
|
482 |
} finally { |
487 |
} finally { |
483 |
monitor.done(); |
488 |
monitor.done(); |
484 |
} |
489 |
} |
|
|
490 |
if (Policy.DEBUG_RESTORE) { |
491 |
System.out.println("Full restore for workspace: " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ |
492 |
} |
485 |
} |
493 |
} |
486 |
/** |
494 |
/** |
487 |
* Reads the markers which were originally saved |
495 |
* Reads the markers which were originally saved |
Lines 489-494
Link Here
|
489 |
*/ |
497 |
*/ |
490 |
protected void restoreMarkers(IResource resource, boolean generateDeltas, IProgressMonitor monitor) throws CoreException { |
498 |
protected void restoreMarkers(IResource resource, boolean generateDeltas, IProgressMonitor monitor) throws CoreException { |
491 |
Assert.isLegal(resource.getType() == IResource.ROOT || resource.getType() == IResource.PROJECT); |
499 |
Assert.isLegal(resource.getType() == IResource.ROOT || resource.getType() == IResource.PROJECT); |
|
|
500 |
long start = System.currentTimeMillis(); |
492 |
MarkerManager markerManager = workspace.getMarkerManager(); |
501 |
MarkerManager markerManager = workspace.getMarkerManager(); |
493 |
// when restoring a project, only load markers if it is open |
502 |
// when restoring a project, only load markers if it is open |
494 |
if (resource.isAccessible()) |
503 |
if (resource.isAccessible()) |
Lines 501-506
Link Here
|
501 |
for (int i = 0; i < projects.length; i++) |
510 |
for (int i = 0; i < projects.length; i++) |
502 |
if (projects[i].isAccessible()) |
511 |
if (projects[i].isAccessible()) |
503 |
markerManager.restore(projects[i], generateDeltas, monitor); |
512 |
markerManager.restore(projects[i], generateDeltas, monitor); |
|
|
513 |
if (Policy.DEBUG_RESTORE_MARKERS) { |
514 |
System.out.println("Restore Markers for " + resource.getFullPath() + ": " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
515 |
} |
504 |
} |
516 |
} |
505 |
protected void restoreMasterTable() throws CoreException { |
517 |
protected void restoreMasterTable() throws CoreException { |
506 |
masterTable = new Properties(); |
518 |
masterTable = new Properties(); |
Lines 530-535
Link Here
|
530 |
* project description could not be restored. |
542 |
* project description could not be restored. |
531 |
*/ |
543 |
*/ |
532 |
protected void restoreMetaInfo(Project project, IProgressMonitor monitor) throws CoreException { |
544 |
protected void restoreMetaInfo(Project project, IProgressMonitor monitor) throws CoreException { |
|
|
545 |
long start = System.currentTimeMillis(); |
533 |
ProjectDescription description = null; |
546 |
ProjectDescription description = null; |
534 |
CoreException failure = null; |
547 |
CoreException failure = null; |
535 |
try { |
548 |
try { |
Lines 559-564
Link Here
|
559 |
project.internalClose(); |
572 |
project.internalClose(); |
560 |
throw failure; |
573 |
throw failure; |
561 |
} |
574 |
} |
|
|
575 |
if (Policy.DEBUG_RESTORE_METAINFO) { |
576 |
System.out.println("Restore MetaInfo for " + project.getFullPath() + ": " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
577 |
} |
562 |
} |
578 |
} |
563 |
/** |
579 |
/** |
564 |
* Restores the state of this workspace by opening the projects |
580 |
* Restores the state of this workspace by opening the projects |
Lines 566-571
Link Here
|
566 |
*/ |
582 |
*/ |
567 |
protected void restoreMetaInfo(Workspace workspace, MultiStatus problems, IProgressMonitor monitor) { |
583 |
protected void restoreMetaInfo(Workspace workspace, MultiStatus problems, IProgressMonitor monitor) { |
568 |
// FIXME: read the meta info for the workspace? |
584 |
// FIXME: read the meta info for the workspace? |
|
|
585 |
long start = System.currentTimeMillis(); |
569 |
IProject[] roots = workspace.getRoot().getProjects(); |
586 |
IProject[] roots = workspace.getRoot().getProjects(); |
570 |
for (int i = 0; i < roots.length; i++) { |
587 |
for (int i = 0; i < roots.length; i++) { |
571 |
//fatal to throw exceptions during startup |
588 |
//fatal to throw exceptions during startup |
Lines 575-580
Link Here
|
575 |
problems.merge(e.getStatus()); |
592 |
problems.merge(e.getStatus()); |
576 |
} |
593 |
} |
577 |
} |
594 |
} |
|
|
595 |
if (Policy.DEBUG_RESTORE_METAINFO) { |
596 |
System.out.println("Restore MetaInfo for workspace: " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ |
597 |
} |
578 |
} |
598 |
} |
579 |
/** |
599 |
/** |
580 |
* Restores the workspace tree from snapshot files in the event |
600 |
* Restores the workspace tree from snapshot files in the event |
Lines 630-635
Link Here
|
630 |
*/ |
650 |
*/ |
631 |
protected void restoreSyncInfo(IResource resource, IProgressMonitor monitor) throws CoreException { |
651 |
protected void restoreSyncInfo(IResource resource, IProgressMonitor monitor) throws CoreException { |
632 |
Assert.isLegal(resource.getType() == IResource.ROOT || resource.getType() == IResource.PROJECT); |
652 |
Assert.isLegal(resource.getType() == IResource.ROOT || resource.getType() == IResource.PROJECT); |
|
|
653 |
long start = System.currentTimeMillis(); |
633 |
Synchronizer synchronizer = (Synchronizer) workspace.getSynchronizer(); |
654 |
Synchronizer synchronizer = (Synchronizer) workspace.getSynchronizer(); |
634 |
// when restoring a project, only load sync info if it is open |
655 |
// when restoring a project, only load sync info if it is open |
635 |
if (resource.isAccessible()) |
656 |
if (resource.isAccessible()) |
Lines 642-647
Link Here
|
642 |
for (int i = 0; i < projects.length; i++) |
663 |
for (int i = 0; i < projects.length; i++) |
643 |
if (projects[i].isAccessible()) |
664 |
if (projects[i].isAccessible()) |
644 |
synchronizer.restore(projects[i], monitor); |
665 |
synchronizer.restore(projects[i], monitor); |
|
|
666 |
if (Policy.DEBUG_RESTORE_SYNCINFO) { |
667 |
System.out.println("Restore SyncInfo for " + resource.getFullPath() + ": " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
668 |
} |
645 |
} |
669 |
} |
646 |
/** |
670 |
/** |
647 |
* Restores the trees for the builders of this project from the local disk. |
671 |
* Restores the trees for the builders of this project from the local disk. |
Lines 652-657
Link Here
|
652 |
* @exception if the project could not be restored. |
676 |
* @exception if the project could not be restored. |
653 |
*/ |
677 |
*/ |
654 |
protected void restoreTree(Project project, IProgressMonitor monitor) throws CoreException { |
678 |
protected void restoreTree(Project project, IProgressMonitor monitor) throws CoreException { |
|
|
679 |
long start = System.currentTimeMillis(); |
655 |
monitor = Policy.monitorFor(monitor); |
680 |
monitor = Policy.monitorFor(monitor); |
656 |
String message; |
681 |
String message; |
657 |
try { |
682 |
try { |
Lines 680-685
Link Here
|
680 |
} finally { |
705 |
} finally { |
681 |
monitor.done(); |
706 |
monitor.done(); |
682 |
} |
707 |
} |
|
|
708 |
if (Policy.DEBUG_RESTORE_TREE) { |
709 |
System.out.println("Restore Tree for " + project.getFullPath() + ": " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
710 |
} |
683 |
} |
711 |
} |
684 |
/** |
712 |
/** |
685 |
* Reads the contents of the tree rooted by the given resource from the |
713 |
* Reads the contents of the tree rooted by the given resource from the |
Lines 688-693
Link Here
|
688 |
* @exception if the workspace could not be restored. |
716 |
* @exception if the workspace could not be restored. |
689 |
*/ |
717 |
*/ |
690 |
protected void restoreTree(Workspace workspace, IProgressMonitor monitor) throws CoreException { |
718 |
protected void restoreTree(Workspace workspace, IProgressMonitor monitor) throws CoreException { |
|
|
719 |
long start = System.currentTimeMillis(); |
691 |
IPath treeLocation = workspace.getMetaArea().getTreeLocationFor(workspace.getRoot(), false); |
720 |
IPath treeLocation = workspace.getMetaArea().getTreeLocationFor(workspace.getRoot(), false); |
692 |
IPath tempLocation = workspace.getMetaArea().getBackupLocationFor(treeLocation); |
721 |
IPath tempLocation = workspace.getMetaArea().getBackupLocationFor(treeLocation); |
693 |
if (!treeLocation.toFile().exists() && !tempLocation.toFile().exists()) { |
722 |
if (!treeLocation.toFile().exists() && !tempLocation.toFile().exists()) { |
Lines 712-717
Link Here
|
712 |
} catch (IOException e) { |
741 |
} catch (IOException e) { |
713 |
String msg = Policy.bind("resources.readMeta", treeLocation.toOSString()); //$NON-NLS-1$ |
742 |
String msg = Policy.bind("resources.readMeta", treeLocation.toOSString()); //$NON-NLS-1$ |
714 |
throw new ResourceException(IResourceStatus.FAILED_READ_METADATA, treeLocation, msg, e); |
743 |
throw new ResourceException(IResourceStatus.FAILED_READ_METADATA, treeLocation, msg, e); |
|
|
744 |
} |
745 |
if (Policy.DEBUG_RESTORE_TREE) { |
746 |
System.out.println("Restore Tree for workspace: " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ |
715 |
} |
747 |
} |
716 |
} |
748 |
} |
717 |
protected void saveMasterTable() throws CoreException { |
749 |
protected void saveMasterTable() throws CoreException { |