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=3941b1d2c850a016271ee5fe48928abb508cd17d;hpb=f919efc362c3de5c94d894dc8fc7fe22c03fc865;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 3941b1d2..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 @@ -23,7 +23,6 @@ public class AddMograsimNatureHandler extends AbstractHandler public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getCurrentSelection(event); - // MultiStatus ms = new MultiStatus("net.mograsim.plugin.core", 42, "MograsimNature Conversion", null); @@ -44,7 +43,7 @@ public class AddMograsimNatureHandler extends AbstractHandler { try { - ms.add(toggleNature(project)); + ms.add(addNature(project)); } catch (CoreException e) { @@ -64,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(); @@ -86,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