From e02293b2feedd333d03ac8d1b119a73584960c5b Mon Sep 17 00:00:00 2001 From: Marc-Andre Laperle Date: Tue, 15 May 2012 12:46:28 -0400 Subject: [PATCH] Bug 379490 - [Implement method] NPE when a method needing a parameter input is not selected --- .../implementmethod/ParameterNamesInputPage.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ParameterNamesInputPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ParameterNamesInputPage.java index f66f1b442cc..0de86606430 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ParameterNamesInputPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ParameterNamesInputPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik + * Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik * Rapperswil, University of applied sciences and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -197,7 +197,14 @@ public class ParameterNamesInputPage extends UserInputWizardPage { } } + /** + * @return true if the preview job could still be running, false otherwise + */ protected boolean cancelPreviewJob() { + if (delayedPreviewUpdater == null) { + return false; + } + // We cannot rely on getState being accurate in all cases so we only use this // as a hint to change the preview text if (delayedPreviewUpdater.getState() != Job.NONE) { @@ -207,6 +214,10 @@ public class ParameterNamesInputPage extends UserInputWizardPage { } protected void joinPreviewJob() { + if (delayedPreviewUpdater == null) { + return; + } + try { delayedPreviewUpdater.join(); } catch (InterruptedException e1) {