Allow to add nature and configure in one step
authorChristian Femers <femers@in.tum.de>
Mon, 14 Oct 2019 20:40:00 +0000 (22:40 +0200)
committerChristian Femers <femers@in.tum.de>
Mon, 14 Oct 2019 20:40:00 +0000 (22:40 +0200)
plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/nature/AddMograsimNatureHandler.java

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