Commit 4d93bb82 authored by hjk's avatar hjk

TextEditor: Flip default to 'duplicatedSupported'

opt-out now, for all editors created by BaseTextEditorFactories.

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