Action is not triggered from main menu

Answered

Hi, i has been created first plugin for IntelliJ with simple action like on this tutorial.

But when I run plugin this action is not triggered from main menu.

I triggered my action only by hot keys and also from Search Everywhere result list.


What is my problem?

 

plugin.xml

<actions>
<action id="DummyAction" class="DummyAction" text="Dummy Action" description="Dummy Action">
<add-to-group group-id="WindowMenu" anchor="last"/>
<keyboard-shortcut keymap="$default" first-keystroke="ctrl meta alt D"/>
</action>
</actions>

DummyAction.java

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.ui.Messages;

public class DummyAction extends AnAction {

@Override
public void actionPerformed(AnActionEvent e) {
Messages.showMessageDialog("Hello!\n I am glad to see you.", "Information", Messages.getInformationIcon());
}
}
0
13 comments

Do you mean that you can see 'Dummy Action' menu item in 'Window' menu, but when you click on it nothing happens?

If so please look in idea.log (Help | Show Log) for exceptions.

0

BTW you shouldn't place classes into the root package in Java, please move the class into some package.

0
Avatar
Permanently deleted user

Why I should not place classes into root package? I'm newbie in Java world.

0
Avatar
Permanently deleted user

I can see menu item in main menu but when I click on it nothing happens.

0
Avatar
Permanently deleted user

I moved classes into package. But problem still exists.

 

IDEA log

2018-01-22 15:23:42,617 [ 0] INFO - #com.intellij.idea.Main - ------------------------------------------------------ IDE STARTED ------------------------------------------------------ 
2018-01-22 15:23:42,630 [ 13] INFO - #com.intellij.util.ui.JBUI - User scale factor: 1.0
2018-01-22 15:23:42,630 [ 13] INFO - #com.intellij.util.ui.JBUI - System scale factor: 2.0 (JRE-managed HiDPI)
2018-01-22 15:23:42,638 [ 21] INFO - #com.intellij.idea.Main - IDE: IntelliJ IDEA (build #IU-173.4301.25, 15 Jan 2018 19:42)
2018-01-22 15:23:42,638 [ 21] INFO - #com.intellij.idea.Main - OS: Mac OS X (10.13.2, x86_64)
2018-01-22 15:23:42,638 [ 21] INFO - #com.intellij.idea.Main - JRE: 1.8.0_152-b16 (Oracle Corporation)
2018-01-22 15:23:42,638 [ 21] INFO - #com.intellij.idea.Main - JVM: 25.152-b16 (Java HotSpot(TM) 64-Bit Server VM)
2018-01-22 15:23:42,647 [ 30] INFO - #com.intellij.idea.Main - JVM Args: -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:49792,suspend=y,server=n -Xmx512m -Xms256m -XX:MaxPermSize=250m -ea -Xbootclasspath/a:/Users/alex/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/173.4301.25/IntelliJ IDEA.app/Contents/lib/boot.jar -Didea.config.path=/Users/alex/Library/Caches/IntelliJIdea2017.3/plugins-sandbox/config -Didea.system.path=/Users/alex/Library/Caches/IntelliJIdea2017.3/plugins-sandbox/system -Didea.plugins.path=/Users/alex/Library/Caches/IntelliJIdea2017.3/plugins-sandbox/plugins -Didea.classpath.index.enabled=false -Didea.required.plugins.id=com.your.company.unique.plugin.id -Didea.smooth.progress=false -Dapple.laf.useScreenMenuBar=true -Dapple.awt.fileDialogForDirectories=true -javaagent:/Users/alex/Library/Caches/IntelliJIdea2017.3/captureAgent/debugger-agent.jar=/private/var/folders/qv/mk1nzktn0fdg2dg5_pkjvf2r0000gn/T/capture.props -Dfile.encoding=UTF-8
2018-01-22 15:23:42,649 [ 32] INFO - #com.intellij.idea.Main - ForkJoinPool.commonPool: java.util.concurrent.ForkJoinPool@3c6b15ce[Running, parallelism = 7, size = 0, active = 0, running = 0, steals = 0, tasks = 0, submissions = 0]
2018-01-22 15:23:42,649 [ 32] INFO - #com.intellij.idea.Main - ext: /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre/lib/ext: [sunec.jar, nashorn.jar, cldrdata.jar, jfxrt.jar, dnsns.jar, localedata.jar, sunjce_provider.jar, meta-index, sunpkcs11.jar, jaccess.jar, zipfs.jar]
2018-01-22 15:23:42,649 [ 32] INFO - #com.intellij.idea.Main - ext: /System/Library/Java/Extensions: [MRJToolkit.jar]
2018-01-22 15:23:42,649 [ 32] INFO - #com.intellij.idea.Main - JNU charset: UTF-8
2018-01-22 15:23:42,664 [ 47] INFO - #com.intellij.idea.Main - JNA library (64-bit) loaded in 14 ms
2018-01-22 15:23:42,683 [ 66] INFO - #com.intellij.idea.Main - initializing environment
2018-01-22 15:23:42,684 [ 67] INFO - .intellij.util.EnvironmentUtil - loading shell env: /bin/bash -l -i -c '/Users/alex/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/173.4301.25/IntelliJ IDEA.app/Contents/bin/printenv.py' '/private/var/folders/qv/mk1nzktn0fdg2dg5_pkjvf2r0000gn/T/intellij-shell-env.tmp'
2018-01-22 15:23:43,405 [ 788] INFO - .intellij.util.EnvironmentUtil - shell environment loaded (19 vars)
2018-01-22 15:23:45,759 [ 3142] INFO - llij.ide.plugins.PluginManager - 131 plugins initialized in 1050 ms
2018-01-22 15:23:45,768 [ 3151] INFO - llij.ide.plugins.PluginManager - Loaded bundled plugins: ASP (0.1), Android Support (10.2.3), AngularJS (173.4301.25), Ant Support (1.0), Application Servers View (0.2.0), AspectJ Support (1.2), Bytecode Viewer (0.1), CFML Support (3.53), CSS Support (173.4301.25), CVS Integration (11), Cloud Foundry integration (1.0), CloudBees integration (1.0), CoffeeScript (2.0), Copyright (8.1), Coverage (173.4301.25), Cucumber for Groovy (999.999), Cucumber for Java (999.999), DSM Analysis (1.0.0), Database Tools and SQL (173.4301.25), Eclipse Integration (3.0), EditorConfig (173.4301.25), Emma (173.4301.25), Flash/Flex Support (173.4301.25), FreeMarker support (1.0), GWT Support (1.0), Geronimo Integration (1.0), Gherkin (999.999), Git Integration (8.1), GitHub (173.4301.25), GlassFish Integration (1.0), Google App Engine Integration (1.1.4), Gradle (173.4301.25), Grails (9.0), Groovy (9.0), Guice (8.0), HTML Tools (2.0), Haml (173.4301.25), Heroku integration (173.4301.25), Hibernate Support (1.0), I18n for Java (173.4301.25), IDE Settings Sync (173.4301.25), IDEA CORE (173.4301.25), IntelliLang (8.0), J2ME (1.0), JBoss Arquillian Support (1.0), JBoss Drools Support (1.0), JBoss Frameworks Base Support (1.0), JBoss Integration (1.0), JBoss Seam Pageflow Support (1.0), JBoss Seam Pages Support (1.0), JBoss Seam Support (1.0), JBoss jBPM (2.0.0), JSR45 Integration (1.0), JUnit (1.0), Java Bytecode Decompiler (173.4301.25), Java EE: Batch Applications (1.0), Java EE: Bean Validation Support (1.1), Java EE: Contexts and Dependency Injection (1.1), Java EE: EJB, JPA, Servlets (1.0), Java EE: JMS, JSON Processing, Concurrency, Transaction (1.0), Java EE: Java Server Faces (2.2.X.), Java EE: RESTful Web Services (JAX-RS) (1.0), Java EE: Web Services (JAX-WS) (1.9), Java EE: WebSockets (1.0), Java Server Pages (JSP) Integration (1.0), Java Stream Debugger (173.4301.25), JavaFX (1.0), JavaScript Debugger (1.0), JavaScript Intention Power Pack (0.9.4), JavaScript Support (1.0), Jetty Integration (1.0), Kotlin (1.2.10-release-IJ2017.3-1), Less support (173.4301.25), Markdown support (173.4301.25), Maven Integration (173.4301.25), Maven Integration Extension (173.4301.25), Mercurial Integration (10.0), OpenShift integration (1.0), Osmorc (1.4.11), Perforce Integration (2.0), Persistence Frameworks Support (1.0), Playframework Support (1.0), Plugin DevKit (1.0), Properties Support (173.4301.25), QuirksMode (173.4301.25), REST Client (173.4301.25), Refactor-X (2.01), Remote Hosts Access (0.1), Resin Integration (8.1), SSH Remote Run (0.1), Sass support (173.4301.25), Settings Repository (173.4301.25), Spring AOP/@AspectJ (1.0), Spring Batch (1.0), Spring Boot (1.0), Spring Data (1.0), Spring Integration Patterns (1.0), Spring MVC (1.0), Spring OSGi (1.0), Spring Security (1.0), Spring Support (1.0), Spring Web Flow (1.0), Spring Web Services (1.0), Spring WebSocket (1.0), Spy-js (173.4301.25), Struts 1.x (2.0), Struts 2 (1.0), Stylus support (999.999), Subversion Integration (1.1), TFS Integration (999.999), Tapestry support (1.0), Task Management (1.0), Terminal (0.1), TestNG-J (8.0), Thymeleaf (1.0), Time Tracking (1.0), Tomcat and TomEE Integration (1.0), UI Designer (173.4301.25), UML Support (1.0), Vaadin Support (1.0), Velocity support (1.0), W3C Validators (2.0), WebLogic Integration (1.0), WebSphere Integration (1.0), XPathView + XSLT Support (4), XSLT-Debugger (1.4), YAML (173.4301.25), ZKM-Unscramble (1.0), dmServer Support (0.9.5), tslint (173.4301.25)
2018-01-22 15:23:45,768 [ 3151] INFO - llij.ide.plugins.PluginManager - Loaded custom plugins: Plugin display name here (1.0)
2018-01-22 15:23:46,880 [ 4263] INFO - cloudConfig.CloudConfigManager - === Start.updateInitStatus ===
2018-01-22 15:23:46,883 [ 4266] INFO - cloudConfig.CloudConfigManager - === Start: JBA_NOT_CONNECTED ===
2018-01-22 15:23:46,883 [ 4266] INFO - cloudConfig.CloudConfigManager - === calculateInitStatus ===
2018-01-22 15:23:46,972 [ 4355] INFO - til.net.ssl.CertificateManager - Default SSL context initialized
2018-01-22 15:23:46,989 [ 4372] INFO - ellij.util.io.PagedFileStorage - lower=100; upper=435; buffer=10; max=435
2018-01-22 15:23:47,036 [ 4419] INFO - pl.local.NativeFileWatcherImpl - Starting file watcher: /Users/alex/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/173.4301.25/IntelliJ IDEA.app/Contents/bin/fsnotifier
2018-01-22 15:23:47,049 [ 4432] INFO - pl.local.NativeFileWatcherImpl - Native file watcher is operational.
2018-01-22 15:23:47,842 [ 5225] INFO - .cloudConfig.CloudConfigClient - === Get cloud config URL: https://cloudconfig.jetbrains.com/cloudconfig/files ===
2018-01-22 15:23:48,271 [ 5654] INFO - .openapi.application.Preloader - Finished preloading com.intellij.ide.ui.OptionsTopHitProvider$Activity@f610e0b
2018-01-22 15:23:48,357 [ 5740] INFO - tellij.ide.SystemHealthMonitor - issue detected: bundled.jre.version.message
2018-01-22 15:23:48,374 [ 5757] INFO - rains.ide.BuiltInServerManager - built-in server started, port 63344
2018-01-22 15:23:48,427 [ 5810] INFO - gs.impl.UpdateCheckerComponent - channel: release
2018-01-22 15:23:48,521 [ 5904] INFO - cloudConfig.CloudConfigManager - === calculateInitStatus.value: JBA_NOT_CONNECTED ===
2018-01-22 15:23:48,865 [ 6248] INFO - il.indexing.FileBasedIndexImpl - Index exts enumerated:389
2018-01-22 15:23:48,873 [ 6256] INFO - il.indexing.FileBasedIndexImpl - Index scheduled:7
2018-01-22 15:23:48,917 [ 6300] INFO - tellij.psi.stubs.StubIndexImpl - All stub exts enumerated:37
2018-01-22 15:23:48,917 [ 6300] INFO - tellij.psi.stubs.StubIndexImpl - stub exts update scheduled:0
2018-01-22 15:23:49,282 [ 6665] INFO - plication.impl.ApplicationImpl - 98 application components initialized in 4576ms
2018-01-22 15:23:49,321 [ 6704] INFO - .intellij.idea.IdeaApplication - App initialization took 9186 ms
2018-01-22 15:23:49,517 [ 6900] WARN - j.ui.mac.MacMainFrameDecorator - no url bundle present.
To use platform protocol handler to open external links specify required protocols in the mac app layout section of the build file
Example: args.urlSchemes = ["your-protocol"] will handle following links: your-protocol://open?file=file&line=line
2018-01-22 15:23:50,619 [ 8002] INFO - pl$FileIndexDataInitialization - Initialization done:1745
2018-01-22 15:23:50,797 [ 8180] INFO - com.intellij.ide.ui.UISettings - Loaded: fontSize=12, fontScale=1.0; restored: fontSize=12, fontScale=1.0
2018-01-22 15:23:50,817 [ 8200] INFO - exImpl$StubIndexInitialization - Initialization done:197
2018-01-22 15:23:51,360 [ 8743] INFO - .openapi.application.Preloader - Finished preloading com.intellij.openapi.actionSystem.impl.ActionPreloader@2fdb79aa
2018-01-22 15:23:52,239 [ 9622] INFO - ellij.project.impl.ProjectImpl - 177 project components initialized in 2298 ms
2018-01-22 15:23:52,251 [ 9634] INFO - le.impl.ModuleManagerComponent - 0 module(s) loaded in 0 ms
2018-01-22 15:23:52,585 [ 9968] WARN - om.intellij.util.ProfilingUtil - Profiling agent is not enabled. Add -agentlib:yjpagent to idea.vmoptions if necessary to profile IDEA.
2018-01-22 15:23:52,704 [ 10087] INFO - j.ide.script.IdeStartupScripts - 0 startup script(s) found
2018-01-22 15:23:53,040 [ 10423] INFO - CompilerBackwardReferenceIndex - backward reference index version differ due to: class java.io.FileNotFoundException
2018-01-22 15:23:53,462 [ 10845] INFO - .diagnostic.PerformanceWatcher - Pushing properties took 1ms; general responsiveness: ok; EDT responsiveness: ok
2018-01-22 15:23:53,521 [ 10904] INFO - ellij.project.impl.ProjectImpl - 20 project components initialized in 45 ms
2018-01-22 15:23:53,652 [ 11035] INFO - .diagnostic.PerformanceWatcher - Post-startup activities under progress took 268ms; general responsiveness: ok; EDT responsiveness: ok
2018-01-22 15:23:53,926 [ 11309] INFO - cloudConfig.CloudConfigManager - === StatusBar.update create ===
2018-01-22 15:23:54,035 [ 11418] INFO - ScriptTemplatesProviders - [kts] loading script definitions [] using cp:
2018-01-22 15:23:54,040 [ 11423] INFO - ScriptTemplatesProviders - Templates provider KotlinCompilerScriptTemplatesSettings is invalid:
2018-01-22 15:23:54,084 [ 11467] INFO - ScriptTemplatesProviders - Templates provider Gradle Kotlin DSL is invalid: Unable to get Gradle home directory
2018-01-22 15:23:54,085 [ 11468] INFO - ScriptTemplatesProviders - Templates provider Gradle Kotlin DSL is invalid: Unable to get Gradle home directory
2018-01-22 15:23:54,085 [ 11468] INFO - ScriptTemplatesProviders - Templates provider Gradle Script Kotlin is invalid: Unable to get Gradle home directory
2018-01-22 15:23:54,085 [ 11468] INFO - ScriptTemplatesProviders - [kts] loading script definitions [kotlin.script.templates.standard.ScriptTemplateWithArgs] using cp:
2018-01-22 15:23:54,136 [ 11519] INFO - .openapi.application.Preloader - Finished preloading com.intellij.ide.ui.search.SearchableOptionPreloader@312eee36
2018-01-22 15:23:54,330 [ 11713] INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 867ms; general responsiveness: ok; EDT responsiveness: ok
2018-01-22 15:23:54,343 [ 11726] INFO - j.ide.ui.OptionsTopHitProvider - 354 ms spent to cache options in application
2018-01-22 15:23:54,344 [ 11727] INFO - cloudConfig.CloudConfigManager - === End.updateInitStatus ===
2018-01-22 15:23:54,551 [ 11934] INFO - tartup.impl.StartupManagerImpl - /Users/alex/IdeaProjects/emptyProject/.idea case-sensitivity: expected=false actual=false
2018-01-22 15:23:54,560 [ 11943] INFO - pl.projectlevelman.NewMappings - VCS Root: [] - [<Project>]
2018-01-22 15:23:54,837 [ 12220] INFO - .openapi.application.Preloader - Finished preloading com.intellij.codeInsight.completion.CompletionPreloader@28141d4
2018-01-22 15:23:55,084 [ 12467] INFO - cloudConfig.CloudConfigManager - === StatusBar.start another widget: com.intellij.cloudConfig.StatusBarInfoManager$InfoComponent@25a1db55 ===
2018-01-22 15:23:55,723 [ 13106] INFO - j.ide.plugins.RepositoryHelper - using cached plugin list (updated at 22/01/2018, 00:32)
2018-01-22 15:23:55,883 [ 13266] INFO - j.ide.ui.OptionsTopHitProvider - 170 ms spent to cache options in project
2018-01-22 15:23:55,892 [ 13275] INFO - tor.impl.FileEditorManagerImpl - Project opening took 6024 ms
2018-01-22 15:23:56,289 [ 13672] INFO - CompilerWorkspaceConfiguration - Available processors: 8
2018-01-22 15:26:49,034 [ 186417] INFO - j.compiler.server.BuildManager - Clearing project build data because the project does not exist or was not opened for more than 30 days: /Users/alex/Library/Caches/IntelliJIdea2017.3/plugins-sandbox/system/compile-server/emptyproject_245f9cc5
2018-01-22 15:27:57,472 [ 254855] INFO - .script.IdeScriptEngineManager - javax.script.ScriptEngineManager initialized in 453 ms
0
Avatar
Permanently deleted user

I have MacBook Pro with High Sierra (macOS 10.13.3). When I build IntelliJ community edition from sources and run it, main menu is visible but does not work.

I use key -Dapple.laf.useScreenMenuBar=false to run IntelliJ community edition and my plugin too. And now I have working main menu.

0
Avatar
Permanently deleted user

I have same problem. When I click the custom action menu, there are no any response. -Dapple.laf.useScreenMenuBar=false works.

1
Avatar
Permanently deleted user

I have the same problem when running a debug IDE to test my plugin. I am going through the tutorial and when I click on Tools -> Simple Action, nothing happens. In fact, many of the standard menu items don't do anything either (ex: Tools -> Save Project As Template...)

0
Avatar
Permanently deleted user

I am having the same problem and tiered of it

0

I'm facing the same issue. Impossible to test plugin, since none of the actions is actionable

0

If you are experiencing this problem in macOS but not Win, please try this workaround:

Repeat step one of the IntelliJ Build Configuration, but base the IntelliJ IDEA JDK "1.8" on the JetBrains Java runtime (jbr) rather than the Oracle Java 8 JDK.

The jbr is located in ~/Library/Preferences/<PRODUCT><VERSION>/jdks, and will have a folder name something like "jbsdk8u152b1402.1_osx_x64". 

Configure a new IntelliJ Platform SDK, using the jbr-based "1.8" JDK.

Choose this new jbr-based IntelliJ Platform SDK as the project SDK for your plugin. Recompile and then run or debug.

 

0

I'am facing the similar issue even in Win,could you suggest a solution.

0

Abhiram654 please share your plugin sources

0

Please sign in to leave a comment.