Intellij 插件开发,如何防止一个动作发生,比如关闭一个标签

Intellij plugin development, how to prevent an action from occuring, like closing a tab

这可能吗?

我需要以某种方式订阅事件,可能return false 或类似的,我猜。不过我不知道如何

那是什么活动?

在哪里注册?

有人吗?

编辑:

我试过这个:

import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.editor.impl.EditorComponentImpl;
import org.jetbrains.annotations.NotNull;

import java.awt.*;
import java.awt.event.AWTEventListener;
import java.awt.event.KeyEvent;

public class MyPlugin implements ApplicationComponent {

    static {
        /*MessageBus bus = ApplicationManager.getApplication().get

        MessageBusConnection connection = bus.connect();

        connection.subscribe(AppTopics.FILE_DOCUMENT_SYNC,
            new FileDocumentManagerAdapter() {
                @Override
                public void beforeDocumentSaving(Document document) {
                    // create your custom logic here
                }
            });*/
    }

    private final AWTEventListener listener;

    public MyPlugin() {
        System.out.println("111111111111111111");
        listener = new AWTEventListener() {

            @Override
            public void eventDispatched(AWTEvent event) {

                if ( event instanceof KeyEvent ) {
                    KeyEvent kv = (KeyEvent) event;
                    Component component = kv.getComponent();

                    if ( component instanceof EditorComponentImpl) {
                        EditorComponentImpl cp = (EditorComponentImpl) component;

                    }

                    System.out.println("3333333" + component.getClass());
                }

                System.out.println("aaaaaaa" + event.getClass());

            }
        };
    }

    @Override
    public void initComponent() {
        System.out.println("bbbbbbbbbbbbbbbbbbbbbbbbbbb");
        Toolkit.getDefaultToolkit().addAWTEventListener(listener, AWTEvent.KEY_EVENT_MASK);
    }

    @Override
    public void disposeComponent() {
        Toolkit.getDefaultToolkit().removeAWTEventListener(listener);
    }

    @NotNull
    @Override
    public String getComponentName() {
        return "temp";
    }

}

但是不行。我收到事件但类型错误。

最后开发了两个插件来完成这个:

https://plugins.jetbrains.com/space/index?pr=idea&lg=opensource%40momomo.com