void PlainTextEditorFactory::updateEditorInfoBar(Core::IEditor *editor) { PlainTextEditor *editorEditable = qobject_cast<PlainTextEditor *>(editor); if (editorEditable) { BaseTextDocument *file = qobject_cast<BaseTextDocument *>(editor->document()); if (!file) return; PlainTextEditorWidget *textEditor = static_cast<PlainTextEditorWidget *>(editorEditable->editorWidget()); const QString infoSyntaxDefinition = QLatin1String(Constants::INFO_SYNTAX_DEFINITION); if (textEditor->isMissingSyntaxDefinition() && !textEditor->ignoreMissingSyntaxDefinition() && TextEditorSettings::instance()->highlighterSettings().alertWhenNoDefinition()) { if (file->hasHighlightWarning()) return; Core::InfoBarEntry info(infoSyntaxDefinition, tr("A highlight definition was not found for this file. " "Would you like to try to find one?")); info.setCustomButtonInfo(tr("Show highlighter options..."), textEditor, SLOT(acceptMissingSyntaxDefinitionInfo())); info.setCancelButtonInfo(textEditor, SLOT(ignoreMissingSyntaxDefinitionInfo())); file->infoBar()->addInfo(info); file->setHighlightWarning(true); return; } if (!file->hasHighlightWarning()) return; file->infoBar()->removeInfo(infoSyntaxDefinition); file->setHighlightWarning(false); } }
void PlainTextEditorFactory::updateEditorInfoBar(Core::IEditor *editor) { PlainTextEditor *editorEditable = qobject_cast<PlainTextEditor *>(editor); if (editorEditable) { PlainTextEditorWidget *textEditor = static_cast<PlainTextEditorWidget *>(editorEditable->editorWidget()); if (textEditor->isMissingSyntaxDefinition() && !textEditor->ignoreMissingSyntaxDefinition() && TextEditorSettings::instance()->highlighterSettings().alertWhenNoDefinition()) { Core::EditorManager::instance()->showEditorInfoBar( Constants::INFO_SYNTAX_DEFINITION, tr("A highlight definition was not found for this file. " "Would you like to try to find one?"), tr("Show highlighter options"), textEditor, SLOT(acceptMissingSyntaxDefinitionInfo()), SLOT(ignoreMissingSyntaxDefinitionInfo())); return; } } Core::EditorManager::instance()->hideEditorInfoBar(Constants::INFO_SYNTAX_DEFINITION); }