Commit 0b21c97e authored by Johannes Roith's avatar Johannes Roith

Minor changes.

parent df2abecc
......@@ -10,6 +10,8 @@ public abstract class Conflict
public lalr_state getState() {
return state;
}
public abstract ConflictType getType();
public Conflict(lalr_state state) {
this.state = state;
......
package de.in.tum.www2.cup;
public enum ConflictType {
ShiftReduce,
ReduceReduce
}
......@@ -25,6 +25,11 @@ public class ReduceReduceConflict extends Conflict
return conflict2;
}
@Override
public ConflictType getType() {
return ConflictType.ReduceReduce;
}
public ReduceReduceConflict(lalr_state state, lalr_item conflict1, lalr_item conflict2, List<terminal> terminals) {
super(state);
this.conflict1 = conflict1;
......
......@@ -24,6 +24,11 @@ public class ShiftReduceConflict extends Conflict
return conflict2;
}
@Override
public ConflictType getType() {
return ConflictType.ShiftReduce;
}
public ShiftReduceConflict(lalr_state state, lalr_item conflict1, List<lalr_item> conflict2, terminal terminal) {
super(state);
this.conflict1 = conflict1;
......
......@@ -3,6 +3,7 @@ package de.tum.in.www2.cupplugin.editors;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import de.in.tum.www2.cup.ConflictType;
import de.in.tum.www2.cup.Position;
import de.in.tum.www2.cup.Range;
import de.tum.in.www2.cupplugin.PluginUtility;
......@@ -15,12 +16,11 @@ public class Jumper {
this.mpe = mpe;
}
public void jumpToConflictGraphState(int index) {
// TODO: call something here.
public void jumpToConflictGraphState(ConflictType conflictType, int index) {
PluginUtility.showMessage("Jumper: Jump to conflict graph state - not yet implemented!");
mpe.jumpTo(mpe.CONFLICT_GRAPH_PAGE_INDEX);
// TODO!
// mpe.getConflictGraphView().
}
......
......@@ -63,6 +63,10 @@ public class MultiPageEditor extends MultiPageEditorPart implements
return editor;
}
CupConflictGraphView getConflictGraphView() {
return conflictGraphView;
}
void createEditorPage(Jumper jumper) {
try {
editor = new CupTextEditor(jumper);
......
......@@ -24,6 +24,7 @@ import org.eclipse.ui.forms.widgets.TableWrapLayout;
import de.in.tum.www2.cup.Conflict;
import de.in.tum.www2.cup.ConflictManager;
import de.in.tum.www2.cup.ConflictType;
import de.in.tum.www2.cup.LALRResult;
import de.in.tum.www2.cup.Range;
import de.in.tum.www2.cup.ReduceReduceConflict;
......@@ -60,6 +61,8 @@ public class CupConflictsView implements ICupEditorPageVisibility,
private static final int COLUMNS = 3;
private static final int HEADING_FONT_SIZE = 14;
private Conflict conflict;
private Label conflictTypeLabel;
private Link stateLabel;
private Label symbolLabel;
......@@ -107,7 +110,10 @@ public class CupConflictsView implements ICupEditorPageVisibility,
stateLabel.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
jumper.jumpToConflictGraphState(Integer
if (conflict == null)
return;
jumper.jumpToConflictGraphState(conflict.getType(), Integer
.parseInt(e.text));
}
});
......@@ -155,6 +161,8 @@ public class CupConflictsView implements ICupEditorPageVisibility,
}
public void update(Conflict conflict) {
this.conflict = conflict;
links.clear();
int linkCounter = 0;
......@@ -324,10 +332,7 @@ public class CupConflictsView implements ICupEditorPageVisibility,
conflictPanels.add(new ConflictPanel(list, SWT.NONE));
}
}
System.out
.println("conflictPanels size: " + this.conflictPanels.size());
System.out.println("conflictPanels size: " + this.conflictPanels.size());
}
private void 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