NimEditorFactory::NimEditorFactory() { setId(Constants::C_NIMEDITOR_ID); setDisplayName(tr(Nim::Constants::C_EDITOR_DISPLAY_NAME)); addMimeType(QLatin1String(Nim::Constants::C_NIM_MIMETYPE)); setEditorActionHandlers(TextEditorActionHandler::Format | TextEditorActionHandler::UnCommentSelection | TextEditorActionHandler::UnCollapseAll); setEditorWidgetCreator([]{ auto result = new TextEditorWidget(); result->setLanguageSettingsId(Nim::Constants::C_NIMLANGUAGE_ID); return result; }); setDocumentCreator([]() { return new TextDocument(Constants::C_NIMEDITOR_ID); }); setIndenterCreator([]() { return new NimIndenter; }); setSyntaxHighlighterCreator([]() { return new NimHighlighter; }); setCommentStyle(CommentDefinition::HashStyle); setParenthesesMatchingEnabled(true); setMarksVisible(false); setCodeFoldingSupported(true); setMarksVisible(true); }
CppEditorFactory() { setId(Constants::CPPEDITOR_ID); setDisplayName(qApp->translate("OpenWith::Editors", Constants::CPPEDITOR_DISPLAY_NAME)); addMimeType(Constants::C_SOURCE_MIMETYPE); addMimeType(Constants::C_HEADER_MIMETYPE); addMimeType(Constants::CPP_SOURCE_MIMETYPE); addMimeType(Constants::CPP_HEADER_MIMETYPE); setDocumentCreator([]() { return new CppEditorDocument; }); setEditorWidgetCreator([]() { return new CppEditorWidget; }); setEditorCreator([]() { return new CppEditor; }); setAutoCompleterCreator([]() { return new CppAutoCompleter; }); setCommentStyle(Utils::CommentDefinition::CppStyle); setCodeFoldingSupported(true); setMarksVisible(true); setParenthesesMatchingEnabled(true); setEditorActionHandlers(TextEditorActionHandler::Format | TextEditorActionHandler::UnCommentSelection | TextEditorActionHandler::UnCollapseAll | TextEditorActionHandler::FollowSymbolUnderCursor); addHoverHandler(new CppHoverHandler); if (!Utils::HostOsInfo::isMacHost() && !Utils::HostOsInfo::isWindowsHost()) { FileIconProvider::registerIconOverlayForMimeType(creatorTheme()->iconOverlay(Theme::CppSourceMimetype).toLatin1().data(), Constants::CPP_SOURCE_MIMETYPE); FileIconProvider::registerIconOverlayForMimeType(creatorTheme()->iconOverlay(Theme::CSourceMimetype).toLatin1().data(), Constants::C_SOURCE_MIMETYPE); FileIconProvider::registerIconOverlayForMimeType(creatorTheme()->iconOverlay(Theme::CppHeaderMimetype).toLatin1().data(), Constants::CPP_HEADER_MIMETYPE); } }
EditorFactory::EditorFactory() { setId(Constants::EditorId); setDisplayName(qApp->translate("OpenWith::Editors", Constants::EditorDisplayName)); addMimeType(Constants::MimeType); addMimeType(Constants::ProjectMimeType); setDocumentCreator([]() { return new TextEditor::TextDocument(Constants::EditorId); }); setIndenterCreator([]() { return new Indenter; }); setEditorWidgetCreator([]() { return new EditorWidget; }); setEditorCreator([]() { return new Editor; }); setAutoCompleterCreator([]() { return new AutoCompleter; }); setCompletionAssistProvider(new CompletionAssistProvider); setSyntaxHighlighterCreator([]() { return new Highlighter; }); setCommentStyle(Utils::CommentDefinition::HashStyle); setParenthesesMatchingEnabled(true); setCodeFoldingSupported(true); setMarksVisible(true); addHoverHandler(new HoverHandler); setEditorActionHandlers(TextEditor::TextEditorActionHandler::Format | TextEditor::TextEditorActionHandler::UnCommentSelection | TextEditor::TextEditorActionHandler::UnCollapseAll | TextEditor::TextEditorActionHandler::FollowSymbolUnderCursor); }
EditorWidget::EditorWidget(QWidget *parent) :TextEditor::BaseTextEditorWidget(parent) { m_commentDefinition.multiLineStart.clear(); m_commentDefinition.multiLineEnd.clear(); m_commentDefinition.singleLine = QLatin1Char('#'); setParenthesesMatchingEnabled(true); setMarksVisible(true); setCodeFoldingSupported(true); setIndenter(new PythonIndenter()); new PythonHighlighter(baseTextDocument().data()); }
JavaEditorFactory::JavaEditorFactory() { setId(Constants::JAVA_EDITOR_ID); setDisplayName(tr("Java Editor")); addMimeType(Constants::JAVA_MIMETYPE); setDocumentCreator([]() { return new JavaDocument; }); setAutoCompleterCreator([]() { return new JavaAutoCompleter; }); setUseGenericHighlighter(true); setCommentStyle(Utils::CommentDefinition::CppStyle); setEditorActionHandlers(TextEditor::TextEditorActionHandler::UnCommentSelection); setCompletionAssistProvider(new JavaCompletionAssistProvider); setMarksVisible(true); }
void PlainTextEditorWidget::ctor() { m_isMissingSyntaxDefinition = false; setRevisionsVisible(true); setMarksVisible(true); setLineSeparatorsAllowed(true); baseTextDocument()->setMimeType(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT)); m_commentDefinition.clearCommentStyles(); connect(baseTextDocument(), SIGNAL(filePathChanged(QString,QString)), this, SLOT(configure())); connect(Manager::instance(), SIGNAL(mimeTypesRegistered()), this, SLOT(configure())); }
PlainTextEditorWidget::PlainTextEditorWidget(QWidget *parent) : BaseTextEditorWidget(parent), m_isMissingSyntaxDefinition(false) { setRevisionsVisible(true); setMarksVisible(true); setLineSeparatorsAllowed(true); setIndenter(new NormalIndenter); // Currently only "normal" indentation is supported. setMimeType(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT)); m_commentDefinition.clearCommentStyles(); connect(editorDocument(), SIGNAL(changed()), this, SLOT(configure())); connect(Manager::instance(), SIGNAL(mimeTypesRegistered()), this, SLOT(configure())); }
PythonEditorFactory::PythonEditorFactory() { setId(Constants::C_PYTHONEDITOR_ID); setDisplayName(tr(Constants::C_EDITOR_DISPLAY_NAME)); addMimeType(QLatin1String(Constants::C_PY_MIMETYPE)); setEditorActionHandlers(TextEditorActionHandler::Format | TextEditorActionHandler::UnCommentSelection | TextEditorActionHandler::UnCollapseAll); setDocumentCreator([]() { return new TextDocument(Constants::C_PYTHONEDITOR_ID); }); setIndenterCreator([]() { return new PythonIndenter; }); setSyntaxHighlighterCreator([]() { return new PythonHighlighter; }); setCommentStyle(Utils::CommentDefinition::HashStyle); setParenthesesMatchingEnabled(true); setMarksVisible(true); setCodeFoldingSupported(true); }