2010-06-14 14:52:43 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2010-06-14 14:52:43 +02:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
2010-06-14 14:52:43 +02:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** 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.
|
2010-06-14 14:52:43 +02:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
2010-06-14 14:52:43 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef QMLREFACTORINGCHANGES_H
|
|
|
|
|
#define QMLREFACTORINGCHANGES_H
|
|
|
|
|
|
2010-11-11 10:05:05 +01:00
|
|
|
#include "qmljstools_global.h"
|
|
|
|
|
|
2010-06-14 14:52:43 +02:00
|
|
|
#include <qmljs/qmljsdocument.h>
|
|
|
|
|
|
|
|
|
|
#include <texteditor/refactoringchanges.h>
|
|
|
|
|
|
|
|
|
|
namespace QmlJS {
|
|
|
|
|
class ModelManagerInterface;
|
|
|
|
|
} // namespace QmlJS
|
|
|
|
|
|
2010-11-11 10:05:05 +01:00
|
|
|
namespace QmlJSTools {
|
2010-06-14 14:52:43 +02:00
|
|
|
|
2010-08-13 12:49:11 +02:00
|
|
|
class QmlJSRefactoringChanges;
|
|
|
|
|
|
2010-11-11 10:05:05 +01:00
|
|
|
class QMLJSTOOLS_EXPORT QmlJSRefactoringFile: public TextEditor::RefactoringFile
|
2010-08-13 12:49:11 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QmlJSRefactoringFile();
|
|
|
|
|
QmlJSRefactoringFile(const QString &fileName, QmlJSRefactoringChanges *refactoringChanges);
|
2011-02-21 16:02:26 +01:00
|
|
|
QmlJSRefactoringFile(TextEditor::BaseTextEditorWidget *editor, QmlJS::Document::Ptr document);
|
2010-08-13 12:49:11 +02:00
|
|
|
|
|
|
|
|
QmlJS::Document::Ptr qmljsDocument() const;
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\returns the offset in the document for the start position of the given
|
|
|
|
|
source location.
|
|
|
|
|
*/
|
|
|
|
|
unsigned startOf(const QmlJS::AST::SourceLocation &loc) const;
|
|
|
|
|
|
2010-09-30 16:12:24 +02:00
|
|
|
bool isCursorOn(QmlJS::AST::UiObjectMember *ast) const;
|
|
|
|
|
bool isCursorOn(QmlJS::AST::UiQualifiedId *ast) const;
|
|
|
|
|
|
2010-08-13 12:49:11 +02:00
|
|
|
private:
|
|
|
|
|
QmlJSRefactoringChanges *refactoringChanges() const;
|
|
|
|
|
|
|
|
|
|
mutable QmlJS::Document::Ptr m_qmljsDocument;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2010-11-11 10:05:05 +01:00
|
|
|
class QMLJSTOOLS_EXPORT QmlJSRefactoringChanges: public TextEditor::RefactoringChanges
|
2010-06-14 14:52:43 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QmlJSRefactoringChanges(QmlJS::ModelManagerInterface *modelManager,
|
|
|
|
|
const QmlJS::Snapshot &snapshot);
|
|
|
|
|
|
2010-08-13 12:49:11 +02:00
|
|
|
const QmlJS::Snapshot &snapshot() const;
|
|
|
|
|
|
|
|
|
|
QmlJSRefactoringFile file(const QString &fileName);
|
|
|
|
|
|
2010-08-12 11:34:48 +02:00
|
|
|
private:
|
2011-02-01 14:13:54 +01:00
|
|
|
virtual void indentSelection(const QTextCursor &selection,
|
|
|
|
|
const QString &fileName,
|
2011-02-21 16:02:26 +01:00
|
|
|
const TextEditor::BaseTextEditorWidget *textEditor) const;
|
2010-08-12 13:46:18 +02:00
|
|
|
virtual void fileChanged(const QString &fileName);
|
2010-08-12 11:34:48 +02:00
|
|
|
|
2010-06-14 14:52:43 +02:00
|
|
|
private:
|
|
|
|
|
QmlJS::ModelManagerInterface *m_modelManager;
|
|
|
|
|
QmlJS::Snapshot m_snapshot;
|
|
|
|
|
};
|
|
|
|
|
|
2010-11-11 10:05:05 +01:00
|
|
|
} // namespace QmlJSTools
|
2010-06-14 14:52:43 +02:00
|
|
|
|
|
|
|
|
#endif // QMLREFACTORINGCHANGES_H
|