//(used for detecting installed machines in plugin.core)
public class Am2900MachineDefinition implements MachineDefinition
{
+ public static final String AM2900_MACHINE_ID = "Am2900";
+
+ @Override
+ public String getId()
+ {
+ return AM2900_MACHINE_ID;
+ }
+
@Override
public Am2900Machine createNew()
{
{
return Am2900MicroInstructionMemoryDefinition.instance;
}
+
}
import net.mograsim.logic.model.model.LogicModel;
import net.mograsim.logic.model.model.components.ModelComponent;
import net.mograsim.logic.model.model.components.submodels.SubmodelComponent;
-import net.mograsim.logic.model.model.components.submodels.SubmodelInterface;
-import net.mograsim.logic.model.model.wires.ModelWireCrossPoint;
+import net.mograsim.logic.model.snippets.highlevelstatehandlers.DefaultHighLevelStateHandler;
import net.mograsim.preferences.Preferences;
/**
recalculateQueued.set(false);
componentsByItemIndex.clear();
componentSelector.setItems();
- addComponentSelectorItems(componentsByItemIndex, "", componentSelector, model);
+ addComponentSelectorItems(componentsByItemIndex, "", componentSelector, model,
+ Preferences.current().getInt("net.mograsim.logic.model.debug.hlsshelldepth"));
}
private void addComponentSelectorItems(List<ModelComponent> componentsByItemIndex, String base, Combo componentSelector,
- LogicModel model)
+ LogicModel model, int depth)
{
model.getComponentsByName().values().stream().sorted((c1, c2) -> c1.getName().compareTo(c2.getName())).forEach(c ->
{
- if (!(c instanceof ModelWireCrossPoint || c instanceof SubmodelInterface))
+ if (!(c.getHighLevelStateHandler() instanceof DefaultHighLevelStateHandler))
{
String item = base + c.getName();
componentsByItemIndex.add(c);
componentSelector.add(item);
- if (c instanceof SubmodelComponent)
- addComponentSelectorItems(componentsByItemIndex, item + " -> ", componentSelector, ((SubmodelComponent) c).submodel);
+ // this causes negative numbers to result in infinite depth
+ if (depth != 0 && c instanceof SubmodelComponent)
+ addComponentSelectorItems(componentsByItemIndex, item + " -> ", componentSelector, ((SubmodelComponent) c).submodel,
+ depth - 1);
}
});
}
public interface MachineDefinition
{
+ /**
+ * This returns the MachineDefinitions ID. This must be consistent and coherent with the id in the extension point (Eclipse plugin xml)
+ * providing the definition.
+ *
+ * @return a human readable, unique id representing the specified machine.
+ * @author Christian Femers
+ */
+ String getId();
/**
* Creates a new instance of the machine
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
public class MachineRegistry
{
+
private static final String MACHINE_EXT_ID = "net.mograsim.machine.machine_definition";
- private static final Map<String, MachineDefinition> installedMachines = new HashMap<>();
+ private static final Map<String, MachineDefinition> installedMachines = Collections.synchronizedMap(new HashMap<>());
+ private static final Set<MachineRegistryListener> listeners = Collections.synchronizedSet(new HashSet<>());
private static void reload()
{
if (o instanceof MachineDefinition)
{
System.out.println("Found " + id);
- installedMachines.put(id, (MachineDefinition) o);
+ MachineDefinition md = (MachineDefinition) o;
+ if (Objects.equals(id, md.getId()))
+ installedMachines.put(id, md);
+ else
+ System.err.println("Machine definition ids to not match: " + id + " and " + md.getId());
} else
{
System.err.println("Invalid machine definition: " + o + "(id=" + id + "");
{
System.out.println(ex.getMessage());
}
+ notifyListeners();
}
public static void initialize()
{
return installedMachines.get(id);
}
+
+ private static void notifyListeners()
+ {
+ Map<String, MachineDefinition> unmodMachines = getInstalledMachines();
+ listeners.forEach(l -> l.onReload(unmodMachines));
+ }
+
+ public static void addMachineRegistryListener(MachineRegistryListener listener)
+ {
+ listeners.add(listener);
+ }
+
+ public static void removeMachineRegistryListener(MachineRegistryListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+ @FunctionalInterface
+ public interface MachineRegistryListener
+ {
+ void onReload(Map<String, MachineDefinition> installedMachines);
+ }
}
category="net.mograsim.plugin"
class="net.mograsim.plugin.views.LogicUIPart"
icon="icons/mograsim/blue-orange/icon_blue-orange_16.png"
- id="net.mograsim.plugin.core.view1"
+ id="net.mograsim.plugin.core.simulationView"
inject="true"
name="%view.name.0"
restorable="true">
import net.mograsim.machine.Machine;
import net.mograsim.machine.MachineRegistry;
+import net.mograsim.plugin.nature.ProjectMachineContext;
+/**
+ * @deprecated use the {@link ProjectMachineContext} instead to make the context project dependent.
+ */
+@Deprecated(forRemoval = true)
public class MachineContext
{
private Machine machine;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
@Override
protected void createFieldEditors()
{
- addField(new BooleanFieldEditor("net.mograsim.logic.model.debug.openhlsshell", "Open the debug HLS shell", getFieldEditorParent()));
+ Composite parent = getFieldEditorParent();
+ addField(new BooleanFieldEditor("net.mograsim.logic.model.debug.openhlsshell", "Open the debug HLS shell", parent));
+ addField(new IntegerFieldEditor("net.mograsim.logic.model.debug.hlsshelldepth",
+ "Depth of components to list in the debug HLS shell", parent));
// TODO add other preferences
}
}
\ No newline at end of file
{
try
{
- ms.add(toggleNature(project));
+ ms.add(addNature(project));
}
catch (CoreException e)
{
* @param project to have Mograsim nature
* @return
*/
- private IStatus toggleNature(IProject project) throws CoreException
+ public static IStatus addNature(IProject project) throws CoreException
{
IProjectDescription description = project.getDescription();
String[] natures = description.getNatureIds();
import net.mograsim.machine.Machine;
import net.mograsim.machine.MachineDefinition;
import net.mograsim.machine.MachineRegistry;
+import net.mograsim.plugin.nature.ProjectContextEvent.ProjectContextEventType;
public class MachineContext
{
final void updateDefinition()
{
machineDefinition = machineId.map(MachineRegistry::getMachine);
+ machineDefinition.ifPresent(md -> setActiveMachine(md.createNew()));
+ ProjectMachineContext.notifyListeners(new ProjectContextEvent(this, ProjectContextEventType.MACHINE_DEFINITION_CHANGE));
}
private void preferenceListener(PropertyChangeEvent changeEvent)
--- /dev/null
+package net.mograsim.plugin.nature;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.Consumer;
+import java.util.function.Function;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+
+import net.mograsim.machine.MachineDefinition;
+import net.mograsim.machine.MachineRegistry;
+import net.mograsim.plugin.nature.ProjectContextEvent.ProjectContextEventType;
+
+public final class MachineContextSwtTools
+{
+ private static final Map<String, MachineDefinition> INSTALLED_MACHINES = MachineRegistry.getInstalledMachines();
+ private static final Map<IProject, MachineContext> PROJECT_MACHINE_CONTEXTS = ProjectMachineContext.getAllProjectMachineContexts();
+
+ private MachineContextSwtTools()
+ {
+ // not instantiable
+ }
+
+ public static MachineCombo createMachineSelector(Composite parent, int style)
+ {
+ return new MachineCombo(parent, style);
+ }
+
+ public static MograsimProjectCombo createMograsimProjectSelector(Composite parent, int style)
+ {
+ return new MograsimProjectCombo(parent, style);
+ }
+
+ public abstract static class AdvancedCombo<T>
+ {
+ final ComboViewer combo;
+ private Set<Consumer<T>> listeners;
+
+ public AdvancedCombo(Composite parent, Function<T, String> labelProvider)
+ {
+ this(parent, SWT.NONE, labelProvider);
+ }
+
+ public AdvancedCombo(Composite parent, int style, Function<T, String> labelProvider)
+ {
+ listeners = Collections.synchronizedSet(new HashSet<>());
+ combo = new ComboViewer(parent, style);
+ combo.addSelectionChangedListener(e -> updateSelection());
+ combo.setComparator(new ViewerComparator());
+ combo.setLabelProvider(new LabelProvider()
+ {
+ @SuppressWarnings("unchecked")
+ @Override
+ public String getText(Object element)
+ {
+ try
+ {
+ return labelProvider.apply((T) element);
+ }
+ catch (ClassCastException e)
+ {
+ return "Invalid Element: " + e.getLocalizedMessage();
+ }
+ }
+ });
+ }
+
+ public final ComboViewer getCombo()
+ {
+ return combo;
+ }
+
+ @SuppressWarnings("unchecked")
+ public T getSelection()
+ {
+ return (T) combo.getStructuredSelection().getFirstElement();
+ }
+
+ private void updateSelection()
+ {
+ T active = getSelection();
+ listeners.forEach(l -> l.accept(active));
+ }
+
+ public final void addListener(Consumer<T> listener)
+ {
+ listeners.add(listener);
+ }
+
+ public final void removeListener(Consumer<T> listener)
+ {
+ listeners.remove(listener);
+ }
+
+ public void refreshContent()
+ {
+ Display.getDefault().asyncExec(combo::refresh);
+ }
+ }
+
+ public static class MachineCombo extends AdvancedCombo<MachineDefinition>
+ {
+ private static final Set<MachineCombo> machineComboListeners = Collections.synchronizedSet(new HashSet<>());
+
+ static
+ {
+ MachineRegistry.addMachineRegistryListener(newMap -> machineComboListeners.forEach(AdvancedCombo::refreshContent));
+ }
+
+ public MachineCombo(Composite parent)
+ {
+ this(parent, SWT.NONE);
+ }
+
+ public MachineCombo(Composite parent, int style)
+ {
+ super(parent, style, MachineDefinition::getId);
+ combo.setContentProvider(new IStructuredContentProvider()
+ {
+ @Override
+ public void dispose()
+ {
+ machineComboListeners.remove(MachineCombo.this);
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement)
+ {
+ return INSTALLED_MACHINES.values().toArray();
+ }
+ });
+ combo.setInput(this);
+ machineComboListeners.add(this);
+ }
+ }
+
+ public static class MograsimProjectCombo extends AdvancedCombo<IProject>
+ {
+ private static final Set<MograsimProjectCombo> projectComboListeners = Collections.synchronizedSet(new HashSet<>());
+
+ static
+ {
+ ProjectMachineContext.addProjectContextListener(projectEvent ->
+ {
+ if (projectEvent.getEventType() != ProjectContextEventType.OTHER_CHANGE)
+ projectComboListeners.forEach(AdvancedCombo::refreshContent);
+ });
+ }
+
+ public MograsimProjectCombo(Composite parent)
+ {
+ this(parent, SWT.NONE);
+ }
+
+ public MograsimProjectCombo(Composite parent, int style)
+ {
+ super(parent, style, IProject::getName);
+ combo.setContentProvider(new IStructuredContentProvider()
+ {
+ @Override
+ public void dispose()
+ {
+ projectComboListeners.remove(MograsimProjectCombo.this);
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement)
+ {
+ return PROJECT_MACHINE_CONTEXTS.values().stream().filter(mc -> mc.getProject().isOpen() && mc.isCurrentyValid())
+ .map(MachineContext::getProject).toArray();
+ }
+ });
+ combo.setInput(this);
+ projectComboListeners.add(this);
+ }
+ }
+
+ /**
+ * XXX: of no use?
+ */
+ static Optional<String> getSelection(Combo c)
+ {
+ int selectionIndex = c.getSelectionIndex();
+ if (selectionIndex == -1)
+ return Optional.empty();
+ return Optional.of(c.getItem(selectionIndex));
+ }
+}
--- /dev/null
+package net.mograsim.plugin.nature;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceChangeEvent;
+
+public class ProjectContextEvent
+{
+ private final MachineContext machineContext;
+ private final ProjectContextEventType eventType;
+
+ public ProjectContextEvent(MachineContext machineContext, ProjectContextEventType eventType)
+ {
+ this.machineContext = machineContext;
+ this.eventType = eventType;
+ }
+
+ public final MachineContext getMachineContext()
+ {
+ return machineContext;
+ }
+
+ public final ProjectContextEventType getEventType()
+ {
+ return eventType;
+ }
+
+ public final IProject getProject()
+ {
+ return machineContext.getProject();
+ }
+
+ public enum ProjectContextEventType
+ {
+ NEW, MACHINE_DEFINITION_CHANGE, OTHER_CHANGE, REFRESH, CLOSE, DELETE;
+
+ static ProjectContextEventType ofResourceChangeEvent(int id)
+ {
+ switch (id)
+ {
+ case IResourceChangeEvent.POST_CHANGE:
+ return OTHER_CHANGE;
+ case IResourceChangeEvent.PRE_CLOSE:
+ return CLOSE;
+ case IResourceChangeEvent.PRE_DELETE:
+ return DELETE;
+ case IResourceChangeEvent.PRE_REFRESH:
+ return REFRESH;
+ default:
+ return null;
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+package net.mograsim.plugin.nature;
+
+@FunctionalInterface
+public interface ProjectContextListener
+{
+ void onProjectContextChange(ProjectContextEvent projectContextEvent);
+}
\ No newline at end of file
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+import java.util.Set;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
+import net.mograsim.plugin.nature.ProjectContextEvent.ProjectContextEventType;
+
public class ProjectMachineContext
{
private static Map<IProject, MachineContext> projectMachineContexts = Collections.synchronizedMap(new HashMap<>());
+ private static final Set<ProjectContextListener> listeners = Collections.synchronizedSet(new HashSet<>());
public static final String MOGRASIM_PROJECT_PREFS_NODE = "net.mograsim";
public static final String MACHINE_PROPERTY = "net.mograsim.projectMachineId";
validateMograsimNatureProject(project);
mc = new MachineContext(project);
projectMachineContexts.put(project, mc);
+ notifyListeners(new ProjectContextEvent(mc, ProjectContextEventType.NEW));
return mc;
}
return getMachineContextOf(project);
}
+ public static Map<IProject, MachineContext> getAllProjectMachineContexts()
+ {
+ return Collections.unmodifiableMap(projectMachineContexts);
+ }
+
static ScopedPreferenceStore getProjectPrefs(IProject mograsimProject)
{
return new ScopedPreferenceStore(new ProjectScope(mograsimProject), MOGRASIM_PROJECT_PREFS_NODE);
return Optional.of(preferenceStore.getString(MACHINE_PROPERTY));
return Optional.empty();
}
+
+ static void notifyListeners(ProjectContextEvent projectContextEvent)
+ {
+ listeners.forEach(l -> l.onProjectContextChange(projectContextEvent));
+ }
+
+ public static void addProjectContextListener(ProjectContextListener listener)
+ {
+ listeners.add(listener);
+ }
+
+ public static void removeProjectContextListener(ProjectContextListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+ static
+ {
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(ProjectMachineContext::resourceChanged);
+ }
+
+ private static void resourceChanged(IResourceChangeEvent event)
+ {
+// System.out.println(((ResourceChangeEvent) event).toDebugString());
+ ProjectContextEventType eventType = ProjectContextEventType.ofResourceChangeEvent(event.getType());
+ if (eventType == null)
+ return;
+ if (event.getResource() == null || event.getResource().getProject() == null)
+ return;
+ MachineContext mc = projectMachineContexts.get(event.getResource().getProject());
+ if (mc == null)
+ return;
+// System.out.println(" " + eventType + " - " + mc.getProject());
+ notifyListeners(new ProjectContextEvent(mc, eventType));
+ }
}
package net.mograsim.plugin.tables.mi;
import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.CheckboxCellEditor;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
import net.mograsim.logic.core.types.Bit;
import net.mograsim.machine.mi.MicroInstruction;
import net.mograsim.machine.mi.MicroInstructionDefinition;
import net.mograsim.machine.mi.parameters.BooleanClassification;
import net.mograsim.machine.mi.parameters.MicroInstructionParameter;
+import net.mograsim.machine.mi.parameters.Mnemonic;
public class BooleanEditingSupport extends EditingSupport
{
- private final CheckboxCellEditor editor;
+ private final ComboBoxCellEditor editor;
private final BooleanClassification boolClass;
private final TableViewer viewer;
private final int index;
super(viewer);
this.viewer = viewer;
this.boolClass = (BooleanClassification) definition.getParameterClassification(index);
- editor = new CheckboxCellEditor(viewer.getTable());
+ editor = new ComboBoxCellEditor(viewer.getTable(), boolClass.getStringValues(), SWT.READ_ONLY);
+ editor.setActivationStyle(
+ ComboBoxCellEditor.DROP_DOWN_ON_TRAVERSE_ACTIVATION | ComboBoxCellEditor.DROP_DOWN_ON_PROGRAMMATIC_ACTIVATION
+ | ComboBoxCellEditor.DROP_DOWN_ON_MOUSE_ACTIVATION | ComboBoxCellEditor.DROP_DOWN_ON_KEY_ACTIVATION);
this.index = index;
}
protected Object getValue(Object element)
{
InstructionTableRow row = (InstructionTableRow) element;
- return row.data.getCell(row.address).getParameter(index).getValue().getMSBit(0).equals(Bit.ONE);
+ // true is 0 because the true value comes first in the combo box
+ return row.data.getCell(row.address).getParameter(index).getValue().getMSBit(0).equals(Bit.ONE) ? 0 : 1;
}
@Override
{
InstructionTableRow row = (InstructionTableRow) element;
MicroInstructionParameter[] params = row.data.getCell(row.address).getParameters();
- params[index] = boolClass.get((Boolean) value);
+ // true is 0 because the true value comes first in the combo box
+ Mnemonic newParam = boolClass.get(value.equals(0) ? true : false);
+ if (newParam.equals(params[index]))
+ return;
+ params[index] = newParam;
row.data.setCell(row.address, MicroInstruction.create(params));
viewer.update(element, null);
}
import java.util.Arrays;
import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ColumnViewerEditor;
+import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent;
+import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy;
import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter;
import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.TableViewerEditor;
+import org.eclipse.jface.viewers.TableViewerFocusCellManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
public InstructionTable(Composite parent, DisplaySettings displaySettings)
{
- viewer = new LazyTableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER | SWT.VIRTUAL);
+ viewer = new LazyTableViewer(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.VIRTUAL);
this.displaySettings = displaySettings;
Table table = viewer.getTable();
table.setLinesVisible(true);
viewer.setUseHashlookup(true);
+ TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(viewer, new FocusCellOwnerDrawHighlighter(viewer));
+
+ ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(viewer)
+ {
+ @Override
+ protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event)
+ {
+ return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
+ || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
+ || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR)
+ || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
+ }
+ };
+ int features = ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
+ | ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION;
+ TableViewerEditor.create(viewer, focusCellManager, actSupport, features);
+
GridData viewerData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
viewerData.horizontalSpan = 3;
viewer.getTable().setLayoutData(viewerData);
provider = new IntegerColumnLabelProvider(displaySettings, index);
break;
case MNEMONIC:
-// viewerColumn.setEditingSupport(editingSupport)
support = new MnemonicEditingSupport(viewer, miDef, index, this.provider);
provider = new ParameterLabelProvider(index);
break;
{
super(address, data);
}
-}
+}
\ No newline at end of file
{
InstructionTableRow row = ((InstructionTableRow) element);
MicroInstructionParameter[] params = row.data.getCell(row.address).getParameters();
- params[index] = new IntegerImmediate(value, classification.getExpectedBits());
+ IntegerImmediate newParam = new IntegerImmediate(value, classification.getExpectedBits());
+ if (params[index].equals(newParam))
+ return;
+ params[index] = newParam;
row.data.setCell(row.address, MicroInstruction.create(params));
provider.update(row.address);
// viewer.update(element, null); Does not do anything for some reason
+++ /dev/null
-package net.mograsim.plugin.tables.mi;
-
-import org.eclipse.jface.viewers.ICellEditorValidator;
-
-import net.mograsim.machine.mi.parameters.MnemonicFamily;
-
-public class MnemonicCellEditorValidator implements ICellEditorValidator
-{
- private MnemonicFamily family;
-
- public MnemonicCellEditorValidator(MnemonicFamily family)
- {
- this.family = family;
- }
-
- @Override
- public String isValid(Object value)
- {
- int index = (Integer) value;
- return index >= 0 && index < family.size() ? null
- : String.format("MnemonicFamily has %s elements, index %s is out of bounds", family.size(), value.toString());
- }
-
-}
super(viewer);
family = (MnemonicFamily) definition.getParameterClassifications()[index];
editor = new ComboBoxCellEditor(viewer.getTable(), family.getStringValues(), SWT.READ_ONLY);
+ editor.setActivationStyle(
+ ComboBoxCellEditor.DROP_DOWN_ON_TRAVERSE_ACTIVATION | ComboBoxCellEditor.DROP_DOWN_ON_PROGRAMMATIC_ACTIVATION
+ | ComboBoxCellEditor.DROP_DOWN_ON_MOUSE_ACTIVATION | ComboBoxCellEditor.DROP_DOWN_ON_KEY_ACTIVATION);
this.index = index;
- editor.setValidator(new MnemonicCellEditorValidator(family));
this.provider = provider;
}
{
InstructionTableRow row = ((InstructionTableRow) element);
MicroInstructionParameter[] params = row.data.getCell(row.address).getParameters();
- params[index] = family.get((Integer) value);
+ Mnemonic newParam = family.get((Integer) value);
+ if (newParam.equals(params[index]))
+ return;
+ params[index] = newParam;
row.data.setCell(row.address, MicroInstruction.create(params));
provider.update(row.address);
}
import net.mograsim.plugin.EclipsePreferences;
import net.mograsim.plugin.MachineContext;
import net.mograsim.plugin.MograsimActivator;
+import net.mograsim.plugin.nature.MachineContextSwtTools;
+import net.mograsim.plugin.nature.MachineContextSwtTools.MachineCombo;
+import net.mograsim.plugin.nature.MachineContextSwtTools.MograsimProjectCombo;
import net.mograsim.plugin.tables.DisplaySettings;
import net.mograsim.plugin.tables.mi.ActiveInstructionPreviewContentProvider;
import net.mograsim.plugin.tables.mi.InstructionTable;
{
if (exec != null)
exec.stopLiveExecution();
+ super.dispose();
}
@Override
private void addSimulationControlWidgets(Composite parent)
{
Composite c = new Composite(parent, SWT.NONE);
- c.setLayout(new GridLayout(5, false));
+ c.setLayout(new GridLayout(7, false));
+
+ MograsimProjectCombo projectCombo = MachineContextSwtTools.createMograsimProjectSelector(c, SWT.NONE);
+ MachineCombo machineCombo = MachineContextSwtTools.createMachineSelector(c, SWT.NONE);
+
Button sbseButton = new Button(c, SWT.CHECK);
Button pauseButton = new Button(c, SWT.TOGGLE);
{
switch (name)
{
+ case "net.mograsim.logic.model.debug.hlsshelldepth":
+ return -1;
default:
throw new IllegalArgumentException("Unknown int preference name: " + name);
}