DataKeys class not found in PhpStorm
I want to make simple plugin to have in files popup menu option "Upload to all servers in Deployment section".
First question: is this possible at all? (get from plugin servers list in phpstorm and push for each upload action in loop). And if possible - how to get this deployements servers, cause seems its something special thing for phpstrom\webstorm and idea dont know about them.
Second question:
I started from webinar tutorial, made simple plugin that has action in projects right click popup, found code to get selected files here.
This was working, than i found this link http://confluence.jetbrains.com/display/PhpStorm/Setting-up+environment+for+PhpStorm+plugin+development, it says "... in the second case you need to specify current installation of PhpStorm. This step is described in the Getting Started with Plugin Development...", so i changed in projects settings SDK to phpstrom folder, instead of idea. And add idea sources. After this run button start running phpstrom, plugin inside, but it say:
java.lang.ClassNotFoundException: com.intellij.openapi.actionSystem.DataKeys
when code try to
VirtualFile[] selectedFiles = DataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext);
At same time when i switching SDK back to idea folder, and export plugin as jar, import in phpstrom - this code works.
Please sign in to leave a comment.
I second this, a user of the MKS plugin(which I maintain) reported the plugin was failing in PyCharm 3.1.1 due to the same cause. See http://code.google.com/p/ideamksplugin/issues/detail?id=98
I know this DataKeys class has been deprecated but according to github's community source it still exists.
what's the IDEA version for that PyCharm version ?
Is this an oversight when building it ? or do we have to patch all plugins using that depreacted class to use the new way ?
eg
private VirtualFile[] getVirtualFiles(AnActionEvent event) {
return PlatformDataKeys.VIRTUAL_FILE_ARRAY.getData(event.getDataContext());
}
private Project getProject(AnActionEvent event) {
return PlatformDataKeys.PROJECT.getData(event.getDataContext());
}
DataKeys class is IntelliJ IDEA-specific, you should be able to use LangDataKeys or PlatformDataKeys instead.