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:
parent
e560beb08a
commit
d47055dbd7
3 changed files with 20 additions and 14 deletions
|
@ -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
|
* Rapperswil, University of applied sciences and others
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
@ -7,8 +7,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Institute for Software - initial API and implementation
|
* Institute for Software - initial API and implementation
|
||||||
* Marc-Andre Laperle
|
* Marc-Andre Laperle
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.refactoring.implementmethod;
|
package org.eclipse.cdt.internal.ui.refactoring.implementmethod;
|
||||||
|
|
||||||
|
@ -91,14 +91,20 @@ public class ImplementMethodRefactoring extends CRefactoring2 {
|
||||||
super.checkInitialConditions(sm.newChild(6));
|
super.checkInitialConditions(sm.newChild(6));
|
||||||
|
|
||||||
if (!initStatus.hasFatalError()) {
|
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) {
|
if (selectedRegion.getLength() > 0) {
|
||||||
IASTSimpleDeclaration methodDeclaration = SelectionHelper.findFirstSelectedDeclaration(selectedRegion, astCache.getAST(tu, pm));
|
IASTSimpleDeclaration methodDeclaration = SelectionHelper.findFirstSelectedDeclaration(selectedRegion, astCache.getAST(tu, pm));
|
||||||
if (NodeHelper.isMethodDeclaration(methodDeclaration)) {
|
if (NodeHelper.isMethodDeclaration(methodDeclaration)) {
|
||||||
for (MethodToImplementConfig config : data.getMethodDeclarations()) {
|
for (MethodToImplementConfig config : data.getMethodDeclarations()) {
|
||||||
if (config.getDeclaration() == methodDeclaration) {
|
if (config.getDeclaration() == methodDeclaration) {
|
||||||
config.setChecked(true);
|
config.setChecked(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* 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_GeneratingPreview;
|
||||||
public static String ImplementMethodRefactoringPage_PreviewCanceled;
|
public static String ImplementMethodRefactoringPage_PreviewCanceled;
|
||||||
public static String ImplementMethodRefactoringPage_PreviewGenerationNotPossible;
|
public static String ImplementMethodRefactoringPage_PreviewGenerationNotPossible;
|
||||||
public static String ImplementMethodRefactoring_NoMethodSelected;
|
public static String ImplementMethodRefactoring_NoMethodToImplement;
|
||||||
public static String ImplementMethodRefactoring_MethodHasImpl;
|
public static String ImplementMethodRefactoring_MethodHasImpl;
|
||||||
public static String ImplementMethodRefactoring_NoImplFile;
|
public static String ImplementMethodRefactoring_NoImplFile;
|
||||||
public static String ImplementMethodRefactoringWizard_CancelingPreviewGeneration;
|
public static String ImplementMethodRefactoringWizard_CancelingPreviewGeneration;
|
||||||
|
|
|
@ -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
|
# Rapperswil, University of applied sciences and others
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
# 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_PreviewGenerationNotPossible=Preview generation not possible
|
||||||
ImplementMethodRefactoringPage_GeneratingPreview=Generating preview...
|
ImplementMethodRefactoringPage_GeneratingPreview=Generating preview...
|
||||||
ImplementMethodRefactoringPage_PreviewCanceled=Preview canceled
|
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_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.
|
ImplementMethodRefactoring_NoImplFile=No implementation file found for one or more method. Inserting definition(s) into the header file.
|
||||||
ImplementMethodRefactoringWizard_CancelingPreviewGeneration=Canceling preview generation
|
ImplementMethodRefactoringWizard_CancelingPreviewGeneration=Canceling preview generation
|
Loading…
Add table
Reference in a new issue