void EnvVarsTableDlg::OnButtonOk(wxCommandEvent& event) { EvnVarList vars; std::map<wxString, wxString> envSets; wxString content = m_textCtrlDefault->GetText(); wxString name = wxT("Default"); content.Trim().Trim(false); envSets[name] = content; for(size_t i = 1; i < m_notebook1->GetPageCount(); i++) { if(i == (size_t)m_notebook1->GetSelection()) { vars.SetActiveSet(m_notebook1->GetPageText(i)); } EnvVarSetPage* page = (EnvVarSetPage*)m_notebook1->GetPage(i); wxString content = page->m_textCtrl->GetText(); wxString name = m_notebook1->GetPageText(i); content.Trim().Trim(false); envSets[name] = content; } vars.SetEnvVarSets(envSets); EnvironmentConfig::Instance()->WriteObject(wxT("Variables"), &vars); // Notify that the environment variables were modified clCommandEvent eventSave(wxEVT_ENVIRONMENT_VARIABLES_MODIFIED); EventNotifier::Get()->AddPendingEvent(eventSave); event.Skip(); }
void PhpPlugin::OnFileSaved(clCommandEvent& e) { e.Skip(); // Check to see if we got a remote-upload setup SSHWorkspaceSettings settings; settings.Load(); if(settings.IsRemoteUploadSet() && settings.IsRemoteUploadEnabled()) { // Post an event to the SFTP plugin and ask it to save our file wxFileName fnLocalFile(e.GetString()); fnLocalFile.MakeRelativeTo(PHPWorkspace::Get()->GetFilename().GetPath()); fnLocalFile.MakeAbsolute(wxFileName(settings.GetRemoteFolder(), "", wxPATH_UNIX).GetPath()); wxString remoteFile = fnLocalFile.GetFullPath(wxPATH_UNIX); wxString localFile = e.GetString(); JSONRoot root(cJSON_Object); root.toElement().addProperty("account", settings.GetAccount()); root.toElement().addProperty("local_file", localFile); root.toElement().addProperty("remote_file", remoteFile); clCommandEvent eventSave(XRCID("wxEVT_SFTP_SAVE_FILE")); eventSave.SetString(root.toElement().format()); EventNotifier::Get()->AddPendingEvent(eventSave); } }
void PhpSFTPHandler::DoSyncFileWithRemote(const wxFileName& localFile) { // Check to see if we got a remote-upload setup PHPProject::Ptr_t pProject = PHPWorkspace::Get()->GetProjectForFile(localFile); if(!pProject) { // Not a workspace file clDEBUG() << localFile << "is not a PHP workspace file, will not sync it with remote" << clEndl; return; } SSHWorkspaceSettings workspaceSettings; workspaceSettings.Load(); if(!EnsureAccountExists(workspaceSettings)) { return; } // Convert the local path to remote path wxString remotePath = GetRemotePath(workspaceSettings, localFile.GetFullPath()); if(remotePath.IsEmpty()) { return; } // Fire this event, if the sftp plugin is ON, it will handle it clSFTPEvent eventSave(wxEVT_SFTP_SAVE_FILE); eventSave.SetAccount(workspaceSettings.GetAccount()); eventSave.SetLocalFile(localFile.GetFullPath()); eventSave.SetRemoteFile(remotePath); EventNotifier::Get()->AddPendingEvent(eventSave); }
void PhpPlugin::DoSyncFileWithRemote(const wxFileName& localFile) { // Check to see if we got a remote-upload setup PHPProject::Ptr_t pProject = PHPWorkspace::Get()->GetProjectForFile(localFile); if(!pProject) { // Not a workspace file clDEBUG() << localFile << "is not a PHP workspace file, will not sync it with remote" << clEndl; return; } SSHWorkspaceSettings settings; settings.Load(); if(settings.IsRemoteUploadSet() && settings.IsRemoteUploadEnabled()) { // Post an event to the SFTP plugin and ask it to save our file wxFileName fnLocalFile = localFile; fnLocalFile.MakeRelativeTo(PHPWorkspace::Get()->GetFilename().GetPath()); fnLocalFile.MakeAbsolute(wxFileName(settings.GetRemoteFolder(), "", wxPATH_UNIX).GetPath()); wxString remoteFile = fnLocalFile.GetFullPath(wxPATH_UNIX); // Fire this event, if the sftp plugin is ON, it will handle it clSFTPEvent eventSave(wxEVT_SFTP_SAVE_FILE); eventSave.SetAccount(settings.GetAccount()); eventSave.SetLocalFile(localFile.GetFullPath()); eventSave.SetRemoteFile(remoteFile); EventNotifier::Get()->AddPendingEvent(eventSave); } }