Can't instantiate plugin action class

I've written the small plugin for the Intellij IDEA. Then, I created new action (src folder -> Right Mouse Button -> new -> Action).
Then I filled the id, class name, description and chose the ToolsMenu as the target for the action to appear.
The project makes, successfully runs, then when I try to press Tools menu I get the followinf error:
[ 19661] ERROR - ellij.project.impl.ProjectImpl - IntelliJ IDEA 14.0.2 Build #IC-139.659.2
[ 19661] ERROR - ellij.project.impl.ProjectImpl - JDK: 1.6.0_65
[ 19661] ERROR - ellij.project.impl.ProjectImpl - VM: Java HotSpot(TM) 64-Bit Server VM
[ 19661] ERROR - ellij.project.impl.ProjectImpl - Vendor: Apple Inc.
[ 19661] ERROR - ellij.project.impl.ProjectImpl - OS: Mac OS X
[ 19661] ERROR - ellij.project.impl.ProjectImpl - Last Action:
[ 27163] WARN - ateSettings.impl.UpdateChecker - Connection timed out
2015-04-02 12:07:03.043 java[5626:2638183] needed to substitute Lucida Grande for: NotoColorEmoji
[ 64099] ERROR - ctionSystem.DefaultActionGroup - class with name 'com.intel.actions.OpenUIBuilder' must be an instance of 'com.intellij.openapi.actionSystem.AnAction'; got null (null)
java.lang.IllegalStateException: class with name 'com.intel.actions.OpenUIBuilder' must be an instance of 'com.intellij.openapi.actionSystem.AnAction'; got null (null)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.convertStub(ActionManagerImpl.java:183)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.convert(ActionManagerImpl.java:523)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.getActionImpl(ActionManagerImpl.java:503)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.getAction(ActionManagerImpl.java:480)
at com.intellij.openapi.actionSystem.DefaultActionGroup.unStub(DefaultActionGroup.java:354)
at com.intellij.openapi.actionSystem.DefaultActionGroup.getChildren(DefaultActionGroup.java:331)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$5.compute(ActionManagerImpl.java:1316)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$5.compute(ActionManagerImpl.java:1309)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:928)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.preloadActionGroup(ActionManagerImpl.java:1309)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.preloadActionGroup(ActionManagerImpl.java:1324)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.preloadActionGroup(ActionManagerImpl.java:1303)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.doPreloadActions(ActionManagerImpl.java:1294)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.access$200(ActionManagerImpl.java:75)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$4.run(ActionManagerImpl.java:1274)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:405)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)
[ 64099] ERROR - ctionSystem.DefaultActionGroup - IntelliJ IDEA 14.0.2 Build #IC-139.659.2
[ 64099] ERROR - ctionSystem.DefaultActionGroup - JDK: 1.6.0_65
[ 64099] ERROR - ctionSystem.DefaultActionGroup - VM: Java HotSpot(TM) 64-Bit Server VM
[ 64099] ERROR - ctionSystem.DefaultActionGroup - Vendor: Apple Inc.
[ 64099] ERROR - ctionSystem.DefaultActionGroup - OS: Mac OS X
[ 64099] ERROR - ctionSystem.DefaultActionGroup - Last Action:
[ 64100] ERROR - ctionSystem.DefaultActionGroup - Can't unstub <Prototyping (description),com.intellij.openapi.actionSystem.Constraints@58d3e2>
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:115)
at com.intellij.openapi.actionSystem.DefaultActionGroup.getChildren(DefaultActionGroup.java:333)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$5.compute(ActionManagerImpl.java:1316)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$5.compute(ActionManagerImpl.java:1309)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:928)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.preloadActionGroup(ActionManagerImpl.java:1309)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.preloadActionGroup(ActionManagerImpl.java:1324)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.preloadActionGroup(ActionManagerImpl.java:1303)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.doPreloadActions(ActionManagerImpl.java:1294)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.access$200(ActionManagerImpl.java:75)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$4.run(ActionManagerImpl.java:1274)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:405)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)
[ 64100] ERROR - ctionSystem.DefaultActionGroup - IntelliJ IDEA 14.0.2 Build #IC-139.659.2
[ 64100] ERROR - ctionSystem.DefaultActionGroup - JDK: 1.6.0_65
[ 64100] ERROR - ctionSystem.DefaultActionGroup - VM: Java HotSpot(TM) 64-Bit Server VM
[ 64100] ERROR - ctionSystem.DefaultActionGroup - Vendor: Apple Inc.
[ 64100] ERROR - ctionSystem.DefaultActionGroup - OS: Mac OS X
[ 64100] ERROR - ctionSystem.DefaultActionGroup - Last Action:
[4960331] ERROR - ctionSystem.DefaultActionGroup - Null child action in group Tools () of class class com.intellij.openapi.actionSystem.DefaultCompactActionGroup, id=show.ui
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:115)
at com.intellij.openapi.actionSystem.DefaultActionGroup.unStub(DefaultActionGroup.java:356)
at com.intellij.openapi.actionSystem.DefaultActionGroup.getChildren(DefaultActionGroup.java:331)
at com.intellij.openapi.actionSystem.impl.Utils.expandActionGroup(Utils.java:125)
at com.intellij.openapi.actionSystem.impl.Utils.expandActionGroup(Utils.java:86)
at com.intellij.openapi.actionSystem.impl.Utils.fillMenu(Utils.java:280)
at com.intellij.openapi.actionSystem.impl.ActionMenu.fillMenu(ActionMenu.java:281)
at com.intellij.openapi.actionSystem.impl.ActionMenu.access$400(ActionMenu.java:41)
at com.intellij.openapi.actionSystem.impl.ActionMenu$MenuListenerImpl.menuSelected(ActionMenu.java:235)
at javax.swing.JMenu.fireMenuSelected(JMenu.java:1028)
at javax.swing.JMenu$MenuChangeListener.stateChanged(JMenu.java:1107)
at javax.swing.DefaultButtonModel.fireStateChanged(DefaultButtonModel.java:333)
at javax.swing.DefaultButtonModel.setSelected(DefaultButtonModel.java:215)
at javax.swing.JMenu.setSelected(JMenu.java:294)
at com.apple.laf.ScreenMenu$1.run(ScreenMenu.java:117)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at apple.awt.CToolkit$CPeerEvent.dispatch(CToolkit.java:1221)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)
at java.awt.EventQueue.access$400(EventQueue.java:82)
at java.awt.EventQueue$2.run(EventQueue.java:676)
at java.awt.EventQueue$2.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:748)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:577)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:384)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


What I'm trying to do: to reuse the ui plugin for Android Studio, but it uses another openapi (so I imported the openapi module from the github project and deleted openapi.jar from dependencies of SDK)

I've also tried to make sample action class, but the error is pretty the same.

5 comments
Comment actions Permalink

Hello Alexander,

it isn't possible to provide your own version of any IntelliJ platform JAR file (including openapi.jar) in a plugin. If you want write a plugin for
Android Studio you can set create an 'IntelliJ Platform Plugin SDK' instance in File | Project Structure | SDKs which points to Android Studio
installation.

--
Nikolay Chashnikov
JetBrains
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

The UI Designer plugin uses a bit modified openapi. So, it seems to be inappropriate to redesign the whole plugin.
So, I'm asking for the soultion, which would overcome this obstacle

0
Comment actions Permalink

What do you mean by "a bit modified openapi"? Android Studio is based on some version of IntelliJ Platform, you can refer to
http://tools.android.com/build/studio/idea-tags to find which version of IntelliJ Platform corresponding to your version of Android Studio. Then you
can checkout IntelliJ sources from github using tag idea/<intellij-build-number>, this way you will get sources which correspond to the openapi.jar
from Android Studio.

--
Nikolay Chashnikov
JetBrains
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Please, explain it a bit more.

I have checkout the latest version of intellij-community from github.
I try to use the code from it (in particualar Android UI Designer).
So, I develop the plugin in my Intellij (14.0.2). And when I run the plugin, Intellij IDEA, not  Android Studio is running.
So, it reflects to the openapi.jar of the Intellij previously installed.

What should I do then?

0
Comment actions Permalink

As I said before you can setup an IntelliJ Platform Plugin SDK which points to Android Studio installation, not IntelliJ IDEA installation, and when
you start the 'Plugin' run configuration it'll run Android Studio instead of IntelliJ IDEA.

Also if you want to use classes from Android plugin you don't need to copy them into your project, you can add
'' tag to your plugin.xml instead and add required JARs from Android plugin to 'Classpath' of 'IntelliJ
Platform Plugin SDK'.

--
Nikolay Chashnikov
JetBrains
http://www.jetbrains.com
"Develop with pleasure!"

0

Please sign in to leave a comment.