2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-11-02 11:10:27 +01:00
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2010-11-02 11:10:27 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-11-02 11:10:27 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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.
|
2010-11-02 11:10:27 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2010-12-17 17:14:20 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-11-02 11:10:27 +01:00
|
|
|
|
|
|
|
|
#include "qmljseditoreditable.h"
|
|
|
|
|
#include "qmljseditor.h"
|
|
|
|
|
#include "qmljseditorconstants.h"
|
2013-08-30 12:55:06 +02:00
|
|
|
#include "qmljscompletionassist.h"
|
2010-11-02 11:10:27 +01:00
|
|
|
|
2011-10-05 12:09:14 +02:00
|
|
|
#include <qmljstools/qmljstoolsconstants.h>
|
2010-11-02 11:10:27 +01:00
|
|
|
#include <texteditor/texteditorconstants.h>
|
2010-11-11 10:05:05 +01:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2010-11-02 11:10:27 +01:00
|
|
|
|
|
|
|
|
#include <coreplugin/mimedatabase.h>
|
|
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
#include <coreplugin/designmode.h>
|
|
|
|
|
#include <coreplugin/modemanager.h>
|
|
|
|
|
#include <coreplugin/coreconstants.h>
|
|
|
|
|
|
2013-08-30 12:55:06 +02:00
|
|
|
#include <extensionsystem/pluginmanager.h>
|
|
|
|
|
|
2010-11-02 11:10:27 +01:00
|
|
|
namespace QmlJSEditor {
|
2014-02-07 14:21:58 +01:00
|
|
|
namespace Internal {
|
2010-11-02 11:10:27 +01:00
|
|
|
|
2013-06-03 19:31:32 +02:00
|
|
|
QmlJSEditor::QmlJSEditor(QmlJSTextEditorWidget *editor)
|
2011-02-21 16:02:26 +01:00
|
|
|
: BaseTextEditor(editor)
|
2010-11-02 11:10:27 +01:00
|
|
|
{
|
2013-06-03 19:31:32 +02:00
|
|
|
m_context.add(Constants::C_QMLJSEDITOR_ID);
|
2010-11-02 11:10:27 +01:00
|
|
|
m_context.add(TextEditor::Constants::C_TEXTEDITOR);
|
2010-11-11 10:05:05 +01:00
|
|
|
m_context.add(ProjectExplorer::Constants::LANG_QMLJS);
|
2010-11-02 11:10:27 +01:00
|
|
|
}
|
|
|
|
|
|
2013-06-03 19:31:32 +02:00
|
|
|
bool QmlJSEditor::isDesignModePreferred() const
|
2010-11-02 11:10:27 +01:00
|
|
|
{
|
2013-05-31 12:52:53 +02:00
|
|
|
// stay in design mode if we are there
|
2012-01-26 01:18:02 +01:00
|
|
|
Core::IMode *mode = Core::ModeManager::currentMode();
|
2013-05-31 12:52:53 +02:00
|
|
|
if (mode && mode->id() == Core::Constants::MODE_DESIGN)
|
|
|
|
|
return true;
|
|
|
|
|
return false;
|
2010-11-02 11:10:27 +01:00
|
|
|
}
|
|
|
|
|
|
2013-06-03 19:31:32 +02:00
|
|
|
const Utils::CommentDefinition *QmlJSEditor::commentDefinition() const
|
2013-03-06 15:28:19 +01:00
|
|
|
{
|
|
|
|
|
return &m_commentDefinition;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-30 12:55:06 +02:00
|
|
|
TextEditor::CompletionAssistProvider *QmlJSEditor::completionAssistProvider()
|
|
|
|
|
{
|
|
|
|
|
return ExtensionSystem::PluginManager::getObject<Internal::QmlJSCompletionAssistProvider>();
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-07 14:21:58 +01:00
|
|
|
} // namespace Internal
|
2010-11-02 11:10:27 +01:00
|
|
|
} // namespace QmlJSEditor
|