本文整理汇总了C++中IEditor类的典型用法代码示例。如果您正苦于以下问题:C++ IEditor类的具体用法?C++ IEditor怎么用?C++ IEditor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IEditor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnEditorClosed
void SFTP::OnEditorClosed(wxCommandEvent& e)
{
e.Skip();
IEditor* editor = (IEditor*)e.GetClientData();
if(editor) {
wxString localFile = editor->GetFileName().GetFullPath();
if(m_remoteFiles.count(localFile)) {
wxLogNull noLog;
// Remove the file from our cache
::wxRemoveFile(localFile);
m_remoteFiles.erase(localFile);
}
}
}
示例2: DestroyTooltip
void LLDBPlugin::DestroyTooltip()
{
if(m_tooltip) {
m_tooltip->Destroy();
m_tooltip = NULL;
// Raise codelite back
EventNotifier::Get()->TopFrame()->Raise();
// If we destroyed the tooltip, set the focus back to the active editor
IEditor* editor = m_mgr->GetActiveEditor();
if(editor) {
editor->SetActive();
}
}
}
示例3: activateEvent
void OpenResourceDialog::OpenSelection(const OpenResourceDialogItemData& selection, IManager* manager)
{
// send event to the plugins to see if they want
// to open this file
wxString file_path = selection.m_file;
clCommandEvent activateEvent(wxEVT_TREE_ITEM_FILE_ACTIVATED);
activateEvent.SetFileName(file_path);
if(EventNotifier::Get()->ProcessEvent(activateEvent)) return;
if(manager && manager->OpenFile(selection.m_file, wxEmptyString, selection.m_line - 1)) {
IEditor* editor = manager->GetActiveEditor();
if(editor && !selection.m_name.IsEmpty() && !selection.m_pattern.IsEmpty()) {
editor->FindAndSelectV(selection.m_pattern, selection.m_name);
}
}
}
示例4: OnFilesTagged
void OutlineTab::OnFilesTagged(wxCommandEvent& e)
{
e.Skip();
IEditor* editor = m_mgr->GetActiveEditor();
if( editor ) {
m_tree->BuildTree( editor->GetFileName() );
if(editor->GetSTC()) {
// make sure we dont steal the focus from the editor...
editor->GetSTC()->SetFocus();
}
} else {
m_tree->Clear();
}
}
示例5: reInclude
bool PHPEditorContextMenu::IsIncludeOrRequireStatement(wxString& includeWhat)
{
// Do a basic check to see whether this line is include statement or not.
// Don't bother in full parsing the file since it can be a quite an expensive operation
// (include|require_once|require|include_once)[ \t\\(]*(.*?)[\\) \t)]*;
static wxRegEx reInclude(wxT("(include|require_once|require|include_once)[ \t\\(]*(.*?)[\\) \t]*;"), wxRE_ADVANCED);
IEditor* editor = m_manager->GetActiveEditor();
if(!editor) return false;
wxString line = editor->GetCtrl()->GetLine(editor->GetCurrentLine());
if(reInclude.IsValid() && reInclude.Matches(line)) {
includeWhat = reInclude.GetMatch(line, 2);
return true;
}
return false;
}
示例6: time
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()));
}
示例7: clGetManager
void ZoomText::OnIdle(wxIdleEvent& event)
{
event.Skip();
// sanity
if(!m_classes.IsEmpty() || IsEmpty()) return;
IEditor* editor = clGetManager()->GetActiveEditor();
if(!editor) return;
if(m_classes.IsEmpty() && !editor->GetKeywordClasses().IsEmpty() &&
(editor->GetFileName().GetFullPath() == m_filename)) {
// Sync between the keywords
SetKeyWords(1, editor->GetKeywordClasses()); // classes
SetKeyWords(3, editor->GetKeywordLocals()); // locals
Colourise(0, GetLength());
}
}
示例8: fn
void LanguageServerCluster::OnSymbolFound(LSPEvent& event)
{
const LSP::Location& location = event.GetLocation();
wxFileName fn(location.GetUri());
clDEBUG() << "LSP: Opening file:" << fn << "(" << location.GetRange().GetStart().GetLine() << ":"
<< location.GetRange().GetStart().GetCharacter() << ")";
// Manage the browser (BACK and FORWARD) ourself
BrowseRecord from;
IEditor* oldEditor = clGetManager()->GetActiveEditor();
if(oldEditor) { from = oldEditor->CreateBrowseRecord(); }
IEditor* editor = clGetManager()->OpenFile(fn.GetFullPath(), "", wxNOT_FOUND, OF_None);
if(editor) {
editor->SelectRange(location.GetRange());
if(oldEditor) { NavMgr::Get()->AddJump(from, editor->CreateBrowseRecord()); }
}
}
示例9: CHECK_PTR_RET
void PHPOutlineTree::ItemSelected(const wxTreeItemId& item, bool focusEditor)
{
QItemData* itemData = dynamic_cast<QItemData*>(GetItemData(item));
CHECK_PTR_RET(itemData);
IEditor* editor = m_manager->GetActiveEditor();
CHECK_PTR_RET(editor);
// Define the pattern to search
editor->FindAndSelect(itemData->m_entry->GetShortName(), itemData->m_entry->GetShortName(),
editor->PosFromLine(itemData->m_entry->GetLine()), NavMgr::Get());
// set the focus to the editor
if(focusEditor) {
CallAfter(&PHPOutlineTree::SetEditorActive, editor);
}
}
示例10: DoDeleteBreakpoint
void XDebugManager::OnDeleteBreakpoint(PHPEvent& e)
{
e.Skip();
wxString filename = e.GetFileName();
int line = e.GetLineNumber();
int bpid = e.GetInt();
if ( bpid != wxNOT_FOUND ) {
// breakpoint was applied
DoDeleteBreakpoint(bpid);
}
IEditor * editor = m_plugin->GetManager()->FindEditor( filename );
if ( editor ) {
editor->GetSTC()->MarkerDelete(line-1, smt_breakpoint);
}
m_breakpointsMgr.DeleteBreakpoint(filename, line);
}
示例11: OnFindSymbol
void PHPCodeCompletion::OnFindSymbol(clCodeCompletionEvent& e)
{
if(PHPWorkspace::Get()->IsOpen()) {
if(!CanCodeComplete(e)) return;
IEditor* editor = dynamic_cast<IEditor*>(e.GetEditor());
if(editor) {
PHPEntityBase::Ptr_t resolved = GetPHPEntryUnderTheAtPos(editor, editor->GetCurrentPosition());
if(resolved) {
m_manager->OpenFile(resolved->GetFilename().GetFullPath(), "", resolved->GetLine());
}
}
} else {
e.Skip();
}
}
示例12: clLogMessage
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();
}
示例13: entryInfo
QList<FilterEntry> FileSystemFilter::matchesFor(const QString &entry)
{
QList<FilterEntry> value;
QFileInfo entryInfo(entry);
QString name = entryInfo.fileName();
QString directory = entryInfo.path();
QString filePath = entryInfo.filePath();
if (entryInfo.isRelative()) {
if (filePath.startsWith("~/")) {
directory.replace(0, 1, QDir::homePath());
} else {
IEditor *editor = m_editorManager->currentEditor();
if (editor && !editor->file()->fileName().isEmpty()) {
QFileInfo info(editor->file()->fileName());
directory.prepend(info.absolutePath()+"/");
}
}
}
QDir dirInfo(directory);
QDir::Filters dirFilter = QDir::Dirs|QDir::Drives;
QDir::Filters fileFilter = QDir::Files;
if (m_includeHidden) {
dirFilter |= QDir::Hidden;
fileFilter |= QDir::Hidden;
}
QStringList dirs = dirInfo.entryList(dirFilter,
QDir::Name|QDir::IgnoreCase|QDir::LocaleAware);
QStringList files = dirInfo.entryList(fileFilter,
QDir::Name|QDir::IgnoreCase|QDir::LocaleAware);
foreach (const QString &dir, dirs) {
if (dir != "." && (name.isEmpty() || dir.startsWith(name, Qt::CaseInsensitive))) {
FilterEntry entry(this, dir, dirInfo.filePath(dir));
entry.resolveFileIcon = true;
value.append(entry);
}
}
foreach (const QString &file, files) {
if (name.isEmpty() || file.startsWith(name, Qt::CaseInsensitive)) {
const QString fullPath = dirInfo.filePath(file);
FilterEntry entry(this, file, fullPath);
entry.resolveFileIcon = true;
value.append(entry);
}
}
return value;
}
示例14: fn
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 );
}
}
示例15: OnPreviewClicked
void ZoomNavigator::OnPreviewClicked(wxMouseEvent& e)
{
IEditor* curEditor = m_mgr->GetActiveEditor();
// user clicked on the preview
CHECK_CONDITION(m_startupCompleted);
CHECK_CONDITION(curEditor);
CHECK_CONDITION(m_enabled);
// the first line is taken from the preview
int pos = m_text->PositionFromPoint(e.GetPosition());
if(pos == wxSTC_INVALID_POSITION) {
return;
}
int first = m_text->LineFromPosition(pos);
int nLinesOnScreen = curEditor->GetCtrl()->LinesOnScreen();
first -= (nLinesOnScreen / 2);
if(first < 0) first = 0;
// however, the last line is set according to the actual editor
int last = nLinesOnScreen + first;
PatchUpHighlights(first, last);
curEditor->GetCtrl()->SetFirstVisibleLine(first);
curEditor->SetCaretAt(curEditor->PosFromLine(first + (nLinesOnScreen / 2)));
// reset the from/last members to avoid unwanted movements in the 'OnTimer' function
m_markerFirstLine = curEditor->GetCtrl()->GetFirstVisibleLine();
m_markerLastLine = m_markerFirstLine + curEditor->GetCtrl()->LinesOnScreen();
}