}
public final void actionPerformed(final Editor editor, final DataContext dataContext) {
if (editor == null) return;
CommandProcessor commandProcessor = CommandProcessor.getInstance();
Runnable command = new Runnable() {
public void run() {
getHandler().execute(editor, getProjectAwareDataContext(editor, dataContext));
}
};
String commandName = getTemplatePresentation().getText();
if (commandName == null) commandName = "";
// use new Ref() here to avoid merging two consequential commands, and, in the same time, pass along the Document
commandProcessor.executeCommand(editor.getProject(), command, commandName, new Ref(editor.getDocument()));
}