Commit 5161af32 authored by Michael Schwarz's avatar Michael Schwarz 🤔
Browse files

fixed insert location of precedences

parent 97758e5c
...@@ -823,6 +823,8 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi ...@@ -823,6 +823,8 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
resolutionOptions.select(0); resolutionOptions.select(0);
changeColors(backgroundColorShiftReduce,foregroundColorShiftReduce); changeColors(backgroundColorShiftReduce,foregroundColorShiftReduce);
} }
partOfCurrentConnected = false;
} }
// replace (*) generated by CUP with BULLET U+2022 • // replace (*) generated by CUP with BULLET U+2022 •
...@@ -950,8 +952,7 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi ...@@ -950,8 +952,7 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
} }
public CupConflictsView(Composite realParent, Jumper jumper, public CupConflictsView(Composite realParent, Jumper jumper,CupTextEditor editor) {
CupTextEditor editor) {
super(realParent); super(realParent);
Composite parent = getMain(); Composite parent = getMain();
...@@ -1167,18 +1168,21 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi ...@@ -1167,18 +1168,21 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
positionForPrec = r.symbols.get(r.symbols.size() - 1).getEnd().getOffsetFromStart(); positionForPrec = r.symbols.get(r.symbols.size() - 1).getEnd().getOffsetFromStart();
toInsert = "\n\n//Precedences added by Eclipse plugin\n" + toInsert; toInsert = "\n\n//Precedences added by Eclipse plugin\n" + toInsert;
} else { } else {
positionForPrec = r.precedences.get(r.precedences.size() - 1).getRange().getBegin() positionForPrec = r.precedences.get(0).getRange().getBegin()
.getOffsetFromStart(); .getOffsetFromStart();
toInsert = toInsert + "\n"; toInsert = toInsert + "\n";
} }
document.replace(positionForPrec, 0, toInsert); document.replace(positionForPrec, 0, toInsert);
abortConnectedResolution();
} catch (BadLocationException e) { } catch (BadLocationException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
finally{
abortConnectedResolution();
}
} }
private void insertPrecedence(terminal terminal,Precedence.Type assoc){ private void insertPrecedence(terminal terminal,Precedence.Type assoc){
...@@ -1195,7 +1199,7 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi ...@@ -1195,7 +1199,7 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
toInsert = "\n\n//Precedences added by Eclipse plugin\n" + toInsert; toInsert = "\n\n//Precedences added by Eclipse plugin\n" + toInsert;
} }
else { else {
positionForPrec = r.precedences.get(r.precedences.size()-1).getRange().getBegin().getOffsetFromStart(); positionForPrec = r.precedences.get(0).getRange().getBegin().getOffsetFromStart();
toInsert = toInsert + "\n"; toInsert = toInsert + "\n";
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment