forked from qt-creator/qt-creator
TextEditor: Flip default to 'duplicatedSupported'
opt-out now, for all editors created by BaseTextEditorFactories. Change-Id: I01d0a9ff26320fcd0b84ff90ff22c747cf84b84c Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -48,20 +48,6 @@
|
|||||||
namespace Android {
|
namespace Android {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
//
|
|
||||||
// JavaEditor
|
|
||||||
//
|
|
||||||
|
|
||||||
class JavaEditor : public TextEditor::BaseTextEditor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
JavaEditor()
|
|
||||||
{
|
|
||||||
setDuplicateSupported(true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// JavaEditorWidget
|
// JavaEditorWidget
|
||||||
//
|
//
|
||||||
@@ -121,7 +107,6 @@ JavaEditorFactory::JavaEditorFactory()
|
|||||||
|
|
||||||
setDocumentCreator([]() { return new JavaDocument; });
|
setDocumentCreator([]() { return new JavaDocument; });
|
||||||
setEditorWidgetCreator([]() { return new JavaEditorWidget; });
|
setEditorWidgetCreator([]() { return new JavaEditorWidget; });
|
||||||
setEditorCreator([]() { return new JavaEditor; });
|
|
||||||
setAutoCompleterCreator([]() { return new JavaAutoCompleter; });
|
setAutoCompleterCreator([]() { return new JavaAutoCompleter; });
|
||||||
setGenericSyntaxHighlighter(QLatin1String(Constants::JAVA_MIMETYPE));
|
setGenericSyntaxHighlighter(QLatin1String(Constants::JAVA_MIMETYPE));
|
||||||
setCommentStyle(Utils::CommentDefinition::CppStyle);
|
setCommentStyle(Utils::CommentDefinition::CppStyle);
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ namespace Internal {
|
|||||||
|
|
||||||
CMakeEditor::CMakeEditor()
|
CMakeEditor::CMakeEditor()
|
||||||
{
|
{
|
||||||
setDuplicateSupported(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeEditor::finalizeInitialization()
|
void CMakeEditor::finalizeInitialization()
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ CppEditor::CppEditor()
|
|||||||
{
|
{
|
||||||
m_context.add(ProjectExplorer::Constants::LANG_CXX);
|
m_context.add(ProjectExplorer::Constants::LANG_CXX);
|
||||||
m_context.add(TextEditor::Constants::C_TEXTEDITOR);
|
m_context.add(TextEditor::Constants::C_TEXTEDITOR);
|
||||||
setDuplicateSupported(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(CppTools::SymbolFinder, symbolFinder)
|
Q_GLOBAL_STATIC(CppTools::SymbolFinder, symbolFinder)
|
||||||
|
|||||||
@@ -208,8 +208,6 @@ DiffEditor::DiffEditor(const QSharedPointer<DiffEditorDocument> &doc)
|
|||||||
, m_reloadAction(0)
|
, m_reloadAction(0)
|
||||||
, m_diffEditorSwitcher(0)
|
, m_diffEditorSwitcher(0)
|
||||||
{
|
{
|
||||||
setDuplicateSupported(true);
|
|
||||||
|
|
||||||
QSplitter *splitter = new Core::MiniSplitter(Qt::Vertical);
|
QSplitter *splitter = new Core::MiniSplitter(Qt::Vertical);
|
||||||
|
|
||||||
m_descriptionWidget = new Internal::DescriptionEditorWidget(splitter);
|
m_descriptionWidget = new Internal::DescriptionEditorWidget(splitter);
|
||||||
|
|||||||
@@ -41,19 +41,6 @@ using namespace TextEditor;
|
|||||||
namespace GenericProjectManager {
|
namespace GenericProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
//
|
|
||||||
// ProjectFilesEditor
|
|
||||||
//
|
|
||||||
|
|
||||||
class ProjectFilesEditor : public BaseTextEditor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ProjectFilesEditor()
|
|
||||||
{
|
|
||||||
setDuplicateSupported(true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// ProjectFilesFactory
|
// ProjectFilesFactory
|
||||||
//
|
//
|
||||||
@@ -66,7 +53,6 @@ ProjectFilesFactory::ProjectFilesFactory()
|
|||||||
addMimeType(Constants::INCLUDES_MIMETYPE);
|
addMimeType(Constants::INCLUDES_MIMETYPE);
|
||||||
addMimeType(Constants::CONFIG_MIMETYPE);
|
addMimeType(Constants::CONFIG_MIMETYPE);
|
||||||
|
|
||||||
setEditorCreator([]() { return new ProjectFilesEditor; });
|
|
||||||
setDocumentCreator([]() { return new BaseTextDocument(Constants::FILES_EDITOR_ID); });
|
setDocumentCreator([]() { return new BaseTextDocument(Constants::FILES_EDITOR_ID); });
|
||||||
setEditorActionHandlers(TextEditorActionHandler::None);
|
setEditorActionHandlers(TextEditorActionHandler::None);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -335,7 +335,6 @@ class GlslEditor : public TextEditor::BaseTextEditor
|
|||||||
public:
|
public:
|
||||||
GlslEditor()
|
GlslEditor()
|
||||||
{
|
{
|
||||||
setDuplicateSupported(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool open(QString *errorString, const QString &fileName, const QString &realFileName)
|
bool open(QString *errorString, const QString &fileName, const QString &realFileName)
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ class PythonEditor : public BaseTextEditor
|
|||||||
public:
|
public:
|
||||||
PythonEditor()
|
PythonEditor()
|
||||||
{
|
{
|
||||||
setDuplicateSupported(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool open(QString *errorString, const QString &fileName, const QString &realFileName)
|
bool open(QString *errorString, const QString &fileName, const QString &realFileName)
|
||||||
|
|||||||
@@ -51,23 +51,6 @@ using namespace TextEditor;
|
|||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
//
|
|
||||||
// ProFileEditor
|
|
||||||
//
|
|
||||||
|
|
||||||
class ProFileEditor : public TextEditor::BaseTextEditor
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ProFileEditor()
|
|
||||||
{
|
|
||||||
setDuplicateSupported(true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// ProFileEditorWidget
|
|
||||||
//
|
|
||||||
|
|
||||||
class ProFileEditorWidget : public BaseTextEditorWidget
|
class ProFileEditorWidget : public BaseTextEditorWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -227,7 +210,6 @@ ProFileEditorFactory::ProFileEditorFactory()
|
|||||||
|
|
||||||
setDocumentCreator([]() { return new ProFileDocument; });
|
setDocumentCreator([]() { return new ProFileDocument; });
|
||||||
setEditorWidgetCreator([]() { return new ProFileEditorWidget; });
|
setEditorWidgetCreator([]() { return new ProFileEditorWidget; });
|
||||||
setEditorCreator([]() { return new ProFileEditor; });
|
|
||||||
|
|
||||||
setCommentStyle(Utils::CommentDefinition::HashStyle);
|
setCommentStyle(Utils::CommentDefinition::HashStyle);
|
||||||
setEditorActionHandlers(TextEditorActionHandler::UnCommentSelection
|
setEditorActionHandlers(TextEditorActionHandler::UnCommentSelection
|
||||||
|
|||||||
@@ -879,7 +879,6 @@ QString QmlJSEditorWidget::foldReplacementText(const QTextBlock &block) const
|
|||||||
QmlJSEditor::QmlJSEditor()
|
QmlJSEditor::QmlJSEditor()
|
||||||
{
|
{
|
||||||
addContext(ProjectExplorer::Constants::LANG_QMLJS);
|
addContext(ProjectExplorer::Constants::LANG_QMLJS);
|
||||||
setDuplicateSupported(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlJSEditor::isDesignModePreferred() const
|
bool QmlJSEditor::isDesignModePreferred() const
|
||||||
|
|||||||
@@ -6553,7 +6553,6 @@ BaseTextEditor::BaseTextEditor()
|
|||||||
: d(new BaseTextEditorPrivate)
|
: d(new BaseTextEditorPrivate)
|
||||||
{
|
{
|
||||||
addContext(TextEditor::Constants::C_TEXTEDITOR);
|
addContext(TextEditor::Constants::C_TEXTEDITOR);
|
||||||
setDuplicateSupported(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseTextEditor::~BaseTextEditor()
|
BaseTextEditor::~BaseTextEditor()
|
||||||
@@ -7189,6 +7188,7 @@ BaseTextEditorFactory::BaseTextEditorFactory(QObject *parent)
|
|||||||
m_editorCreator = []() { return new BaseTextEditor; };
|
m_editorCreator = []() { return new BaseTextEditor; };
|
||||||
m_widgetCreator = []() { return new BaseTextEditorWidget; };
|
m_widgetCreator = []() { return new BaseTextEditorWidget; };
|
||||||
m_commentStyle = CommentDefinition::NoStyle;
|
m_commentStyle = CommentDefinition::NoStyle;
|
||||||
|
m_duplicatedSupported = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditorFactory::setDocumentCreator(const DocumentCreator &creator)
|
void BaseTextEditorFactory::setDocumentCreator(const DocumentCreator &creator)
|
||||||
@@ -7245,6 +7245,11 @@ void BaseTextEditorFactory::setCommentStyle(CommentDefinition::Style style)
|
|||||||
m_commentStyle = style;
|
m_commentStyle = style;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseTextEditorFactory::setDuplicatedSupported(bool on)
|
||||||
|
{
|
||||||
|
m_duplicatedSupported = on;
|
||||||
|
}
|
||||||
|
|
||||||
BaseTextEditor *BaseTextEditorFactory::duplicateTextEditor(BaseTextEditor *other)
|
BaseTextEditor *BaseTextEditorFactory::duplicateTextEditor(BaseTextEditor *other)
|
||||||
{
|
{
|
||||||
BaseTextEditor *editor = createEditorHelper(other->editorWidget()->textDocumentPtr());
|
BaseTextEditor *editor = createEditorHelper(other->editorWidget()->textDocumentPtr());
|
||||||
@@ -7272,6 +7277,7 @@ BaseTextEditor *BaseTextEditorFactory::createEditorHelper(const BaseTextDocument
|
|||||||
{
|
{
|
||||||
BaseTextEditorWidget *widget = m_widgetCreator();
|
BaseTextEditorWidget *widget = m_widgetCreator();
|
||||||
BaseTextEditor *editor = m_editorCreator();
|
BaseTextEditor *editor = m_editorCreator();
|
||||||
|
editor->setDuplicateSupported(m_duplicatedSupported);
|
||||||
editor->addContext(id());
|
editor->addContext(id());
|
||||||
editor->d->m_origin = this;
|
editor->d->m_origin = this;
|
||||||
|
|
||||||
|
|||||||
@@ -644,6 +644,7 @@ public:
|
|||||||
void setEditorActionHandlers(uint optionalActions);
|
void setEditorActionHandlers(uint optionalActions);
|
||||||
|
|
||||||
void setCommentStyle(Utils::CommentDefinition::Style style);
|
void setCommentStyle(Utils::CommentDefinition::Style style);
|
||||||
|
void setDuplicatedSupported(bool on);
|
||||||
|
|
||||||
Core::IEditor *createEditor();
|
Core::IEditor *createEditor();
|
||||||
|
|
||||||
@@ -661,6 +662,7 @@ private:
|
|||||||
IndenterCreator m_indenterCreator;
|
IndenterCreator m_indenterCreator;
|
||||||
SyntaxHighLighterCreator m_syntaxHighlighterCreator;
|
SyntaxHighLighterCreator m_syntaxHighlighterCreator;
|
||||||
Utils::CommentDefinition::Style m_commentStyle;
|
Utils::CommentDefinition::Style m_commentStyle;
|
||||||
|
bool m_duplicatedSupported;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace TextEditor
|
} // namespace TextEditor
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters,
|
|||||||
addMimeType(parameters->mimeType);
|
addMimeType(parameters->mimeType);
|
||||||
|
|
||||||
setEditorActionHandlers(TextEditorActionHandler::None);
|
setEditorActionHandlers(TextEditorActionHandler::None);
|
||||||
|
setDuplicatedSupported(false);
|
||||||
|
|
||||||
setDocumentCreator([=]() -> BaseTextDocument* {
|
setDocumentCreator([=]() -> BaseTextDocument* {
|
||||||
auto document = new BaseTextDocument(parameters->id);
|
auto document = new BaseTextDocument(parameters->id);
|
||||||
|
|||||||
Reference in New Issue
Block a user