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-01-06 03:12:30 +00:00
parent 3df7d3854f
commit 46b2750a00

View file

@ -9,7 +9,6 @@
* Contributors: * Contributors:
* Institute for Software - initial API and implementation * Institute for Software - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.ui.refactoring.implementmethod; package org.eclipse.cdt.internal.ui.refactoring.implementmethod;
import java.util.ArrayList; import java.util.ArrayList;
@ -37,15 +36,14 @@ import org.eclipse.cdt.internal.ui.refactoring.utils.NodeHelper;
* Findes the information that are needed to tell where a MethodDefinition of a certain method declaration should be inserted. * Findes the information that are needed to tell where a MethodDefinition of a certain method declaration should be inserted.
* *
* @author Mirko Stocker, Lukas Felber * @author Mirko Stocker, Lukas Felber
*
*/ */
public class MethodDefinitionInsertLocationFinder { public class MethodDefinitionInsertLocationFinder {
private static IASTNode findFunctionDefinitionInParents(IASTNode node) { private static IASTNode findFunctionDefinitionInParents(IASTNode node) {
if(node == null) { if (node == null) {
return null; return null;
} else if(node instanceof IASTFunctionDefinition) { } else if (node instanceof IASTFunctionDefinition) {
if(node.getParent() instanceof ICPPASTTemplateDeclaration) { if (node.getParent() instanceof ICPPASTTemplateDeclaration) {
node = node.getParent(); node = node.getParent();
} }
return node; return node;
@ -55,7 +53,7 @@ public class MethodDefinitionInsertLocationFinder {
private static IASTNode findFirstSurroundingParentFunctionNode(IASTNode definition) { private static IASTNode findFirstSurroundingParentFunctionNode(IASTNode definition) {
IASTNode functionDefinitionInParents = findFunctionDefinitionInParents(definition); IASTNode functionDefinitionInParents = findFunctionDefinitionInParents(definition);
if(functionDefinitionInParents == null || functionDefinitionInParents.getNodeLocations().length == 0) { if (functionDefinitionInParents == null || functionDefinitionInParents.getNodeLocations().length == 0) {
return null; return null;
} }
return functionDefinitionInParents; return functionDefinitionInParents;
@ -86,17 +84,15 @@ public class MethodDefinitionInsertLocationFinder {
} }
} }
IPath path = file.getLocation().removeFileExtension().addFileExtension("cpp"); //$NON-NLS-1$ IPath path = file.getLocation().removeFileExtension().addFileExtension("cpp"); //$NON-NLS-1$
IFile fileForLocation = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path); IFile fileForLocation = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
if(fileForLocation != null && fileForLocation.exists()) { if (fileForLocation != null && fileForLocation.exists()) {
result.setInsertFile(fileForLocation); result.setInsertFile(fileForLocation);
} }
return result; return result;
} }
/** /**
* Search the given class for all IASTSimpleDeclarations occuring before 'method' and return them in reverse order. * Search the given class for all IASTSimpleDeclarations occuring before 'method' and return them in reverse order.
* *