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

JsonWizard: Replace Java wizard with JsonWizard

Change-Id: I93fc26e48b39635662662a9ab4040f45fa874876
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 161f33d0
{
"version": 1,
"kind": "file",
"id": "Wizard.Java",
"category": "U.Java",
"trDescription": "Creates a Java file with boilerplate code.",
"trDisplayName": "Java File",
"trDisplayCategory": "Java",
"icon": "../../global/genericfilewizard.png",
"featuresRequired": [ "Plugin.Android" ],
"options": [ { "key": "ClassName", "value": "%{JS: '%{FileName}'.charAt(0).toUpperCase() + '%{FileName}'.substr(1)}" } ],
"pages" :
[
{
"trDisplayName": "Location",
"trShortTitle": "Location",
"typeId": "File"
},
{
"trDisplayName": "Project Management",
"trShortTitle": "Summary",
"typeId": "Summary"
}
],
"generators" :
[
{
"typeId": "File",
"data":
{
"source": "source.java",
"target": "%{JS: Util.fileName('%{Path}/%{ClassName}', '%{JS: Util.preferredSuffix('text/x-java')}')}",
"openInEditor": true
}
}
]
}
......@@ -44,7 +44,6 @@ HEADERS += \
javaindenter.h \
javaautocompleter.h \
javacompletionassistprovider.h \
javafilewizard.h \
avddialog.h \
android_global.h \
androidbuildapkstep.h \
......@@ -86,7 +85,6 @@ SOURCES += \
javaindenter.cpp \
javaautocompleter.cpp \
javacompletionassistprovider.cpp \
javafilewizard.cpp \
avddialog.cpp \
androidbuildapkstep.cpp \
androidbuildapkwidget.cpp \
......
......@@ -100,8 +100,6 @@ QtcPlugin {
"javacompletionassistprovider.h",
"javaeditor.cpp",
"javaeditor.h",
"javafilewizard.cpp",
"javafilewizard.h",
"javaindenter.cpp",
"javaindenter.h",
"javaparser.cpp",
......
......@@ -69,9 +69,6 @@ const char ANDROID_MANIFEST_EDITOR_CONTEXT[] = "Android.AndroidManifestEditor.Id
const char ANDROID_BUILDDIRECTORY[] = "android-build";
const char JAVA_EDITOR_ID[] = "java.editor";
const char JAVA_MIMETYPE[] = "text/x-java";
const char WIZARD_JAVA[] = "Wizard.Java";
const char JAVA_WIZARD_CATEGORY[] = "U.Java";
const char JAVA_DISPLAY_CATEGORY[] = "Java";
const char ANDROID_ARCHITECTURE[] = "Android.Architecture";
const char ANDROID_DEPLOY_SETTINGS_FILE[] = "AndroidDeploySettingsFile";
const char ANDROID_PACKAGE_SOURCE_DIR[] = "AndroidPackageSourceDir";
......
......@@ -45,7 +45,6 @@
#include "androidpotentialkit.h"
#include "javacompletionassistprovider.h"
#include "javaeditor.h"
#include "javafilewizard.h"
#ifdef HAVE_QBS
# include "androidqbspropertyprovider.h"
#endif
......@@ -81,7 +80,6 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa
addAutoReleasedObject(new Internal::AndroidPotentialKit);
addAutoReleasedObject(new Internal::JavaEditorFactory);
addAutoReleasedObject(new Internal::JavaCompletionAssistProvider);
addAutoReleasedObject(new Internal::JavaFileWizard);
ProjectExplorer::KitManager::registerKitInformation(new Internal::AndroidGdbServerKitInformation);
// AndroidManifest.xml editor
......
/****************************************************************************
**
** 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 "javafilewizard.h"
#include "androidconstants.h"
#include <QFileInfo>
#include <QTextStream>
#include <QCoreApplication>
using namespace Android;
using namespace Android::Internal;
JavaFileWizard::JavaFileWizard()
{
setWizardKind(Core::IWizardFactory::FileWizard);
setCategory(QLatin1String(Constants::JAVA_WIZARD_CATEGORY));
setDisplayCategory(QCoreApplication::translate("Android", Constants::JAVA_DISPLAY_CATEGORY));
setDescription(tr("Creates a Java file with boilerplate code."));
setDisplayName(tr("Java File"));
setId(QLatin1String(Constants::WIZARD_JAVA));
}
Core::GeneratedFiles JavaFileWizard::generateFilesFromPath(const QString &path,
const QString &name,
QString * /*errorMessage*/) const
{
const QString mimeType = QLatin1String(Android::Constants::JAVA_MIMETYPE);
QString capitalizedName = name;
if (!capitalizedName.isEmpty())
capitalizedName[0] = capitalizedName[0].toUpper();
const QString fileName = Core::BaseFileWizardFactory::buildFileName(path, capitalizedName, preferredSuffix(mimeType));
Core::GeneratedFile file(fileName);
file.setContents(fileContents(fileName));
file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
return Core::GeneratedFiles() << file;
}
QString JavaFileWizard::fileContents(const QString &path) const
{
QString contents;
QTextStream str(&contents);
QString className = QFileInfo(path).baseName();
str << QString::fromLatin1("public class %1 {\n").arg(className)
<< QLatin1String("\n")
<< QLatin1String("}\n")
<< QLatin1String("\n");
return contents;
}
/****************************************************************************
**
** 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 JAVAFILEWIZARD_H
#define JAVAFILEWIZARD_H
#include <coreplugin/basefilewizardfactory.h>
namespace Android {
namespace Internal {
class JavaFileWizard : public Core::StandardFileWizardFactory
{
Q_OBJECT
public:
JavaFileWizard();
private:
QString fileContents(const QString &path) const;
Core::GeneratedFiles generateFilesFromPath(const QString &path,
const QString &fileName,
QString *errorMessage) const;
};
}
}
#endif // JAVAFILEWIZARD_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