Search in sources :

Example 1 with CommandListener

use of com.intellij.openapi.command.CommandListener in project intellij-community by JetBrains.

the class CoreCommandProcessor method fireCommandStarted.

private void fireCommandStarted() {
    ApplicationManager.getApplication().assertIsDispatchThread();
    CommandDescriptor currentCommand = myCurrentCommand;
    CommandEvent event = new CommandEvent(this, currentCommand.myCommand, currentCommand.myName, currentCommand.myGroupId, currentCommand.myProject, currentCommand.myUndoConfirmationPolicy, currentCommand.myShouldRecordActionForActiveDocument, currentCommand.myDocument);
    for (CommandListener listener : myListeners) {
        try {
            listener.commandStarted(event);
        } catch (Throwable e) {
            CommandLog.LOG.error(e);
        }
    }
}
Also used : CommandListener(com.intellij.openapi.command.CommandListener) CommandEvent(com.intellij.openapi.command.CommandEvent)

Example 2 with CommandListener

use of com.intellij.openapi.command.CommandListener in project intellij-community by JetBrains.

the class CoreCommandProcessor method fireCommandFinished.

protected void fireCommandFinished() {
    ApplicationManager.getApplication().assertIsDispatchThread();
    CommandDescriptor currentCommand = myCurrentCommand;
    CommandEvent event = new CommandEvent(this, currentCommand.myCommand, currentCommand.myName, currentCommand.myGroupId, currentCommand.myProject, currentCommand.myUndoConfirmationPolicy, currentCommand.myShouldRecordActionForActiveDocument, currentCommand.myDocument);
    try {
        for (CommandListener listener : myListeners) {
            try {
                listener.beforeCommandFinished(event);
            } catch (Throwable e) {
                CommandLog.LOG.error(e);
            }
        }
    } finally {
        myCurrentCommand = null;
        for (CommandListener listener : myListeners) {
            try {
                listener.commandFinished(event);
            } catch (Throwable e) {
                CommandLog.LOG.error(e);
            }
        }
    }
}
Also used : CommandListener(com.intellij.openapi.command.CommandListener) CommandEvent(com.intellij.openapi.command.CommandEvent)

Aggregations

CommandEvent (com.intellij.openapi.command.CommandEvent)2 CommandListener (com.intellij.openapi.command.CommandListener)2