File indexing completed on 2024-04-28 15:53:09

0001 /*
0002     SPDX-FileCopyrightText: 2012 Sven Brauch <svenbrauch@googlemail.com>
0003     SPDX-FileCopyrightText: 2014 Miquel Sabaté <mikisabate@gmail.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #include "refactoring.h"
0009 #include "duchain/helpers.h"
0010 
0011 #include <QDebug>
0012 #include "codegendebug.h"
0013 
0014 namespace Python {
0015 
0016 RefactoringCollector::RefactoringCollector(const IndexedDeclaration &decl)
0017     : BasicRefactoringCollector(decl)
0018 {
0019     /* There's nothing to do in here.*/
0020 }
0021 
0022 void RefactoringCollector::processUses(KDevelop::ReferencedTopDUContext topContext)
0023 {
0024     if (topContext != Helper::getDocumentationFileContext())
0025         RefactoringCollector::processUses(topContext);
0026 }
0027 
0028 Refactoring::Refactoring(QObject *parent)
0029     : BasicRefactoring(parent)
0030 {
0031     /* There's nothing to do in here.*/
0032 }
0033 
0034 bool Refactoring::acceptForContextMenu(const KDevelop::Declaration* decl)
0035 {
0036     if (decl->topContext() == Helper::getDocumentationFileContext()) {
0037         qCDebug(KDEV_PYTHON_CODEGEN) << "in doc file, not offering rename action";
0038         return false;
0039     }
0040     return true;
0041 }
0042 
0043 }
0044 
0045 #include "moc_refactoring.cpp"