2013-08-21 59 views
0

我正在创建一个自定义的eclipse插件,基础是Lua代码。我想构建独立的IDE,所以我有Application和LuaNature类。我的Eclipse插件中不存在性质

plugin.xml看起来是这样的:

<extension 
     id="application" 
     point="org.eclipse.core.runtime.applications"> 
    <application> 
     <run 
      class="com.my.ide.Application"> 
     </run> 
    </application> 
</extension> 
. 
. 
. 

<extension 
     id="id1" 
     point="org.eclipse.core.resources.natures"> 
     <runtime> 
     <run 
       class="com.my.ide.core.LuaNature"> 
     </run> 
     </runtime> 
    </extension> 

Application.class看起来是这样的:

public class Application implements IApplication { 

    /* (non-Javadoc) 
    * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) 
    */ 
    public Object start(IApplicationContext context) throws Exception { 
     Display display = PlatformUI.createDisplay(); 
     try { 
      int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); 
      if (returnCode == PlatformUI.RETURN_RESTART) 
       return IApplication.EXIT_RESTART; 
      else 
       return IApplication.EXIT_OK; 
     } finally { 
      display.dispose(); 
     } 

    } 

    /* (non-Javadoc) 
    * @see org.eclipse.equinox.app.IApplication#stop() 
    */ 
    public void stop() { 
     if (!PlatformUI.isWorkbenchRunning()) 
      return; 
     final IWorkbench workbench = PlatformUI.getWorkbench(); 
     final Display display = workbench.getDisplay(); 
     display.syncExec(new Runnable() { 
      public void run() { 
       if (!display.isDisposed()) 
        workbench.close(); 
      } 
     }); 
    } 
} 

LuaNature.class这样的:

public class LuaNature extends ScriptNature { 
    /** 
    * Nature of IDE composed from plug-in ID 
    * 
    * @return String 
    */ 
    public static final String ID = Activator.PLUGIN_ID + ".nature"; //$NON-NLS-1$ 
} 

当我运行newProjectWizard为lua项目,我得到错误

自然不存在:com.my.ide.nature。

我是否缺少一些设置?

回答

1

plugin.xml声明具有编号com.my.ide.id1而不是com.my.ide.nature的性质。

0

我的猜测是你的插件可能没有被激活。我建议你去你的运行/调试配置对话框,选择你的配置进入插件选项卡,确保你的插件com.my.ide被选中,然后点击验证,看看是否有任何遗漏的依赖关系,一旦你知道它的选中。如果是这种情况,请尝试单击添加所需的依赖关系。一旦确定启动配置中包含插件,并且没有依赖关系丢失,请再次运行该应用程序。如果仍然存在问题,请返回到启动配置对话框,并在参数选项卡add -console中添加到程序参数文本区域。再次启动应用程序并在您的控制台中输入“start com.my.ide”以确保没有其他错误导致您的插件被激活,如果它启动正常,那么还有其他问题。

1

我也有类似的问题。看来你没有正确定义自然ID。在这一点上你的插件是activating.So如果项目性质已配置

<extension 
     id="id1" 
     point="org.eclipse.core.resources.natures"> 
     <runtime> 
     <run 
       class="com.my.ide.core.LuaNature"> 
     </run> 
     </runtime> 
    </extension> 

这里ID应该是你的项目性质ID。因此,请使用plugin.xml中给出的id作为项目性质ID。