From 25b9989749801cc78d7cf673cc198c9f9f20ec39 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 13 Jul 2016 15:10:21 +0200 Subject: [PATCH] Add wizard and mime type for SCXML This allows us to easily add scxml files to a qmake project. Change-Id: I2b5b21683f3e76062e6858fb8d0bceaa699a5569 Reviewed-by: Tobias Hunger --- .../templates/wizards/files/scxml/file.scxml | 3 + .../templates/wizards/files/scxml/wizard.json | 66 +++++++++++++++++++ .../projectexplorerconstants.h | 1 + .../qmakeprojectmanager/qmakenodes.cpp | 4 ++ src/plugins/qtsupport/QtSupport.mimetypes.xml | 5 ++ 5 files changed, 79 insertions(+) create mode 100644 share/qtcreator/templates/wizards/files/scxml/file.scxml create mode 100644 share/qtcreator/templates/wizards/files/scxml/wizard.json diff --git a/share/qtcreator/templates/wizards/files/scxml/file.scxml b/share/qtcreator/templates/wizards/files/scxml/file.scxml new file mode 100644 index 00000000000..960867a73f4 --- /dev/null +++ b/share/qtcreator/templates/wizards/files/scxml/file.scxml @@ -0,0 +1,3 @@ + + + diff --git a/share/qtcreator/templates/wizards/files/scxml/wizard.json b/share/qtcreator/templates/wizards/files/scxml/wizard.json new file mode 100644 index 00000000000..263fa530749 --- /dev/null +++ b/share/qtcreator/templates/wizards/files/scxml/wizard.json @@ -0,0 +1,66 @@ +{ + "version": 1, + "supportedProjectTypes": [ ], + "id": "F.Scxml", + "category": "O.Model", + "trDescription": "Creates a new, empty, state chart.", + "trDisplayName": "State Chart", + "trDisplayCategory": "Modeling", + "platformIndependent": true, + "icon": "../../global/genericfilewizard.png", + "enabled": "%{JS: [ %{Plugins} ].indexOf('QtSupport') >= 0}", + + "options": + [ + { "key": "TargetPath", "value": "%{JS: Util.fileName('%{Location}/%{FileName}', '%{JS: Util.preferredSuffix('application/scxml+xml')}')}" }, + { "key": "FileName", "value": "%{Name}" } + ], + + "pages" : + [ + { + "trDisplayName": "State Chart Name and Location", + "trShortTitle": "Location", + "typeId": "Fields", + "data": + [ + { + "name": "Name", + "trDisplayName": "State Chart name:", + "mandatory": true, + "type": "LineEdit" + }, + { + "name": "Location", + "trDisplayName": "Location:", + "type": "PathChooser", + "isComplete": "%{JS: '%{Location}' === '' || !Util.exists('%{TargetPath}')}", + "trIncompleteMessage": "\"%{JS: Util.toNativeSeparators('%{TargetPath}')}\" exists in the filesystem.", + "data": + { + "kind": "existingDirectory", + "basePath": "%{InitialPath}", + "path": "%{InitialPath}" + } + } + ] + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators" : + [ + { + "typeId": "File", + "data": + { + "source": "file.scxml", + "target": "%{TargetPath}", + "openInEditor": true + } + } + ] +} diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h index b40f7f9b91b..8d2ef91ff75 100644 --- a/src/plugins/projectexplorer/projectexplorerconstants.h +++ b/src/plugins/projectexplorer/projectexplorerconstants.h @@ -159,6 +159,7 @@ const char LINGUIST_MIMETYPE[] = "text/vnd.trolltech.linguist"; const char FORM_MIMETYPE[] = "application/x-designer"; const char QML_MIMETYPE[] = "text/x-qml"; // separate def also in qmljstoolsconstants.h const char RESOURCE_MIMETYPE[] = "application/vnd.qt.xml.resource"; +const char SCXML_MIMETYPE[] = "application/scxml+xml"; // Settings page const char PROJECTEXPLORER_SETTINGS_CATEGORY[] = "K.ProjectExplorer"; diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index 813f7c16066..2766209e9c7 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -1438,6 +1438,9 @@ QString QmakePriFileNode::varNameForAdding(const QString &mimeType) if (mimeType == QLatin1String(ProjectExplorer::Constants::QML_MIMETYPE)) return QLatin1String("DISTFILES"); + if (mimeType == QLatin1String(ProjectExplorer::Constants::SCXML_MIMETYPE)) + return QLatin1String("STATECHARTS"); + if (mimeType == QLatin1String(Constants::PROFILE_MIMETYPE)) return QLatin1String("SUBDIRS"); @@ -1464,6 +1467,7 @@ QStringList QmakePriFileNode::varNamesForRemoving() vars << QLatin1String("DISTFILES"); vars << QLatin1String("ICON"); vars << QLatin1String("QMAKE_INFO_PLIST"); + vars << QLatin1String("STATECHARTS"); return vars; } diff --git a/src/plugins/qtsupport/QtSupport.mimetypes.xml b/src/plugins/qtsupport/QtSupport.mimetypes.xml index 21c20bebfc1..c54904c9c59 100644 --- a/src/plugins/qtsupport/QtSupport.mimetypes.xml +++ b/src/plugins/qtsupport/QtSupport.mimetypes.xml @@ -11,4 +11,9 @@ + + Scxml State Chart + + +