forked from qt-creator/qt-creator
GenericProject: Use new setup pattern for ProjectFilesFactory
Change-Id: If5d64a8d6b09fbd3ceaea1736ce74ba2c837a456 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -6,22 +6,20 @@
|
|||||||
|
|
||||||
#include <coreplugin/coreplugintr.h>
|
#include <coreplugin/coreplugintr.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <texteditor/textdocument.h>
|
|
||||||
#include <texteditor/texteditoractionhandler.h>
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <texteditor/textdocument.h>
|
||||||
|
#include <texteditor/texteditor.h>
|
||||||
|
#include <texteditor/texteditoractionhandler.h>
|
||||||
|
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
namespace GenericProjectManager {
|
namespace GenericProjectManager::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
//
|
class ProjectFilesFactory : public TextEditorFactory
|
||||||
// ProjectFilesFactory
|
|
||||||
//
|
|
||||||
|
|
||||||
ProjectFilesFactory::ProjectFilesFactory()
|
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
ProjectFilesFactory()
|
||||||
|
{
|
||||||
setId(Constants::FILES_EDITOR_ID);
|
setId(Constants::FILES_EDITOR_ID);
|
||||||
setDisplayName(::Core::Tr::tr(".files Editor"));
|
setDisplayName(::Core::Tr::tr(".files Editor"));
|
||||||
addMimeType("application/vnd.qtcreator.generic.files");
|
addMimeType("application/vnd.qtcreator.generic.files");
|
||||||
@@ -32,7 +30,12 @@ ProjectFilesFactory::ProjectFilesFactory()
|
|||||||
|
|
||||||
setDocumentCreator([]() { return new TextDocument(Constants::FILES_EDITOR_ID); });
|
setDocumentCreator([]() { return new TextDocument(Constants::FILES_EDITOR_ID); });
|
||||||
setEditorActionHandlers(TextEditorActionHandler::None);
|
setEditorActionHandlers(TextEditorActionHandler::None);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void setupGenericProjectFiles()
|
||||||
|
{
|
||||||
|
static ProjectFilesFactory theProjectFilesFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // GenericProjectManager::Internal
|
||||||
} // namespace GenericProjectManager
|
|
||||||
|
|||||||
@@ -3,16 +3,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <texteditor/texteditor.h>
|
namespace GenericProjectManager::Internal {
|
||||||
|
|
||||||
namespace GenericProjectManager {
|
void setupGenericProjectFiles();
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class ProjectFilesFactory : public TextEditor::TextEditorFactory
|
} // GenericProjectManager::Internal
|
||||||
{
|
|
||||||
public:
|
|
||||||
ProjectFilesFactory();
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace GenericProjectManager
|
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ class GenericProjectPluginPrivate : public QObject
|
|||||||
public:
|
public:
|
||||||
GenericProjectPluginPrivate();
|
GenericProjectPluginPrivate();
|
||||||
|
|
||||||
ProjectFilesFactory projectFilesFactory;
|
|
||||||
GenericMakeStepFactory makeStepFactory;
|
GenericMakeStepFactory makeStepFactory;
|
||||||
GenericBuildConfigurationFactory buildConfigFactory;
|
GenericBuildConfigurationFactory buildConfigFactory;
|
||||||
};
|
};
|
||||||
@@ -45,6 +44,7 @@ GenericProjectPluginPrivate::GenericProjectPluginPrivate()
|
|||||||
ProjectManager::registerProjectType<GenericProject>(Constants::GENERICMIMETYPE);
|
ProjectManager::registerProjectType<GenericProject>(Constants::GENERICMIMETYPE);
|
||||||
|
|
||||||
setupGenericProjectWizard();
|
setupGenericProjectWizard();
|
||||||
|
setupGenericProjectFiles();
|
||||||
|
|
||||||
ActionBuilder editAction(this, "GenericProjectManager.EditFiles");
|
ActionBuilder editAction(this, "GenericProjectManager.EditFiles");
|
||||||
editAction.setContext(Constants::GENERICPROJECT_ID);
|
editAction.setContext(Constants::GENERICPROJECT_ID);
|
||||||
|
|||||||
Reference in New Issue
Block a user