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:
hjk
2014-09-03 11:24:38 +02:00
parent 7ec74147a8
commit 4d93bb8216
12 changed files with 10 additions and 55 deletions

View File

@@ -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);

View File

@@ -65,7 +65,6 @@ namespace Internal {
CMakeEditor::CMakeEditor()
{
setDuplicateSupported(true);
}
void CMakeEditor::finalizeInitialization()

View File

@@ -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)

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -335,7 +335,6 @@ class GlslEditor : public TextEditor::BaseTextEditor
public:
GlslEditor()
{
setDuplicateSupported(true);
}
bool open(QString *errorString, const QString &fileName, const QString &realFileName)

View File

@@ -62,7 +62,6 @@ class PythonEditor : public BaseTextEditor
public:
PythonEditor()
{
setDuplicateSupported(true);
}
bool open(QString *errorString, const QString &fileName, const QString &realFileName)

View File

@@ -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

View File

@@ -879,7 +879,6 @@ QString QmlJSEditorWidget::foldReplacementText(const QTextBlock &block) const
QmlJSEditor::QmlJSEditor()
{
addContext(ProjectExplorer::Constants::LANG_QMLJS);
setDuplicateSupported(true);
}
bool QmlJSEditor::isDesignModePreferred() const

View File

@@ -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;

View File

@@ -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

View File

@@ -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);