Missing extension point: in area null

已回答

I am trying to create some extension points in a plugin and trying to use the extensions in the same plugin just to make sure it works. But when I run the ide instance with the plugin, I get the following exception:

IllegalArgumentException: Missing extension point: org.guidewire.swagger.customFormatValues in area null

 

Following is the plugin.xml under META-INF

<id>org.gw.swagger</id>
<extensionPoints>
<extensionPoint name="customFormatValues" interface="org.extensionPoints.CustomFormatValues" area="IDEA_PROJECT"/>
</extensionPoints>

<extensions defaultExtensionNs="org.gw.swagger">
<customFormatValues implementation="org.extensionPoints.CustomFormatValuesImpl"/>
</extensions>
public abstract class CustomFormatValues {
static final ExtensionPointName<CustomFormatValues> EP_NAME = ExtensionPointName.create("org.gw.swagger.customFormatValues");
public abstract List<Value> getFormatValues();
}

 

And following is the implementation

public class CustomFormatValuesImpl extends CustomFormatValues {
@Override
public List<Value> getFormatValues() {
return ImmutableList.of(
new StringValue("gw-bigdecimal"),
new StringValue("gw-biginteger"),
new StringValue("gw-money")
);
}
}

 

When I run the plugin and try the code that should get the custom format values, I get the above mentioned exception

for (final CustomFormatValues ep : CustomFormatValues.EP_NAME.getExtensions()) {
System.out.println(ep.getFormatValues());

 

What am I missing?

Are there any more requirements to define and extend the extension point? Does the extension interface has to extend any other interface?

Is the area param correct?

Also, how are these extensions loaded when application starts?

 

I would appreciate any help.

Thanks

0

I have tried it the following way as well i.e. with qualified name. Also have tried to remove the area attribute but same result

<extensionPoint qualifiedName="org.gw.swagger.customFormatValues" interface="org.extensionPoints.CustomFormatValues" area="IDEA_PROJECT"/>
0

This is working now. Not sure what changed exactly (except the qualified name and not having the area attribute... which i tried earlier)

<extensionPoints>
<extensionPoint qualifiedName="org.gw.swagger.customFormatValues" interface="org.extensionPoints.CustomFormatValues"/>
</extensionPoints>

<extensions defaultExtensionNs="org.gw.swagger">
<customFormatValues implementation="org.extensionPoints.CustomFormatValuesImpl"/>
</extensions>
0

The difference is "per-application" vs "per-project" extension point instances.
If you declare extension point using `area="IDEA_PROJECT"`, you should pass Project when getting extensions, ex: `EP_NAME.getExtensions(project)`.
And, if you declare `CustomFormatValuesImpl(Project)` constructor, the Project will be passed to it.

0

请先登录再写评论。