Скачиваний:
33
Добавлен:
03.06.2014
Размер:
23.75 Кб
Скачать
package gui;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Table;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;

import model.CPUModel;
import model.CPUModel.integerMemoryCell;
import model.CPUModel.shortMemoryCell;

public class CPUModelAppWindow extends Shell {
private static final int ITERATIONS_TO_ASK_STOP_PROGRAM = 10000;
private Text textPC;
private Text textIR;
private Table tableDataMemory;
private Table tableRON;
private Table tableCommandMemory;
private TableViewer tableViewerDataMemory;
private TableViewer tableViewerCommandMemory;
private TableViewer tableViewerRON;
private TextCellEditor valTextEditor;
private Text textOperands;
private Text textAddressFeatures;
private Text textKOP;
private Text textCommandName;
private Text textFormat;
private CPUModel model;
private Text textProgram;
private Text textErrors;
private Button btnZ, btnC, btnS, btnO, btnI, btnT, btnU;
private Text textPCStart;

/**
* Launch the application.
* @param args
*/
public static void main(String args[]) {
try {
Display display = Display.getDefault();
CPUModelAppWindow shell = new CPUModelAppWindow(display);
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
catch (Exception e) {
e.printStackTrace();
}
}

/**
* Create the shell.
* @param display
*/
public CPUModelAppWindow(Display display) {
super(display, SWT.SHELL_TRIM);
setLayout(new FillLayout(SWT.HORIZONTAL));

model = new CPUModel((short) 0);

Composite composite = new Composite(this, SWT.NONE);
composite.setLayout(new GridLayout(4, false));

Label label = new Label(composite, SWT.NONE);
label.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
label.setText("\u041F\u0430\u043C\u044F\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0445");

Group group = new Group(composite, SWT.NONE);
GridData gd_group = new GridData(SWT.FILL, SWT.TOP, false, false, 1, 2);
gd_group.heightHint = 123;
group.setLayoutData(gd_group);
group.setText("\u0421\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044B");
group.setLayout(new GridLayout(7, true));

Label label_1 = new Label(group, SWT.NONE);
label_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
label_1.setText("\u041F\u0421");
new Label(group, SWT.NONE);
new Label(group, SWT.NONE);

textPC = new Text(group, SWT.BORDER);
textPC.setEditable(false);
textPC.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1));

Label label_3 = new Label(group, SWT.NONE);
label_3.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 7, 1));
label_3.setText("\u0424\u043B\u0430\u0433\u0438");

Label lblZ = new Label(group, SWT.NONE);
lblZ.setText("Z");

Label lblC = new Label(group, SWT.NONE);
lblC.setText("C");

Label lblS = new Label(group, SWT.NONE);
lblS.setText("S");

Label lblO = new Label(group, SWT.NONE);
lblO.setText("O");

Label lblI = new Label(group, SWT.NONE);
lblI.setText("I");

Label lblT = new Label(group, SWT.NONE);
lblT.setText("T");

Label lblU = new Label(group, SWT.NONE);
lblU.setText("U");

btnZ = new Button(group, SWT.CHECK);
btnZ.setEnabled(false);

btnC = new Button(group, SWT.CHECK);
btnC.setEnabled(false);

btnS = new Button(group, SWT.CHECK);
btnS.setEnabled(false);

btnO = new Button(group, SWT.CHECK);
btnO.setEnabled(false);

btnI = new Button(group, SWT.CHECK);
btnI.setEnabled(false);

btnT = new Button(group, SWT.CHECK);
btnT.setEnabled(false);

btnU = new Button(group, SWT.CHECK);
btnU.setEnabled(false);

Label label_2 = new Label(group, SWT.NONE);
label_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
label_2.setText("\u0420\u041A");

textIR = new Text(group, SWT.BORDER);
textIR.setEditable(false);
textIR.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 6, 1));

Label label_5 = new Label(composite, SWT.NONE);
label_5.setText("\u041F\u0430\u043C\u044F\u0442\u044C \u043A\u043E\u043C\u0430\u043D\u0434");

Label label_12 = new Label(composite, SWT.NONE);
label_12.setText("\u0422\u0435\u043A\u0441\u0442 \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u044B");

//---------------------------------TableViewers----------------------------------------------------
tableViewerDataMemory = new TableViewer(composite, SWT.V_SCROLL | SWT.H_SCROLL
| SWT.FULL_SELECTION | SWT.BORDER);
tableDataMemory = tableViewerDataMemory.getTable();
tableViewerDataMemory.setUseHashlookup(true);

tableDataMemory.setHeaderVisible(true);
tableDataMemory.setLinesVisible(true);

GridData gd_tableDataMemory = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4);
gd_tableDataMemory.widthHint = 80;
tableDataMemory.setLayoutData(gd_tableDataMemory);

TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewerDataMemory, SWT.NONE);
TableColumn tableColumn = tableViewerColumn.getColumn();
tableColumn.setWidth(50);
tableColumn.setText("\u0410\u0434\u0440\u0435\u0441");
tableViewerColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
// return ((Integer)dataMemoryTableViewerCounter++).toString();
return Short.toString(((shortMemoryCell)element).getAddress());
}
});

TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(tableViewerDataMemory, SWT.NONE);
TableColumn tableColumn_1 = tableViewerColumn_1.getColumn();
tableColumn_1.setWidth(60);
tableColumn_1.setText("\u0417\u043D-\u0435");
tableViewerColumn_1.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
// return element.toString();
return Short.toString(((shortMemoryCell)element).getValue());
}
});
valTextEditor = new TextCellEditor(tableDataMemory);
((Text) valTextEditor.getControl()).addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
// если хотя бы один из новых вводимых
// символов не цифра -
// ввод отменяется, они не заносятся в поле.
for (int i = 0; i < e.text.length(); i++) {
if ("0123456789-xABCDEFabcdef".indexOf(e.text.charAt(i)) == -1) {
e.doit = false;
break;
}
}
}
});

tableViewerColumn_1.setEditingSupport(new EditingSupport(tableViewerDataMemory) {

@Override
protected void setValue(Object element, Object value) {
// Short s = (new Short((String)value));
try{
((shortMemoryCell)element).setValue(Short.decode((String)value));
getViewer().update(element, null);
model.updateDataMemoryElement((shortMemoryCell)element);
// tableViewerDataMemory.refresh();
}
catch(NumberFormatException e){}
}

@Override
protected Object getValue(Object element) {
return Short.toString(((shortMemoryCell)element).getValue());
}

@Override
protected CellEditor getCellEditor(Object element) {
return valTextEditor;
}

@Override
protected boolean canEdit(Object element) {
return true;
}
});

tableViewerDataMemory.setContentProvider(ArrayContentProvider.getInstance());

// int lng = 5;
// Short[] arr = new Short[lng];
// for (int i = 0; i < lng; i++) arr[i] = new Short((short) i);

// int lng = 5;
// short[] arr = new short[lng];
// for (int i = 0; i < lng; i++) arr[i] = (short)i;

// tableViewerDataMemory.setInput(arr);

tableViewerDataMemory.setInput(model.getDataMemory());


//-------------------------
tableViewerCommandMemory = new TableViewer(composite, SWT.MULTI | SWT.V_SCROLL
| SWT.FULL_SELECTION | SWT.BORDER);
tableViewerCommandMemory.setUseHashlookup(true);
tableCommandMemory = tableViewerCommandMemory.getTable();
GridData gd_tableCommandMemory = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4);
gd_tableCommandMemory.widthHint = 70;
tableCommandMemory.setLayoutData(gd_tableCommandMemory);
tableCommandMemory.setHeaderVisible(true);
tableCommandMemory.setLinesVisible(true);

TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(tableViewerCommandMemory, SWT.NONE);
TableColumn tableColumn_2 = tableViewerColumn_2.getColumn();
tableColumn_2.setWidth(50);
tableColumn_2.setText("\u0410\u0434\u0440\u0435\u0441");
tableViewerColumn_2.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
return Integer.toString(((integerMemoryCell)element).getAddress());
}
});

TableViewerColumn tableViewerColumn_3 = new TableViewerColumn(tableViewerCommandMemory, SWT.NONE);
TableColumn tableColumn_3 = tableViewerColumn_3.getColumn();
tableColumn_3.setWidth(80);
tableColumn_3.setText("\u0417\u043D-\u0435");
tableViewerColumn_3.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
return Integer.toString(((integerMemoryCell)element).getValue());
}
});

tableViewerCommandMemory.setContentProvider(new ArrayContentProvider());
tableViewerCommandMemory.setInput(model.getCommandMemory());
//----------------------------------------------------------------------------------------
textProgram = new Text(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
textProgram.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3));

Label label_4 = new Label(composite, SWT.NONE);
label_4.setText("\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u044B \u043E\u0431\u0449\u0435\u0433\u043E \u043D\u0430\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F");
//--------------------------------------------------------------------------------------
tableViewerRON = new TableViewer(composite, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL
| SWT.FULL_SELECTION | SWT.BORDER);
tableViewerRON.setUseHashlookup(true);
tableRON = tableViewerRON.getTable();
GridData gd_tableRON = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
tableRON.setHeaderVisible(true);
tableRON.setLinesVisible(true);
gd_tableRON.heightHint = 110;
tableRON.setLayoutData(gd_tableRON);

TableViewerColumn tableViewerColumn_4 = new TableViewerColumn(tableViewerRON, SWT.NONE);
TableColumn tableColumn_4 = tableViewerColumn_4.getColumn();
tableColumn_4.setWidth(50);
tableColumn_4.setText("\u0410\u0434\u0440\u0435\u0441");
tableViewerColumn_4.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
return Short.toString(((shortMemoryCell)element).getAddress());
}
});

TableViewerColumn tableViewerColumn_5 = new TableViewerColumn(tableViewerRON, SWT.NONE);
TableColumn tableColumn_5 = tableViewerColumn_5.getColumn();
tableColumn_5.setWidth(100);
tableColumn_5.setText("\u0417\u043D-\u0435");
tableViewerColumn_5.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
return Short.toString(((shortMemoryCell)element).getValue());
}
});

tableViewerRON.setContentProvider(ArrayContentProvider.getInstance());
tableViewerRON.setInput(model.getRON());

Button btnParseProgram = new Button(composite, SWT.NONE);
btnParseProgram.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if(!model.running()){
model.parseProgram(textProgram.getText());
updateGUI(false);
}
else{
model.printMessage("Остановите выполнение текущей программы чтобы загрузить новую!");
}
}
});
btnParseProgram.setText("\u0412 \u043F\u0430\u043C\u044F\u0442\u044C");

Group group_3 = new Group(composite, SWT.NONE);
group_3.setLayout(new GridLayout(1, false));
group_3.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
group_3.setText("\u0421\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F");

textErrors = new Text(group_3, SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
textErrors.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));



//--------------------------------------
Group group_1 = new Group(composite, SWT.NONE);
group_1.setText("\u0423\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435");
group_1.setLayout(new GridLayout(3, false));
group_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));

final Button btnStart = new Button(group_1, SWT.NONE);
btnStart.setText("\u0421\u0442\u0430\u0440\u0442");

final Button btnTakt = new Button(group_1, SWT.NONE);
btnTakt.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
btnTakt.setText("\u0422\u0430\u043A\u0442");

final Button taktMode = new Button(group_1, SWT.CHECK);
taktMode.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
taktMode.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (taktMode.getSelection()){
btnTakt.setEnabled(true);
btnStart.setEnabled(false);
}
else {
btnTakt.setEnabled(false);
btnStart.setEnabled(true);
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e){
widgetSelected(e);
}
});
taktMode.setText("\u041F\u043E\u0442\u0430\u043A\u0442\u043D\u044B\u0439 \u0440\u0435\u0436\u0438\u043C");

Button btnPCStartSet = new Button(group_1, SWT.NONE);
btnPCStartSet.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
try{
model.setPCStartAddress(Short.decode(textPCStart.getText()));
}
catch(NumberFormatException ex){};
}
});
btnPCStartSet.setToolTipText("\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0430\u0434\u0440\u0435\u0441 \u0441 \u043A\u043E\u0442\u043E\u0440\u043E\u0433\u043E \u041F\u0421 \u0431\u0443\u0434\u0435\u0442 \u0432\u044B\u043F\u043E\u043B\u043D\u044F\u0442\u044C \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u0443, \u0437\u0430\u0434\u0430\u043D\u043D\u044B\u0439 \u0432 \u043F\u043E\u043B\u0435 \u0441\u043F\u0440\u0430\u0432\u0430");
btnPCStartSet.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
btnPCStartSet.setText("\u0410\u0434\u0440\u0435\u0441 \u0441\u0442\u0430\u0440\u0442\u0430");

textPCStart = new Text(group_1, SWT.BORDER);
GridData gd_textPCStart = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
gd_textPCStart.widthHint = 40;
textPCStart.setLayoutData(gd_textPCStart);
textPCStart.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
// если хотя бы один из новых вводимых
// символов не цифра -
// ввод отменяется, они не заносятся в поле.
for (int i = 0; i < e.text.length(); i++) {
if ("0123456789-xABCDEFabcdef".indexOf(e.text.charAt(i)) == -1) {
e.doit = false;
break;
}
}
}
});
//TODO: !
Button btnClear = new Button(group_1, SWT.NONE);
btnClear.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
model.clear();
updateGUI(false);
textAddressFeatures.setText("");
textCommandName.setText("");
textErrors.setText("");
textFormat.setText("");
textKOP.setText("");
textOperands.setText("");
textIR.setText("");
}
});
btnClear.setText("\u0421\u0431\u0440\u043E\u0441");

Button btnReset = new Button(group_1, SWT.NONE);
btnReset.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
btnReset.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {//TODO: test
model = new CPUModel((short) 0);
tableViewerCommandMemory.setInput(model.getCommandMemory());
tableViewerDataMemory.setInput(model.getDataMemory());
tableViewerRON.setInput(model.getRON());
updateGUI(false);
}
});
btnReset.setText("\u041F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0430");

Button btnExit = new Button(group_1, SWT.NONE);
btnExit.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {

}
});
btnExit.setText("\u0412\u044B\u0445\u043E\u0434");
btnExit.addSelectionListener(new SelectionListener() {

@Override
public void widgetSelected(SelectionEvent e) {
getShell().dispose();
}

@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
new Label(group_1, SWT.NONE);

Group group_2 = new Group(composite, SWT.NONE);
group_2.setLayout(new GridLayout(3, true));
group_2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
group_2.setText("\u0422\u0435\u043A\u0443\u0449\u0430\u044F \u043A\u043E\u043C\u0430\u043D\u0434\u0430 (\u0432 \u0420\u041A)");

Label label_6 = new Label(group_2, SWT.NONE);
label_6.setText("\u041A\u041E\u041F \u0438 \u0438\u043C\u044F:");

textKOP = new Text(group_2, SWT.BORDER);
textKOP.setEditable(false);
textKOP.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

textCommandName = new Text(group_2, SWT.BORDER);
textCommandName.setEditable(false);
textCommandName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

Label label_11 = new Label(group_2, SWT.NONE);
label_11.setText("\u0424\u043E\u0440\u043C\u0430\u0442:");

textFormat = new Text(group_2, SWT.BORDER);
textFormat.setEditable(false);
textFormat.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
new Label(group_2, SWT.NONE);

Label label_10 = new Label(group_2, SWT.NONE);
label_10.setText("\u041E\u043F\u0435\u0440\u0430\u043D\u0434\u044B:");

textOperands = new Text(group_2, SWT.BORDER);
textOperands.setEditable(false);
textOperands.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

Label label_7 = new Label(group_2, SWT.NONE);
label_7.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
label_7.setText("\u041F\u0440\u0438\u0437\u043D\u0430\u043A\u0438 \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u0438:");

textAddressFeatures = new Text(group_2, SWT.BORDER);
textAddressFeatures.setEditable(false);
textAddressFeatures.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

btnTakt.setEnabled(false);
btnStart.setEnabled(true);
new Label(group_1, SWT.NONE);
//выполнение всей программы TODO: предотвращение зацикливания - по нажатию Стоп
btnStart.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (!taktMode.getSelection()) {
// btnStart.setText("Стоп");
try {
long currentIter = 0;
boolean checkTime = true;
do {
currentIter++;
model.run_one_tact();
updateGUI(true);
if (checkTime && (currentIter > ITERATIONS_TO_ASK_STOP_PROGRAM)) {
if (!MessageDialog.openQuestion(getShell(), "Предотвращение бесконечных циклов", "Программа выполнила уже " + ITERATIONS_TO_ASK_STOP_PROGRAM + " итераций.\nВ случае продолжения окно больше не будет появлятся\nПродолжить выполнение?")) break;
else checkTime = false;
}
} while (model.running());
} catch (Exception e1) {
textErrors.append(e1.getLocalizedMessage());
}
// finally {
// btnStart.setText("\u0421\u0442\u0430\u0440\u0442");
// }
}

}
});
//выполнение одногй команды
btnTakt.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {

try{
model.run_one_tact();
updateGUI(true);
if (!model.running()){
if (model.getInstr_type() == 13) MessageDialog.openInformation(getShell(), "Информация", "Выполнение программы завершено по команде HALT.");
else MessageDialog.openInformation(getShell(), "Информация", "Выполнение программы завершено из за ошибки.");
return;
}
}
catch(Exception e1){
textErrors.append(e1.getLocalizedMessage());
}
}
});

createContents();
}

/**
* Create contents of the shell.
*/
protected void createContents() {
setText("SWT Application");
setSize(640, 480);

}

@Override
protected void checkSubclass() {
// Disable the check that prevents subclassing of SWT components
}

private void updateGUI(boolean updateRuntimeInfo){
this.textIR.setText(((Integer)model.getInstr()).toString());
this.textPC.setText(((Integer)model.getPC()).toString());
this.tableCommandMemory.setSelection(model.getPC());
this.textErrors.setText(model.getErrors());
if (updateRuntimeInfo){
this.textKOP.setText(((Integer)model.getInstr_type()).toString());
this.textCommandName.setText(model.getCommandName());
this.textFormat.setText(((Byte)model.getFormat()).toString());

this.textAddressFeatures.setText("");
this.textOperands.setText("");
updateFlags();
for (int i = 0; i < model.getOperands().size(); i++){
this.textOperands.append(" " + ((Short)model.getOperands().get(i)).toString());
}
for (int i = 0; i < model.getAddress_features().size(); i++){
this.textAddressFeatures.append(" " + ((Byte)model.getAddress_features().get(i)).toString());
}
}
model.getCommandMemory();
model.getDataMemory();
model.getRON();
tableViewerCommandMemory.refresh();
// tableViewerCommandMemory.setInput(model.getCommandMemory());
tableViewerDataMemory.refresh();
tableViewerRON.refresh();
}
private void updateFlags(){
btnZ.setSelection(model.getFlags().getZ());
btnC.setSelection(model.getFlags().getC());
btnS.setSelection(model.getFlags().getS());
btnO.setSelection(model.getFlags().getO());
btnI.setSelection(model.getFlags().getI());
btnT.setSelection(model.getFlags().getT());
btnU.setSelection(model.getFlags().getU());
}
}