Facet开发中对“Project facet has not been defined”错误的解决

Facet开发中,我们需要配置org.eclipse.wst.common.project.facet.core.facets扩展点,而该扩展点中又需要配置project-facetproject-facet-versionaction元素。

 

如果action的子元素config-factoryclass属性值是以data model provider的方式来提供的,即该data model provider继承于FacetInstallDataModelProvider,那么当运行插件,在Project Facets页面中选择自定义的facet时,提示“Project facet has not been defined”错误。解决办法是重写FacetInstallDataModelProvider.getDefaultProperty(...)方法,当FacetInstallDataModelProvider.FACET_ID等于propertyName时,返回自定义的facet id,具体如下:

@Override

    public Object getDefaultProperty(String propertyName) {

       // TODO Auto-generated method stub

       if(FACET_ID.equals(propertyName)) {

           return facetID_in_pluginxml;

       }

       return super.getDefaultProperty(propertyName);

    }

 

 

 

你可能感兴趣的:(Facet开发中对“Project facet has not been defined”错误的解决)