gvcsfx 0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/Gemfile +24 -0
- data/README.md +71 -0
- data/bin/gvcsfx +13 -0
- data/bin/gvcsfx.rb +97 -0
- data/config/warble.rb +212 -0
- data/fx/add_workspace.fxml +90 -0
- data/fx/diff.fxml +51 -0
- data/fx/float.fxml +29 -0
- data/fx/main.fxml +637 -0
- data/fx/show_text.fxml +50 -0
- data/fx/stash_select.fxml +59 -0
- data/gvcs_fx.rb +85 -0
- data/handlers/add_workspace_controller.rb +88 -0
- data/handlers/event_handler.rb +58 -0
- data/handlers/float_win_controller.rb +68 -0
- data/handlers/fx_alert.rb +120 -0
- data/handlers/listener.rb +59 -0
- data/handlers/main_win_controller.rb +191 -0
- data/handlers/notification.rb +113 -0
- data/handlers/show_text_controller.rb +38 -0
- data/handlers/stash_select_controller.rb +86 -0
- data/handlers/tab_branches.rb +312 -0
- data/handlers/tab_files.rb +27 -0
- data/handlers/tab_ignore_rules.rb +40 -0
- data/handlers/tab_logs.rb +222 -0
- data/handlers/tab_repos.rb +277 -0
- data/handlers/tab_state.rb +571 -0
- data/handlers/tab_tags.rb +224 -0
- data/handlers/tray.rb +128 -0
- data/handlers/workspace.rb +547 -0
- data/javafx_test.rb +81 -0
- data/lib/global.rb +56 -0
- data/lib/log_helper.rb +40 -0
- data/lib/store.rb +152 -0
- data/lib/version.rb +21 -0
- data/res/accept.png +0 -0
- data/res/cross.png +0 -0
- data/res/tick.png +0 -0
- data/res/version-control.png +0 -0
- data/res/warn.png +0 -0
- data/res/world.png +0 -0
- metadata +156 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
# Copyright (C) 2020 Chris Liaw <chrisliaw@antrapol.com>
|
2
|
+
# Author: Chris Liaw <chrisliaw@antrapol.com>
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
module GvcsFx
|
20
|
+
module Listener
|
21
|
+
|
22
|
+
Event = {
|
23
|
+
workspace_added: :workspace_added,
|
24
|
+
workspace_selection_changed: :workspace_selection_changed
|
25
|
+
}
|
26
|
+
|
27
|
+
def register(event, proctal)
|
28
|
+
if not is_event_listed?(event)
|
29
|
+
event_listeners[event] = []
|
30
|
+
end
|
31
|
+
|
32
|
+
event_listeners[event] << proctal
|
33
|
+
end
|
34
|
+
|
35
|
+
def deregister(event,proctal)
|
36
|
+
event_listeners[event].delete(proctal)
|
37
|
+
end
|
38
|
+
|
39
|
+
def raise_event(event, opts = { })
|
40
|
+
event_listeners[event].each do |hdl|
|
41
|
+
hdl.call(opts)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
def event_listeners
|
47
|
+
if @eventListener.nil?
|
48
|
+
@eventListener = { }
|
49
|
+
end
|
50
|
+
|
51
|
+
@eventListener
|
52
|
+
end
|
53
|
+
|
54
|
+
def is_event_listed?(evt)
|
55
|
+
event_listeners.keys.include?(evt)
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,191 @@
|
|
1
|
+
# Copyright (C) 2020 Chris Liaw <chrisliaw@antrapol.com>
|
2
|
+
# Author: Chris Liaw <chrisliaw@antrapol.com>
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
|
18
|
+
require 'toolrack'
|
19
|
+
|
20
|
+
require 'gvcs'
|
21
|
+
require 'git_cli'
|
22
|
+
|
23
|
+
require_relative 'fx_alert'
|
24
|
+
|
25
|
+
require_relative "workspace"
|
26
|
+
require_relative "tab_state"
|
27
|
+
require_relative "tab_files"
|
28
|
+
require_relative "tab_branches"
|
29
|
+
require_relative "tab_tags"
|
30
|
+
require_relative "tab_repos"
|
31
|
+
require_relative "tab_logs"
|
32
|
+
require_relative "tab_ignore_rules"
|
33
|
+
|
34
|
+
require_relative "listener"
|
35
|
+
require_relative "notification"
|
36
|
+
require_relative "event_handler"
|
37
|
+
|
38
|
+
require_relative '../lib/log_helper'
|
39
|
+
|
40
|
+
require_relative 'add_workspace_controller'
|
41
|
+
require_relative 'stash_select_controller'
|
42
|
+
|
43
|
+
module GvcsFx
|
44
|
+
class MainWinController
|
45
|
+
include JRubyFX::Controller
|
46
|
+
fxml "main.fxml"
|
47
|
+
|
48
|
+
include Antrapol::ToolRack::ExceptionUtils
|
49
|
+
include GvcsFx::LogHelper
|
50
|
+
include GvcsFx::FxAlert
|
51
|
+
|
52
|
+
include GvcsFx::Workspace
|
53
|
+
include GvcsFx::TabState
|
54
|
+
include GvcsFx::TabFiles
|
55
|
+
include GvcsFx::TabBranches
|
56
|
+
include GvcsFx::TabTags
|
57
|
+
include GvcsFx::TabRepos
|
58
|
+
include GvcsFx::TabLogs
|
59
|
+
include GvcsFx::TabIgnoreRules
|
60
|
+
|
61
|
+
include GvcsFx::Listener
|
62
|
+
include GvcsFx::EventHandler
|
63
|
+
|
64
|
+
include GvcsFx::Notification
|
65
|
+
|
66
|
+
|
67
|
+
def initialize
|
68
|
+
|
69
|
+
@lblVersion.text = "v#{GvcsFx::VERSION}"
|
70
|
+
|
71
|
+
# sequence here is important
|
72
|
+
install_handler
|
73
|
+
init_tblWorkspace
|
74
|
+
init_tab_state
|
75
|
+
init_tab_logs
|
76
|
+
init_tab_ignore_rules
|
77
|
+
|
78
|
+
init_tab_repos
|
79
|
+
init_tab_branches
|
80
|
+
init_tab_tags
|
81
|
+
|
82
|
+
# hide the other not yet completed tab
|
83
|
+
@tabPnlDetails.tabs.remove(@tabWsFiles)
|
84
|
+
@tabPnlDetails.tabs.remove(@tabWsConflict)
|
85
|
+
@tabPnlDetails.tabs.remove(@tabWsAction)
|
86
|
+
@tabPnlDetails.tabs.remove(@tabWsConfig)
|
87
|
+
|
88
|
+
show_landing
|
89
|
+
end
|
90
|
+
|
91
|
+
def winclose
|
92
|
+
@butClose.scene.window.close
|
93
|
+
#p @butClose.scene.window
|
94
|
+
#@butClose.scene.window.hide
|
95
|
+
end
|
96
|
+
|
97
|
+
def main_stage
|
98
|
+
if @mstage.nil?
|
99
|
+
@mstage = @butClose.scene.window
|
100
|
+
end
|
101
|
+
@mstage
|
102
|
+
end
|
103
|
+
|
104
|
+
def workspace_tab_changed(evt)
|
105
|
+
#p evt.methods.sort
|
106
|
+
#p evt.source
|
107
|
+
##p evt.source.methods.sort
|
108
|
+
#p evt.source.text
|
109
|
+
#p evt.target
|
110
|
+
##p evt.target.methods.sort
|
111
|
+
#p evt.target.text
|
112
|
+
|
113
|
+
javafx.application.Platform.run_later do
|
114
|
+
|
115
|
+
# only update whatever tab that is visible right now
|
116
|
+
if evt.target.text == "State"
|
117
|
+
refresh_tab_state
|
118
|
+
elsif evt.target.text == "Logs"
|
119
|
+
refresh_tab_logs
|
120
|
+
elsif evt.target.text == "Ignore Rules"
|
121
|
+
refresh_tab_ignore_rules
|
122
|
+
elsif evt.target.text == "Branches"
|
123
|
+
refresh_tab_branches
|
124
|
+
elsif evt.target.text == "Tags"
|
125
|
+
refresh_tab_tags
|
126
|
+
elsif evt.target.text == "Repository"
|
127
|
+
refresh_tab_repos
|
128
|
+
end
|
129
|
+
|
130
|
+
reset_gmsg
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# refresh the whole bottom tabs
|
135
|
+
def refresh_details
|
136
|
+
|
137
|
+
currTab = @tabPnlDetails.selection_model.selected_item
|
138
|
+
case currTab.text
|
139
|
+
when "State"
|
140
|
+
refresh_tab_state
|
141
|
+
when "Logs"
|
142
|
+
refresh_tab_logs
|
143
|
+
when "Ignore Rules"
|
144
|
+
refresh_tab_ignore_rules
|
145
|
+
when "Branches"
|
146
|
+
refresh_tab_branches
|
147
|
+
when "Tags"
|
148
|
+
refresh_tab_tags
|
149
|
+
when "Repository"
|
150
|
+
refresh_tab_repos
|
151
|
+
end
|
152
|
+
|
153
|
+
reset_gmsg
|
154
|
+
|
155
|
+
# refresh state
|
156
|
+
# refresh branch
|
157
|
+
# refresh tags
|
158
|
+
# refresh log
|
159
|
+
# refresh files
|
160
|
+
# refresh repos
|
161
|
+
end
|
162
|
+
|
163
|
+
def rescue_exception(&block)
|
164
|
+
begin
|
165
|
+
yield
|
166
|
+
rescue Exception => ex
|
167
|
+
raise GvcsFxException, ex
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
def inside_jar?
|
172
|
+
File.dirname(__FILE__)[0..3] == "uri:"
|
173
|
+
end
|
174
|
+
|
175
|
+
def show_content_win(stageTitle, dlgTitle, content, parent = nil)
|
176
|
+
|
177
|
+
javafx.application.Platform.run_later do
|
178
|
+
stage = javafx.stage.Stage.new
|
179
|
+
stage.title = stageTitle
|
180
|
+
stage.initModality(javafx.stage.Modality::WINDOW_MODAL)
|
181
|
+
stage.initOwner(parent) if not parent.nil?
|
182
|
+
dlg = ShowTextController.load_into(stage)
|
183
|
+
dlg.set_title(dlgTitle)
|
184
|
+
dlg.set_content(content)
|
185
|
+
stage.showAndWait
|
186
|
+
end # run_later
|
187
|
+
|
188
|
+
end
|
189
|
+
|
190
|
+
end
|
191
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# Copyright (C) 2020 Chris Liaw <chrisliaw@antrapol.com>
|
2
|
+
# Author: Chris Liaw <chrisliaw@antrapol.com>
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
|
18
|
+
module GvcsFx
|
19
|
+
module Notification
|
20
|
+
|
21
|
+
def prompt_error(str, title = "GVCS Error", stage = main_stage)
|
22
|
+
set_err_gmsg(str)
|
23
|
+
fx_alert_error(str, title, stage)
|
24
|
+
log_error(str)
|
25
|
+
end
|
26
|
+
def prompt_info(str, title = "GVCS Info", stage = main_stage)
|
27
|
+
set_info_gmsg(str)
|
28
|
+
fx_alert_info(str, title, stage)
|
29
|
+
end
|
30
|
+
def prompt_warn(str, title = "GVCS Warning", stage = main_stage)
|
31
|
+
set_warn_gmsg(str)
|
32
|
+
fx_alert_warn(str, title, stage)
|
33
|
+
log_warn(str)
|
34
|
+
end
|
35
|
+
|
36
|
+
def reset_gmsg
|
37
|
+
@imgGmsg.image = nil
|
38
|
+
@lblGlobalMsg.text = ""
|
39
|
+
end
|
40
|
+
|
41
|
+
def set_success_gmsg(str)
|
42
|
+
set_gmsg(str, :success)
|
43
|
+
end
|
44
|
+
def set_info_gmsg(str)
|
45
|
+
set_gmsg(str, :info)
|
46
|
+
end
|
47
|
+
def set_err_gmsg(str)
|
48
|
+
set_gmsg(str,:err)
|
49
|
+
end
|
50
|
+
def set_warn_gmsg(str)
|
51
|
+
set_gmsg(str, :warn)
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
def set_gmsg(str, type = :info)
|
56
|
+
case type
|
57
|
+
when :err
|
58
|
+
@imgGmsg.setImage(load_image(:err))
|
59
|
+
when :warn
|
60
|
+
@imgGmsg.setImage(load_image(:warn))
|
61
|
+
when :success
|
62
|
+
@imgGmsg.setImage(load_image(:success))
|
63
|
+
else
|
64
|
+
@imgGmsg.setImage(load_image(:info))
|
65
|
+
end
|
66
|
+
@lblGlobalMsg.text = str
|
67
|
+
|
68
|
+
end # set_gmsg
|
69
|
+
|
70
|
+
def load_image(type)
|
71
|
+
case type
|
72
|
+
when :err
|
73
|
+
if @errImg.nil?
|
74
|
+
if inside_jar?
|
75
|
+
@errImg = javafx.scene.image.Image.new(java.lang.Object.new.java_class.resource("/gvcsfx/res/cross.png").to_s)
|
76
|
+
else
|
77
|
+
@errImg = javafx.scene.image.Image.new("res/cross.png")
|
78
|
+
end
|
79
|
+
end
|
80
|
+
@errImg
|
81
|
+
when :warn
|
82
|
+
if @warnImg.nil?
|
83
|
+
if inside_jar?
|
84
|
+
@warnImg = javafx.scene.image.Image.new(java.lang.Object.new.java_class.resource("/gvcsfx/res/warn.png").to_s)
|
85
|
+
else
|
86
|
+
@warnImg = javafx.scene.image.Image.new("res/warn.png")
|
87
|
+
end
|
88
|
+
end
|
89
|
+
@warnImg
|
90
|
+
when :success
|
91
|
+
if @sucImg.nil?
|
92
|
+
if inside_jar?
|
93
|
+
@sucImg = javafx.scene.image.Image.new(java.lang.Object.new.java_class.resource("/gvcsfx/res/tick.png").to_s)
|
94
|
+
else
|
95
|
+
@sucImg = javafx.scene.image.Image.new("res/tick.png")
|
96
|
+
end
|
97
|
+
end
|
98
|
+
@sucImg
|
99
|
+
else
|
100
|
+
if @infoImg.nil?
|
101
|
+
if inside_jar?
|
102
|
+
@infoImg = javafx.scene.image.Image.new(java.lang.Object.new.java_class.resource("/gvcsfx/res/world.png").to_s)
|
103
|
+
else
|
104
|
+
@infoImg = javafx.scene.image.Image.new("res/world.png")
|
105
|
+
end
|
106
|
+
end
|
107
|
+
@infoImg
|
108
|
+
end
|
109
|
+
end # load_image
|
110
|
+
|
111
|
+
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright (C) 2020 Chris Liaw <chrisliaw@antrapol.com>
|
2
|
+
# Author: Chris Liaw <chrisliaw@antrapol.com>
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
module GvcsFx
|
21
|
+
class ShowTextController
|
22
|
+
include JRubyFX::Controller
|
23
|
+
fxml "show_text.fxml"
|
24
|
+
|
25
|
+
def set_title(str)
|
26
|
+
@lblHeader.text = str
|
27
|
+
end
|
28
|
+
|
29
|
+
def set_content(cnt)
|
30
|
+
@txtContent.text = cnt
|
31
|
+
end
|
32
|
+
|
33
|
+
def win_close
|
34
|
+
@butClose.scene.window.close
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# Copyright (C) 2020 Chris Liaw <chrisliaw@antrapol.com>
|
2
|
+
# Author: Chris Liaw <chrisliaw@antrapol.com>
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
|
18
|
+
require_relative 'fx_alert'
|
19
|
+
|
20
|
+
module GvcsFx
|
21
|
+
|
22
|
+
class CmbOption
|
23
|
+
attr_accessor :key, :string
|
24
|
+
def initialize(key, str)
|
25
|
+
@key = key
|
26
|
+
@string = str
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_s
|
30
|
+
"#{@key} - #{@string}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
class StashSelectController
|
36
|
+
include JRubyFX::Controller
|
37
|
+
include Antrapol::ToolRack::ExceptionUtils
|
38
|
+
include GvcsFx::FxAlert
|
39
|
+
|
40
|
+
fxml "stash_select.fxml"
|
41
|
+
|
42
|
+
attr_reader :result
|
43
|
+
|
44
|
+
def initialize
|
45
|
+
@result = []
|
46
|
+
end
|
47
|
+
|
48
|
+
def options=(val)
|
49
|
+
if not_empty?(val)
|
50
|
+
if val.is_a?(Array)
|
51
|
+
@cmbOptions.items.add_all(val)
|
52
|
+
elsif val.is_a?(Hash)
|
53
|
+
dat = []
|
54
|
+
val.each do |k,v|
|
55
|
+
dat << CmbOption.new(k,v[1].strip)
|
56
|
+
end
|
57
|
+
@cmbOptions.items.add_all(dat)
|
58
|
+
else
|
59
|
+
@cmbOptions.items.add(val)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def win_close(evt)
|
65
|
+
@result << false
|
66
|
+
@butCancel.scene.window.close
|
67
|
+
end
|
68
|
+
|
69
|
+
def butOk_onAction(evt)
|
70
|
+
br = @txtNewBranch.text
|
71
|
+
sel = @cmbOptions.selection_model.selected_item
|
72
|
+
if not_empty?(br) and not_empty?(sel)
|
73
|
+
@result << true
|
74
|
+
@result << sel
|
75
|
+
@result << br
|
76
|
+
|
77
|
+
@butCancel.scene.window.close
|
78
|
+
elsif is_empty?(sel)
|
79
|
+
fx_alert_error("Stash selection cannot be empty. Please try again", "Empty Stash Selection", @butCancel.scene.window)
|
80
|
+
elsif is_empty?(br)
|
81
|
+
fx_alert_error("Branch name cannot be empty. Please try again", "Empty Branch Name", @butCancel.scene.window)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|