X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=plugins%2Fnet.mograsim.plugin.core%2Fsrc%2Fnet%2Fmograsim%2Fplugin%2Fnature%2FAddMograsimNatureHandler.java;h=900fc9df40e5c6adcd4e31cc8f25f588c12da8fa;hb=cc800d982ab9fe3e7d026655847a2160e34a5f8e;hp=f4d0357714dcdf656147491e9ece2137045a0d35;hpb=51a65b109c1c7e9d0be14556c39c81a9f71c4e0c;p=Mograsim.git diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/nature/AddMograsimNatureHandler.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/nature/AddMograsimNatureHandler.java index f4d03577..900fc9df 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/nature/AddMograsimNatureHandler.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/nature/AddMograsimNatureHandler.java @@ -43,7 +43,7 @@ public class AddMograsimNatureHandler extends AbstractHandler { try { - ms.add(toggleNature(project)); + ms.add(addNature(project)); } catch (CoreException e) { @@ -63,7 +63,7 @@ public class AddMograsimNatureHandler extends AbstractHandler * @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(); @@ -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