Example #1
0
void ActionHandler::createActions()
{
    Core::ActionContainer *medit = Core::ActionManager::actionContainer(Core::Constants::M_EDIT);

    d->undoAction = registerCommand(Core::Constants::UNDO, [this]() { undo(); })->action();
    d->redoAction = registerCommand(Core::Constants::REDO, [this]() { redo(); })->action();
    d->cutAction = registerCommand(Core::Constants::CUT, [this]() { cut(); })->action();
    d->copyAction = registerCommand(Core::Constants::COPY, [this]() { copy(); })->action();
    d->pasteAction = registerCommand(Core::Constants::PASTE, [this]() { paste(); })->action();
    Core::Command *removeCommand = registerCommand(
                Constants::REMOVE_SELECTED_ELEMENTS, [this]() { removeSelectedElements(); }, true,
                tr("&Remove"), QKeySequence::Delete);
    medit->addAction(removeCommand, Core::Constants::G_EDIT_COPYPASTE);
    d->removeAction = removeCommand->action();
    Core::Command *deleteCommand = registerCommand(
                Constants::DELETE_SELECTED_ELEMENTS, [this]() { deleteSelectedElements(); }, true,
                tr("&Delete"), QKeySequence(QStringLiteral("Ctrl+D")));
    medit->addAction(deleteCommand, Core::Constants::G_EDIT_COPYPASTE);
    d->deleteAction = deleteCommand->action();
    d->selectAllAction = registerCommand(Core::Constants::SELECTALL, [this]() { selectAll(); })->action();
    registerCommand(Constants::ACTION_ADD_PACKAGE, nullptr);
    registerCommand(Constants::ACTION_ADD_COMPONENT, nullptr);
    registerCommand(Constants::ACTION_ADD_CLASS, nullptr);
    registerCommand(Constants::ACTION_ADD_CANVAS_DIAGRAM, nullptr);
}
Example #2
0
void ActionHandler::removeSelectedElements()
{
    auto editor = dynamic_cast<AbstractEditor *>(Core::EditorManager::currentEditor());
    if (editor)
        editor->removeSelectedElements();
}
Example #3
0
void ActionHandler::removeSelectedElements()
{
    auto editor = qobject_cast<ModelEditor *>(Core::EditorManager::currentEditor());
    if (editor)
        editor->removeSelectedElements();
}