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 2011-04-18 17:15:32 +00:00
parent eb7b349013
commit 0f416da87c

View file

@ -24,12 +24,11 @@ import org.eclipse.cdt.ui.CUIPlugin;
/** /**
* @author Mirko Stocker * @author Mirko Stocker
*
*/ */
public class ImplementMethodRefactoringWizard extends RefactoringWizard { public class ImplementMethodRefactoringWizard extends RefactoringWizard {
private final ImplementMethodRefactoring refactoring; private final ImplementMethodRefactoring refactoring;
private Map<MethodToImplementConfig, ParameterNamesInputPage>pagesMap = new HashMap<MethodToImplementConfig, ParameterNamesInputPage>(); private Map<MethodToImplementConfig, ParameterNamesInputPage>pagesMap =
new HashMap<MethodToImplementConfig, ParameterNamesInputPage>();
public ImplementMethodRefactoringWizard(ImplementMethodRefactoring refactoring) { public ImplementMethodRefactoringWizard(ImplementMethodRefactoring refactoring) {
super(refactoring, WIZARD_BASED_USER_INTERFACE); super(refactoring, WIZARD_BASED_USER_INTERFACE);
@ -54,11 +53,12 @@ public class ImplementMethodRefactoringWizard extends RefactoringWizard {
} }
/** /**
* - When cancelling the wizard, RefactoringASTCache gets disposed and releases the lock on the index but * When canceling the wizard, RefactoringASTCache gets disposed and releases the lock on
* the preview jobs might still be running and access the index or an index based AST so we need to make sure they * the index but the preview jobs might still be running and access the index or an index-based
* are done before disposing the cache * AST so we need to make sure they are done before disposing the cache
* - When proceeding to the last page and finishing the wizard, the * <p>
* refactoring will run and possibly use concurrently the same ASTs that the jobs use, so we need to make * When proceeding to the last page and finishing the wizard, the refactoring will run
* and possibly use concurrently the same ASTs that the jobs use, so we need to make
* sure the jobs are joined. * sure the jobs are joined.
*/ */
protected void cancelAndJoinPreviewJobs() { protected void cancelAndJoinPreviewJobs() {
@ -67,13 +67,14 @@ public class ImplementMethodRefactoringWizard extends RefactoringWizard {
isOnePreviewJobRunning |= parameterNamesInputPage.cancelPreviewJob(); isOnePreviewJobRunning |= parameterNamesInputPage.cancelPreviewJob();
} }
// There are good chances that one job is still running, show a progress bar to the user, join everything // There are good chances that one job is still running, show a progress bar to the user,
// join everything.
if (isOnePreviewJobRunning) { if (isOnePreviewJobRunning) {
try { try {
getContainer().run(false, false, new IRunnableWithProgress() { getContainer().run(false, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask(Messages.ImplementMethodRefactoringWizard_CancelingPreviewGeneration, pagesMap.size() + 1); monitor.beginTask(Messages.ImplementMethodRefactoringWizard_CancelingPreviewGeneration,
pagesMap.size() + 1);
monitor.worked(1); monitor.worked(1);
for (ParameterNamesInputPage parameterNamesInputPage : pagesMap.values()) { for (ParameterNamesInputPage parameterNamesInputPage : pagesMap.values()) {
@ -89,10 +90,9 @@ public class ImplementMethodRefactoringWizard extends RefactoringWizard {
} catch (InterruptedException e) { } catch (InterruptedException e) {
// ignore since not cancelable // ignore since not cancelable
} }
} } else {
// We don't take any chances, we still join everything. But there are good chances that the jobs are stopped // We don't take any chances, we still join everything. But there are good chances that
// so we don't show a progress bar. // the jobs are stopped so we don't show a progress bar.
else {
for (ParameterNamesInputPage parameterNamesInputPage : pagesMap.values()) { for (ParameterNamesInputPage parameterNamesInputPage : pagesMap.values()) {
parameterNamesInputPage.joinPreviewJob(); parameterNamesInputPage.joinPreviewJob();
} }