diff --git a/src/plugins/modeleditor/actionhandler.cpp b/src/plugins/modeleditor/actionhandler.cpp index 77895787f2e0d4b7a2ff9c6b31b5a1ae622f03a2..97b582955273c04057d43a7f24d36d4dc1a57b9f 100644 --- a/src/plugins/modeleditor/actionhandler.cpp +++ b/src/plugins/modeleditor/actionhandler.cpp @@ -145,7 +145,7 @@ void ActionHandler::createActions() menuTools->addMenu(menuModelEditor); Core::Command *exportDiagramCommand = registerCommand( - Constants::EXPORT_DIAGRAM, [this]() { exportDiagram(); }, Core::Context(), true, + Constants::EXPORT_DIAGRAM, [this]() { exportDiagram(); }, d->context, true, tr("Export Diagram...")); menuModelEditor->addAction(exportDiagramCommand); d->exportDiagramAction = exportDiagramCommand->action(); diff --git a/src/plugins/modeleditor/modeleditor.cpp b/src/plugins/modeleditor/modeleditor.cpp index dae5c0b06f3b3f8c4ee60caee8800c0e667dca82..9b5ab84eb3e551e1c7bbcca261b4745e62165fdc 100644 --- a/src/plugins/modeleditor/modeleditor.cpp +++ b/src/plugins/modeleditor/modeleditor.cpp @@ -596,6 +596,7 @@ void ModelEditor::updateSelectedArea(SelectedArea selectedArea) bool canSelectAll = false; bool canCopyDiagram = false; bool canOpenParentDiagram = false; + bool canExportDiagram = false; QList<qmt::MElement *> propertiesModelElements; QList<qmt::DElement *> propertiesDiagramElements; qmt::MDiagram *propertiesDiagram = 0; @@ -604,10 +605,12 @@ void ModelEditor::updateSelectedArea(SelectedArea selectedArea) switch (d->selectedArea) { case SelectedArea::Nothing: canSelectAll = activeDiagram && !activeDiagram->diagramElements().isEmpty(); + canExportDiagram = activeDiagram != 0; break; case SelectedArea::Diagram: { if (activeDiagram) { + canExportDiagram = true; bool hasSelection = documentController->diagramsManager()->diagramSceneModel(activeDiagram)->hasSelection(); canCutCopyDelete = hasSelection; canRemove = hasSelection; @@ -631,6 +634,7 @@ void ModelEditor::updateSelectedArea(SelectedArea selectedArea) } case SelectedArea::TreeView: { + canExportDiagram = activeDiagram != 0; bool hasSelection = !d->modelTreeViewServant->selectedObjects().isEmpty(); bool hasSingleSelection = d->modelTreeViewServant->selectedObjects().indices().size() == 1; canCutCopyDelete = hasSelection && !d->modelTreeViewServant->isRootPackageSelected(); @@ -658,6 +662,7 @@ void ModelEditor::updateSelectedArea(SelectedArea selectedArea) d->actionHandler->deleteAction()->setEnabled(canCutCopyDelete); d->actionHandler->selectAllAction()->setEnabled(canSelectAll); d->actionHandler->openParentDiagramAction()->setEnabled(canOpenParentDiagram); + d->actionHandler->exportDiagramAction()->setEnabled(canExportDiagram); if (!propertiesModelElements.isEmpty()) showProperties(propertiesModelElements);