How to trigger an action on Application startup or restart

已回答

Hi team,

I am working on a plugin, where I have a requirement to run an action on Application StartUp, So I tried the following code but did not worked for me

package com.dbs.codeshare.handlers;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupActivity;
import com.intellij.openapi.ui.Messages;
import org.jetbrains.annotations.NotNull;

public class StartUpWork implements StartupActivity{

@Override
public void runActivity(@NotNull Project project) {

Messages.showInfoMessage("Triggering action","Demo");
}
}


Tried this for sample demo didn't work for us......Can you please help what else I have to do or If I am using wrong approach please correct us.

Please respond us asap this is an urgent requirement to finish this plugin

 

Thank you :)

0
Just got to know we have to add this postStartUpActivity tag in extentions.. Then it will work as expected
<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
<postStartupActivity implementation="com.dbs.codeshare.handlers.StartUpWork"/>
</extensions>


Thanks :)

0

请先登录再写评论。