Eclipse plugin 我的Eclipse插件中不存在Nature
我正在创建一个定制的eclipse插件,其基础是Lua代码。我想构建独立的IDE,所以我有应用程序类和逻辑类Eclipse plugin 我的Eclipse插件中不存在Nature,eclipse-plugin,eclipse-rcp,Eclipse Plugin,Eclipse Rcp,我正在创建一个定制的eclipse插件,其基础是Lua代码。我想构建独立的IDE,所以我有应用程序类和逻辑类 plugin.xml如下所示: <extension id="application" point="org.eclipse.core.runtime.applications"> <application> <run class="com.my.ide.Application">
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>
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();
}
});
}
}
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$
}
和lunature.class
如下:
<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>
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();
}
});
}
}
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$
}
当我为Lua项目运行newProjectWizard时,我得到一个错误
大自然不存在:com.my.ide.Nature
我缺少一些设置吗?我猜你的插件可能没有被激活。我建议您转到“运行/调试配置”对话框,选择您的配置转到“插件”选项卡,确保您的插件com.my.ide已选中,然后单击“验证”,查看是否有任何缺少的依赖项,一旦您知道它已选中。如果是这种情况,请尝试单击添加所需的依赖项。一旦确定启动配置中包含了插件,并且没有缺少依赖项,请再次运行应用程序。如果仍然存在问题,请返回启动配置对话框,并在参数选项卡的程序参数文本区域添加-控制台。再次启动应用程序,在控制台中键入“start com.my.ide”以确保没有其他错误导致插件被激活,如果启动正常,则会出现其他问题 plugin.xml声明nature具有id
com.my.ide.id1
而不是com.my.ide.nature
,我也有类似的问题。似乎您没有正确定义nature id。此时你的插件正在激活。所以如果配置了项目性质
<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