Commit ac02f6fb authored by Tobias Hunger's avatar Tobias Hunger Committed by Tobias Hunger

JsonWizard: Replace TextFileWizard with JsonWizard

Change-Id: Iae2833554529c2f333d9781eb0f7fa28f3bfde79
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent ed8a9cba
{
"version": 1,
"kind": "file",
"id": "F.Resource",
"category": "U.General",
"trDescription": "Creates a text file. The default file extension is <tt>.txt</tt>. You can specify a different extension as part of the filename.",
"trDisplayName": "Text File",
"trDisplayCategory": "General",
"icon": "../../global/genericfilewizard.png",
"platformIndependent": true,
"featuresRequired": [ "Plugin.TextEditor" ],
"pages" :
[
{
"trDisplayName": "Location",
"trShortTitle": "Location",
"typeId": "File"
},
{
"trDisplayName": "Project Management",
"trShortTitle": "Summary",
"typeId": "Summary"
}
],
"generators" :
[
{
"typeId": "File",
"data":
{
"source": "file.txt",
"target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/plain')}')}",
"openInEditor": true
}
}
]
}
......@@ -51,7 +51,6 @@
#include <texteditor/highlighterfactory.h>
#include <texteditor/texteditorconstants.h>
#include <texteditor/textfilewizard.h>
#include <utils/qtcassert.h>
......
......@@ -35,7 +35,6 @@
#include "../pythoneditorconstants.h"
#include <coreplugin/basefilewizard.h>
#include <texteditor/textfilewizard.h>
#include <utils/filewizardpage.h>
#include <utils/qtcassert.h>
......
......@@ -58,7 +58,6 @@
#include <coreplugin/editormanager/editormanager.h>
#include <projectexplorer/taskhub.h>
#include <texteditor/texteditorconstants.h>
#include <texteditor/textfilewizard.h>
#include <texteditor/highlighterfactory.h>
#include <utils/qtcassert.h>
#include <utils/json.h>
......
......@@ -4,7 +4,6 @@ CONFIG += exceptions
CONFIG += include_source_dir # For the highlighter autotest.
include(../../qtcreatorplugin.pri)
SOURCES += texteditorplugin.cpp \
textfilewizard.cpp \
plaintexteditorfactory.cpp \
textdocument.cpp \
texteditor.cpp \
......@@ -104,7 +103,6 @@ SOURCES += texteditorplugin.cpp \
marginsettings.cpp
HEADERS += texteditorplugin.h \
textfilewizard.h \
plaintexteditorfactory.h \
texteditor_p.h \
textdocument.h \
......
......@@ -133,8 +133,6 @@ QtcPlugin {
"texteditorplugin.h",
"texteditorsettings.cpp",
"texteditorsettings.h",
"textfilewizard.cpp",
"textfilewizard.h",
"textmark.cpp",
"textmark.h",
"textmarkregistry.h",
......
......@@ -41,7 +41,6 @@
#include "snippets/plaintextsnippetprovider.h"
#include "texteditoractionhandler.h"
#include "texteditorsettings.h"
#include "textfilewizard.h"
#include "textmarkregistry.h"
#include <coreplugin/icore.h>
......@@ -83,13 +82,6 @@ TextEditorPlugin::~TextEditorPlugin()
m_instance = 0;
}
static const char wizardCategoryC[] = "U.General";
static inline QString wizardDisplayCategory()
{
return TextEditorPlugin::tr("General");
}
// ExtensionSystem::PluginInterface
bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
......@@ -98,19 +90,6 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
if (!MimeDatabase::addMimeTypes(QLatin1String(":/texteditor/TextEditor.mimetypes.xml"), errorMessage))
return false;
TextFileWizard *wizard = new TextFileWizard(QLatin1String(Constants::C_TEXTEDITOR_MIMETYPE_TEXT),
QLatin1String("text$"));
wizard->setWizardKind(IWizardFactory::FileWizard);
wizard->setDescription(tr("Creates a text file. The default file extension is <tt>.txt</tt>. "
"You can specify a different extension as part of the filename."));
wizard->setDisplayName(tr("Text File"));
wizard->setCategory(QLatin1String(wizardCategoryC));
wizard->setDisplayCategory(wizardDisplayCategory());
wizard->setFlags(IWizardFactory::PlatformIndependent);
// Add text file wizard
addAutoReleasedObject(wizard);
m_settings = new TextEditorSettings(this);
// Add plain text editor factory
......
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "textfilewizard.h"
namespace TextEditor {
TextFileWizard::TextFileWizard(const QString &mimeType,
const QString &suggestedFileName) :
m_mimeType(mimeType),
m_suggestedFileName(suggestedFileName)
{
}
Core::GeneratedFiles
TextFileWizard::generateFilesFromPath(const QString &path, const QString &name,
QString * /*errorMessage*/) const
{
const QString suffix = preferredSuffix(m_mimeType);
const QString fileName = Core::BaseFileWizardFactory::buildFileName(path, name, suffix);
Core::GeneratedFile file(fileName);
file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
return Core::GeneratedFiles() << file;
}
} // namespace TextEditor
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef TEXTFILEWIZARD_H
#define TEXTFILEWIZARD_H
#include "texteditor_global.h"
#include <coreplugin/basefilewizardfactory.h>
namespace TextEditor {
class TEXTEDITOR_EXPORT TextFileWizard : public Core::StandardFileWizardFactory
{
Q_OBJECT
public:
TextFileWizard(const QString &mimeType,
const QString &suggestedFileName);
protected:
Core::GeneratedFiles generateFilesFromPath(const QString &path, const QString &name,
QString *errorMessage) const;
private:
const QString m_mimeType;
const QString m_suggestedFileName;
};
} // namespace TextEditor
#endif // TEXTFILEWIZARD_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment