37
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
|
3 local ipairs = Luan.ipairs or error()
|
59
|
4 local stringify = Luan.stringify or error()
|
37
|
5 local String = require "luan:String.luan"
|
53
|
6 local to_number = String.to_number or error()
|
37
|
7 local Io = require "luan:Io.luan"
|
|
8 local new_file = Io.schemes.file or error()
|
59
|
9 local Launcher = require "luan:swing/Launcher.luan"
|
53
|
10 local Java = require "classpath:luan_editor/Java.luan"
|
37
|
11 local Logging = require "luan:logging/Logging.luan"
|
|
12 local logger = Logging.logger "editor/editor"
|
|
13
|
|
14
|
59
|
15 local function open(args)
|
|
16 local Window = require "classpath:luan_editor/Window.luan"
|
|
17 local new_window = Window.new_window or error()
|
37
|
18
|
|
19 if #args == 0 then
|
|
20 new_window()
|
|
21 else
|
|
22 for _, arg in ipairs(args) do
|
|
23 local file = new_file(arg)
|
|
24 new_window(file)
|
|
25 end
|
|
26 end
|
59
|
27 end
|
|
28
|
|
29 local function reopen(args)
|
|
30 local Window = require "classpath:luan_editor/Window.luan"
|
|
31 local open_windows = Window.open_windows or error()
|
|
32
|
|
33 open_windows(args)
|
|
34 end
|
37
|
35
|
59
|
36 local port = Java.port
|
|
37 if port ~= nil then
|
|
38 Launcher.port = to_number(port) or error("bad port: "..port)
|
|
39 end
|
|
40
|
|
41 local args = {nil}
|
|
42 for _, arg in ipairs(Luan.arg) do
|
|
43 local file = new_file(arg)
|
|
44 file = file.canonical().to_string()
|
|
45 args[#args+1] = file
|
|
46 end
|
|
47
|
|
48 Launcher.launch(open,reopen,args)
|