Commit b11f5c22 authored by hjk's avatar hjk
Browse files

GenericProjectManager: Use BaseTextEditorFactory for creation



Change-Id: I7d932266ed9e139f9e22fd0bc84761a0430b0a95
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 89bd4ee3
...@@ -41,11 +41,23 @@ using namespace TextEditor; ...@@ -41,11 +41,23 @@ using namespace TextEditor;
namespace GenericProjectManager { namespace GenericProjectManager {
namespace Internal { namespace Internal {
//////////////////////////////////////////////////////////////////////////////////////// //
// ProjectFilesEditor
//
class ProjectFilesEditor : public BaseTextEditor
{
public:
ProjectFilesEditor()
{
addContext(Constants::C_FILESEDITOR);
setDuplicateSupported(true);
}
};
// //
// ProjectFilesFactory // ProjectFilesFactory
// //
////////////////////////////////////////////////////////////////////////////////////////
ProjectFilesFactory::ProjectFilesFactory() ProjectFilesFactory::ProjectFilesFactory()
{ {
...@@ -54,27 +66,10 @@ ProjectFilesFactory::ProjectFilesFactory() ...@@ -54,27 +66,10 @@ ProjectFilesFactory::ProjectFilesFactory()
addMimeType(Constants::FILES_MIMETYPE); addMimeType(Constants::FILES_MIMETYPE);
addMimeType(Constants::INCLUDES_MIMETYPE); addMimeType(Constants::INCLUDES_MIMETYPE);
addMimeType(Constants::CONFIG_MIMETYPE); addMimeType(Constants::CONFIG_MIMETYPE);
new TextEditor::TextEditorActionHandler(this, Constants::C_FILESEDITOR);
}
Core::IEditor *ProjectFilesFactory::createEditor()
{
return new ProjectFilesEditor;
}
////////////////////////////////////////////////////////////////////////////////////////
//
// ProjectFilesEditor
//
////////////////////////////////////////////////////////////////////////////////////////
ProjectFilesEditor::ProjectFilesEditor()
{
addContext(Constants::C_FILESEDITOR);
setDuplicateSupported(true);
setEditorCreator([]() { return new ProjectFilesEditor; }); setEditorCreator([]() { return new ProjectFilesEditor; });
setWidgetCreator([]() { return new BaseTextEditorWidget; });
setDocumentCreator([]() { return new BaseTextDocument(Constants::FILES_EDITOR_ID); }); setDocumentCreator([]() { return new BaseTextDocument(Constants::FILES_EDITOR_ID); });
setEditorActionHandlers(Constants::C_FILESEDITOR, TextEditorActionHandler::None);
} }
} // namespace Internal } // namespace Internal
......
...@@ -32,23 +32,13 @@ ...@@ -32,23 +32,13 @@
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
#include <coreplugin/editormanager/ieditorfactory.h>
namespace GenericProjectManager { namespace GenericProjectManager {
namespace Internal { namespace Internal {
class ProjectFilesFactory: public Core::IEditorFactory class ProjectFilesFactory : public TextEditor::BaseTextEditorFactory
{ {
public: public:
ProjectFilesFactory(); ProjectFilesFactory();
Core::IEditor *createEditor();
};
class ProjectFilesEditor : public TextEditor::BaseTextEditor
{
public:
ProjectFilesEditor();
}; };
} // namespace Internal } // namespace Internal
......
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