Commit dc29a25d authored by Michael Schwarz's avatar Michael Schwarz
Browse files

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

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