public Object execute(ExecutionEvent event) throws ExecutionException
{
ISelection selection = HandlerUtil.getCurrentSelection(event);
- //
MultiStatus ms = new MultiStatus("net.mograsim.plugin.core", 42, "MograsimNature Conversion", null);
{
try
{
- ms.add(toggleNature(project));
+ ms.add(addNature(project));
}
catch (CoreException e)
{
* @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();
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