Commit 67c3fed2 authored by hjk's avatar hjk

QmlJSEditor: Rename QmlJSEditorEditable into QmlJSEditor

Change-Id: I710817ffd7bdf87aa6c0fed0f1f3cd4ea842fd01
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent e40308ab
......@@ -66,11 +66,13 @@
#include <QTextDocumentFragment>
using namespace QmlJS;
using namespace QmlJSEditor;
using namespace QmlJSTools;
using namespace Internal;
using namespace TextEditor;
namespace QmlJSEditor {
using namespace Internal;
namespace {
enum CompletionOrder {
......@@ -335,7 +337,11 @@ bool isLiteral(AST::Node *ast)
} // Anonymous
Q_DECLARE_METATYPE(CompleteFunctionCall)
} // namesapce QmlJSEditor
Q_DECLARE_METATYPE(QmlJSEditor::CompleteFunctionCall)
namespace QmlJSEditor {
// -----------------------
// QmlJSAssistProposalItem
......@@ -1028,3 +1034,5 @@ bool QmlJSAssistProposalModel::keepPerfectMatch(TextEditor::AssistReason reason)
{
return reason == ExplicitlyInvoked;
}
} // namespace QmlJSEditor
......@@ -47,10 +47,12 @@
#include <QMessageBox>
using namespace QmlJS::AST;
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
using namespace QmlJSTools;
namespace QmlJSEditor {
using namespace Internal;
namespace {
class Operation: public QmlJSQuickFixOperation
......@@ -153,3 +155,5 @@ void ComponentFromObjectDef::match(const QmlJSQuickFixInterface &interface, Quic
}
}
}
} //namespace QmlJSEditor
......@@ -95,10 +95,11 @@ enum {
using namespace QmlJS;
using namespace QmlJS::AST;
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
using namespace QmlJSTools;
namespace QmlJSEditor {
using namespace Internal;
namespace {
class FindIdDeclarations: protected Visitor
......@@ -577,7 +578,7 @@ QModelIndex QmlJSTextEditorWidget::outlineModelIndex()
return m_outlineModelIndex;
}
Core::IEditor *QmlJSEditorEditable::duplicate(QWidget *parent)
Core::IEditor *QmlJSEditor::duplicate(QWidget *parent)
{
QmlJSTextEditorWidget *newEditor = new QmlJSTextEditorWidget(parent);
newEditor->duplicateFrom(editorWidget());
......@@ -585,12 +586,12 @@ Core::IEditor *QmlJSEditorEditable::duplicate(QWidget *parent)
return newEditor->editor();
}
Core::Id QmlJSEditorEditable::id() const
Core::Id QmlJSEditor::id() const
{
return Core::Id(QmlJSEditor::Constants::C_QMLJSEDITOR_ID);
return Core::Id(Constants::C_QMLJSEDITOR_ID);
}
bool QmlJSEditorEditable::open(QString *errorString, const QString &fileName, const QString &realFileName)
bool QmlJSEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
{
bool b = TextEditor::BaseTextEditor::open(errorString, fileName, realFileName);
editorWidget()->setMimeType(Core::ICore::mimeDatabase()->findByFile(QFileInfo(fileName)).type());
......@@ -748,9 +749,13 @@ void QmlJSTextEditorWidget::updateOutlineIndexNow()
}
}
} // namespace QmlJSEditor
class QtQuickToolbarMarker {};
Q_DECLARE_METATYPE(QtQuickToolbarMarker)
namespace QmlJSEditor {
template <class T>
static QList<TextEditor::RefactorMarker> removeMarkersOfType(const QList<TextEditor::RefactorMarker> &markers)
{
......@@ -1025,12 +1030,12 @@ bool QmlJSTextEditorWidget::isClosingBrace(const QList<Token> &tokens) const
TextEditor::BaseTextEditor *QmlJSTextEditorWidget::createEditor()
{
QmlJSEditorEditable *editable = new QmlJSEditorEditable(this);
QmlJSEditor *editable = new QmlJSEditor(this);
createToolBar(editable);
return editable;
}
void QmlJSTextEditorWidget::createToolBar(QmlJSEditorEditable *editor)
void QmlJSTextEditorWidget::createToolBar(QmlJSEditor *editor)
{
m_outlineCombo = new QComboBox;
m_outlineCombo->setMinimumContentsLength(22);
......@@ -1209,13 +1214,13 @@ void QmlJSTextEditorWidget::contextMenuEvent(QContextMenuEvent *e)
refactoringMenu->setEnabled(!refactoringMenu->isEmpty());
if (Core::ActionContainer *mcontext = Core::ActionManager::actionContainer(QmlJSEditor::Constants::M_CONTEXT)) {
if (Core::ActionContainer *mcontext = Core::ActionManager::actionContainer(Constants::M_CONTEXT)) {
QMenu *contextMenu = mcontext->menu();
foreach (QAction *action, contextMenu->actions()) {
menu->addAction(action);
if (action->objectName() == QLatin1String(QmlJSEditor::Constants::M_REFACTORING_MENU_INSERTION_POINT))
if (action->objectName() == QLatin1String(Constants::M_REFACTORING_MENU_INSERTION_POINT))
menu->addMenu(refactoringMenu);
if (action->objectName() == QLatin1String(QmlJSEditor::Constants::SHOW_QT_QUICK_HELPER)) {
if (action->objectName() == QLatin1String(Constants::SHOW_QT_QUICK_HELPER)) {
bool enabled = m_contextPane->isAvailable(editor(), semanticInfo().document, m_semanticInfo.declaringMemberNoProperties(position()));
action->setEnabled(enabled);
}
......@@ -1448,3 +1453,5 @@ QString QmlJSTextEditorWidget::foldReplacementText(const QTextBlock &block) cons
return TextEditor::BaseTextEditorWidget::foldReplacementText(block);
}
} // namespace QmlJSEditor
......@@ -65,7 +65,7 @@ namespace AST {
The top-level namespace of the QmlJSEditor plug-in.
*/
namespace QmlJSEditor {
class QmlJSEditorEditable;
class QmlJSEditor;
class FindReferences;
namespace Internal {
......@@ -160,7 +160,7 @@ protected:
void resizeEvent(QResizeEvent *event);
void scrollContentsBy(int dx, int dy);
TextEditor::BaseTextEditor *createEditor();
void createToolBar(QmlJSEditorEditable *editable);
void createToolBar(QmlJSEditor *editable);
TextEditor::BaseTextEditorWidget::Link findLinkAt(const QTextCursor &cursor, bool resolveTarget = true);
QString foldReplacementText(const QTextBlock &block) const;
......
......@@ -43,15 +43,15 @@
namespace QmlJSEditor {
QmlJSEditorEditable::QmlJSEditorEditable(QmlJSTextEditorWidget *editor)
QmlJSEditor::QmlJSEditor(QmlJSTextEditorWidget *editor)
: BaseTextEditor(editor)
{
m_context.add(QmlJSEditor::Constants::C_QMLJSEDITOR_ID);
m_context.add(Constants::C_QMLJSEDITOR_ID);
m_context.add(TextEditor::Constants::C_TEXTEDITOR);
m_context.add(ProjectExplorer::Constants::LANG_QMLJS);
}
bool QmlJSEditorEditable::isDesignModePreferred() const
bool QmlJSEditor::isDesignModePreferred() const
{
// stay in design mode if we are there
Core::IMode *mode = Core::ModeManager::currentMode();
......@@ -60,14 +60,14 @@ bool QmlJSEditorEditable::isDesignModePreferred() const
return false;
}
void QmlJSEditorEditable::setTextCodec(QTextCodec *codec, TextCodecReason reason)
void QmlJSEditor::setTextCodec(QTextCodec *codec, TextCodecReason reason)
{
if (reason != TextCodecOtherReason) // qml is defined to be utf8
return;
editorWidget()->setTextCodec(codec);
}
const Utils::CommentDefinition *QmlJSEditorEditable::commentDefinition() const
const Utils::CommentDefinition *QmlJSEditor::commentDefinition() const
{
return &m_commentDefinition;
}
......
......@@ -37,12 +37,12 @@
namespace QmlJSEditor {
class QmlJSTextEditorWidget;
class QMLJSEDITOR_EXPORT QmlJSEditorEditable : public TextEditor::BaseTextEditor
class QMLJSEDITOR_EXPORT QmlJSEditor : public TextEditor::BaseTextEditor
{
Q_OBJECT
public:
explicit QmlJSEditorEditable(QmlJSTextEditorWidget *);
explicit QmlJSEditor(QmlJSTextEditorWidget *);
bool duplicateSupported() const { return true; }
Core::IEditor *duplicate(QWidget *parent);
......
......@@ -49,9 +49,8 @@
#include <QMessageBox>
#include <QPushButton>
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
using namespace QmlJSEditor::Constants;
namespace QmlJSEditor {
namespace Internal {
QmlJSEditorFactory::QmlJSEditorFactory(QObject *parent)
: Core::IEditorFactory(parent)
......@@ -68,17 +67,17 @@ QmlJSEditorFactory::QmlJSEditorFactory(QObject *parent)
Core::Id QmlJSEditorFactory::id() const
{
return Core::Id(C_QMLJSEDITOR_ID);
return Core::Id(Constants::C_QMLJSEDITOR_ID);
}
QString QmlJSEditorFactory::displayName() const
{
return qApp->translate("OpenWith::Editors", C_QMLJSEDITOR_DISPLAY_NAME);
return qApp->translate("OpenWith::Editors", Constants::C_QMLJSEDITOR_DISPLAY_NAME);
}
Core::IEditor *QmlJSEditorFactory::createEditor(QWidget *parent)
{
QmlJSEditor::QmlJSTextEditorWidget *rc = new QmlJSEditor::QmlJSTextEditorWidget(parent);
QmlJSTextEditorWidget *rc = new QmlJSTextEditorWidget(parent);
QmlJSEditorPlugin::instance()->initializeEditor(rc);
return rc->editor();
}
......@@ -87,3 +86,6 @@ QStringList QmlJSEditorFactory::mimeTypes() const
{
return m_mimeTypes;
}
} // namespace Internal
} // namespace QmlJSEditor
......@@ -77,8 +77,6 @@
#include <QMenu>
#include <QAction>
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
using namespace QmlJSEditor::Constants;
using namespace ProjectExplorer;
......@@ -86,6 +84,9 @@ enum {
QUICKFIX_INTERVAL = 20
};
namespace QmlJSEditor {
using namespace Internal;
void registerQuickFixes(ExtensionSystem::IPlugin *plugIn);
QmlJSEditorPlugin *QmlJSEditorPlugin::m_instance = 0;
......@@ -130,7 +131,7 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
connect(m_modelManager, SIGNAL(aboutToRemoveFiles(QStringList)),
m_qmlTaskManager, SLOT(documentsRemoved(QStringList)));
Core::Context context(QmlJSEditor::Constants::C_QMLJSEDITOR_ID);
Core::Context context(Constants::C_QMLJSEDITOR_ID);
m_editor = new QmlJSEditorFactory(this);
addObject(m_editor);
......@@ -160,14 +161,14 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
jsWizardParameters.setId(QLatin1String("Z.Js"));
addAutoReleasedObject(new JsFileWizard(jsWizardParameters, core));
m_actionHandler = new TextEditor::TextEditorActionHandler(QmlJSEditor::Constants::C_QMLJSEDITOR_ID,
m_actionHandler = new TextEditor::TextEditorActionHandler(Constants::C_QMLJSEDITOR_ID,
TextEditor::TextEditorActionHandler::Format
| TextEditor::TextEditorActionHandler::UnCommentSelection
| TextEditor::TextEditorActionHandler::UnCollapseAll
| TextEditor::TextEditorActionHandler::FollowSymbolUnderCursor);
m_actionHandler->initializeActions();
Core::ActionContainer *contextMenu = Core::ActionManager::createMenu(QmlJSEditor::Constants::M_CONTEXT);
Core::ActionContainer *contextMenu = Core::ActionManager::createMenu(Constants::M_CONTEXT);
Core::ActionContainer *qmlToolsMenu = Core::ActionManager::actionContainer(Core::Id(QmlJSTools::Constants::M_TOOLS_QMLJS));
Core::Context globalContext(Core::Constants::C_GLOBAL);
......@@ -259,7 +260,7 @@ ExtensionSystem::IPlugin::ShutdownFlag QmlJSEditorPlugin::aboutToShutdown()
return IPlugin::aboutToShutdown();
}
void QmlJSEditorPlugin::initializeEditor(QmlJSEditor::QmlJSTextEditorWidget *editor)
void QmlJSEditorPlugin::initializeEditor(QmlJSTextEditorWidget *editor)
{
QTC_CHECK(m_instance);
......@@ -358,4 +359,6 @@ void QmlJSEditorPlugin::checkCurrentEditorSemanticInfoUpToDate()
m_reformatFileAction->setEnabled(semanticInfoUpToDate);
}
Q_EXPORT_PLUGIN(QmlJSEditorPlugin)
} // namespace QmlJSEditor
Q_EXPORT_PLUGIN(QmlJSEditor::Internal::QmlJSEditorPlugin)
......@@ -92,7 +92,7 @@ public:
QmlJSQuickFixAssistProvider *quickFixAssistProvider() const;
void initializeEditor(QmlJSEditor::QmlJSTextEditorWidget *editor);
void initializeEditor(QmlJSTextEditorWidget *editor);
Utils::JsonSchemaManager *jsonManager() const;
......
......@@ -56,8 +56,9 @@
using namespace Core;
using namespace QmlJS;
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
namespace QmlJSEditor {
namespace Internal {
namespace {
......@@ -97,7 +98,7 @@ HoverHandler::HoverHandler(QObject *parent) : BaseHoverHandler(parent), m_modelM
bool HoverHandler::acceptEditor(IEditor *editor)
{
QmlJSEditorEditable *qmlEditor = qobject_cast<QmlJSEditorEditable *>(editor);
QmlJSEditor *qmlEditor = qobject_cast<QmlJSEditor *>(editor);
if (qmlEditor)
return true;
return false;
......@@ -189,7 +190,7 @@ void HoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos)
if (!m_modelManager)
return;
QmlJSEditor::QmlJSTextEditorWidget *qmlEditor = qobject_cast<QmlJSEditor::QmlJSTextEditorWidget *>(editor->widget());
QmlJSTextEditorWidget *qmlEditor = qobject_cast<QmlJSTextEditorWidget *>(editor->widget());
if (!qmlEditor)
return;
......@@ -256,7 +257,7 @@ void HoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos)
setQmlHelpItem(scopeChain, qmlDocument, node);
}
bool HoverHandler::matchDiagnosticMessage(QmlJSEditor::QmlJSTextEditorWidget *qmlEditor, int pos)
bool HoverHandler::matchDiagnosticMessage(QmlJSTextEditorWidget *qmlEditor, int pos)
{
foreach (const QTextEdit::ExtraSelection &sel,
qmlEditor->extraSelections(TextEditor::BaseTextEditorWidget::CodeWarningsSelection)) {
......@@ -521,3 +522,7 @@ bool HoverHandler::setQmlHelpItem(const ScopeChain &scopeChain,
}
return false;
}
} // namespace Internal
} // namespace QmlJSEditor
......@@ -73,7 +73,7 @@ private:
virtual void identifyMatch(TextEditor::ITextEditor *editor, int pos);
virtual void operateTooltip(TextEditor::ITextEditor *editor, const QPoint &point);
bool matchDiagnosticMessage(QmlJSEditor::QmlJSTextEditorWidget *qmlEditor, int pos);
bool matchDiagnosticMessage(QmlJSTextEditorWidget *qmlEditor, int pos);
bool matchColorItem(const QmlJS::ScopeChain &lookupContext,
const QmlJS::Document::Ptr &qmlDocument,
const QList<QmlJS::AST::Node *> &astPath,
......
......@@ -244,7 +244,7 @@ bool QmlJSOutlineWidget::syncCursor()
bool QmlJSOutlineWidgetFactory::supportsEditor(Core::IEditor *editor) const
{
if (qobject_cast<QmlJSEditorEditable*>(editor))
if (qobject_cast<QmlJSEditor*>(editor))
return true;
return false;
}
......@@ -253,7 +253,7 @@ TextEditor::IOutlineWidget *QmlJSOutlineWidgetFactory::createWidget(Core::IEdito
{
QmlJSOutlineWidget *widget = new QmlJSOutlineWidget;
QmlJSEditorEditable *qmlJSEditable = qobject_cast<QmlJSEditorEditable*>(editor);
QmlJSEditor *qmlJSEditable = qobject_cast<QmlJSEditor*>(editor);
QmlJSTextEditorWidget *qmlJSEditor = qobject_cast<QmlJSTextEditorWidget*>(qmlJSEditable->widget());
Q_ASSERT(qmlJSEditor);
......
......@@ -42,11 +42,13 @@
using namespace QmlJS;
using namespace QmlJS::AST;
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
using namespace QmlJSTools;
using TextEditor::RefactoringChanges;
namespace QmlJSEditor {
using namespace Internal;
QmlJSQuickFixOperation::QmlJSQuickFixOperation(const QmlJSQuickFixInterface &interface,
int priority)
: QuickFixOperation(priority)
......@@ -79,3 +81,5 @@ void QmlJSQuickFixFactory::matchingOperations(const QuickFixInterface &interface
{
match(interface.staticCast<const QmlJSQuickFixAssistInterface>(), result);
}
} // namespace QmlJSEditor
......@@ -35,11 +35,13 @@
#include <extensionsystem/pluginmanager.h>
using namespace QmlJSEditor;
using namespace Internal;
using namespace QmlJSTools;
using namespace TextEditor;
namespace QmlJSEditor {
using namespace Internal;
// -----------------------
// QuickFixAssistInterface
// -----------------------
......@@ -107,7 +109,9 @@ IAssistProcessor *QmlJSQuickFixAssistProvider::createProcessor() const
QList<QuickFixFactory *> QmlJSQuickFixAssistProvider::quickFixFactories() const
{
QList<TextEditor::QuickFixFactory *> results;
foreach (QmlJSQuickFixFactory *f, ExtensionSystem::PluginManager::getObjects<QmlJSEditor::QmlJSQuickFixFactory>())
foreach (QmlJSQuickFixFactory *f, ExtensionSystem::PluginManager::getObjects<QmlJSQuickFixFactory>())
results.append(f);
return results;
}
} // namespace QmlJSEditor
......@@ -42,11 +42,13 @@
using namespace QmlJS;
using namespace QmlJS::AST;
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
using namespace QmlJSTools;
using TextEditor::RefactoringChanges;
namespace QmlJSEditor {
using namespace Internal;
namespace {
/*
......@@ -179,3 +181,5 @@ void registerQuickFixes(ExtensionSystem::IPlugin *plugIn)
plugIn->addAutoReleasedObject(new WrapInLoader);
plugIn->addAutoReleasedObject(new AddAnalysisMessageSuppressionComment);
}
} // namespace QmlJSEditor
......@@ -51,11 +51,13 @@
#include <QFutureInterface>
#include <QRunnable>
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
using namespace QmlJS;
using namespace QmlJS::AST;
namespace QmlJSEditor {
using namespace Internal;
namespace {
template <typename T>
......@@ -624,3 +626,5 @@ int SemanticHighlighter::startRevision() const
{
return m_startRevision;
}
} // namespace QmlJSEditor
......@@ -44,10 +44,12 @@
using namespace QmlJS;
using namespace QmlJS::AST;
using namespace QmlJSEditor;
using namespace QmlJSEditor::Internal;
using namespace QmlJSTools;
namespace QmlJSEditor {
using namespace Internal;
namespace {
class FindIds : protected Visitor
......@@ -191,3 +193,5 @@ void WrapInLoader::match(const QmlJSQuickFixInterface &interface, QuickFixOperat
}
}
}
} // namespace QmlJSEditor
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