Commit 0670175a authored by Michael Schwarz's avatar Michael Schwarz

Display number of conflicts in current connected

parent cd73cf64
......@@ -389,10 +389,11 @@ class ConflictPanel extends Composite {
/**
* Marks the conflict as affected if it is by the precedences to be inserted
* This entails setting the background color and hiding/showing/disbaeling the dropdown
* This entails setting the background color and hiding/showing/disabling the dropdown
* @param pti precedences to be inserted
* @return true iff conflict is indeed affected
*/
public void markIfAffected(PrecedenceToInsert pti){
public boolean markIfAffected(PrecedenceToInsert pti){
if(conflict instanceof ShiftReduceConflict && pti.isAffected(srdetails)){
partOfCurrentConnected = true;
......@@ -428,6 +429,7 @@ class ConflictPanel extends Composite {
}
resolutionButton.setEnabled(false);
return true;
}
else {
partOfCurrentConnected = false;
......@@ -439,6 +441,8 @@ class ConflictPanel extends Composite {
changeColors(backgroundColorShiftReduceUnrelated,foregroundColorShiftReduceUnrelated);
}
return false;
}
}
......
......@@ -357,9 +357,14 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
}
void markAllAffected(){
int affected = 0;
for(ConflictPanel c : conflictPanels){
c.markIfAffected(currentPrecs);
if(c.markIfAffected(currentPrecs)){
affected++;
}
}
this.connectedResolutionLabel.setText("Currently resolving a set of conflicts that are connected (at least " + affected +" conflicts involved).");
}
void addFirstPrecedence(terminal t,terminal other){
......@@ -381,12 +386,13 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
Shell shell = new Shell(Display.getCurrent());
MessageBox box = new MessageBox(shell,SWT.ICON_WARNING | SWT.OK);
box.setText("Information");
box.setMessage("This affects some other conflicts. These are marked now. Please resolve all those as well."
box.setMessage("This affects some other conflicts. These are marked now. Please resolve all those as well.\n"
+ "The effects if no further precedences are inserted are simulated right now.");
box.open();
currentPrecs = new PrecedenceToInsert();
this.connectedResolutionLabel.setText("Currently resolving a set of conflicts that are connected.");
// Text of label already set in the markAllAffected()
this.connectedResolutionLabel.setVisible(true);
this.connectedResolutionAbort.setVisible(true);
this.connectedResolutionApply.setVisible(true);
refreshScrolledLayout();
......@@ -394,7 +400,7 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
private void abortConnectedResolution(){
currentPrecs = new PrecedenceToInsert();
this.connectedResolutionLabel.setText("");
this.connectedResolutionLabel.setVisible(false);
this.connectedResolutionAbort.setVisible(false);
this.connectedResolutionApply.setVisible(false);
......@@ -448,8 +454,6 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
}
}
//TODO: What happens with breakpoints if we insert precedences
void insertPrecedence(terminal terminal,Precedence.Type assoc){
try {
String toInsert = "precedence " + assoc.toString().toLowerCase() + " " + terminal.name()+ "; // Inserted by Eclipse plugin";
......@@ -470,7 +474,6 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
document.replace(positionForPrec, 0, toInsert);
} catch (BadLocationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
......
Markdown is supported
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