Commit 103d8f37 authored by Johannes Roith's avatar Johannes Roith

_Attempt_ to fix height calculation in conflicts view.

parent a34379e3
......@@ -13,6 +13,7 @@ import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
......@@ -62,10 +63,9 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
class ConflictPanel extends Composite {
private static final int BASE_HEIGHT = 90;
private static final int BASE_HEIGHT = 60;
private static final int COLUMNS = 3;
private static final int HEADING_FONT_SIZE = 14;
private static final int SIZE_INCREASE_PER_LINE = 11;
private Conflict conflict;
......@@ -200,6 +200,7 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
public void update(ConflictResolutionManager crm, Conflict conflict) {
this.conflict = conflict;
gridData.heightHint = BASE_HEIGHT;
links.clear();
int linkCounter = 0;
......@@ -207,7 +208,9 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
lalr_state state = conflict.getState();
Pair<String,Integer> hint = makeConflictResolutionHint(crm, state);
resolutionHint.setText(hint.getFirst());
gridData.heightHint = BASE_HEIGHT + hint.getSecond() * SIZE_INCREASE_PER_LINE;
gridData.heightHint += resolutionHint.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
System.err.println(gridData.heightHint);
int cindex = state.index();
stateLabel.setText("<a href=\"" + cindex + "\">State: " + cindex + "</a>");
......@@ -310,11 +313,14 @@ public class CupConflictsView extends FailableView implements ICupEditorPageVisi
builder.append("</a>");
if (i != size - 1)
builder.append(", ");
gridData.heightHint += SIZE_INCREASE_PER_LINE;
// gridData.heightHint += SIZE_INCREASE_PER_LINE;
}
detailText.setText(builder.toString());
gridData.heightHint += detailText.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
} else {
throw new RuntimeException("unexpected conflict type.");
}
......
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