Search in sources :

Example 1 with UserCommand

use of jetbrains.communicator.core.commands.UserCommand in project intellij-plugins by JetBrains.

the class CommandManagerTest method testGetCommandTwice.

public void testGetCommandTwice() throws Exception {
    UserCommand command = myCommandManager.getCommand(MyTestCommand.class, myContainer);
    UserCommand command1 = myCommandManager.getCommand(MyTestCommand.class, myContainer);
    assertSame(command, command1);
}
Also used : UserCommand(jetbrains.communicator.core.commands.UserCommand)

Example 2 with UserCommand

use of jetbrains.communicator.core.commands.UserCommand in project intellij-plugins by JetBrains.

the class BaseAction method update.

public void update(AnActionEvent e) {
    super.update(e);
    UserCommand command = getCommand(e);
    e.getPresentation().setEnabled(command != null && command.isEnabled());
    if (command instanceof NamedUserCommand) {
        NamedUserCommand userCommand = (NamedUserCommand) command;
        e.getPresentation().setText(userCommand.getName(), true);
        e.getPresentation().setIcon(userCommand.getIcon());
    }
}
Also used : NamedUserCommand(jetbrains.communicator.core.commands.NamedUserCommand) UserCommand(jetbrains.communicator.core.commands.UserCommand) NamedUserCommand(jetbrains.communicator.core.commands.NamedUserCommand)

Example 3 with UserCommand

use of jetbrains.communicator.core.commands.UserCommand in project intellij-plugins by JetBrains.

the class UserTree method invokeSendMessageAction.

protected void invokeSendMessageAction() {
    MutablePicoContainer container = BaseAction.getContainer(this);
    UserCommand command = Pico.getCommandManager().getCommand(SendMessageCommand.class, container);
    if (command.isEnabled()) {
        command.execute();
    }
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer) UserCommand(jetbrains.communicator.core.commands.UserCommand)

Example 4 with UserCommand

use of jetbrains.communicator.core.commands.UserCommand in project intellij-plugins by JetBrains.

the class CommandManagerTest method testGetCommand.

public void testGetCommand() throws Exception {
    UserCommand command = myCommandManager.getCommand(MyTestCommand.class, myContainer);
    assertNotNull(command);
    assertSame(MyTestCommand.class, command.getClass());
    assertNotNull(myContainer.getComponentInstanceOfType(MyTestCommand.class));
}
Also used : UserCommand(jetbrains.communicator.core.commands.UserCommand)

Aggregations

UserCommand (jetbrains.communicator.core.commands.UserCommand)4 NamedUserCommand (jetbrains.communicator.core.commands.NamedUserCommand)1 MutablePicoContainer (org.picocontainer.MutablePicoContainer)1