本文整理汇总了C++中IEditor::GetFileName方法的典型用法代码示例。如果您正苦于以下问题:C++ IEditor::GetFileName方法的具体用法?C++ IEditor::GetFileName怎么用?C++ IEditor::GetFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEditor
的用法示例。
在下文中一共展示了IEditor::GetFileName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoSettingsItem
void CppCheckPlugin::DoSettingsItem(ProjectPtr project/*= NULL*/)
{
// Find the default path for the CppCheckSettingsDialog's wxFileDialog
wxString defaultpath;
IEditor* ed = m_mgr->GetActiveEditor();
if (ed && ed->GetFileName().IsOk()) {
defaultpath = ed->GetFileName().GetPath();
}
// If there's an active project, first load any project-specific settings: definitions and undefines
// (We couldn't do that with the rest of the settings as the workspace hadn't yet been loaded)
m_settings.LoadProjectSpecificSettings(project); // NB we still do this if !project, as that will clear any stale settings
CppCheckSettingsDialog dlg(m_mgr->GetTheApp()->GetTopWindow(), &m_settings, m_mgr->GetConfigTool(), defaultpath, project.Get() != NULL);
if (dlg.ShowModal() == wxID_OK) {
m_mgr->GetConfigTool()->WriteObject(wxT("CppCheck"), &m_settings);
if (project) {
// Also save any project-specific settings: definitions and undefines
wxString definitions = wxJoin(m_settings.GetDefinitions(), ',');
wxString undefines = wxJoin(m_settings.GetUndefines(), ',');
if (!(definitions.empty() && undefines.empty())) {
project->SetPluginData("CppCheck", definitions + ';' + undefines);
} else {
project->SetPluginData("CppCheck", "");
}
}
}
}
示例2: 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"));
}
}
示例3: OnEditorClosed
void OutlineTab::OnEditorClosed(wxCommandEvent& e)
{
e.Skip();
IEditor* editor = reinterpret_cast<IEditor*>(e.GetClientData());
if(editor) {
if(m_tree->GetFilename() == editor->GetFileName()) {
m_tree->Clear();
m_tree->ClearCache();
} else if(m_treeCtrlPhp->GetFilename() == editor->GetFileName()) {
m_treeCtrlPhp->Clear();
}
}
}
示例4: DoItemActivated
void CscopeTab::DoItemActivated(const wxDataViewItem& item )
{
CscopeTabClientData *data = dynamic_cast<CscopeTabClientData*>(m_dataviewModel->GetClientObject(item));
if (data) {
wxString wsp_path = clCxxWorkspaceST::Get()->GetPrivateFolder();
//a single entry was activated, open the file
//convert the file path to absolut path. We do it here, to improve performance
wxFileName fn(data->GetEntry().GetFile());
if ( !fn.MakeAbsolute(wsp_path) ) {
wxLogMessage(wxT("failed to convert file to absolute path"));
}
if(m_mgr->OpenFile(fn.GetFullPath(), wxEmptyString, data->GetEntry().GetLine()-1)) {
IEditor *editor = m_mgr->GetActiveEditor();
if( editor && editor->GetFileName().GetFullPath() == fn.GetFullPath() && !GetFindWhat().IsEmpty()) {
// We can't use data->GetEntry().GetPattern() as the line to search for as any appended comments have been truncated
// For some reason LEditor::DoFindAndSelect checks it against the whole current line
// and won't believe a match unless their lengths are the same
int line = data->GetEntry().GetLine() - 1;
int start = editor->PosFromLine(line); // PosFromLine() returns the line start position
int end = editor->LineEnd(line);
wxString searchline(editor->GetTextRange(start, end));
// Find and select the entry in the file
editor->FindAndSelectV(searchline, GetFindWhat(), start); // The async version of FindAndSelect()
editor->DelayedSetActive(); // We need to SetActive() editor. At least in wxGTK, this won't work synchronously
}
}
} else {
// Parent item, expand it
m_dataview->Expand( item );
}
}
示例5: OnToggleBreakpoint
void NodeJSDebugger::OnToggleBreakpoint(clDebugEvent& event)
{
event.Skip();
if(NodeJSWorkspace::Get()->IsOpen()) {
event.Skip(false);
IEditor* editor = clGetManager()->GetActiveEditor();
if(editor && (editor->GetFileName().GetFullPath() == event.GetFileName())) {
// Correct editor
// add marker
NodeJSBreakpoint bp = m_bptManager.GetBreakpoint(event.GetFileName(), event.GetInt());
if(bp.IsOk()) {
if(bp.IsApplied() && IsConnected()) {
// Tell NodeJS to delete this breakpoint
DeleteBreakpoint(bp);
}
m_bptManager.DeleteBreakpoint(event.GetFileName(), event.GetInt());
} else {
// We have no breakpoint on this file/line (yet)
m_bptManager.AddBreakpoint(event.GetFileName(), event.GetInt());
bp = m_bptManager.GetBreakpoint(event.GetFileName(), event.GetInt());
if(IsConnected()) {
SetBreakpoint(bp);
}
}
// Update the UI
m_bptManager.SetBreakpoints(editor);
clDebugEvent event(wxEVT_NODEJS_DEBUGGER_UPDATE_BREAKPOINTS_VIEW);
EventNotifier::Get()->AddPendingEvent(event);
}
}
}
示例6: OnToggleBreakpoint
void XDebugManager::OnToggleBreakpoint(clDebugEvent& e)
{
if ( !PHPWorkspace::Get()->IsOpen() ) {
e.Skip();
return;
}
// User toggled a breakpoint
IEditor* editor = m_plugin->GetManager()->GetActiveEditor();
if ( editor && editor->GetFileName().GetFullPath() == e.GetFileName() ) {
// Correct editor
// add marker
if ( m_breakpointsMgr.HasBreakpoint(e.GetFileName(), e.GetInt()) ) {
XDebugBreakpoint bp;
m_breakpointsMgr.GetBreakpoint(e.GetFileName(), e.GetInt(), bp);
if ( bp.IsApplied() && m_readerThread ) {
// Remove it from XDebug as well
DoDeleteBreakpoint( bp.GetBreakpointId() );
}
m_breakpointsMgr.DeleteBreakpoint( e.GetFileName(), e.GetInt() );
} else {
m_breakpointsMgr.AddBreakpoint( e.GetFileName(), e.GetInt() );
DoApplyBreakpoints();
}
DoRefreshBreakpointsMarkersForEditor( editor );
}
}
示例7: DoUpdate
void ZoomNavigator::DoUpdate()
{
// sanity tests
CHECK_CONDITION(m_enabled);
CHECK_CONDITION(!m_mgr->IsShutdownInProgress());
IEditor* curEditor = m_mgr->GetActiveEditor();
if(!curEditor && !m_text->IsEmpty()) {
DoCleanup();
}
CHECK_CONDITION(curEditor);
wxStyledTextCtrl* stc = curEditor->GetCtrl();
CHECK_CONDITION(stc);
if(curEditor->GetFileName().GetFullPath() != m_curfile) {
SetEditorText(curEditor);
}
int first = stc->GetFirstVisibleLine();
int last = stc->LinesOnScreen() + first;
if(m_markerFirstLine != first || m_markerLastLine != last) {
PatchUpHighlights(first, last);
SetZoomTextScrollPosToMiddle(stc);
}
}
示例8: CreateHelpPage
void CMakeHelpTab::CreateHelpPage(const wxString& content, const wxString& subject)
{
wxString text = content;
text.Replace("<br />", "\n");
text.Replace("<" , "<");
text.Replace(">" , ">");
text.Replace("\r", "");
text.Replace("\n\n", "\n");
text.Replace("::\n", "\n\n");
IManager* manager = ::clGetManager();
// Write the content of the help into a temporary file
wxFileName fnTemp = wxFileName::CreateTempFileName("cmake");
wxFileName fnCMakeHelpFile = fnTemp;
fnCMakeHelpFile.SetFullName("CMakeHelp.cmake");
if(!FileUtils::WriteFileContent(fnCMakeHelpFile, text)) return;
if(manager->OpenFile(fnCMakeHelpFile.GetFullPath())) {
IEditor* activeEditor = manager->GetActiveEditor();
if(activeEditor && activeEditor->GetFileName().GetFullPath() == fnCMakeHelpFile.GetFullPath()) {
activeEditor->GetCtrl()->SetEditable(true);
activeEditor->ReloadFile();
activeEditor->GetCtrl()->SetFirstVisibleLine(0);
activeEditor->GetCtrl()->SetEditable(false);
}
}
}
示例9: OnInsertCopyrights
void Copyright::OnInsertCopyrights(wxCommandEvent& e)
{
wxUnusedVar(e);
// read configuration
CopyrightsConfigData data;
m_mgr->GetConfigTool()->ReadObject(wxT("CopyrightsConfig"), &data);
// make sure that the template file exists
if(!wxFileName::FileExists(data.GetTemplateFilename())) {
wxMessageBox(
wxString::Format(_("Template file name '%s', does not exist!"), data.GetTemplateFilename().GetData()),
_("CodeLite"), wxICON_WARNING | wxOK);
return;
}
// read the copyrights file
wxString content;
if(!ReadFileWithConversion(data.GetTemplateFilename(), content)) {
wxMessageBox(wxString::Format(_("Failed to read template file '%s'"), data.GetTemplateFilename().c_str()),
_("CodeLite"), wxICON_WARNING | wxOK);
return;
}
IEditor* editor = m_mgr->GetActiveEditor();
if(!editor) {
wxMessageBox(wxString::Format(_("There is no active editor\n")), _("CodeLite"), wxICON_WARNING | wxOK);
return;
}
// verify that the file consist only with comment code
CppWordScanner scanner(data.GetTemplateFilename().mb_str().data());
CppTokensMap l;
scanner.FindAll(l);
if(!l.is_empty()) {
if(wxMessageBox(_("Template file contains text which is not comment, continue anyway?"), _("CodeLite"),
wxICON_QUESTION | wxYES_NO) == wxNO) {
return;
}
}
// expand constants
wxString _content = ExpandAllVariables(content, m_mgr->GetWorkspace(), wxEmptyString, wxEmptyString,
editor->GetFileName().GetFullPath());
// we are good to go :)
wxString ignoreString = data.GetIgnoreString();
ignoreString = ignoreString.Trim().Trim(false);
if(ignoreString.IsEmpty() == false) {
if(editor->GetEditorText().Find(data.GetIgnoreString()) != wxNOT_FOUND) {
clLogMessage(_("File contains ignore string, skipping it"));
return;
}
}
editor->InsertText(0, _content);
}
示例10: OnTimer
void WebTools::OnTimer(wxTimerEvent& event)
{
event.Skip();
time_t curtime = time(NULL);
if((curtime - m_lastColourUpdate) < 5) return;
IEditor* editor = m_mgr->GetActiveEditor();
// Sanity
CHECK_PTR_RET(editor);
CHECK_PTR_RET(editor->IsModified());
if(!IsJavaScriptFile(editor->GetFileName())) return;
// This file is a modified JS file
m_lastColourUpdate = time(NULL);
m_jsColourThread->QueueBuffer(editor->GetFileName().GetFullPath(), editor->GetTextRange(0, editor->GetLength()));
}
示例11: OnActiveEditorChanged
void OutlineTab::OnActiveEditorChanged(wxCommandEvent& e)
{
e.Skip();
IEditor* editor = reinterpret_cast<IEditor*>(e.GetClientData());
if(editor) {
m_tree->BuildTree(editor->GetFileName());
}
}
示例12: OnLSPInitialized
void LanguageServerCluster::OnLSPInitialized(LSPEvent& event)
{
wxUnusedVar(event); // Now that the workspace is loaded, parse the active file
IEditor* editor = clGetManager()->GetActiveEditor();
CHECK_PTR_RET(editor);
LanguageServerProtocol::Ptr_t lsp = GetServerForFile(editor->GetFileName());
if(lsp) { lsp->OpenEditor(editor); }
}
示例13: OnEditorContentMenu
void Cscope::OnEditorContentMenu(clContextMenuEvent& event)
{
event.Skip();
IEditor* editor = m_mgr->GetActiveEditor();
CHECK_PTR_RET(editor);
if(FileExtManager::IsCxxFile(editor->GetFileName())) {
event.GetMenu()->Append(wxID_ANY, _("CScope"), CreateEditorPopMenu());
}
}
示例14: CodeFormatterBaseDlg
CodeFormatterDlg::CodeFormatterDlg(wxWindow* parent,
IManager* mgr,
CodeFormatter* cf,
const FormatOptions& opts,
const wxString& sampleCode)
: CodeFormatterBaseDlg(parent)
, m_cf(cf)
, m_sampleCode(sampleCode)
, m_isDirty(false)
, m_mgr(mgr)
{
::wxPGPropertyBooleanUseCheckbox(m_pgMgrAstyle->GetGrid());
::wxPGPropertyBooleanUseCheckbox(m_pgMgrClang->GetGrid());
::wxPGPropertyBooleanUseCheckbox(m_pgMgrPhp->GetGrid());
// center the dialog
Centre();
m_options = opts;
m_textCtrlPreview->SetText(m_sampleCode);
GetSizer()->Fit(this);
InitDialog();
UpdatePreview();
// Clear the modified status
m_pgMgrPhp->GetGrid()->ClearModifiedStatus();
m_pgMgrAstyle->GetGrid()->ClearModifiedStatus();
m_pgMgrClang->GetGrid()->ClearModifiedStatus();
// set the selection based on the editor
IEditor* editor = m_mgr->GetActiveEditor();
if(editor && FileExtManager::IsPHPFile(editor->GetFileName())) {
m_treebook->SetSelection(4);
} else if(editor && FileExtManager::IsCxxFile(editor->GetFileName())) {
m_treebook->SetSelection(1);
} else {
m_treebook->SetSelection(0);
}
SetName("CodeFormatterDlg");
WindowAttrManager::Load(this);
}
示例15: OnEditorChanged
void NavBar::OnEditorChanged(wxCommandEvent& e)
{
e.Skip();
IEditor* editor = reinterpret_cast<IEditor*>(e.GetClientData());
if(!editor) {
return;
}
const wxFileName& fn = editor->GetFileName();
DoPopulateTags(fn);
}