2009-05-04 12:19:22 +02:00
|
|
|
/**************************************************************************
|
|
|
|
**
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
**
|
2010-03-05 11:25:49 +01:00
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
2009-06-17 00:01:27 +10:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
|
|
|
** Commercial Usage
|
|
|
|
**
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
**
|
|
|
|
** 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.
|
|
|
|
**
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
2009-08-14 09:30:56 +02:00
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
2009-05-04 12:19:22 +02:00
|
|
|
**
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
#include "qmlprojectplugin.h"
|
|
|
|
#include "qmlprojectmanager.h"
|
2010-02-18 15:33:35 +01:00
|
|
|
#include "qmlprojectimportwizard.h"
|
|
|
|
#include "qmlprojectapplicationwizard.h"
|
2009-05-04 12:19:22 +02:00
|
|
|
#include "qmlprojectconstants.h"
|
2009-05-07 12:27:52 +02:00
|
|
|
#include "qmlproject.h"
|
2010-02-16 13:39:13 +01:00
|
|
|
#include "qmlprojectrunconfigurationfactory.h"
|
|
|
|
#include "qmlprojectruncontrol.h"
|
2009-11-11 10:10:00 +01:00
|
|
|
#include "qmltaskmanager.h"
|
2010-02-26 14:46:04 +01:00
|
|
|
#include "fileformat/qmlprojectfileformat.h"
|
2009-11-11 10:10:00 +01:00
|
|
|
|
|
|
|
#include <extensionsystem/pluginmanager.h>
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2010-04-01 17:21:18 +02:00
|
|
|
#include <coreplugin/fileiconprovider.h>
|
2009-05-04 12:19:22 +02:00
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
#include <coreplugin/mimedatabase.h>
|
|
|
|
|
|
|
|
#include <texteditor/texteditoractionhandler.h>
|
|
|
|
|
2009-11-11 10:10:00 +01:00
|
|
|
#include <projectexplorer/taskwindow.h>
|
2010-06-09 15:56:03 +02:00
|
|
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
2009-11-11 10:10:00 +01:00
|
|
|
|
2009-05-04 12:19:22 +02:00
|
|
|
#include <QtCore/QtPlugin>
|
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
namespace QmlProjectManager {
|
|
|
|
namespace Internal {
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2009-11-11 10:10:00 +01:00
|
|
|
QmlProjectPlugin::QmlProjectPlugin() :
|
|
|
|
m_qmlTaskManager(0)
|
2009-05-04 12:19:22 +02:00
|
|
|
{ }
|
|
|
|
|
|
|
|
QmlProjectPlugin::~QmlProjectPlugin()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QmlProjectPlugin::initialize(const QStringList &, QString *errorMessage)
|
|
|
|
{
|
|
|
|
using namespace Core;
|
|
|
|
|
|
|
|
ICore *core = ICore::instance();
|
|
|
|
Core::MimeDatabase *mimeDB = core->mimeDatabase();
|
|
|
|
|
|
|
|
const QLatin1String mimetypesXml(":qmlproject/QmlProject.mimetypes.xml");
|
|
|
|
|
|
|
|
if (! mimeDB->addMimeTypes(mimetypesXml, errorMessage))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
Manager *manager = new Manager;
|
|
|
|
|
2009-11-11 10:10:00 +01:00
|
|
|
m_qmlTaskManager = new QmlTaskManager(this);
|
2010-04-16 12:42:12 +02:00
|
|
|
addAutoReleasedObject(m_qmlTaskManager);
|
2009-11-11 10:10:00 +01:00
|
|
|
|
2009-05-04 12:19:22 +02:00
|
|
|
addAutoReleasedObject(manager);
|
2010-02-16 13:39:13 +01:00
|
|
|
addAutoReleasedObject(new Internal::QmlProjectRunConfigurationFactory);
|
|
|
|
addAutoReleasedObject(new Internal::QmlRunControlFactory);
|
2010-02-18 15:33:35 +01:00
|
|
|
addAutoReleasedObject(new QmlProjectApplicationWizard);
|
|
|
|
addAutoReleasedObject(new QmlProjectImportWizard);
|
2010-02-26 14:46:04 +01:00
|
|
|
|
|
|
|
QmlProjectFileFormat::registerDeclarativeTypes();
|
|
|
|
|
2010-04-01 17:21:18 +02:00
|
|
|
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
|
|
|
iconProvider->registerIconOverlayForSuffix(QIcon(":/qmlproject/images/qmlproject.png"), "qmlproject");
|
|
|
|
|
2009-05-04 12:19:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void QmlProjectPlugin::extensionsInitialized()
|
2009-11-11 10:10:00 +01:00
|
|
|
{
|
|
|
|
ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance();
|
|
|
|
ProjectExplorer::TaskWindow *taskWindow = pluginManager->getObject<ProjectExplorer::TaskWindow>();
|
|
|
|
m_qmlTaskManager->setTaskWindow(taskWindow);
|
|
|
|
|
2010-06-09 15:56:03 +02:00
|
|
|
QmlJS::ModelManagerInterface *modelManager = pluginManager->getObject<QmlJS::ModelManagerInterface>();
|
2009-11-11 10:10:00 +01:00
|
|
|
Q_ASSERT(modelManager);
|
2010-04-16 12:42:12 +02:00
|
|
|
connect(modelManager, SIGNAL(documentChangedOnDisk(QmlJS::Document::Ptr)),
|
|
|
|
m_qmlTaskManager, SLOT(documentChangedOnDisk(QmlJS::Document::Ptr)));
|
2010-05-18 13:40:35 +02:00
|
|
|
connect(modelManager, SIGNAL(aboutToRemoveFiles(QStringList)),
|
|
|
|
m_qmlTaskManager, SLOT(documentsRemoved(QStringList)));
|
2009-11-11 10:10:00 +01:00
|
|
|
}
|
2009-05-04 12:19:22 +02:00
|
|
|
|
2010-02-16 13:39:13 +01:00
|
|
|
} // namespace Internal
|
|
|
|
} // namespace QmlProjectManager
|
|
|
|
|
|
|
|
Q_EXPORT_PLUGIN(QmlProjectManager::Internal::QmlProjectPlugin)
|