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

Bug 342519 - Toggle refactoring: misleading error message

This commit is contained in:
Marc-Andre Laperle 2011-04-12 16:49:26 +00:00
parent ca1d3510c6
commit db2ef6ceaa
3 changed files with 17 additions and 0 deletions

View file

@ -89,6 +89,10 @@ ITextSelection selection,
}
if (node instanceof IASTSimpleDeclaration) {
IASTDeclarator[] declarators = ((IASTSimpleDeclaration) node).getDeclarators();
if (declarators.length > 1) {
throw new NotSupportedException(Messages.DeclaratorFinder_MultipleDeclarators);
}
if (declarators.length == 1 &&
declarators[0] instanceof IASTFunctionDeclarator)
return (IASTFunctionDeclarator) declarators[0];

View file

@ -17,6 +17,7 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.ui.refactoring.togglefunction.messages"; //$NON-NLS-1$
public static String DeclaratorFinder_NestedFunction;
public static String DeclaratorFinder_NoDeclarator;
public static String DeclaratorFinder_MultipleDeclarators;
public static String RefactoringJob_UndoName;
public static String ToggleFileCreator_andMove;
public static String ToggleFileCreator_CanNotCreateNewFile;

View file

@ -1,5 +1,17 @@
###############################################################################
# Copyright (c) 2011 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
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Martin Schwab & Thomas Kallenberg - initial API and implementation
###############################################################################
DeclaratorFinder_NestedFunction=Nested function declarations not supported
DeclaratorFinder_NoDeclarator=cannot work without declarator
DeclaratorFinder_MultipleDeclarators=cannot work with multiple declarators
RefactoringJob_UndoName=toggle function definition
ToggleFileCreator_andMove=\ and move
ToggleFileCreator_CanNotCreateNewFile=Cannot create new filechange