mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 07:15:39 +02:00
Cosmetics.
This commit is contained in:
parent
415903e978
commit
bf2a1b3472
1 changed files with 4 additions and 7 deletions
|
@ -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 org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
|
@ -25,7 +24,6 @@ import org.eclipse.cdt.internal.ui.refactoring.utils.TranslationUnitHelper;
|
||||||
* Contains all the infos needet to insert at the correct position.
|
* Contains all the infos needet to insert at the correct position.
|
||||||
*
|
*
|
||||||
* @author Lukas Felber
|
* @author Lukas Felber
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class InsertLocation {
|
public class InsertLocation {
|
||||||
private IFile insertFile;
|
private IFile insertFile;
|
||||||
|
@ -72,24 +70,23 @@ public class InsertLocation {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IASTTranslationUnit getTargetTranslationUnit() throws CoreException{
|
public IASTTranslationUnit getTargetTranslationUnit() throws CoreException{
|
||||||
if(targetTranslationUnit == null) {
|
if (targetTranslationUnit == null) {
|
||||||
loadTargetTranslationUnit();
|
loadTargetTranslationUnit();
|
||||||
}
|
}
|
||||||
return targetTranslationUnit;
|
return targetTranslationUnit;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadTargetTranslationUnit() throws CoreException{
|
private void loadTargetTranslationUnit() throws CoreException{
|
||||||
IASTNode affectedNode = getAffectedNode();
|
IASTNode affectedNode = getAffectedNode();
|
||||||
if(affectedNode != null) {
|
if (affectedNode != null) {
|
||||||
targetTranslationUnit = affectedNode.getTranslationUnit();
|
targetTranslationUnit = affectedNode.getTranslationUnit();
|
||||||
} else if(hasFile()) {
|
} else if (hasFile()) {
|
||||||
targetTranslationUnit = TranslationUnitHelper.loadTranslationUnit(insertFile, true);
|
targetTranslationUnit = TranslationUnitHelper.loadTranslationUnit(insertFile, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInsertPosition() {
|
public int getInsertPosition() {
|
||||||
if(nodeToInsertBefore != null) {
|
if (nodeToInsertBefore != null) {
|
||||||
return nodeToInsertBefore.getFileLocation().getNodeOffset();
|
return nodeToInsertBefore.getFileLocation().getNodeOffset();
|
||||||
} else if (nodeToInsertAfter != null) {
|
} else if (nodeToInsertAfter != null) {
|
||||||
return nodeToInsertAfter.getFileLocation().getNodeOffset() + nodeToInsertAfter.getFileLocation().getNodeLength();
|
return nodeToInsertAfter.getFileLocation().getNodeOffset() + nodeToInsertAfter.getFileLocation().getNodeLength();
|
||||||
|
|
Loading…
Add table
Reference in a new issue