Commit 3c807939 authored by Michael Schwarz's avatar Michael Schwarz

resolution of connected conflicts can be aborted

parent dd6a0bab
......@@ -74,6 +74,7 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
private boolean isVisible;
private List<ConflictPanel> conflictPanels;
private Label countConflictsLabel, connectedResolutionLabel;
private Button connectedResolutionAbort;
private ScrolledComposite scrolled;
private Composite list;
......@@ -96,6 +97,10 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
public void add(terminal t){
terminals.add(t);
for(ConflictPanel c : conflictPanels){
c.markIfAffected(this);
}
}
}
......@@ -494,15 +499,24 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
resolutionButton.setEnabled(false);
}
else {
resolutionButton.setEnabled(false);
resolutionOptions.setEnabled(false);
if(conflict instanceof ShiftReduceConflict){
resolutionButton.setEnabled(false);
resolutionOptions.setEnabled(false);
changeColors(backgroundColorShiftReduceUnrelated,foregroundColorShiftReduceUnrelated);
}
}
}
public void connectedEditAborted(){
if(conflict instanceof ShiftReduceConflict){
resolutionButton.setEnabled(true);
resolutionOptions.setEnabled(true);
resolutionOptions.select(0);
changeColors(backgroundColorShiftReduce,foregroundColorShiftReduce);
}
}
// replace (*) generated by CUP with BULLET U+2022 •
private String prettyString(lalr_item item) throws internal_error {
return item.toString().replace("(*)", "\u2022");
......@@ -530,11 +544,6 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
if(srdetails.shiftAffectsOthers && resolutionOptions.getSelectionIndex() == 1){
beginConnectedResolution();
currentPrecs.add(srdetails.shift);
for(ConflictPanel c : conflictPanels){
c.markIfAffected(currentPrecs);
}
return;
}
......@@ -595,6 +604,22 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
this.connectedResolutionLabel = new Label(list,SWT.NONE);
this.connectedResolutionLabel.setBackground(new Color(Display.getCurrent(), Colors.white));
this.connectedResolutionAbort = new Button(list,SWT.PUSH);
this.connectedResolutionAbort.setVisible(false);
this.connectedResolutionAbort.setText("Abort");
this.connectedResolutionAbort.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
abortConnectedResolution();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
refreshScrolledLayout();
}
......@@ -700,6 +725,7 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
}
}
private void beginConnectedResolution(){
Shell shell = new Shell(Display.getCurrent());
MessageBox box = new MessageBox(shell,SWT.ICON_WARNING | SWT.OK);
......@@ -710,6 +736,19 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
currentPrecs = new PrecedenceToInsert();
this.connectedResolutionLabel.setText("Currently resolving a set of conflicts that are connected.");
this.connectedResolutionAbort.setVisible(true);
refreshScrolledLayout();
}
private void abortConnectedResolution(){
currentPrecs = new PrecedenceToInsert();
this.connectedResolutionLabel.setText("");
this.connectedResolutionAbort.setVisible(false);
for(ConflictPanel c : conflictPanels){
c.connectedEditAborted();
}
refreshScrolledLayout();
}
......
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