1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-13 11:15:38 +02:00

Bug 305118: Add include for relative inclusion from different folder.

This commit is contained in:
Markus Schorn 2010-03-15 13:41:02 +00:00
parent e5da8307a0
commit 05957c8002

View file

@ -548,26 +548,25 @@ public class AddIncludeOnSelectionAction extends TextEditorAction {
} }
} }
} }
if (k == 0) { if (k != 0) {
return null; Arrays.sort(ballotBox, 0, k);
} String contender = ballotBox[0];
Arrays.sort(ballotBox, 0, k); int votes = 1;
String contender = ballotBox[0]; String winner = contender;
int votes = 1; int winnerVotes = votes;
String winner = contender; for (int i = 1; i < k; i++) {
int winnerVotes = votes; if (!ballotBox[i].equals(contender)) {
for (int i = 1; i < k; i++) { contender = ballotBox[i];
if (!ballotBox[i].equals(contender)) { votes = 1;
contender = ballotBox[i]; }
votes = 1; votes++;
} if (votes > winnerVotes) {
votes++; winner = contender;
if (votes > winnerVotes) { winnerVotes = votes;
winner = contender; }
winnerVotes = votes;
} }
return new RequiredInclude(winner, systemIncludeVotes * 2 >= k);
} }
return new RequiredInclude(winner, systemIncludeVotes * 2 >= k);
} }
// The file has never been included before. // The file has never been included before.