1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 367393 - [Implement Method] Refactoring wizard opens even if there

are no method to implement
This commit is contained in:
Marc-Andre Laperle 2012-01-04 12:53:19 -05:00
parent e560beb08a
commit d47055dbd7
3 changed files with 20 additions and 14 deletions

View file

@ -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
@ -91,7 +91,12 @@ public class ImplementMethodRefactoring extends CRefactoring2 {
super.checkInitialConditions(sm.newChild(6));
if (!initStatus.hasFatalError()) {
data.setMethodDeclarations(findUnimplementedMethodDeclarations(pm));
List<IASTSimpleDeclaration> unimplementedMethodDeclarations = findUnimplementedMethodDeclarations(pm);
if (unimplementedMethodDeclarations.isEmpty()) {
initStatus.addFatalError(Messages.ImplementMethodRefactoring_NoMethodToImplement);
}
else {
data.setMethodDeclarations(unimplementedMethodDeclarations);
if (selectedRegion.getLength() > 0) {
IASTSimpleDeclaration methodDeclaration = SelectionHelper.findFirstSelectedDeclaration(selectedRegion, astCache.getAST(tu, pm));
@ -104,6 +109,7 @@ public class ImplementMethodRefactoring extends CRefactoring2 {
}
}
}
}
sm.done();
return initStatus;
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2011 IBM Corporation and others.
* Copyright (c) 2005, 2012 IBM Corporation 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
@ -21,7 +21,7 @@ public final class Messages extends NLS {
public static String ImplementMethodRefactoringPage_GeneratingPreview;
public static String ImplementMethodRefactoringPage_PreviewCanceled;
public static String ImplementMethodRefactoringPage_PreviewGenerationNotPossible;
public static String ImplementMethodRefactoring_NoMethodSelected;
public static String ImplementMethodRefactoring_NoMethodToImplement;
public static String ImplementMethodRefactoring_MethodHasImpl;
public static String ImplementMethodRefactoring_NoImplFile;
public static String ImplementMethodRefactoringWizard_CancelingPreviewGeneration;

View file

@ -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
@ -20,7 +20,7 @@ ImplementMethodInputPage_DeselectAll=Deselect All
ImplementMethodRefactoringPage_PreviewGenerationNotPossible=Preview generation not possible
ImplementMethodRefactoringPage_GeneratingPreview=Generating preview...
ImplementMethodRefactoringPage_PreviewCanceled=Preview canceled
ImplementMethodRefactoring_NoMethodSelected=No method declaration selected
ImplementMethodRefactoring_NoMethodToImplement=No methods to implement found.
ImplementMethodRefactoring_MethodHasImpl=This method already has an implementation.
ImplementMethodRefactoring_NoImplFile=No implementation file found for one or more method. Inserting definition(s) into the header file.
ImplementMethodRefactoringWizard_CancelingPreviewGeneration=Canceling preview generation