|
|
@ -42,6 +42,7 @@ var run = function () { |
|
|
|
var storage = new Storage() |
|
|
|
var storage = new Storage() |
|
|
|
var config = new Config(storage) |
|
|
|
var config = new Config(storage) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add files received from remote instance (i.e. another browser-solidity)
|
|
|
|
function loadFiles (files) { |
|
|
|
function loadFiles (files) { |
|
|
|
for (var f in files) { |
|
|
|
for (var f in files) { |
|
|
|
storage.loadFile(f, files[f].content) |
|
|
|
storage.loadFile(f, files[f].content) |
|
|
@ -51,10 +52,12 @@ var run = function () { |
|
|
|
updateFiles() |
|
|
|
updateFiles() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Replace early callback with instant response
|
|
|
|
loadFilesCallback = function (files) { |
|
|
|
loadFilesCallback = function (files) { |
|
|
|
loadFiles(files) |
|
|
|
loadFiles(files) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Run if we did receive an event from remote instance while starting up
|
|
|
|
if (filesToLoad !== null) { |
|
|
|
if (filesToLoad !== null) { |
|
|
|
loadFiles(filesToLoad) |
|
|
|
loadFiles(filesToLoad) |
|
|
|
} |
|
|
|
} |
|
|
@ -135,6 +138,7 @@ var run = function () { |
|
|
|
var $el = $(this) |
|
|
|
var $el = $(this) |
|
|
|
selectTab($el) |
|
|
|
selectTab($el) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
var selectTab = function (el) { |
|
|
|
var selectTab = function (el) { |
|
|
|
var match = /[a-z]+View/.exec(el.get(0).className) |
|
|
|
var match = /[a-z]+View/.exec(el.get(0).className) |
|
|
|
if (!match) return |
|
|
|
if (!match) return |
|
|
@ -216,8 +220,14 @@ var run = function () { |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
$filesEl.on('click', '.file:not(.active)', showFileHandler) |
|
|
|
// Switch tab
|
|
|
|
|
|
|
|
$filesEl.on('click', '.file:not(.active)', function (ev) { |
|
|
|
|
|
|
|
ev.preventDefault() |
|
|
|
|
|
|
|
switchToFile($(this).find('.name').text()) |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Edit name of current tab
|
|
|
|
$filesEl.on('click', '.file.active', function (ev) { |
|
|
|
$filesEl.on('click', '.file.active', function (ev) { |
|
|
|
var $fileTabEl = $(this) |
|
|
|
var $fileTabEl = $(this) |
|
|
|
var originalName = $fileTabEl.find('.name').text() |
|
|
|
var originalName = $fileTabEl.find('.name').text() |
|
|
@ -253,6 +263,7 @@ var run = function () { |
|
|
|
return false |
|
|
|
return false |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remove current tab
|
|
|
|
$filesEl.on('click', '.file .remove', function (ev) { |
|
|
|
$filesEl.on('click', '.file .remove', function (ev) { |
|
|
|
ev.preventDefault() |
|
|
|
ev.preventDefault() |
|
|
|
var name = $(this).parent().find('.name').text() |
|
|
|
var name = $(this).parent().find('.name').text() |
|
|
@ -266,17 +277,12 @@ var run = function () { |
|
|
|
return false |
|
|
|
return false |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
function swicthToFile (file) { |
|
|
|
function switchToFile (file) { |
|
|
|
editor.setCacheFile(file) |
|
|
|
editor.setCacheFile(file) |
|
|
|
updateFiles() |
|
|
|
updateFiles() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function showFileHandler (ev) { |
|
|
|
// Synchronise tab list with file names known to the editor
|
|
|
|
ev.preventDefault() |
|
|
|
|
|
|
|
swicthToFile($(this).find('.name').text()) |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function updateFiles () { |
|
|
|
function updateFiles () { |
|
|
|
var $filesEl = $('#files') |
|
|
|
var $filesEl = $('#files') |
|
|
|
var files = editor.getFiles() |
|
|
|
var files = editor.getFiles() |
|
|
@ -489,7 +495,7 @@ var run = function () { |
|
|
|
|
|
|
|
|
|
|
|
var offsetToLineColumnConverter = new OffsetToLineColumnConverter(compiler.event) |
|
|
|
var offsetToLineColumnConverter = new OffsetToLineColumnConverter(compiler.event) |
|
|
|
|
|
|
|
|
|
|
|
var transactionDebugger = new Debugger('#debugger', editor, compiler, executionContext.event, swicthToFile, offsetToLineColumnConverter) |
|
|
|
var transactionDebugger = new Debugger('#debugger', editor, compiler, executionContext.event, switchToFile, offsetToLineColumnConverter) |
|
|
|
transactionDebugger.addProvider('vm', executionContext.vm()) |
|
|
|
transactionDebugger.addProvider('vm', executionContext.vm()) |
|
|
|
transactionDebugger.switchProvider('vm') |
|
|
|
transactionDebugger.switchProvider('vm') |
|
|
|
transactionDebugger.addProvider('injected', executionContext.web3()) |
|
|
|
transactionDebugger.addProvider('injected', executionContext.web3()) |
|
|
|