title: Eclipse plugin developement | Contains: Nature does not exist
body: <p>I am creating an customized eclipse plugin.</p>
  
  <p>While adding nature to project I am getting this exception:</p>
  
  <pre><code>org.eclipse.core.runtime.CoreException: Problems encountered while setting project description.
      at org.eclipse.core.internal.resources.Project.setDescription(Project.java:1351)
      at org.eclipse.core.internal.resources.Project.setDescription(Project.java:1378)
      at projectwizard.ProjectWizardManager.createProjectNature(ProjectWizardManager.java:72)
      at projectwizard.ProjectWizardManager.createProject(ProjectWizardManager.java:48)
      at projectwizard.NewMobilePlatformProjectWizard.performFinish(NewMobilePlatformProjectWizard.java:40)
      at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:827)
      at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:432)
      at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
      at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
      at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
      at org.eclipse.jface.window.Window.open(Window.java:801)
      at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:259)
      at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:279)
      at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290)
      at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:76)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
      at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:231)
      at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:212)
      at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:131)
      at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:171)
      at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:277)
      at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:496)
      at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:547)
      at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:368)
      at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:314)
      at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:83)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
      at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104)
      at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1100)
      at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1521)
      at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4640)
      at org.eclipse.swt.widgets.Tree.WM_CHAR(Tree.java:5967)
      at org.eclipse.swt.widgets.Control.windowProc(Control.java:4528)
      at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:5963)
      at org.eclipse.swt.widgets.Display.windowProc(Display.java:4989)
      at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
      at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2546)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3756)
      at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1022)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:916)
      at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
      at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:587)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:542)
      at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
      at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
      at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
      at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
      at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
      at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
  Contains: Nature does not exist: com.mobile.platform.application.
  </code></pre>
  
  <p>Here is my plugin.xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;plugin&gt;
  
     &lt;extension
           id="com.mobile.platform.plugin.newprojectwizrd"
           point="org.eclipse.ui.newWizards" &gt;
        &lt;category
              id="eclipseplugin.com.mpp.ui.wizard" name="Mobile Platform"&gt;
  
        &lt;/category&gt;
         &lt;wizard
              category="eclipseplugin.com.mpp.ui.wizard"
              class="projectwizard.NewMobilePlatformProjectWizard"
              icon="icons/applogo.png"
              id="eclipseplugin.com.mpp.ui.wizard.NewApplicationWizard"
              name="Mobile Platform Application"
              project="true"&gt;
        &lt;/wizard&gt;
     &lt;/extension&gt;
     &lt;extension
           id="com.mobile.platform.application"
           point="org.eclipse.core.resources.natures"&gt;
        &lt;runtime&gt;
           &lt;run
                 class="com.mobile.platform.plugin.ProjectNature"&gt;
           &lt;/run&gt;
        &lt;/runtime&gt;
     &lt;/extension&gt;
  
  &lt;/plugin&gt;
  </code></pre>
  
  <p>To add nature in newly created project here is the code:</p>
  
  <pre><code>private void createProjectNature(IProject project) throws CoreException {
          if (!project.hasNature(ProjectNature.NATURE_ID)) {
              IProjectDescription description = project.getDescription();
              String[] prevNatures = description.getNatureIds();
              String[] newNatures = new String[prevNatures.length + 1];
              System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
              newNatures[prevNatures.length] = ProjectNature.NATURE_ID;
              description.setNatureIds(newNatures);
              project.setDescription(description, new NullProgressMonitor());
          }
  
      } 
  </code></pre>
  
  <p>In create project nature while it do project.setdescription, It throws the exception as dictated above.</p>
  
  <p>Here is the ProjectNature class:</p>
  
  <pre><code>public class ProjectNature implements IProjectNature {
  
      public static final String NATURE_ID = "com.mobile.platform.application";
      private IProject iProject;
      @Override
      public void configure() throws CoreException {
          // TODO Auto-generated method stub
  
      }
  
      @Override
      public void deconfigure() throws CoreException {
          // TODO Auto-generated method stub
  
      }
  
      @Override
      public IProject getProject() {
          return iProject;
      }
  
      @Override
      public void setProject(IProject project) {
          // TODO Auto-generated method stub
          this.iProject=project;
      }
  
  }
  </code></pre>
  
  <p>I am not getting what this is missing.
  Please help me out.
  Thanks in advance.</p>