Skip to content
Snippets Groups Projects
Commit f7532a02 authored by Leandro Melo's avatar Leandro Melo
Browse files

Do not force a specific editor for a file created from a wizard.

The wizards already provide a default suffix for file creation.
But since the user is still free to specify something else it's better to leave it to Creator to decide which one is the proper editor.
After all, this reflects how the file will be treated by Creator (including the next time it's opened).

Task-number: QTCREATORBUG-2006
parent 1a08caf7
No related branches found
No related tags found
No related merge requests found
......@@ -199,10 +199,7 @@ Core::GeneratedFiles CppClassWizard::generateFiles(const QWizard *w, QString *er
const QString headerFileName = Core::BaseFileWizard::buildFileName(params.path, params.headerFile, headerSuffix());
Core::GeneratedFile sourceFile(sourceFileName);
sourceFile.setEditorId(QLatin1String(Constants::CPPEDITOR_ID));
Core::GeneratedFile headerFile(headerFileName);
headerFile.setEditorId(QLatin1String(Constants::CPPEDITOR_ID));
QString header, source;
if (!generateHeaderAndSource(params, &header, &source)) {
......
......@@ -60,7 +60,6 @@ Core::GeneratedFiles CppFileWizard::generateFilesFromPath(const QString &path,
const QString fileName = Core::BaseFileWizard::buildFileName(path, name, preferredSuffix(mimeType));
Core::GeneratedFile file(fileName);
file.setEditorId(QLatin1String(Constants::CPPEDITOR_ID));
file.setContents(fileContents(m_type, fileName));
file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
return Core::GeneratedFiles() << file;
......
......@@ -87,18 +87,15 @@ Core::GeneratedFiles FormClassWizard::generateFiles(const QWizard *w, QString *e
const QString sourceFileName = buildFileName(params.path(), params.sourceFile(), sourceSuffix());
Core::GeneratedFile headerFile(headerFileName);
headerFile.setEditorId(QLatin1String(CppEditor::Constants::CPPEDITOR_ID));
headerFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
// Source
Core::GeneratedFile sourceFile(sourceFileName);
sourceFile.setEditorId(QLatin1String(CppEditor::Constants::CPPEDITOR_ID));
sourceFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
// UI
Core::GeneratedFile uiFile(formFileName);
uiFile.setContents(params.uiTemplate());
uiFile.setEditorId(QLatin1String(Constants::DESIGNER_XML_EDITOR_ID));
uiFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
QString source, header;
......
......@@ -66,7 +66,6 @@ Core::GeneratedFiles FormWizard::generateFiles(const QWizard *w,
Core::GeneratedFile file(fileName);
file.setContents(formTemplate);
file.setEditorId(QLatin1String(Constants::DESIGNER_XML_EDITOR_ID));
file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
return Core::GeneratedFiles() << file;
}
......@@ -50,7 +50,6 @@ Core::GeneratedFiles QmlFileWizard::generateFilesFromPath(const QString &path,
const QString fileName = Core::BaseFileWizard::buildFileName(path, name, preferredSuffix(mimeType));
Core::GeneratedFile file(fileName);
file.setEditorId(QLatin1String(Constants::C_QMLJSEDITOR_ID));
file.setContents(fileContents(fileName));
file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
return Core::GeneratedFiles() << file;
......
......@@ -49,7 +49,6 @@ ResourceWizard::generateFilesFromPath(const QString &path,
const QString fileName = Core::BaseFileWizard::buildFileName(path, name, suffix);
Core::GeneratedFile file(fileName);
file.setContents(QLatin1String("<RCC/>"));
file.setEditorId(QLatin1String(Constants::RESOURCEEDITOR_ID));
file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
return Core::GeneratedFiles() << file;
}
......@@ -98,7 +98,6 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
wizardParameters.setCategory(QLatin1String("U.General"));
wizardParameters.setDisplayCategory(tr("General"));
m_wizard = new TextFileWizard(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT),
QLatin1String(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID),
QLatin1String("text$"),
wizardParameters);
// Add text file wizard
......
......@@ -35,13 +35,11 @@
using namespace TextEditor;
TextFileWizard::TextFileWizard(const QString &mimeType,
const QString &editorId,
const QString &suggestedFileName,
const BaseFileWizardParameters &parameters,
QObject *parent) :
Core::StandardFileWizard(parameters, parent),
m_mimeType(mimeType),
m_editorId(editorId),
m_suggestedFileName(suggestedFileName)
{
}
......@@ -53,7 +51,6 @@ Core::GeneratedFiles
const QString suffix = preferredSuffix(m_mimeType);
const QString fileName = Core::BaseFileWizard::buildFileName(path, name, suffix);
Core::GeneratedFile file(fileName);
file.setEditorId(m_editorId);
file.setAttributes(Core::GeneratedFile::OpenEditorAttribute);
return Core::GeneratedFiles() << file;
}
......@@ -43,7 +43,6 @@ class TEXTEDITOR_EXPORT TextFileWizard : public Core::StandardFileWizard
public:
typedef Core::BaseFileWizardParameters BaseFileWizardParameters;
TextFileWizard(const QString &mimeType,
const QString &editorId,
const QString &suggestedFileName,
const BaseFileWizardParameters &parameters,
QObject *parent = 0);
......@@ -54,7 +53,6 @@ protected:
QString *errorMessage) const;
private:
const QString m_mimeType;
const QString m_editorId;
const QString m_suggestedFileName;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment