mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Allow to customize debug port both in IDEA and Chrome
This commit is contained in:
parent
27d81c4fe6
commit
90c23e6686
|
@ -1,8 +1,13 @@
|
||||||
debuggerAgentMap = {};
|
debuggerAgentMap = {};
|
||||||
|
|
||||||
chrome.browserAction.onClicked.addListener(function(tab) {
|
chrome.browserAction.onClicked.addListener(function(tab) {
|
||||||
new DebuggerAgent(tab, 2357).attach();
|
chrome.storage.sync.get({
|
||||||
|
port: 2357,
|
||||||
|
}, function(items) {
|
||||||
|
new DebuggerAgent(tab, items.port).attach();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function DebuggerAgent(tab, port) {
|
function DebuggerAgent(tab, port) {
|
||||||
this.pendingMessages = [];
|
this.pendingMessages = [];
|
||||||
this.connection = null;
|
this.connection = null;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"description": "TeaVM debugger agent, that sends RDP commands over WebSocket",
|
"description": "TeaVM debugger agent, that sends RDP commands over WebSocket",
|
||||||
"version": "0.6.0",
|
"version": "0.6.0",
|
||||||
|
|
||||||
"permissions" : ["debugger", "activeTab", "tabs", "*://*/*"],
|
"permissions" : ["debugger", "activeTab", "tabs", "storage", "*://*/*"],
|
||||||
|
|
||||||
"browser_action" : {
|
"browser_action" : {
|
||||||
"default_icon": "teavm-16.png",
|
"default_icon": "teavm-16.png",
|
||||||
|
@ -21,5 +21,10 @@
|
||||||
"matches": ["http://*/*", "https://*/*", "file://*/*"],
|
"matches": ["http://*/*", "https://*/*", "file://*/*"],
|
||||||
"js": ["contentscript.js"]
|
"js": ["contentscript.js"]
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
|
||||||
|
"options_ui": {
|
||||||
|
"page": "options.html",
|
||||||
|
"open_in_tab": false
|
||||||
|
}
|
||||||
}
|
}
|
54
tools/chrome-rdp/src/main/js/chrome/options.html
Normal file
54
tools/chrome-rdp/src/main/js/chrome/options.html
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<!--
|
||||||
|
~ Copyright 2018 Alexey Andreev.
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>TeaVM debug options</title>
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
margin: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
font-size: 14pt;
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-item {
|
||||||
|
margin-top: 0.5em;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-item label {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="form-item">
|
||||||
|
<label for="port">Port:</label>
|
||||||
|
<input name="port" id="port" type="number" min="1" max="65535">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-item">
|
||||||
|
<button id="save">Save</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="options.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
32
tools/chrome-rdp/src/main/js/chrome/options.js
Normal file
32
tools/chrome-rdp/src/main/js/chrome/options.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2018 Alexey Andreev.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function saveOptions() {
|
||||||
|
var port = document.getElementById("port").value;
|
||||||
|
chrome.storage.sync.set({
|
||||||
|
port: port !== "" ? parseInt(port) : 2357,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadOptions() {
|
||||||
|
chrome.storage.sync.get({
|
||||||
|
port: 2357,
|
||||||
|
}, function(items) {
|
||||||
|
document.getElementById("port").value = items.port;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
document.addEventListener("DOMContentLoaded", loadOptions);
|
||||||
|
document.getElementById("save").addEventListener('click', saveOptions);
|
|
@ -22,29 +22,34 @@ import java.awt.Font;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
import org.teavm.idea.debug.TeaVMDebugConfiguration;
|
import org.teavm.idea.debug.TeaVMDebugConfiguration;
|
||||||
|
|
||||||
class TeaVMDebugSettingsPanel extends JPanel {
|
class TeaVMDebugSettingsPanel extends JPanel {
|
||||||
private final JBTextField portField = new JBTextField();
|
private final JBTextField portField = new JBTextField();
|
||||||
|
|
||||||
public TeaVMDebugSettingsPanel() {
|
public TeaVMDebugSettingsPanel() {
|
||||||
|
setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||||
|
|
||||||
GridBagConstraints labelConstraints = new GridBagConstraints();
|
GridBagConstraints labelConstraints = new GridBagConstraints();
|
||||||
labelConstraints.gridwidth = GridBagConstraints.REMAINDER;
|
|
||||||
labelConstraints.anchor = GridBagConstraints.BASELINE_LEADING;
|
labelConstraints.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||||
labelConstraints.weightx = 1;
|
labelConstraints.weightx = 0;
|
||||||
labelConstraints.weighty = 1;
|
labelConstraints.weighty = 1;
|
||||||
labelConstraints.insets.left = 5;
|
labelConstraints.insets.left = 5;
|
||||||
labelConstraints.insets.right = 5;
|
labelConstraints.insets.right = 5;
|
||||||
|
|
||||||
GridBagConstraints descriptionConstraints = (GridBagConstraints) labelConstraints.clone();
|
GridBagConstraints fieldConstraints = (GridBagConstraints) labelConstraints.clone();
|
||||||
descriptionConstraints.fill = GridBagConstraints.BOTH;
|
|
||||||
descriptionConstraints.anchor = GridBagConstraints.BASELINE_LEADING;
|
fieldConstraints.gridwidth = GridBagConstraints.REMAINDER;
|
||||||
descriptionConstraints.insets.top = 3;
|
fieldConstraints.weightx = 1;
|
||||||
|
fieldConstraints.weighty = 1;
|
||||||
|
fieldConstraints.fill = GridBagConstraints.BOTH;
|
||||||
|
fieldConstraints.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||||
|
|
||||||
setLayout(new GridBagLayout());
|
setLayout(new GridBagLayout());
|
||||||
|
|
||||||
add(bold(new JBLabel("Listen port:")), labelConstraints);
|
add(bold(new JBLabel("Listen port:")), labelConstraints);
|
||||||
add(portField);
|
add(portField, fieldConstraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load(TeaVMDebugConfiguration runConfiguration) {
|
public void load(TeaVMDebugConfiguration runConfiguration) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user