Can I overwirte extensionPoints define in IdeaPlugin.xml

I find this extensions in IdeaPlugin.xml 

<codeInsight.createFieldFromUsageHelper language="JAVA" implementationClass="com.intellij.codeInsight.daemon.impl.quickfix.JavaCreateFieldFromUsageHelper"/>

so I overwirte it in my plugin.xml,like this

<extensions defaultExtensionNs="com.intellij">
<codeInsight.createFieldFromUsageHelper language="JAVA" implementationClass="MyTestJavaCreateFieldFromUsageHelper"/>
</extensions>

but it did work.so my question is it impossible or I missed something?

0
7 comments

It's possible to make IDE use your language extension instead of default one by adding order="first" attribute to its xml tag. However it's risky, when something changes in the standard implementation these changes will be ignored if your plugin is installed. Why do you need to override the default implementation? Maybe we can provide a proper API for your needs?

0
Avatar
Permanently deleted user

Thank you for your response.

In my team there is several class whitch contailns some constants may change by others,so we difine then by a web page,and then with a tool to gen java class.I did't like web page,I want do these with idea.

these class may look like this or some enum:

public final class GameConfig {

/**
* 地图迷雾过度的时候,帧刷新间隔
* 毫秒
*/
public static volatile float areafogmap_frame_margin = 20F;

/**
* 地图羽化次数
* 次数越大越废
*/
public static volatile float areafogmap_mohu_times = 1F;
 I'am new to plugin dev,I don't don't know the best way to do it,I just find these way by read source code
0

Could you please describe that exactly do you want to do with the plugin? Do you want to generate a Java class from scratch? Or you want to add a field to an existing class?

Anyway, you don't need to override createFieldFromUsageHelper extension, it's about a general way to create a field by reference to it and you'll break this behavior if you override it.

0
Avatar
Permanently deleted user

sorry,what I exactly want to do is when there is undefine filed error add this field and some other info to mysql(and leave the other things to our tools).so now what bother me is how get to know when this error and how to get the element (a expression includes parent class and the undefine field).

0

You can provide implementation of com.intellij.codeInsight.quickfix.UnresolvedReferenceQuickFixProvider extension for PsiJavaCodeReferenceElement to do that.

0
Avatar
Permanently deleted user

can you give me more detail ?where can I config these impelement?

0

UnresolvedReferenceQuickFixProvider is an extension point, so you should register your implementation in plugin.xml file like you did for createFieldFromUsageHelper, I've added javadoc about it. 

0

Please sign in to leave a comment.