GolangEdit::GolangEdit(LiteApi::IApplication *app, QObject *parent) : QObject(parent), m_liteApp(app) { LiteApi::IActionContext *actionContext = m_liteApp->actionManager()->getActionContext(this,"GolangEdit"); m_viewGodocAct = new QAction(tr("View import package use godoc"),this); actionContext->regAction(m_viewGodocAct,"ViewGodoc",""); m_findInfoAct = new QAction(tr("View Expression Information"),this); actionContext->regAction(m_findInfoAct,"ViewInfo","CTRL+SHIFT+I;F1"); m_jumpDeclAct = new QAction(tr("Jump to Declaration"),this); actionContext->regAction(m_jumpDeclAct,"JumpToDeclaration","CTRL+SHIFT+J;F2"); m_findUseAct = new QAction(tr("Find Usages"),this); actionContext->regAction(m_findUseAct,"FindUsages","CTRL+SHIFT+U"); m_renameSymbolAct = new QAction(tr("Rename Symbol Under Cursor"),this); actionContext->regAction(m_renameSymbolAct,"RenameSymbol","CTRL+SHIFT+R"); m_fileSearch = new GolangFileSearch(app,this); m_commentAct = new QAction(tr("Comment/Uncomment Selection"),this); actionContext->regAction(m_commentAct,"Comment","CTRL+/"); LiteApi::IFileSearchManager *manager = LiteApi::getFileSearchManager(app); if (manager) { manager->addFileSearch(m_fileSearch); } m_findDefProcess = new ProcessEx(this); m_findInfoProcess = new ProcessEx(this); m_findLinkProcess = new ProcessEx(this); connect(m_liteApp->editorManager(),SIGNAL(editorCreated(LiteApi::IEditor*)),this,SLOT(editorCreated(LiteApi::IEditor*))); connect(m_liteApp->editorManager(),SIGNAL(currentEditorChanged(LiteApi::IEditor*)),this,SLOT(currentEditorChanged(LiteApi::IEditor*))); connect(m_viewGodocAct,SIGNAL(triggered()),this,SLOT(editorViewGodoc())); connect(m_findInfoAct,SIGNAL(triggered()),this,SLOT(editorFindInfo())); connect(m_jumpDeclAct,SIGNAL(triggered()),this,SLOT(editorJumpToDecl())); connect(m_findUseAct,SIGNAL(triggered()),this,SLOT(editorFindUsages())); connect(m_renameSymbolAct,SIGNAL(triggered()),this,SLOT(editorRenameSymbol())); connect(m_commentAct,SIGNAL(triggered()),this,SLOT(editorComment())); connect(m_findDefProcess,SIGNAL(started()),this,SLOT(findDefStarted())); connect(m_findDefProcess,SIGNAL(extOutput(QByteArray,bool)),this,SLOT(findDefOutput(QByteArray,bool))); connect(m_findDefProcess,SIGNAL(extFinish(bool,int,QString)),this,SLOT(findDefFinish(bool,int,QString))); connect(m_findInfoProcess,SIGNAL(started()),this,SLOT(findInfoStarted())); connect(m_findInfoProcess,SIGNAL(extOutput(QByteArray,bool)),this,SLOT(findInfoOutput(QByteArray,bool))); connect(m_findInfoProcess,SIGNAL(extFinish(bool,int,QString)),this,SLOT(findInfoFinish(bool,int,QString))); connect(m_findLinkProcess,SIGNAL(started()),this,SLOT(findLinkStarted())); connect(m_findLinkProcess,SIGNAL(extOutput(QByteArray,bool)),this,SLOT(findLinkOutput(QByteArray,bool))); connect(m_findLinkProcess,SIGNAL(extFinish(bool,int,QString)),this,SLOT(findLinkFinish(bool,int,QString))); connect(m_fileSearch,SIGNAL(searchTextChanged(QString)),this,SLOT(searchTextChanged(QString))); }
bool GolangCodePlugin::load(LiteApi::IApplication *app) { m_liteApp = app; m_code = new GolangCode(app,this); m_commentAct = new QAction(tr("Comment/Uncomment Selection"),this); m_commentAct->setShortcut(QKeySequence("CTRL+/")); connect(m_commentAct,SIGNAL(triggered()),this,SLOT(editorComment())); connect(app->editorManager(),SIGNAL(editorCreated(LiteApi::IEditor*)),this,SLOT(editorCreated(LiteApi::IEditor*))); connect(app->editorManager(),SIGNAL(currentEditorChanged(LiteApi::IEditor*)),this,SLOT(currentEditorChanged(LiteApi::IEditor*))); connect(app,SIGNAL(loaded()),this,SLOT(appLoaded())); return true; }