void CRUTask::BuildExecutor() { RUASSERT(NULL == pExecutor_); // Create the executor's instance and initialize it pExecutor_ = CreateExecutorInstance(); pExecutor_->Init(); SetExecuted(pExecutor_->HasWork()); }
bool CDeleteEntityAction::ActionPerformed(CEntity* pEntity) { CString command; CString results; bool bRes = false; if(CImpactAction::ActionPerformed(pEntity)==true) { CString kind = pEntity->GetKind(); kind.MakeLower(); CString id = PrepareQuery(pEntity->GetEtag()); SetWait(true); if ( kind == "package" ) { if(MessageBox(NULL,"Running impact queries on packages may take a long time.\nWould you like to proceed?", "QA Warning", MB_ICONQUESTION|MB_OKCANCEL)!=IDOK) { SetExecuted(false); bRes = false; return false; } command = "Impact:DeleteEntity " + id; } else if ( kind == "var" ) { command = "oo_member " + id; results = m_pCtrl->ExecCommand(command); if (results == "1") { command = "Impact:DeleteVariableFromClass " + id; } else { command = "Impact:DeleteVariable " + id + " [ where defined " + id + " ] "; } } else { command = "Impact:DeleteEntity " + id; } results = m_pCtrl->ExecPrint(command); ParseResult(results); bRes = true; SetWait(false); } SetExecuted(bRes); return bRes; }
bool CChangeArgumentsAction::ActionPerformed(CEntity* pEntity) { CString command; CString results; bool bRes = false; if(CImpactAction::ActionPerformed(pEntity)==true) { CString command = "args " + PrepareQuery(pEntity->GetEtag()); results = m_pCtrl->ExecCommand(command); CArguments Args; Args.Parse(results); CArgumentsInfoDlg dlg(m_pCtrl); dlg.SetArguments(&Args); int nRes = dlg.DoModal(); if(nRes == IDOK) { CString szArguments = "("; CArguments* pArgs = dlg.GetArguments(); POSITION nPos = pArgs->GetHeadPosition(); while(nPos!=NULL) { CArgument* pArg = pArgs->GetNext(nPos); szArguments += pArg->GetType(); szArguments += " "; szArguments += pArg->GetName(); if(nPos!=NULL) szArguments += ","; } szArguments += ")"; CString description = GetName(); description += " to " + szArguments; SetDescription(description); command = "Impact:ChangeFunctionArguments " + PrepareQuery(pEntity->GetEtag()) + " " + PrepareQuery(szArguments); results = m_pCtrl->ExecPrint(command); ParseResult(results); bRes = true; } else { SetExecuted(false); } } return bRes; }
bool CChangeTypeAction::ActionPerformed(CEntity* pEntity) { CString command; CString results; bool bRes = false; if(CImpactAction::ActionPerformed(pEntity)==true) { CString type; command = "set CURRENT_TYPE [type " + PrepareQuery(pEntity->GetEtag()) + "]"; results = m_pCtrl->ExecCommand(command); CAttributesQueryResult typeResult; typeResult.parse(results); if(typeResult.getRecordsCount()>0) { POSITION iter = typeResult.getStartPos(); if(iter!=NULL) { TRecord* pRecord = typeResult.getNext(iter); type = *(*pRecord)[0]; } } CNewTypeDlg dlg(m_pCtrl); dlg.SetType(type); int nRes = dlg.DoModal(); if(nRes == IDOK) { CString szType = dlg.GetType(); CString szNewType = dlg.GetNewType(); CString description = GetName(); description += " from " + szType; description += " to " + szNewType; SetDescription(description); command = GetCommand(pEntity,szNewType); results = m_pCtrl->ExecPrint(command); ParseResult(results); bRes = true; } else { SetExecuted(false); } } return bRes; }
bool CAddBaseInterfaceAction::ActionPerformed(CEntity* pEntity) { CString command; CString results; bool bRes = false; if(CImpactAction::ActionPerformed(pEntity)==true) { SetWait(true); // lets get the implemented interfaces first command = "printformat \"%s\t%s\" etag kind;source_dis closure.dis;set IMPLEMENTED_INTERFACES [query_closure 50 \"get_super_classes\" " + PrepareQuery(pEntity->GetEtag()) + "]"; results=m_pCtrl->ExecCommand(command); results=m_pCtrl->ExecPrint(CString("print $IMPLEMENTED_INTERFACES")); CAttributesQueryResult* pImplemented = new CAttributesQueryResult(); pImplemented->parse(results); TActionDataList* pList = NULL; if(m_pHash==NULL || !m_pHash->Lookup(pEntity->GetEtag(),pList)) pList = NULL; // now get all available interfaces command = "printformat \"%s\t%s\" name etag;set DEFINED_INTERFACES [sort name [defines -interfaces /]]"; results=m_pCtrl->ExecCommand(command); results=m_pCtrl->ExecPrint(CString("print $DEFINED_INTERFACES")); CAttributesQueryResult* pAvailable = new CAttributesQueryResult(); pAvailable->parse(results); if(pAvailable->getRecordsCount()>0) { POSITION iter = pAvailable->getStartPos(); CAttributesQueryResult DeletedRecords; while(iter!=NULL) { TRecord* pRecord = pAvailable->getNext(iter); TField* field = (*pRecord)[1]; bool bImplemented = false; if(pList && pList->FindTag(*(*pRecord)[1])) bImplemented = true; if(pImplemented->contains(*field,0) || bImplemented) DeletedRecords.add(pRecord); } iter = DeletedRecords.getStartPos(); while(iter!=NULL) { TRecord* pRecord = DeletedRecords.getNext(iter); pAvailable->remove(pRecord); } } else { m_pCtrl->MessageBox("Nothing to implement.","Warning",MB_OK|MB_ICONWARNING); SetExecuted(false); bRes = false; return bRes; } delete pImplemented; SetWait(false); CSelectorDlg dlg(CString("Add Base Interface"),CString("Base Interface:"),m_pCtrl); dlg.SetQueryResults(pAvailable); int nRes = dlg.DoModal(); if(nRes == IDOK) { CString szInterfaceName = dlg.GetSelection(); CString szTag = dlg.GetSelectionTag(); CString description = GetName(); description += " " + szInterfaceName; SetDescription(description); command = "Impact:AddBaseInterface " + PrepareQuery(pEntity->GetEtag()) + " " + PrepareQuery(szTag); results = m_pCtrl->ExecPrint(command); ParseResult(results); if(m_pHash!=NULL) { if(pList == NULL) { pList = new TActionDataList(); (*m_pHash)[pEntity->GetEtag()] = pList; } CActionData* pData = new CActionData(new CString(pEntity->GetEtag()),new CString(szTag)); pList->AddTail(pData); SetData(pData); bRes = true; } else bRes = false; } delete pAvailable; } SetExecuted(bRes); return bRes; }