1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-01 21:35:40 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2010-06-27 21:38:53 +00:00
parent 494b2dc62c
commit 2afd46deb6

View file

@ -122,7 +122,7 @@ public class TextSearchWrapper {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
for (int i = 0; i < filePattern.length(); i++) { for (int i = 0; i < filePattern.length(); i++) {
char c = filePattern.charAt(i); char c = filePattern.charAt(i);
switch(c) { switch (c) {
case '\\': case '\\':
case '(': case '(':
case ')': case ')':
@ -146,7 +146,7 @@ public class TextSearchWrapper {
break; break;
default: default:
result.append(c); result.append(c);
break; break;
} }
} }
return result.toString(); return result.toString();
@ -288,16 +288,16 @@ public class TextSearchWrapper {
}; };
private int findLocation(CRefactoringMatch match, ArrayList<int[]> states) { private int findLocation(CRefactoringMatch match, ArrayList<int[]> states) {
int pos= Collections.binarySearch(states, new int[] {match.getOffset()}, COMPARE_FIRST_INTEGER); int pos = Collections.binarySearch(states, new int[] {match.getOffset()}, COMPARE_FIRST_INTEGER);
if (pos<0) { if (pos < 0) {
pos= -pos-2; pos= -pos - 2;
if (pos < 0) { if (pos < 0) {
pos=0; pos = 0;
} }
} }
int endOffset= match.getOffset() + match.getLength(); int endOffset= match.getOffset() + match.getLength();
int location= 0; int location= 0;
while (pos<states.size()) { while (pos < states.size()) {
int[] info= states.get(pos); int[] info= states.get(pos);
if (info[0] >= endOffset) { if (info[0] >= endOffset) {
break; break;
@ -312,8 +312,7 @@ public class TextSearchWrapper {
Reader reader; Reader reader;
SimpleScanner scanner= new SimpleScanner(); SimpleScanner scanner= new SimpleScanner();
try { try {
reader = new BufferedReader( reader = new BufferedReader(new InputStreamReader(file.getContents(), file.getCharset()));
new InputStreamReader(file.getContents(), file.getCharset()));
} catch (CoreException e) { } catch (CoreException e) {
return; return;
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
@ -324,9 +323,9 @@ public class TextSearchWrapper {
scanner.setReuseToken(true); scanner.setReuseToken(true);
Token token; Token token;
int lastState= 0; int lastState= 0;
while((token= scanner.nextToken()) != null) { while ((token= scanner.nextToken()) != null) {
int state= CRefactory.OPTION_IN_CODE; int state= CRefactory.OPTION_IN_CODE;
switch(token.getType()) { switch (token.getType()) {
case Token.tLINECOMMENT: case Token.tLINECOMMENT:
case Token.tBLOCKCOMMENT: case Token.tBLOCKCOMMENT:
state= CRefactory.OPTION_IN_COMMENT; state= CRefactory.OPTION_IN_COMMENT;
@ -354,7 +353,7 @@ public class TextSearchWrapper {
} finally { } finally {
try { try {
reader.close(); reader.close();
} catch (IOException e1) { } catch (IOException e) {
} }
} }
} }