m_Interval = interval;
89 if(path.empty())
return false;
91 if(wxFileExists(path)) {
92 if(!wxRemoveFile(path)) {
99 if(wxDirExists(path)) {
100 if(!wxFileName::Rmdir(path, wxPATH_RMDIR_RECURSIVE)) {
117 if(path.empty() || !wxDirExists(path))
return false;
122 if(!fname.FileExists())
return false;
125wxMessageBox(
wxT(
"Application crash detected on the previous launch.\n")
126 wxT(
"Do you want Genome Workbench to try to load the last saved data?"),
127 wxT(
"Exception"), wxOK | wxCANCEL | wxICON_EXCLAMATION)) {
136 wxT(
"Restoring workspace..."));
137}
NCBI_CATCH(
"CWorkspaceAutoSaver::x_RestoreWorkspace");
147 if(doc && doc->IsLoaded()) {
156 catch(
constexception& e) {
164 if(!
m_Err.empty()) {
167 wxT(
"Error"), wxOK|wxICON_ERROR);
176 if(path.empty() || !wxDirExists(path))
return;
200 if(!it->IsSetFilename())
202 stringfileName = it->GetFilename();
207 if(!fileName.empty() && sscanf(fileName.c_str(),
format.c_str(), &counter) == 1)
209 size_tpos = fileName.find(
"|");
210 if(pos != string::npos && pos != 0) {
211 stringprojFile = fileName.substr(0, pos);
212it->SetFilename(fileName.substr(pos + 1));
213fname.SetFullName(projFile);
214unique_ptr<CNcbiIfstream> istr(
new CNcbiIfstream(fname.GetFullPath().fn_str(), ios::binary|
ios::in));
215it->Load(*istr, &canceled);
216it->SetDirty(
true);
224vector<CGBProjectHandle::TId> ids = ws->GetUnloadedProjects();
226 ITERATE(vector<CGBProjectHandle::TId>, it2, ids) {
233task_srv->AddTask(*task);
238}
catch(
constexception& e) {
242 if(!
m_Err.empty()) {
251 if(path.empty())
return;
263 if(!wxFileName::DirExists(path) && !wxFileName::Mkdir(path)) {
280 stringprojFile(
buf);
282 stringfileName = projFile +
"|";
283 if(it->IsSetFilename())
284fileName += it->GetFilename();
285it->SetFilename(fileName);
287fname.SetFullName(projFile);
288 CTimetime = it->GetDescr().GetModified_date().AsCTime();
289 stringfilePath(fname.GetFullPath().ToUTF8());
294 CNcbiOfstreamostr(fname.GetFullPath().fn_str(), ios::binary);
303it->SetDirty(
true);
304it->SetProject().SetDescr().SetModifiedDate(time);
312 if(
file.Exists()) {
318 LOG_POST(
Error<<
"x_SaveWorkspace(): output stream is not good");
332 if(it->IsSetFilename())
333fileName = it->GetFilename();
337 if(!fileName.empty() && sscanf(fileName.c_str(),
format.c_str(), &counter) == 1)
339 size_tpos = fileName.find(
"|");
340 if(pos != string::npos)
341it->SetFilename(fileName.substr(pos + 1));
377 wxT(
"Saving workspace copy..."));
378}
NCBI_CATCH(
"CWorkspaceAutoSaver::x_SaveWorkspace");
381 size_telapsed = (size_t)timer.
Elapsed();
User-defined methods of the data storage class.
User-defined methods of the data storage class.
std::invoke_result< _Fty, ICanceled & >::type GUI_AsyncExec(_Fty &&_Fnarg, const wxString &msg=wxT("Accessing network..."))
CAppTaskService - Application Task Service.
static bool InsideAsyncCall()
CEvent - generic event implementation TODO TODO - Attachments.
virtual void CreateProjectScope()
CProjectService - a service providing API for operations with Workspaces and Projects.
CRef< objects::CGBWorkspace > m_Workspace
the only Workspace
CRef< objects::CGBWorkspace > x_LoadWorkspace(const wxString &filename)
void ResetWorkspace()
release the current workspace and all its contents TODO - review
CRef< objects::CGBWorkspace > GetGBWorkspace()
void x_ReloadProjectTreeView()
static wxString ResolvePath(const wxString &path, const wxString &rel_name)
Utility function to hide the platform specifics of locating our standard directories and files.
Template class for iteration on objects of class C (non-medifiable version)
Template class for iteration on objects of class C.
IServiceLocator & m_ServiceLocator
void x_RestoreWorkspace(ICanceled &canceled)
void x_SaveWorkspace(ICanceled &canceled)
bool CheckCrash(ERestoreMode mode)
Interface for testing cancellation request in a long lasting operation.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define NCBI_CATCH(message)
Catch CExceptions as well This macro is deprecated - use *_X or *_XX variant instead of it.
const string & GetMsg(void) const
Get message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void Info(CExceptionArgs_Base &args)
bool IsNewer(time_t tm, EIfAbsent if_absent) const
Check if the current entry is newer than a specified date/time.
@ eIfAbsent_NotNewer
Deem absent entry to be "older".
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
void Post(CRef< CEvent > evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
Handles an event asynchronously (process and/or dispatch).
#define ON_EVENT(type, id, handler)
#define END_EVENT_MAP()
Ends definition of Command Map.
#define BEGIN_EVENT_MAP(thisClass, baseClass)
Begins definition of Command Map for CEventHandler-derived class.
ESerialDataFormat
Data file format.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
virtual bool IsCanceled(void) const =0
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
void Stop(void)
Suspend the timer.
void Start(void)
Start the timer.
@ eCurrent
Use current time. See also CCurrentTime.
TProjects & SetProjects(void)
Assign a value to Projects data member.
The blob sat and sat key Both must be positive integers</td > n< td > Non empty string The interpretation of the blob id depends on a processor Cassandra n processor expects the following format
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
std::istream & in(std::istream &in_, double &x_)
const wxChar * kTemsWsDir
const char * kFailedService
const char * kProjTemplate
wxString ToWxString(const string &s)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4