60 #include <wx/filedlg.h>
61 #include <wx/filefn.h>
62 #include <wx/msgdlg.h>
63 #include <wx/filename.h>
97 if (item.CanGetItem()) {
101 const CObject* obj = seqSubmit;
106 if (!entrys.empty()) {
107 obj = entrys.front().GetPointerOrNull();
116 item.SetLabel(sLabel);
120 item.AddTag(
"open_discrepancy_dlg");
121 item.AddTag(
"open_editing_buttons");
122 item.AddTag(
"open_text_view");
127 static string sid(
"single_project_mode_item_extension");
133 static string slabel(
"Genome Workbench Single Project mode item extension");
146 static string sid(
"indexer_app_mode_extension");
152 static string slabel(
"Indexer application mode extension");
182 long style = wxFD_OPEN | wxFD_FILE_MUST_EXIST;
185 wxFileDialog dlg(
NULL,
"Select ASN.1 File", wxGetCwd(), wxEmptyString, filter, style);
187 if (dlg.ShowModal() != wxID_OK)
190 vector<wxString> fileNames = { dlg.GetPath() };
195 if (!srv->HasWorkspace())
196 srv->CreateNewWorkspace();
205 task->AddProjectItemExtra(
"SmartFile",
string(fileNames.front().ToUTF8()));
218 vector<CGBDocument*> docs;
221 if (doc && doc->GetDataModified())
226 srv->ResetWorkspace();
232 for (
auto doc : docs) {
239 if (smartFile.empty())
continue;
240 files[so] = smartFile;
243 if (!files.
empty()) {
244 wxString fileNames, msg =
wxT(
"Want to save changes to "), delim;
245 for (
auto&
f : files) {
246 wxFileName fname(wxString::FromUTF8(
f.second.c_str()));
247 msg += delim + fname.GetFullName();
252 wxMessageDialog msgBox(
nullptr, msg,
wxT(
"Gemome Workbech"), wxYES_NO | wxCANCEL | wxICON_QUESTION);
253 msgBox.SetYesNoLabels(wxID_SAVE,
_(
"Do&n't save"));
255 int result = msgBox.ShowModal();
256 if (
result == wxID_CANCEL)
260 for (
auto f : files) {
262 wxString fileName = wxString::FromUTF8(
f.second.c_str());
270 catch (
const exception& e) {
274 if (!errMsg.empty()) {
275 wxMessageBox(
wxT(
"File: ") + fileName +
wxT(
"\nError: ") +
ToWxString(errMsg),
276 wxT(
"Failed to save file"), wxOK | wxICON_ERROR);
283 srv->ResetWorkspace();
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CExtensionDeclaration - static declaration helper.
static wxString GetDialogFilter(EFileType fileType)
void OnCloseWorkspace(wxCommandEvent &event)
virtual void SetWorkbench(CWorkbench *wb)
virtual string GetModeName() const
void OnFileOpen(wxCommandEvent &event)
CIndexerAppModeExtension()
class CIndexerAppModeExtension
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
class CIndexerProjectItemExtension
virtual void ProjectItemCreated(objects::CProjectItem &item, IServiceLocator *service_locator)
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
CIndexerProjectItemExtension()
virtual void ProjectItemDetached(objects::CProjectItem &, CGBDocument &, IServiceLocator *)
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
virtual void ProjectItemAttached(objects::CProjectItem &, CGBDocument &, IServiceLocator *)
static void SetSaveFilePath(bool save)
CProjectService - a service providing API for operations with Workspaces and Projects.
CProjectSelectOptions - describes how new Project Items shall be added to a workspace.
void Set_CreateNewProject(const string &folder=kEmptyStr)
bool IsEntrys(void) const
Base class for all serializable objects.
Template class for iteration on objects of class C (non-medifiable version)
Template class for iteration on objects of class C.
CWorkbench - default implementation of IWorkbench.
IExtension IExtension interface represents an abstract pluggable component.
IServiceLocator - an abstract mechanism for locating services.
const string & GetMsg(void) const
Get message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
virtual CAppTaskService * GetAppTaskService()
void AddTask(IAppTask &task)
Add a task to the queue.
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
#define MSerial_AsnText
I/O stream manipulators –.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
bool IsSubmit(void) const
Check if variant Submit is selected.
const TSubmit & GetSubmit(void) const
Get the variant data.
list< CRef< CSeq_entry > > TEntrys
const TEntrys & GetEntrys(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
bool IsEntrys(void) const
Check if variant Entrys is selected.
bool CanGetData(void) const
Check if it is safe to call GetData method.
double f(double x_, const double &y_)
#define EXT_POINT__OPEN_PROJECT_VIEW_EXTENSION
#define EXT_POINT__PROJECT_ITEM_EXTENSION
wxString ToWxString(const string &s)