Commit dc29a25d authored by Michael Schwarz's avatar Michael Schwarz

panel for RR has buttons, deactivated when resolving other conflict +

bugfix
parent e183076d
......@@ -69,8 +69,8 @@ class ConflictPanel extends Composite {
private Color foregroundColorShiftReduce = new Color(Display.getCurrent(), Colors.conflictFgYellow);
private Color backgroundColorShiftReduceAffected = new Color(Display.getCurrent(), Colors.conflictBgRed);
private Color foregroundColorShiftReduceAffected = new Color(Display.getCurrent(), Colors.conflictFgRed);
private Color backgroundColorShiftReduceUnrelated = new Color(Display.getCurrent(), Colors.conflictBgGray);
private Color foregroundColorShiftReduceUnrelated = new Color(Display.getCurrent(), Colors.conflictFgGray);
private Color backgroundColorUnrelated = new Color(Display.getCurrent(), Colors.conflictBgGray);
private Color foregroundColorUnrelated = new Color(Display.getCurrent(), Colors.conflictFgGray);
private Color textConflictFixResolved = new Color(Display.getCurrent(), Colors.green);
private Color textDefault = new Color(Display.getCurrent(), Colors.black);
......@@ -244,9 +244,9 @@ class ConflictPanel extends Composite {
detailText.setText(makeReduceReduceDetailText(rrc,linkCounter));
gridData.heightHint += detailText.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
resolutionOptions.setVisible(false);
resolutionButton.setVisible(false);
resolutionOptions.removeAll();
resolutionOptions.setVisible(true);
resolutionButton.setVisible(true);
setReduceReduceResolutionOptions();
} else if (conflict instanceof ShiftReduceConflict) {
ShiftReduceConflict src = (ShiftReduceConflict) conflict;
......@@ -392,6 +392,14 @@ class ConflictPanel extends Composite {
}
}
private void setReduceReduceResolutionOptions(){
resolutionOptions.removeAll();
resolutionOptions.add("-- Choose an option --");
resolutionOptions.select(0);
resolutionOptions.add("Reduce with production 1");
resolutionOptions.add("Reduce with production 2");
}
/**
* Marks the conflict as affected if it is by the precedences to be inserted
* This entails setting the background color and hiding/showing/disabling the dropdown
......@@ -471,12 +479,10 @@ class ConflictPanel extends Composite {
partOfCurrentConnected = false;
forceEnableDropdown = false;
if(conflict instanceof ShiftReduceConflict){
resolutionButton.setEnabled(false);
resolutionOptions.setEnabled(false);
changeColors(backgroundColorShiftReduceUnrelated,foregroundColorShiftReduceUnrelated);
}
resolutionButton.setEnabled(false);
resolutionOptions.setEnabled(false);
changeColors(backgroundColorUnrelated,foregroundColorUnrelated);
return false;
}
......@@ -486,12 +492,16 @@ class ConflictPanel extends Composite {
* Abort a connected resolution. Enable dropdown and set to default values
*/
public void connectedEditAborted(){
resolutionButton.setEnabled(true);
resolutionOptions.setEnabled(true);
resolutionOptions.select(0);
resolutionOptions.setForeground(textDefault);
if(conflict instanceof ShiftReduceConflict){
resolutionButton.setEnabled(true);
resolutionOptions.setEnabled(true);
resolutionOptions.select(0);
changeColors(backgroundColorShiftReduce,foregroundColorShiftReduce);
resolutionOptions.setForeground(textDefault);
} else{
changeColors(backgroundColorReduceReduce,foregroundColorReduceReduce);
}
partOfCurrentConnected = false;
......
......@@ -123,8 +123,8 @@ class PrecedenceToInsert {
* @return true iff it can be changed
*/
public boolean canChangeDefaultResolution(ShiftReduceDetails srd){
return !((precs.containsKey(srd.shift) || originalEdge.getFirst().equals(srd.shift)) &&
(precs.containsKey(srd.reduce) || originalEdge.getFirst().equals(srd.reduce)));
return !((precs.containsKey(srd.shift) || (originalEdge != null && originalEdge.getFirst().equals(srd.shift))) &&
(precs.containsKey(srd.reduce) || (originalEdge != null && originalEdge.getFirst().equals(srd.reduce))));
}
/**
......
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