The article about implementing a license check says
(!) For the release version of the IDE, the plugin license will be checked on start. If there is no license provided in the dialog and there is no evaluation available, the plugin will be disabled and won't be loaded at all. If the license would be removed/expired when the plugin is already loaded, it's technically impossible to unload the plugin, so it will be working until the IDE is restarted.
This means that IDEA will check the license at start-up anyway and that the verification calls through isLicensed() is an additional measure to make a plugin defunct if, e.g. its license expires while having IDEA already open. I'm having a hard time thinking about how I can restrict/defunct my custom language plugin without accidentally annoying users. I have thought of 3 ways:
- Use a StartupActivity to check the license and if it fails I don't register, e.g. CompletionProviders or Annotators/Inspections. This would limit the usability drastically but since IDEA performs a license check at startup anyway and disables my plugin if necessary, this is of course useless.
- Call isLicensed() during the runtime when for instance highlighting or completion is invoked. I could then disable these features.
- Call isLicensed() periodically every 10min and simply annoy the user with a dialog that says "You don't have a valid license"
I'm very hesitant to implement any of these options. For one, I don't think calling isLicensed() inside a feature that runs often is a good idea. What happens if the user loses internet-connection and the license check fails although they have a valid substription? Second, most important features of a language plugin like annotators, inspections, completion, indexing, etc. run very often and I wouldn't like to impact the performance negatively by adding a license check there.
My personal opinion is that I would be OK if the plugin license is checked only once at start-up. Even if that means some users can use the plugin without a valid license simply because they haven't closed IDEA yet.
What do other developers think about this? In which places are you putting the license check?