mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 334051: Implement method sometimes doesn't add class name to methods in .cpp
https://bugs.eclipse.org/bugs/show_bug.cgi?id=334051 Patch by Marc-Andre Laperle
This commit is contained in:
parent
baa2c091e7
commit
3ae08fdeab
1 changed files with 16 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik
|
* Copyright (c) 2008, 2011 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
|
||||||
|
@ -17,6 +17,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
|
@ -72,9 +73,20 @@ public class NamespaceHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean checkFileNameAndLocation(final IFile insertFile, final int offset, IASTNode namespace) {
|
private static boolean checkFileNameAndLocation(final IFile insertFile, final int offset, IASTNode namespace) {
|
||||||
return namespace.getFileLocation().getFileName().endsWith(insertFile.getFullPath().toOSString())
|
boolean fileNameOk = namespace.getFileLocation().getFileName().endsWith(insertFile.getFullPath().toOSString());
|
||||||
&& offset >= namespace.getNodeLocations()[0].getNodeOffset()
|
if(!fileNameOk) {
|
||||||
&& offset < namespace.getNodeLocations()[0].getNodeOffset() + namespace.getNodeLocations()[0].getNodeLength();
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(IASTNodeLocation nodeLocation : namespace.getNodeLocations()) {
|
||||||
|
int nodeOffset = nodeLocation.getNodeOffset();
|
||||||
|
boolean locationOk = offset >= nodeOffset && offset < nodeOffset + nodeLocation.getNodeLength();
|
||||||
|
if(locationOk) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IASTName createNameWithTemplates(IASTNode declarationParent) {
|
private static IASTName createNameWithTemplates(IASTNode declarationParent) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue