FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
rstudio/src/cpp/session/SessionClientEvent.cpp at master · usersbin/rstudio · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
usersbin
/
rstudio
Public
forked from
rstudio/rstudio
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
rstudio
/
src
/
cpp
/
session
/
SessionClientEvent.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
218 lines (201 loc) · 6.81 KB
Breadcrumbs
rstudio
/
src
/
cpp
/
session
/
SessionClientEvent.cpp
Copy path
File metadata and controls
218 lines (201 loc) · 6.81 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
/*
* SessionClientEvent.cpp
*
* Copyright (C) 2009-11 by RStudio, Inc.
*
* This program is licensed to you under the terms of version 3 of the
* GNU Affero General Public License. This program is distributed WITHOUT
* ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
* AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
*
*/
#
include
<
session/SessionClientEvent.hpp
>
#
include
<
boost/lexical_cast.hpp
>
#
include
<
core/Error.hpp
>
#
include
<
core/Log.hpp
>
#
include
<
core/FilePath.hpp
>
#
include
<
core/FileSerializer.hpp
>
#
include
<
core/system/System.hpp
>
using
namespace
core
;
namespace
session
{
namespace
client_events
{
const
int
kBusy
=
1
;
const
int
kConsolePrompt
=
2
;
const
int
kConsoleWriteOutput
=
3
;
const
int
kConsoleWriteError
=
4
;
const
int
kShowErrorMessage
=
5
;
const
int
kShowHelp
=
6
;
const
int
kBrowseUrl
=
7
;
const
int
kWorkspaceRefresh
=
8
;
const
int
kWorkspaceAssign
=
9
;
const
int
kWorkspaceRemove
=
10
;
const
int
kShowEditor
=
11
;
const
int
kChooseFile
=
13
;
const
int
kAbendWarning
=
14
;
const
int
kQuit
=
15
;
const
int
kSuicide
=
16
;
const
int
kFileChanged
=
17
;
const
int
kWorkingDirChanged
=
18
;
const
int
kPlotsStateChanged
=
19
;
const
int
kViewData
=
20
;
const
int
kPackageStatusChanged
=
21
;
const
int
kInstalledPackagesChanged
=
22
;
const
int
kLocator
=
23
;
const
int
kConsoleResetHistory
=
25
;
const
int
kSessionSerialization
=
26
;
const
int
kHistoryEntriesAdded
=
27
;
const
int
kQuotaStatus
=
29
;
const
int
kOAuthApproval
=
30
;
const
int
kPublishPdf
=
31
;
const
int
kFileEdit
=
32
;
const
int
kShowContent
=
33
;
const
int
kShowData
=
34
;
const
int
kAsyncCompletion
=
35
;
const
int
kSaveActionChanged
=
36
;
const
int
kConsoleWritePrompt
=
37
;
const
int
kConsoleWriteInput
=
38
;
const
int
kShowWarningBar
=
39
;
const
int
kOpenProjectError
=
40
;
const
int
kVcsRefresh
=
41
;
const
int
kAskPass
=
42
;
const
int
kConsoleProcessOutput
=
43
;
const
int
kConsoleProcessExit
=
44
;
const
int
kListChanged
=
45
;
const
int
kConsoleProcessCreated
=
46
;
const
int
kUiPrefsChanged
=
47
;
const
int
kHandleUnsavedChanges
=
48
;
const
int
kPosixShellOutput
=
49
;
const
int
kPosixShellExit
=
50
;
}
void
ClientEvent::init
(
int
type,
const
json::Value& data)
{
type_ = type;
data_ = data;
id_ =
core::system::generateUuid
();
}
void
ClientEvent::asJsonObject
(
int
id, json::Object* pObject)
const
{
json::Object& object = *pObject;
object[
"
id
"
] = id;
object[
"
type
"
] =
typeName
();
object[
"
data
"
] =
data
();
}
std::string
ClientEvent::typeName
()
const
{
switch
(type_)
{
case
client_events::
kBusy
:
return
"
busy
"
;
case
client_events::
kConsolePrompt
:
return
"
console_prompt
"
;
case
client_events::
kConsoleWriteOutput
:
return
"
console_output
"
;
case
client_events::
kConsoleWriteError
:
return
"
console_error
"
;
case
client_events::
kShowErrorMessage
:
return
"
show_error_message
"
;
case
client_events::
kShowHelp
:
return
"
show_help
"
;
case
client_events::
kBrowseUrl
:
return
"
browse_url
"
;
case
client_events::
kWorkspaceRefresh
:
return
"
workspace_refresh
"
;
case
client_events::
kWorkspaceAssign
:
return
"
workspace_assign
"
;
case
client_events::
kWorkspaceRemove
:
return
"
workspace_remove
"
;
case
client_events::
kShowEditor
:
return
"
show_editor
"
;
case
client_events::
kChooseFile
:
return
"
choose_file
"
;
case
client_events::
kAbendWarning
:
return
"
abend_warning
"
;
case
client_events::
kQuit
:
return
"
quit
"
;
case
client_events::
kSuicide
:
return
"
suicide
"
;
case
client_events::
kFileChanged
:
return
"
file_changed
"
;
case
client_events::
kWorkingDirChanged
:
return
"
working_dir_changed
"
;
case
client_events::
kPlotsStateChanged
:
return
"
plots_state_changed
"
;
case
client_events::
kViewData
:
return
"
view_data
"
;
case
client_events::
kPackageStatusChanged
:
return
"
package_status_changed
"
;
case
client_events::
kInstalledPackagesChanged
:
return
"
installed_packages_changed
"
;
case
client_events::
kLocator
:
return
"
locator
"
;
case
client_events::
kConsoleResetHistory
:
return
"
console_reset_history
"
;
case
client_events::
kSessionSerialization
:
return
"
session_serialization
"
;
case
client_events::
kHistoryEntriesAdded
:
return
"
history_entries_added
"
;
case
client_events::
kQuotaStatus
:
return
"
quota_status
"
;
case
client_events::
kOAuthApproval
:
return
"
oauth_approval
"
;
case
client_events::
kPublishPdf
:
return
"
publish_pdf
"
;
case
client_events::
kFileEdit
:
return
"
file_edit
"
;
case
client_events::
kShowContent
:
return
"
show_content
"
;
case
client_events::
kShowData
:
return
"
show_data
"
;
case
client_events::
kAsyncCompletion
:
return
"
async_completion
"
;
case
client_events::
kSaveActionChanged
:
return
"
save_action_changed
"
;
case
client_events::
kConsoleWritePrompt
:
return
"
console_write_prompt
"
;
case
client_events::
kConsoleWriteInput
:
return
"
console_write_input
"
;
case
client_events::
kShowWarningBar
:
return
"
show_warning_bar
"
;
case
client_events::
kOpenProjectError
:
return
"
open_project_error
"
;
case
client_events::
kVcsRefresh
:
return
"
vcs_refresh
"
;
case
client_events::
kAskPass
:
return
"
ask_pass
"
;
case
client_events::
kConsoleProcessOutput
:
return
"
console_process_output
"
;
case
client_events::
kConsoleProcessExit
:
return
"
console_process_exit
"
;
case
client_events::
kListChanged
:
return
"
list_changed
"
;
case
client_events::
kUiPrefsChanged
:
return
"
ui_prefs_changed
"
;
case
client_events::
kHandleUnsavedChanges
:
return
"
handle_unsaved_changes
"
;
case
client_events::
kPosixShellOutput
:
return
"
posix_shell_output
"
;
case
client_events::
kPosixShellExit
:
return
"
posix_shell_exit
"
;
default
:
LOG_WARNING_MESSAGE
(
"
unexpected event type:
"
+
boost::lexical_cast<std::string>(type_));
return
"
"
;
}
}
ClientEvent
browseUrlEvent
(
const
std::string& url,
const
std::string& window)
{
json::Object browseURLInfo;
browseURLInfo[
"
url
"
] = url;
browseURLInfo[
"
window
"
] = window;
return
ClientEvent
(client_events::
kBrowseUrl
, browseURLInfo);
}
ClientEvent
showErrorMessageEvent
(
const
std::string& title,
const
std::string& message)
{
json::Object errorMessage ;
errorMessage[
"
title
"
] = title;
errorMessage[
"
message
"
] = message;
return
ClientEvent
(client_events::
kShowErrorMessage
, errorMessage);
}
}
//
namespace session
Back
|
FazBrowse Home
|
New Git URL