Commit 3462c5ef authored by hjk's avatar hjk
Browse files

IEditor: Make duplicatesSupported a value member



Change-Id: Iee75dd4155d5074bb319df79d006b6d5e2989e14
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent b739ad38
......@@ -54,6 +54,7 @@ JavaEditor::JavaEditor(JavaEditorWidget *editor)
{
setContext(Core::Context(Constants::C_JAVA_EDITOR,
TextEditor::Constants::C_TEXTEDITOR));
setDuplicateSupported(true);
}
Core::IEditor *JavaEditor::duplicate()
......
......@@ -47,7 +47,6 @@ class JavaEditor : public TextEditor::BaseTextEditor
public:
JavaEditor(JavaEditorWidget *);
bool duplicateSupported() const { return true; }
Core::IEditor *duplicate();
TextEditor::CompletionAssistProvider *completionAssistProvider();
};
......
......@@ -61,6 +61,7 @@ CMakeEditor::CMakeEditor(CMakeEditorWidget *editor)
{
setContext(Core::Context(CMakeProjectManager::Constants::C_CMAKEEDITOR,
TextEditor::Constants::C_TEXTEDITOR));
setDuplicateSupported(true);
connect(document(), SIGNAL(changed()), this, SLOT(markAsChanged()));
}
......
......@@ -52,7 +52,6 @@ class CMakeEditor : public TextEditor::BaseTextEditor
public:
CMakeEditor(CMakeEditorWidget *);
bool duplicateSupported() const { return true; }
Core::IEditor *duplicate();
TextEditor::CompletionAssistProvider *completionAssistProvider();
......
......@@ -56,3 +56,21 @@
\sa Core::EditorFactoryInterface Core::IContext
*/
namespace Core {
IEditor::IEditor(QObject *parent)
: IContext(parent), m_duplicateSupported(false)
{}
bool IEditor::duplicateSupported() const
{
return m_duplicateSupported;
}
void IEditor::setDuplicateSupported(bool duplicatesSupported)
{
m_duplicateSupported = duplicatesSupported;
}
} // namespace Core
......@@ -44,13 +44,15 @@ class CORE_EXPORT IEditor : public IContext
Q_OBJECT
public:
IEditor(QObject *parent = 0) : IContext(parent) {}
IEditor(QObject *parent = 0);
virtual ~IEditor() {}
bool duplicateSupported() const;
void setDuplicateSupported(bool duplicateSupported);
virtual bool open(QString *errorString, const QString &fileName, const QString &realFileName) = 0;
virtual IDocument *document() = 0;
virtual bool duplicateSupported() const { return false; }
virtual IEditor *duplicate() { return 0; }
virtual QByteArray saveState() const { return QByteArray(); }
......@@ -63,6 +65,9 @@ public:
virtual QWidget *toolBar() = 0;
virtual bool isDesignModePreferred() const { return false; }
private:
bool m_duplicateSupported;
};
} // namespace Core
......
......@@ -447,6 +447,7 @@ CPPEditor::CPPEditor(CPPEditorWidget *editor)
m_context.add(CppEditor::Constants::C_CPPEDITOR);
m_context.add(ProjectExplorer::Constants::LANG_CXX);
m_context.add(TextEditor::Constants::C_TEXTEDITOR);
setDuplicateSupported(true);
}
Q_GLOBAL_STATIC(CppTools::SymbolFinder, symbolFinder)
......
......@@ -97,7 +97,6 @@ class CPPEditor : public TextEditor::BaseTextEditor
public:
CPPEditor(CPPEditorWidget *);
bool duplicateSupported() const { return true; }
Core::IEditor *duplicate();
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
......
......@@ -62,7 +62,6 @@ public:
DiffEditorController *controller() const;
// Core::IEditor
bool duplicateSupported() const { return false; }
Core::IEditor *duplicate();
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
......
......@@ -80,11 +80,7 @@ ProjectFilesEditor::ProjectFilesEditor(ProjectFilesEditorWidget *editor)
{
document()->setId(Constants::FILES_EDITOR_ID);
setContext(Core::Context(Constants::C_FILESEDITOR));
}
bool ProjectFilesEditor::duplicateSupported() const
{
return true;
setDuplicateSupported(true);
}
Core::IEditor *ProjectFilesEditor::duplicate()
......
......@@ -59,7 +59,6 @@ class ProjectFilesEditor : public TextEditor::BaseTextEditor
public:
ProjectFilesEditor(ProjectFilesEditorWidget *editorWidget);
bool duplicateSupported() const;
Core::IEditor *duplicate();
};
......
......@@ -48,6 +48,7 @@ GLSLEditorEditable::GLSLEditorEditable(GLSLTextEditorWidget *editor)
{
setContext(Core::Context(GLSLEditor::Constants::C_GLSLEDITOR_ID,
TextEditor::Constants::C_TEXTEDITOR));
setDuplicateSupported(true);
}
} // namespace Internal
......
......@@ -44,7 +44,6 @@ class GLSLEditorEditable : public TextEditor::BaseTextEditor
public:
explicit GLSLEditorEditable(GLSLTextEditorWidget *);
bool duplicateSupported() const { return true; }
Core::IEditor *duplicate();
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
TextEditor::CompletionAssistProvider *completionAssistProvider();
......
......@@ -52,6 +52,7 @@ PythonEditor::PythonEditor(EditorWidget *editorWidget)
{
setContext(Core::Context(Constants::C_PYTHONEDITOR_ID,
TextEditor::Constants::C_TEXTEDITOR));
setDuplicateSupported(true);
}
PythonEditor::~PythonEditor()
......
......@@ -45,7 +45,6 @@ public:
explicit PythonEditor(EditorWidget *editorWidget);
virtual ~PythonEditor();
bool duplicateSupported() const { return true; }
Core::IEditor *duplicate();
/**
......
......@@ -57,6 +57,7 @@ ProFileEditor::ProFileEditor(ProFileEditorWidget *editor)
{
setContext(Core::Context(Constants::C_PROFILEEDITOR,
TextEditor::Constants::C_TEXTEDITOR));
setDuplicateSupported(true);
}
Core::IEditor *ProFileEditor::duplicate()
......
......@@ -47,7 +47,6 @@ class ProFileEditor : public TextEditor::BaseTextEditor
public:
ProFileEditor(ProFileEditorWidget *);
bool duplicateSupported() const { return true; }
Core::IEditor *duplicate();
TextEditor::CompletionAssistProvider *completionAssistProvider();
};
......
......@@ -53,6 +53,7 @@ QmlJSEditor::QmlJSEditor(QmlJSTextEditorWidget *editor)
m_context.add(Constants::C_QMLJSEDITOR_ID);
m_context.add(TextEditor::Constants::C_TEXTEDITOR);
m_context.add(ProjectExplorer::Constants::LANG_QMLJS);
setDuplicateSupported(true);
}
bool QmlJSEditor::isDesignModePreferred() const
......
......@@ -46,7 +46,6 @@ class QmlJSEditor : public TextEditor::BaseTextEditor
public:
explicit QmlJSEditor(QmlJSTextEditorWidget *);
bool duplicateSupported() const { return true; }
Core::IEditor *duplicate();
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
bool isDesignModePreferred() const;
......
......@@ -65,6 +65,7 @@ PlainTextEditor::PlainTextEditor(PlainTextEditorWidget *editor)
{
setContext(Core::Context(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID,
TextEditor::Constants::C_TEXTEDITOR));
setDuplicateSupported(true);
}
PlainTextEditorWidget::PlainTextEditorWidget(QWidget *parent)
......
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