本文整理汇总了C++中IEditor::GetProjectName方法的典型用法代码示例。如果您正苦于以下问题:C++ IEditor::GetProjectName方法的具体用法?C++ IEditor::GetProjectName怎么用?C++ IEditor::GetProjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEditor
的用法示例。
在下文中一共展示了IEditor::GetProjectName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnFileLoaded
void ClangCodeCompletion::OnFileLoaded(wxCommandEvent& e)
{
e.Skip();
CHECK_CLANG_ENABLED_RET();
if(TagsManagerST::Get()->GetCtagsOptions().GetClangCachePolicy() == TagsOptionsData::CLANG_CACHE_ON_FILE_LOAD) {
CL_DEBUG(wxT("ClangCodeCompletion::OnFileLoaded() START"));
if(m_clang.IsBusy() || m_allEditorsAreClosing) {
CL_DEBUG(wxT("ClangCodeCompletion::OnFileLoaded() ENDED"));
return;
}
if(e.GetClientData()) {
IEditor *editor = (IEditor*)e.GetClientData();
// sanity
if(editor->GetProjectName().IsEmpty() || editor->GetFileName().GetFullName().IsEmpty())
return;
if(!TagsManagerST::Get()->IsValidCtagsFile(editor->GetFileName()))
return;
m_clang.SetContext(CTX_CachePCH);
m_clang.CodeCompletion(editor);
}
CL_DEBUG(wxT("ClangCodeCompletion::OnFileLoaded() ENDED"));
}
}
示例2: OnColourTab
void Tweaks::OnColourTab(clColourEvent& e)
{
TWEAKS_ENABLED_EVENT_HANDLER();
IEditor* editor = FindEditorByPage(e.GetPage());
if(!editor) {
if(m_settings.GetGlobalFgColour().IsOk() && m_settings.GetGlobalBgColour().IsOk()) {
// Non editor tab
e.SetBgColour(m_settings.GetGlobalBgColour());
e.SetFgColour(m_settings.GetGlobalFgColour());
} else {
e.Skip();
}
} else {
const ProjectTweaks& tw = m_settings.GetProjectTweaks(editor->GetProjectName());
if(tw.IsOk()) {
e.SetBgColour(tw.GetTabBgColour());
e.SetFgColour(tw.GetTabFgColour());
} else if(m_settings.GetGlobalBgColour().IsOk() && m_settings.GetGlobalFgColour().IsOk()) {
e.SetBgColour(m_settings.GetGlobalBgColour());
e.SetFgColour(m_settings.GetGlobalFgColour());
} else {
e.Skip();
}
}
}
示例3: OnCheckPopupEditor
void MemCheckPlugin::OnCheckPopupEditor(wxCommandEvent& event)
{
CHECK_CL_SHUTDOWN()
IEditor* editor = m_mgr->GetActiveEditor();
if(editor) {
CheckProject(editor->GetProjectName());
}
}
示例4: OnCheckFileEditorItem
void CppCheckPlugin::OnCheckFileEditorItem(wxCommandEvent& e)
{
if(m_cppcheckProcess) {
clLogMessage(_("CppCheckPlugin: CppCheck is currently busy please wait for it to complete the current check"));
return;
}
ProjectPtr proj;
IEditor* editor = m_mgr->GetActiveEditor();
if(editor) {
wxString projectName = editor->GetProjectName();
if(!projectName.IsEmpty()) { proj = clCxxWorkspaceST::Get()->GetProject(projectName); }
m_filelist.Add(editor->GetFileName().GetFullPath());
}
DoStartTest();
}
示例5: OnColourTab
void Tweaks::OnColourTab(clColourEvent& e)
{
#ifdef __WXGTK__
#if CL_USE_NATIVEBOOK
// Not supported with native notebooks
e.Skip();
return;
#endif
#endif
TWEAKS_ENABLED_EVENT_HANDLER();
IEditor* editor = FindEditorByPage( e.GetPage() );
if ( !editor ) {
if ( m_settings.GetGlobalFgColour().IsOk() && m_settings.GetGlobalBgColour().IsOk() ) {
// Non editor tab
e.SetBgColour( e.IsActiveTab() ? EditorConfigST::Get()->GetCurrentOutputviewBgColour() : m_settings.GetGlobalBgColour() );
e.SetFgColour( e.IsActiveTab() ? EditorConfigST::Get()->GetCurrentOutputviewFgColour() : m_settings.GetGlobalFgColour() );
} else {
e.Skip();
}
} else {
const ProjectTweaks& tw = m_settings.GetProjectTweaks( editor->GetProjectName() );
if ( tw.IsOk() ) {
e.SetBgColour( e.IsActiveTab() ? EditorConfigST::Get()->GetCurrentOutputviewBgColour() : tw.GetTabBgColour() );
e.SetFgColour( e.IsActiveTab() ? EditorConfigST::Get()->GetCurrentOutputviewFgColour() : tw.GetTabFgColour() );
} else if ( m_settings.GetGlobalBgColour().IsOk() && m_settings.GetGlobalFgColour().IsOk() ) {
e.SetBgColour( e.IsActiveTab() ? EditorConfigST::Get()->GetCurrentOutputviewBgColour() : m_settings.GetGlobalBgColour() );
e.SetFgColour( e.IsActiveTab() ? EditorConfigST::Get()->GetCurrentOutputviewFgColour() : m_settings.GetGlobalFgColour() );
} else {
e.Skip();
}
}
}
示例6: InsertExpansion
bool AbbreviationPlugin::InsertExpansion(const wxString& abbreviation)
{
// get the active editor
IEditor *editor = m_mgr->GetActiveEditor();
if (!editor || !abbreviation)
return false;
// hide the completion box
if (editor->IsCompletionBoxShown()) {
editor->HideCompletionBox();
}
// search for abbreviation that matches str
// prepate list of abbreviations
AbbreviationJSONEntry jsonData;
if ( !m_config.ReadItem(&jsonData) ) {
// merge the data from the old configuration
AbbreviationEntry data;
m_mgr->GetConfigTool()->ReadObject(wxT("AbbreviationsData"), &data);
jsonData.SetAutoInsert( data.GetAutoInsert() );
jsonData.SetEntries( data.GetEntries() );
m_config.WriteItem( &jsonData );
}
// search for the old item
const JSONElement::wxStringMap_t& entries = jsonData.GetEntries();
JSONElement::wxStringMap_t::const_iterator iter = entries.find(abbreviation);
if (iter != entries.end()) {
wxString text = iter->second;
int selStart = editor->WordStartPos(editor->GetCurrentPosition(), true);
int selEnd = editor->WordEndPos(editor->GetCurrentPosition(), true);
int curPos = editor->GetCurrentPosition();
int typedWordLen = curPos - selStart;
if (typedWordLen < 0) {
typedWordLen = 0;
}
// format the text to insert
bool appendEol(false);
if (text.EndsWith(wxT("\r")) || text.EndsWith(wxT("\n"))) {
appendEol = true;
}
text = editor->FormatTextKeepIndent(text, selStart, Format_Text_Save_Empty_Lines);
// remove the first line indenation that might have been placed by CL
text.Trim(false).Trim();
if (appendEol) {
wxString eol;
switch (editor->GetEOL()) {
case 1:
eol = wxT("\r");
break;
case 0:
eol = wxT("\r\n");
break;
case 2:
eol = wxT("\n");
break;
}
text << eol;
}
//--------------------------------------------
// replace any place holders
//--------------------------------------------
wxString project;
text = MacroManager::Instance()->Expand(text, m_mgr, editor->GetProjectName());
// locate the caret
int where = text.Find(wxT("|"));
if (where == wxNOT_FOUND) {
where = text.length();
}
// remove the pipe (|) character
text.Replace(wxT("|"), wxT(""));
if (selEnd - selStart >= 0) {
editor->SelectText(selStart, selEnd - selStart);
editor->ReplaceSelection(text);
editor->SetCaretAt(curPos + where - typedWordLen);
}
return true;
} else
return false;
}