int start = marker.position.offset;
map.put(start, marker);
}
//create the participant that'll help (will not force a reparse)
final UndefinedVariableFixParticipant variableFixParticipant = new UndefinedVariableFixParticipant(false);
//These are the completions to apply. We must apply them all at once after finishing it because we can't do
//it one by one during the processing because that'd make markers change.
final List<ICompletionProposalExtension2> completionsToApply = new ArrayList<ICompletionProposalExtension2>();
//keeps the strings we've already treated.
final HashSet<String> treatedVars = new HashSet<String>();
//variable to hold whether we should keep on choosing the imports
final Boolean[] keepGoing = new Boolean[] { true };
final IDialogSettings dialogSettings = AnalysisPlugin.getDefault().getDialogSettings();
//analyse the markers (one by one)
for (final MarkerAnnotationAndPosition marker : map.values()) {
if (!keepGoing[0]) {
break;
}
try {
final int start = marker.position.offset;
final int end = start + marker.position.length;
if (start >= 0 && end > start) {
IDocument doc = ps.getDoc();
ArrayList<ICompletionProposal> props = new ArrayList<ICompletionProposal>();
try {
String string = doc.get(start, end - start);
if (treatedVars.contains(string)) {
continue;
}
variableFixParticipant.addProps(marker, null, null, ps, start, edit.getPythonNature(), edit,
props);
if (props.size() > 0) {
edit.selectAndReveal(start, end - start);
treatedVars.add(string);