Commit 8b68d701 authored by Johannes Roith's avatar Johannes Roith

- Fix layout issues in conflicts view.

- Add jumper interface for conflicts graph.
parent b69b734b
......@@ -5,6 +5,7 @@ import org.eclipse.jface.text.IRegion;
import de.in.tum.www2.cup.Position;
import de.in.tum.www2.cup.Range;
import de.tum.in.www2.cupplugin.PluginUtility;
public class Jumper {
......@@ -13,6 +14,15 @@ public class Jumper {
Jumper (MultiPageEditor mpe) {
this.mpe = mpe;
}
public void jumpToConflictGraphState(int index) {
// TODO: call something here.
PluginUtility.showMessage("Jumper: Jump to conflict graph state - not yet implemented!");
mpe.jumpTo(mpe.CONFLICT_GRAPH_PAGE_INDEX);
}
public void jumpToEditorSelection(Range range) {
if (range == null)
......
......@@ -57,6 +57,9 @@ public class CupConflictsView implements ICupEditorPageVisibility,
class ConflictPanel extends Composite {
private static final int COLUMNS = 3;
private static final int HEADING_FONT_SIZE = 14;
private Label conflictTypeLabel;
private Link stateLabel;
private Label symbolLabel;
......@@ -83,34 +86,34 @@ public class CupConflictsView implements ICupEditorPageVisibility,
data.heightHint = 80;
setLayoutData(data);
TableWrapLayout layout = new TableWrapLayout();
layout.numColumns = 3;
layout.verticalSpacing = 8;
setLayout(layout);
GridLayout gl = new GridLayout();
gl.numColumns = COLUMNS;
gl.makeColumnsEqualWidth = false;
setLayout(gl);
this.conflictTypeLabel = new Label(this, SWT.NONE);
FontData[] fD = conflictTypeLabel.getFont().getFontData();
fD[0].setHeight(14);
fD[0].setHeight(HEADING_FONT_SIZE);
conflictTypeLabel.setFont( new Font(Display.getCurrent(),fD[0]));
this.symbolLabel = new Label(this, SWT.NONE);
this.stateLabel = new Link(this, SWT.NONE);
GridData td2 = new GridData(GridData.HORIZONTAL_ALIGN_END);
td2.grabExcessHorizontalSpace = true;
td2.widthHint = 60;
stateLabel.setLayoutData(td2);
stateLabel.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
PluginUtility.showMessage("Not yet implemented!");
jumper.jumpToConflictGraphState(Integer
.parseInt(e.text));
}
});
this.detailText = new Link(this, SWT.WRAP);
this.detailText.setBackground(new Color(Display.getCurrent(),
Colors.lightGray));
TableWrapData td = new TableWrapData();
td.colspan = 1;
detailText.setLayoutData(td);
Composite detailWrapper = makeDetailWrapper(COLUMNS);
this.detailText = new Link(detailWrapper, SWT.WRAP);
detailText.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
......@@ -121,6 +124,26 @@ public class CupConflictsView implements ICupEditorPageVisibility,
});
}
private Composite makeDetailWrapper(int columns) {
Composite detailWrapper = new Composite(this, SWT.WRAP);
detailWrapper.setBackground(new Color(Display.getCurrent(), Colors.red));
GridData detailTextData = new GridData();
detailTextData.grabExcessHorizontalSpace = true;
detailTextData.horizontalSpan = columns;
detailWrapper.setLayoutData(detailTextData);
TableWrapLayout layout = new TableWrapLayout();
layout.bottomMargin = 0;
layout.topMargin = 0;
layout.leftMargin = 0;
layout.rightMargin = 0;
layout.makeColumnsEqualWidth = false;
layout.numColumns = 1;
layout.verticalSpacing = 0;
detailWrapper.setLayout(layout);
return detailWrapper;
}
private void changeColors(Color background, Color foreground) {
setBackground(background);
detailText.setBackground(background);
......@@ -135,7 +158,8 @@ public class CupConflictsView implements ICupEditorPageVisibility,
links.clear();
int linkCounter = 0;
stateLabel.setText("<a href=\"TODO\">State: " + conflict.getState().index() + "</a>");
int cindex = conflict.getState().index();
stateLabel.setText("<a href=\"" + cindex + "\">State: " + cindex + "</a>");
if (conflict instanceof ReduceReduceConflict) {
ReduceReduceConflict rrc = (ReduceReduceConflict) conflict;
......
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