public BigInteger getCellAsBigInteger(long address);
public void setCellAsBigInteger(long address, BigInteger word);
-
- public MainMemoryDefinition getDefinition();
-}
+}
\ No newline at end of file
{
if (m != null)
return m.owner == this;
- else
- return false;
+ return false;
}
public boolean contains(String value)
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
txtInput = new Text(parent, SWT.BORDER);
txtInput.setMessage("Enter new Asm OP");
txtInput.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- txtInput.addKeyListener(new KeyListener()
+ txtInput.addListener(SWT.KeyDown, e ->
{
-
- @Override
- public void keyReleased(KeyEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void keyPressed(KeyEvent e)
+ if (e.keyCode == SWT.CR || e.keyCode == SWT.LF)
{
- if (e.keyCode == SWT.CR || e.keyCode == SWT.LF)
- {
- String in = txtInput.getText().toLowerCase();
- if (in.startsWith("-"))
- viewer.remove(in.substring(1).trim());
- else
- viewer.add(in.trim());
- txtInput.setText("");
- part.setDirty(true);
- save();
- }
+ String in = txtInput.getText().toLowerCase();
+ if (in.startsWith("-"))
+ viewer.remove(in.substring(1).trim());
+ else
+ viewer.add(in.trim());
+ txtInput.setText("");
+ part.setDirty(true);
+ save();
}
});
{
saveAction = new Action()
{
+ @Override
public void run()
{
save();
{
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener()
- {
- public void menuAboutToShow(IMenuManager manager)
- {
- AsmOpsEdit.this.fillContextMenu(manager);
- }
- });
+ menuMgr.addMenuListener(this::fillContextMenu);
Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer);
command.shiftsCaret = false;
}
}
- catch (BadLocationException e)
+ catch (@SuppressWarnings("unused") BadLocationException e)
{
// ignore
}
{
document.replace(offset, 0, asmOp);
}
- catch (BadLocationException e)
+ catch (@SuppressWarnings("unused") BadLocationException e)
{
// ignore
}
searchingFor = SearchingFor.START_OF_TAG;
}
break;
+ default:
+ throw new IllegalStateException("Unknown enum type: " + searchingFor);
}
currentCharIndex++;
}
}
- catch (BadLocationException e)
+ catch (@SuppressWarnings("unused") BadLocationException e)
{
// skip the remainder of file due to error
}
package net.mograsim.plugin.nature;
import java.util.Iterator;
-import org.eclipse.core.commands.*;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
public class AddRemoveMograsimNatureHandler extends AbstractHandler
{
-
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException
{
ISelection selection = HandlerUtil.getCurrentSelection(event);
class SampleResourceVisitor implements IResourceVisitor
{
+ @Override
public boolean visit(IResource resource)
{
checkXML(resource);
MograsimBuilder.this.addMarker(file, e.getMessage(), e.getLineNumber(), severity);
}
+ @Override
public void error(SAXParseException exception) throws SAXException
{
addMarker(exception, IMarker.SEVERITY_ERROR);
}
+ @Override
public void fatalError(SAXParseException exception) throws SAXException
{
addMarker(exception, IMarker.SEVERITY_ERROR);
}
+ @Override
public void warning(SAXParseException exception) throws SAXException
{
addMarker(exception, IMarker.SEVERITY_WARNING);
return null;
}
+ @Override
protected void clean(IProgressMonitor monitor) throws CoreException
{
// delete markers set and files created
package net.mograsim.plugin.tables;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
NumberType corTypes[] = new NumberType[] { NumberType.BINARY, NumberType.OCTAL, NumberType.DECIMAL, NumberType.HEXADECIMAL };
combo.setItems(entries);
combo.select(3);
- combo.addSelectionListener(new SelectionListener()
+ combo.addListener(SWT.Selection, e ->
{
- @Override
- public void widgetSelected(SelectionEvent e)
- {
- int index = combo.getSelectionIndex();
- if (index == -1)
- target.setDataNumberType(NumberType.HEXADECIMAL);
- else
- {
- target.setDataNumberType(corTypes[index]);
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e)
- {
- widgetSelected(e);
- }
+ int index = combo.getSelectionIndex();
+ if (index == -1)
+ target.setDataNumberType(NumberType.HEXADECIMAL);
+ else
+ target.setDataNumberType(corTypes[index]);
});
}
package net.mograsim.plugin.util;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
for (DropDownEntry entry : entries)
{
MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.addSelectionListener(new SelectionListener()
- {
- @Override
- public void widgetSelected(SelectionEvent e)
- {
- entry.listener.widgetSelected(e);
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e)
- {
- widgetSelected(e);
- }
- });
+ item.addListener(SWT.Selection, e -> entry.onSelected.run());
item.setText(entry.title);
}
- button.addListener(SWT.Selection, new Listener()
+ button.addListener(SWT.Selection, e ->
{
- @Override
- public void handleEvent(Event event)
- {
- Rectangle rect = button.getBounds();
- Point pt = new Point(rect.x, rect.y + rect.height);
- pt = button.getParent().toDisplay(pt);
- menu.setLocation(pt.x, pt.y);
- menu.setVisible(true);
- }
+ Rectangle rect = button.getBounds();
+ Point pt = new Point(rect.x, rect.y + rect.height);
+ pt = button.getParent().toDisplay(pt);
+ menu.setLocation(pt.x, pt.y);
+ menu.setVisible(true);
});
}
public static class DropDownEntry
{
public final String title;
- public final EntrySelectedListener listener;
+ public final Runnable onSelected;
- public DropDownEntry(String title, EntrySelectedListener listener)
+ public DropDownEntry(String title, Runnable onSelected)
{
- super();
this.title = title;
- this.listener = listener;
+ this.onSelected = onSelected;
}
}
-
- @FunctionalInterface
- public static interface EntrySelectedListener
- {
- public void widgetSelected(SelectionEvent e);
- }
}
import org.junit.jupiter.api.Test;
+@SuppressWarnings("static-method") // JUnit requires non-static methods
class BitVectorTest
{
org.junit.jupiter.api;bundle-version="5.4.0";visibility:=reexport,
org.junit.jupiter.params;bundle-version="5.4.0";visibility:=reexport,
org.opentest4j;bundle-version="1.1.1";visibility:=reexport
+Export-Package: net.mograsim.logic.model,
+ net.mograsim.logic.model.am2900,
+ net.mograsim.logic.model.am2900.am2901,
+ net.mograsim.logic.model.am2900.am2904,
+ net.mograsim.logic.model.am2900.am2910,
+ net.mograsim.logic.model.am2900.util
source.. = src/
-output.. = bin/
bin.includes = META-INF/,\
.
Require-Bundle: org.junit;bundle-version="4.12.0",
org.junit.jupiter.api;bundle-version="5.4.0";visibility:=reexport,
org.junit.jupiter.params;bundle-version="5.4.0";visibility:=reexport
+Export-Package: net.mograsim.machine.standard.memory
source.. = src/
-output.. = bin/
bin.includes = META-INF/,\
.