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);
}
});
}
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