Merge branch 'development' of https://gitlab.lrz.de/lrr-tum/students/eragp-misim...
authorChristian Femers <femers@in.tum.de>
Mon, 14 Oct 2019 21:23:45 +0000 (23:23 +0200)
committerChristian Femers <femers@in.tum.de>
Mon, 14 Oct 2019 21:23:45 +0000 (23:23 +0200)
plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MachineLaunchConfigType.java
plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/nature/AddMograsimNatureHandler.java
plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/util/NumberRespectingStringComparator.java

index 286975a..5622ca6 100644 (file)
@@ -11,8 +11,10 @@ import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunch;
 import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.IMemoryBlock;
 import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
 import org.eclipse.ui.statushandlers.StatusManager;
 
@@ -125,6 +127,10 @@ public class MachineLaunchConfigType extends LaunchConfigurationDelegate
                debugTarget.setExecutionSpeed(1);
                machine = debugTarget.getMachine();
                machine.reset();
+
+               // Add the default Mograsim memory block to make it less confusing and more comfortable.
+               DebugPlugin.getDefault().getMemoryBlockManager()
+                               .addMemoryBlocks(new IMemoryBlock[] { new MainMemoryBlockExtension(debugTarget, "0", null) });
        }
 
 }
\ No newline at end of file
index aa5d5d6..900fc9d 100644 (file)
@@ -85,4 +85,20 @@ public class AddMograsimNatureHandler extends AbstractHandler
 
                return status;
        }
+
+       /**
+        * Adds Mograsim nature on a project
+        *
+        * @param project to have Mograsim nature
+        * @return
+        */
+       public static IStatus addNatureAndConfigure(IProject project, String machineId) throws CoreException
+       {
+               IStatus result = addNature(project);
+               if (result.getSeverity() > IStatus.INFO)
+                       return result;
+               MachineContext mc = ProjectMachineContext.getMachineContextOf(project);
+               mc.setMachineId(machineId);
+               return result;
+       }
 }
\ No newline at end of file
index c2deaf7..1617a61 100644 (file)
@@ -8,7 +8,7 @@ import java.util.regex.Pattern;
 /**
  * Compares Strings respecting integers that appear in the strings with positions in common.<br>
  * Note that 0003 , 03 and 3 are considered to be at the same level; however if there is no further difference, lexicographic ordering is
- * applied to ensure the comparator meets the {@link Comparator contract} (this will sort "foor_02" before "foo_2").
+ * applied to ensure the comparator meets the {@link Comparator contract} (this will sort "foo_02" before "foo_2").
  *
  * @author Christian Femers
  *