forked from iamxiaoma/sublime-xdk-package
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.py
171 lines (138 loc) · 4.9 KB
/
commands.py
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
# coding: utf-8
# Copyright 2015 Intel Corporation All Rights Reserved.
# The source code, information and material ("Material") contained herein is owned by Intel Corporation or its suppliers or licensors,
# and title to such Material remains with Intel Corporation or its suppliers or licensors. The Material contains proprietary information
# of Intel or its suppliers and licensors. The Material is protected by worldwide copyright laws and treaty provisions. No part of the
# Material may be used, copied, reproduced, modified, published, uploaded, posted, transmitted, distributed or disclosed in any way without
# Intel's prior express written permission. No license under any patent, copyright or other intellectual property rights in the Material is
# granted to or conferred upon you, either expressly, by implication, inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this notice or any other notice embedded in Materials by Intel or
# Intel's suppliers or licensors in any way.
import sublime, sublime_plugin
import os
import sys
__file__ = os.path.normpath(os.path.abspath(__file__));
__path__ = os.path.dirname(__file__)
if __path__ not in sys.path:
sys.path.insert(0, __path__)
import XDKCore
class XdkCommand_(sublime_plugin.TextCommand, XDKCore.XDKPluginCore):
def run(self, edit):
if not self.prepare():
return
self.invoke_command(self.prepare_data())
########## EMULATOR
class XdkRunEmulatorDockedCommand(XdkCommand_):
def prepare_data(self):
data = self.prepare_request_data()
data.update(
action='run_emulate',
method='run_docked'
)
return data
class XdkRunEmulatorUndockedCommand(XdkCommand_):
def prepare_data(self):
data = self.prepare_request_data()
data.update(
action='run_emulate',
method='run_undocked'
)
return data
########## TEST
class XdkRunTestPushFilesCommand(XdkCommand_):
def prepare_data(self):
data = self.prepare_request_data()
data.update(
action='run_test',
method='push_files'
)
return data
class XdkRunTestBeginDebuggingCommand(XdkCommand_):
def prepare_data(self):
data = self.prepare_request_data()
data.update(
action='run_test',
method='begin_debugging'
)
return data
########## DEBUG
class XdkRunDebugLaunchAppCommand(XdkCommand_):
def prepare_data(self):
data = self.prepare_request_data()
data.update(
action='run_debug',
method='launch_app'
)
return data
class XdkRunDebugDebugAppCommand(XdkCommand_):
def prepare_data(self):
data = self.prepare_request_data()
data.update(
action='run_debug',
method='debug_app'
)
return data
class XdkRunDebugStopAppCommand(XdkCommand_):
def prepare_data(self):
data = self.prepare_request_data()
data.update(
action='run_debug',
method='stop_app'
)
return data
########## PROFILE
class XdkRunProfileCpuStartCommand(XdkCommand_):
def prepare_data(self):
data = self.prepare_request_data()
data.update(
action='run_profile',
method='start_cpu_profiling'
)
return data
class XdkRunProfileMemoryStartCommand(XdkCommand_):
def prepare_data(self):
data = self.prepare_request_data()
data.update(
action='run_profile',
method='start_memory_profiling'
)
return data
class XdkRunProfileStopCommand(XdkCommand_):
def prepare_data(self):
data = self.prepare_request_data()
data.update(
action='run_profile',
method='stop'
)
return data
class XdkRunProfileCloseAppCommand(XdkCommand_):
def prepare_data(self):
data = self.prepare_request_data()
data.update(
action='run_profile',
method='close_app'
)
return data
########## CONFIGURE HOTKEYS
class XdkConfigureHotkeysCommand(sublime_plugin.WindowCommand):
def run(self):
files_map = {
'darwin': 'OSX',
'win32': 'Windows',
'linux2': 'Linux'
}
if sys.platform in files_map:
filename = 'Default (' + files_map[sys.platform] + ').sublime-keymap'
self.window.open_file(os.path.join(XDKCore.PLUGIN_PATH, filename))
########## ABOUT
class XdkShowAboutCommand(sublime_plugin.ApplicationCommand):
def run(self):
sublime.message_dialog(u"""Intel® XDK HTML5 Cross-platform Development Tool enables developers to easily design, test, debug, and build HTML5 web and hybrid apps across multiple app stores and form factor devices.
The Intel® XDK plugin for Sublime Text* allows you to drive your HTML5 app emulation, testing, profiling, and builds from within Sublime Text; you just need to set up your project within the Intel® XDK first.
See https://github.com/gomobile/sublime-xdk-package for more information about the Intel® XDK Sublime Text* plugin.
Please see http://xdk.intel.com for more information about the Intel® XDK and for support.
*Other names and brands may be claimed as the property of others.
Copyright (c) 2013-2015 Intel Corporation. All Rights Reserved.
""")