mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Cosmetics.
This commit is contained in:
parent
9c5bcf4e4f
commit
a84636dec5
2 changed files with 8 additions and 10 deletions
|
@ -413,7 +413,7 @@ public abstract class ASTTranslationUnit extends ASTNode implements IASTTranslat
|
|||
copy.setLocationResolver(fLocationResolver);
|
||||
copy.setIsForContentAssist(fForContentAssist);
|
||||
|
||||
for(IASTDeclaration declaration : getDeclarations())
|
||||
for (IASTDeclaration declaration : getDeclarations())
|
||||
copy.addDeclaration(declaration == null ? null : declaration.copy());
|
||||
|
||||
copy.setOffsetAndLength(this);
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.eclipse.cdt.internal.ui.refactoring.Container;
|
|||
* Helper class to support operations concerning a selection.
|
||||
*
|
||||
* @author Mirko Stocker, Lukas Felber
|
||||
*
|
||||
*/
|
||||
public class SelectionHelper {
|
||||
|
||||
|
@ -46,8 +45,8 @@ public class SelectionHelper {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static IASTSimpleDeclaration findFirstSelectedDeclaration(final Region textSelection, IASTTranslationUnit translationUnit) {
|
||||
|
||||
public static IASTSimpleDeclaration findFirstSelectedDeclaration(final Region textSelection,
|
||||
IASTTranslationUnit translationUnit) {
|
||||
final Container<IASTSimpleDeclaration> container = new Container<IASTSimpleDeclaration>();
|
||||
|
||||
translationUnit.accept(new ASTVisitor() {
|
||||
|
@ -90,21 +89,20 @@ public class SelectionHelper {
|
|||
}
|
||||
|
||||
public static boolean isInSameFileSelection(Region textSelection, IASTNode node, IFile file) {
|
||||
if( isInSameFile(node, file) ) {
|
||||
if (isInSameFile(node, file)) {
|
||||
return SelectionHelper.isSelectionOnExpression(textSelection, node);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isSelectedFile(Region textSelection, IASTNode node, IFile file) {
|
||||
if( isInSameFile(node, file) ) {
|
||||
if (isInSameFile(node, file)) {
|
||||
return isExpressionWhollyInSelection(textSelection, node);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static Region createExpressionPosition(IASTNode expression) {
|
||||
|
||||
int start = Integer.MAX_VALUE;
|
||||
int nodeLength = 0;
|
||||
IASTNodeLocation[] nodeLocations = expression.getNodeLocations();
|
||||
|
@ -113,14 +111,14 @@ public class SelectionHelper {
|
|||
if (location instanceof IASTMacroExpansionLocation) {
|
||||
IASTMacroExpansionLocation macroLoc = (IASTMacroExpansionLocation) location;
|
||||
int nodeOffset = macroLoc.asFileLocation().getNodeOffset();
|
||||
if(nodeOffset < start) {
|
||||
if (nodeOffset < start) {
|
||||
start = nodeOffset;
|
||||
}
|
||||
nodeLength += macroLoc.asFileLocation().getNodeLength();
|
||||
}else {
|
||||
} else {
|
||||
IASTFileLocation loc = expression.getFileLocation();
|
||||
int nodeOffset = loc.getNodeOffset();
|
||||
if(nodeOffset < start) {
|
||||
if (nodeOffset < start) {
|
||||
start = nodeOffset;
|
||||
}
|
||||
nodeLength = loc.getNodeLength();
|
||||
|
|
Loading…
Add table
Reference in a new issue