diff --git a/src/libs/qmljs/qmljs-lib.pri b/src/libs/qmljs/qmljs-lib.pri index e0e7b49a16752bfa402613cf46e15ed3cb535124..a723b0354182ae57cc5036c7dbe5d1a69f0052eb 100644 --- a/src/libs/qmljs/qmljs-lib.pri +++ b/src/libs/qmljs/qmljs-lib.pri @@ -21,7 +21,8 @@ HEADERS += \ $$PWD/qmljsscopebuilder.h \ $$PWD/qmljslineinfo.h \ $$PWD/qmljscompletioncontextfinder.h \ - $$PWD/qmljscomponentversion.h + $$PWD/qmljscomponentversion.h \ + $$PWD/qmljsmodelmanagerinterface.h \ SOURCES += \ $$PWD/qmljsbind.cpp \ @@ -34,7 +35,8 @@ SOURCES += \ $$PWD/qmljsscopebuilder.cpp \ $$PWD/qmljslineinfo.cpp \ $$PWD/qmljscompletioncontextfinder.cpp \ - $$PWD/qmljscomponentversion.cpp + $$PWD/qmljscomponentversion.cpp \ + $$PWD/qmljsmodelmanagerinterface.cpp OTHER_FILES += \ $$PWD/parser/qmljs.g diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp new file mode 100644 index 0000000000000000000000000000000000000000..90917547f54b1d36d3bc88d62e957724063837fc --- /dev/null +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp @@ -0,0 +1,42 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +#include "qmljsmodelmanagerinterface.h" + +using namespace QmlJS; + +ModelManagerInterface::ModelManagerInterface(QObject *parent) + : QObject(parent) +{ +} + +ModelManagerInterface::~ModelManagerInterface() +{ +} + diff --git a/src/plugins/qmljseditor/qmljsmodelmanagerinterface.h b/src/libs/qmljs/qmljsmodelmanagerinterface.h similarity index 92% rename from src/plugins/qmljseditor/qmljsmodelmanagerinterface.h rename to src/libs/qmljs/qmljsmodelmanagerinterface.h index a39a7d2e176ea7875f8e8019269d07dce7e9b245..58e56a6c337968ffa5555157c600de6558f339ae 100644 --- a/src/plugins/qmljseditor/qmljsmodelmanagerinterface.h +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.h @@ -30,21 +30,18 @@ #ifndef QMLJSMODELMANAGERINTERFACE_H #define QMLJSMODELMANAGERINTERFACE_H -#include "qmljseditor_global.h" - -#include <qmljs/qmljsdocument.h> +#include "qmljs_global.h" +#include "qmljsdocument.h" #include <QObject> #include <QStringList> #include <QSharedPointer> namespace QmlJS { -class Snapshot; -} -namespace QmlJSEditor { +class Snapshot; -class QMLJSEDITOR_EXPORT ModelManagerInterface: public QObject +class QMLJS_EXPORT ModelManagerInterface: public QObject { Q_OBJECT @@ -67,6 +64,6 @@ signals: void aboutToRemoveFiles(const QStringList &files); }; -} // namespace QmlJSEditor +} // namespace QmlJS #endif // QMLJSMODELMANAGERINTERFACE_H diff --git a/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp b/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp index a7ce641efa75892abaa6a49c46908cc06030540f..3127be6ead8c9d12d3c0b801494770d538027daf 100644 --- a/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp +++ b/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp @@ -31,11 +31,10 @@ #include <extensionsystem/pluginmanager.h> #include <qmljs/qmljsdocument.h> -#include <qmljseditor/qmljsmodelmanagerinterface.h> +#include <qmljs/qmljsmodelmanagerinterface.h> #include <texteditor/tabsettings.h> using namespace QmlDesigner; -using namespace QmlJSEditor; BaseTextEditModifier::BaseTextEditModifier(TextEditor::BaseTextEditor *textEdit): PlainTextEditModifier(textEdit) @@ -69,16 +68,16 @@ int BaseTextEditModifier::indentDepth() const } namespace { -static inline QmlJSEditor::ModelManagerInterface *getModelManager() +static inline QmlJS::ModelManagerInterface *getModelManager() { ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance(); - return pluginManager->getObject<QmlJSEditor::ModelManagerInterface>(); + return pluginManager->getObject<QmlJS::ModelManagerInterface>(); } } QmlJS::Snapshot BaseTextEditModifier::getSnapshot() const { - QmlJSEditor::ModelManagerInterface *modelManager = getModelManager(); + QmlJS::ModelManagerInterface *modelManager = getModelManager(); if (modelManager) return modelManager->snapshot(); else @@ -87,7 +86,7 @@ QmlJS::Snapshot BaseTextEditModifier::getSnapshot() const QStringList BaseTextEditModifier::importPaths() const { - QmlJSEditor::ModelManagerInterface *modelManager = getModelManager(); + QmlJS::ModelManagerInterface *modelManager = getModelManager(); if (modelManager) return modelManager->importPaths(); else diff --git a/src/plugins/qmlinspector/components/objectpropertiesview.cpp b/src/plugins/qmlinspector/components/objectpropertiesview.cpp index b0d1b1220ed8f20007a6bb1862daa3fa154ec7bb..b37daae887f80c730db44a806f66c00b7796c253 100644 --- a/src/plugins/qmlinspector/components/objectpropertiesview.cpp +++ b/src/plugins/qmlinspector/components/objectpropertiesview.cpp @@ -34,7 +34,7 @@ #include "propertytypefinder.h" #include <extensionsystem/pluginmanager.h> -#include <qmljseditor/qmljsmodelmanagerinterface.h> +#include <qmljs/qmljsmodelmanagerinterface.h> #include <qmljs/qmljsdocument.h> #include <QtGui/QApplication> @@ -224,7 +224,7 @@ void ObjectPropertiesView::setPropertyValue(PropertiesViewItem *item, const QVar QString ObjectPropertiesView::propertyBaseClass(const QDeclarativeDebugObjectReference &object, const QDeclarativeDebugPropertyReference &property, int &depth) { ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance(); - QmlJSEditor::ModelManagerInterface *modelManager = pluginManager->getObject<QmlJSEditor::ModelManagerInterface>(); + QmlJS::ModelManagerInterface *modelManager = pluginManager->getObject<QmlJS::ModelManagerInterface>(); QmlJS::Snapshot snapshot = modelManager->snapshot(); QmlJS::Document::Ptr document = snapshot.document(object.source().url().path()); diff --git a/src/plugins/qmljseditor/qmljscodecompletion.cpp b/src/plugins/qmljseditor/qmljscodecompletion.cpp index ebc79e88410ab87ffc6499314ea4bfd70872345b..75f7112f8b8c2ba7ad4f967e64bb557205d84230 100644 --- a/src/plugins/qmljseditor/qmljscodecompletion.cpp +++ b/src/plugins/qmljseditor/qmljscodecompletion.cpp @@ -30,8 +30,8 @@ #include "qmljscodecompletion.h" #include "qmlexpressionundercursor.h" #include "qmljseditor.h" -#include "qmljsmodelmanagerinterface.h" +#include <qmljs/qmljsmodelmanagerinterface.h> #include <qmljs/parser/qmljsast_p.h> #include <qmljs/qmljsbind.h> #include <qmljs/qmljsinterpreter.h> diff --git a/src/plugins/qmljseditor/qmljscodecompletion.h b/src/plugins/qmljseditor/qmljscodecompletion.h index 96de6f588e02304d7fd1cc5948b39c89463e40c8..ae3eb8bcf6cf05861f7dbfc57ce04e51e79b2928 100644 --- a/src/plugins/qmljseditor/qmljscodecompletion.h +++ b/src/plugins/qmljseditor/qmljscodecompletion.h @@ -40,6 +40,8 @@ class ITextEditable; } namespace QmlJS { + class ModelManagerInterface; + namespace Interpreter { class Value; } @@ -47,8 +49,6 @@ namespace QmlJS { namespace QmlJSEditor { -class ModelManagerInterface; - namespace Internal { class FunctionArgumentWidget; @@ -58,7 +58,7 @@ class CodeCompletion: public TextEditor::ICompletionCollector Q_OBJECT public: - CodeCompletion(ModelManagerInterface *modelManager, QObject *parent = 0); + CodeCompletion(QmlJS::ModelManagerInterface *modelManager, QObject *parent = 0); virtual ~CodeCompletion(); virtual TextEditor::ITextEditable *editor() const; @@ -88,7 +88,7 @@ private: const QHash<QString, const QmlJS::Interpreter::Value *> &newCompletions, const QIcon &icon, int relevance); - ModelManagerInterface *m_modelManager; + QmlJS::ModelManagerInterface *m_modelManager; TextEditor::ITextEditable *m_editor; int m_startPosition; QList<TextEditor::CompletionItem> m_completions; diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index ec90ac3f6b532be58a6aa08716a5162332324cc0..5f2e4306702818c351ad3f806abf696d58277e94 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -1430,7 +1430,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source) return semanticInfo; } -void SemanticHighlighter::setModelManager(QmlJSEditor::ModelManagerInterface *modelManager) +void SemanticHighlighter::setModelManager(QmlJS::ModelManagerInterface *modelManager) { m_modelManager = modelManager; } diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h index fd5fe9c3cd955a53c5cf03c9c69b8ad43cb9191c..5ea672dd5fc8bf4d8bde40ea722feb7fbd05190b 100644 --- a/src/plugins/qmljseditor/qmljseditor.h +++ b/src/plugins/qmljseditor/qmljseditor.h @@ -47,9 +47,11 @@ namespace Core { class ICore; } -namespace QmlJSEditor { +namespace QmlJS { + class ModelManagerInterface; +} -class ModelManagerInterface; +namespace QmlJSEditor { class Highlighter; namespace Internal { @@ -176,7 +178,7 @@ public: }; void rehighlight(const Source &source); - void setModelManager(ModelManagerInterface *modelManager); + void setModelManager(QmlJS::ModelManagerInterface *modelManager); Q_SIGNALS: void changed(const QmlJSEditor::Internal::SemanticInfo &semanticInfo); @@ -194,7 +196,7 @@ private: bool m_done; Source m_source; SemanticInfo m_lastSemanticInfo; - ModelManagerInterface *m_modelManager; + QmlJS::ModelManagerInterface *m_modelManager; }; class QmlJSTextEditor : public TextEditor::BaseTextEditor @@ -265,7 +267,7 @@ private: QTimer *m_updateUsesTimer; QTimer *m_semanticRehighlightTimer; QComboBox *m_methodCombo; - ModelManagerInterface *m_modelManager; + QmlJS::ModelManagerInterface *m_modelManager; QTextCharFormat m_occurrencesFormat; QTextCharFormat m_occurrencesUnusedFormat; QTextCharFormat m_occurrenceRenameFormat; diff --git a/src/plugins/qmljseditor/qmljseditor.pro b/src/plugins/qmljseditor/qmljseditor.pro index dc7c0a65d30026b52bee29d1ba65f4e48794ce35..acd9da1afaff392600878f4e181d987157c5f28d 100644 --- a/src/plugins/qmljseditor/qmljseditor.pro +++ b/src/plugins/qmljseditor/qmljseditor.pro @@ -21,7 +21,6 @@ HEADERS += \ qmljshighlighter.h \ qmljshoverhandler.h \ qmljsmodelmanager.h \ - qmljsmodelmanagerinterface.h \ qmljspreviewrunner.h \ qmljsquickfix.h @@ -36,7 +35,6 @@ SOURCES += \ qmljshighlighter.cpp \ qmljshoverhandler.cpp \ qmljsmodelmanager.cpp \ - qmljsmodelmanagerinterface.cpp \ qmljspreviewrunner.cpp \ qmljsquickfix.cpp diff --git a/src/plugins/qmljseditor/qmljseditorplugin.h b/src/plugins/qmljseditor/qmljseditorplugin.h index d5d87a053aca67d2c0a205771a5ca02bdf26ff5d..bf632ecc69d31b014f6f5a5bad2fbda1dcf19270 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.h +++ b/src/plugins/qmljseditor/qmljseditorplugin.h @@ -50,9 +50,12 @@ namespace TextEditor { class ITextEditable; } +namespace QmlJS { + class ModelManagerInterface; +} + namespace QmlJSEditor { -class ModelManagerInterface; class QmlFileWizard; namespace Internal { @@ -98,7 +101,7 @@ private: QAction *m_actionPreview; QmlJSPreviewRunner *m_previewRunner; - ModelManagerInterface *m_modelManager; + QmlJS::ModelManagerInterface *m_modelManager; QmlFileWizard *m_wizard; QmlJSEditorFactory *m_editor; TextEditor::TextEditorActionHandler *m_actionHandler; diff --git a/src/plugins/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp index 38cc47cae562f306d2fc410fcec29b4c01012054..2810fdb4c36e10cd9afc2ea830f61ffc904c1dcb 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.cpp +++ b/src/plugins/qmljseditor/qmljshoverhandler.cpp @@ -63,7 +63,7 @@ HoverHandler::HoverHandler(QObject *parent) : QObject(parent) , m_helpEngineNeedsSetup(false) { - m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<ModelManagerInterface>(); + m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<QmlJS::ModelManagerInterface>(); ICore *core = ICore::instance(); QFileInfo fi(core->settings()->fileName()); diff --git a/src/plugins/qmljseditor/qmljshoverhandler.h b/src/plugins/qmljseditor/qmljshoverhandler.h index f41ad62867846f2780204bfd23692da9537d645b..f8a1f282ddff9223e9a49a48de339b1048822a4d 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.h +++ b/src/plugins/qmljseditor/qmljshoverhandler.h @@ -30,8 +30,7 @@ #ifndef QMLJSHOVERHANDLER_H #define QMLJSHOVERHANDLER_H -#include "qmljsmodelmanagerinterface.h" - +#include <qmljs/qmljsmodelmanagerinterface.h> #include <QtCore/QObject> QT_BEGIN_NAMESPACE @@ -79,7 +78,7 @@ private: QStringList *baseClasses) const; private: - ModelManagerInterface *m_modelManager; + QmlJS::ModelManagerInterface *m_modelManager; QHelpEngineCore *m_helpEngine; QString m_helpId; QString m_toolTip; diff --git a/src/plugins/qmljseditor/qmljsmodelmanager.h b/src/plugins/qmljseditor/qmljsmodelmanager.h index b72d9d318dcbb4aef2dcdd44b0715d7bae1d0614..4386c23dcd41ad4a92080b240c8b44475df2d997 100644 --- a/src/plugins/qmljseditor/qmljsmodelmanager.h +++ b/src/plugins/qmljseditor/qmljsmodelmanager.h @@ -30,8 +30,7 @@ #ifndef QMLJSMODELMANAGER_H #define QMLJSMODELMANAGER_H -#include "qmljsmodelmanagerinterface.h" - +#include <qmljs/qmljsmodelmanagerinterface.h> #include <qmljs/qmljsdocument.h> #include <QFuture> @@ -47,7 +46,7 @@ class MimeType; namespace QmlJSEditor { namespace Internal { -class ModelManager: public ModelManagerInterface +class ModelManager: public QmlJS::ModelManagerInterface { Q_OBJECT diff --git a/src/plugins/qmljseditor/qmljsquickfix.h b/src/plugins/qmljseditor/qmljsquickfix.h index 03a917998a60690b8e0b4f7b77b19cedadd3ac4e..998c35fdc64b97c3a9cd952a59254b4e74ff67c3 100644 --- a/src/plugins/qmljseditor/qmljsquickfix.h +++ b/src/plugins/qmljseditor/qmljsquickfix.h @@ -35,9 +35,11 @@ #include <qmljs/parser/qmljsastfwd_p.h> #include <qmljs/qmljsdocument.h> -namespace QmlJSEditor { +namespace QmlJS { + class ModelManagerInterface; +} -class ModelManagerInterface; +namespace QmlJSEditor { namespace Internal { diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index ee72f414cd7ff5fd00ec31851284cf7a755f70ba..1cbf524fe6305b625c2374e644c865825d4fd2f2 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -37,7 +37,7 @@ #include <coreplugin/messagemanager.h> #include <extensionsystem/pluginmanager.h> #include <projectexplorer/filewatcher.h> -#include <qmljseditor/qmljsmodelmanagerinterface.h> +#include <qmljs/qmljsmodelmanagerinterface.h> #include <QTextStream> #include <QDeclarativeComponent> @@ -48,7 +48,7 @@ namespace QmlProjectManager { QmlProject::QmlProject(Internal::Manager *manager, const QString &fileName) : m_manager(manager), m_fileName(fileName), - m_modelManager(ExtensionSystem::PluginManager::instance()->getObject<QmlJSEditor::ModelManagerInterface>()), + m_modelManager(ExtensionSystem::PluginManager::instance()->getObject<QmlJS::ModelManagerInterface>()), m_fileWatcher(new ProjectExplorer::FileWatcher(this)), m_targetFactory(new Internal::QmlProjectTargetFactory(this)) { diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h index 132622e27ff9d17d5f071c6cabf11b77790158db..8a510a6665273b63f3d780a69c35ae46f5419834 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.h +++ b/src/plugins/qmlprojectmanager/qmlproject.h @@ -39,7 +39,7 @@ #include <QtDeclarative/QDeclarativeEngine> -namespace QmlJSEditor { +namespace QmlJS { class ModelManagerInterface; } @@ -118,7 +118,7 @@ private: QString m_fileName; Internal::QmlProjectFile *m_file; QString m_projectName; - QmlJSEditor::ModelManagerInterface *m_modelManager; + QmlJS::ModelManagerInterface *m_modelManager; // plain format QStringList m_files; diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp index 144d5d00880f12eef4a2a7dbec5fa271c901307b..6f3b6115b5ca2d30e609969af84e9aed17c99f7f 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp @@ -47,7 +47,7 @@ #include <texteditor/texteditoractionhandler.h> #include <projectexplorer/taskwindow.h> -#include <qmljseditor/qmljsmodelmanagerinterface.h> +#include <qmljs/qmljsmodelmanagerinterface.h> #include <QtCore/QtPlugin> @@ -99,7 +99,7 @@ void QmlProjectPlugin::extensionsInitialized() ProjectExplorer::TaskWindow *taskWindow = pluginManager->getObject<ProjectExplorer::TaskWindow>(); m_qmlTaskManager->setTaskWindow(taskWindow); - QmlJSEditor::ModelManagerInterface *modelManager = pluginManager->getObject<QmlJSEditor::ModelManagerInterface>(); + QmlJS::ModelManagerInterface *modelManager = pluginManager->getObject<QmlJS::ModelManagerInterface>(); Q_ASSERT(modelManager); connect(modelManager, SIGNAL(documentChangedOnDisk(QmlJS::Document::Ptr)), m_qmlTaskManager, SLOT(documentChangedOnDisk(QmlJS::Document::Ptr)));