Beispiel #1
0
void BaseTextMark::init()
{
    m_init = true;
    Core::EditorManager *em = Core::EditorManager::instance();
    connect(em, SIGNAL(editorOpened(Core::IEditor *)),
        SLOT(editorOpened(Core::IEditor *)));

    foreach (Core::IEditor *editor, em->openedEditors())
        editorOpened(editor);
}
Beispiel #2
0
void Plugin::openFile(QString path, int line)
{
    Editor *widget = NULL;
    QMap<QString, Editor *>::Iterator it = _openedFiles.find(path);
    if (_openedFiles.end() == it) {
        widget = getEditorWidgetBuilder()->createEditor(path);
        _openedFiles[path] = widget;
        connect(widget, SIGNAL(editorClosing(Editor *)), this, SLOT(closeFileEditor(Editor *)));
        connect(widget, SIGNAL(editorFocusing(Editor *)), this, SLOT(focusFileEditor(Editor *)));
        _layoutManager->add("central", widget);
        emit editorOpened(widget);
    } else {
Beispiel #3
0
void BaseTextMark::moveMark(const QString & /* filename */, int /* line */)
{
    Core::EditorManager *em = Core::EditorManager::instance();
    if (!m_init) {
        connect(em, SIGNAL(editorOpened(Core::IEditor *)),
            SLOT(editorOpened(Core::IEditor *)));
        m_init = true;
    }

    if (m_markableInterface)
        m_markableInterface->removeMark(this);

    foreach (Core::IEditor *editor, em->openedEditors())
        editorOpened(editor);
}
void EditorManager::addEditor(IEditor *editor)
{
    if (!editor)
        return;
    ICore::addContextObject(editor);

    d->m_editorModel->addEditor(editor);
    const bool isTemporary = editor->isTemporary();
    const bool addWatcher = !isTemporary;//不是临时文件就需要添加Watcher
    //添加document,这个函数将会去掉重复
    DocumentManager::addDocument(editor->document(), addWatcher);
    if (!isTemporary)
        DocumentManager::addToRecentFiles(editor->document()->fileName(),
                                          editor->id());
    emit editorOpened(editor);
}