From b642c396c7a1c2a179bf26d0d57a15424bbaeeaf Mon Sep 17 00:00:00 2001 From: eyck Date: Wed, 28 Oct 2020 13:32:17 +0100 Subject: [PATCH] add reload menu and toolbar item --- .../Application.e4xmi | 8 +++- .../icons/database_refresh.png | Bin 0 -> 770 bytes .../application/handlers/ReloadHandler.java | 42 ++++++++++++++++++ .../e4/application/parts/WaveformViewer.java | 24 +++++++--- 4 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 plugins/com.minres.scviewer.e4.application/icons/database_refresh.png create mode 100644 plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/ReloadHandler.java diff --git a/plugins/com.minres.scviewer.e4.application/Application.e4xmi b/plugins/com.minres.scviewer.e4.application/Application.e4xmi index 81fadd5..0822bbe 100644 --- a/plugins/com.minres.scviewer.e4.application/Application.e4xmi +++ b/plugins/com.minres.scviewer.e4.application/Application.e4xmi @@ -11,7 +11,8 @@ - + + @@ -58,7 +59,8 @@ - + + @@ -133,6 +135,7 @@ + type:user @@ -264,6 +267,7 @@ + diff --git a/plugins/com.minres.scviewer.e4.application/icons/database_refresh.png b/plugins/com.minres.scviewer.e4.application/icons/database_refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..ff803be124ac5f1bd747490d2243f876eebdf5f6 GIT binary patch literal 770 zcmV+d1O5DoP)L1E-$)@F1-w)3&R|k zpe8{Z8<~c8GL+Q$?>DkG77MrB>ib*oIq``rr5B#_9^P}_=lwfJ$Ye4I1OislR|zeK zVbqYWCeYUSM0$zz3qqi|xmm|wBKZCO<8;X*Nm5-|Ss83L8wv^vz=$_CHjqpv5e|nD zi^V>Y?WWu9Ue99i`F!tXS!UrfyNRl*nP4!OdF<_2YxlP1Fme+XT27Rfmg0ZnbUKmN zQchLT0^98(MdnP?)6=lq?HnZ~C0I!=;+^~kYsqD3nhs6X;Vdi{?VA1UEzfmtU&~-q z7JwZi{gIM{t3{_E4UR1%)L*WJg$bH{MmVw30fE`e?I2IEj?l`hAghYH3 zt$W+>w6P28pTBBza%f!nsWhE`b~-<+1YOrT3B$cZ4>?gZ8b$I)lH1swJjJS$^EqF~ zm_fejtPITPCdn3|s^RUIA%3SpXiSi^{?8N`Oh=PY(SA|m3=BsGkWx0eT~QP?b~cPr zKhDrN8M!R7Nbz_a^b+|5(&_XcW=k#xvLap&a?YNRF|tvD>5s;|fF{5;0S zC%l5k;M1&07*qoM6N<$f state) { + loadDatabase(state, 1000L); + } + + protected void loadDatabase(final Map state, long delay) { fileMonitor.removeFileChangeListener(this); Job job = new Job(Messages.WaveformViewer_15) { @Override @@ -619,8 +623,9 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis return result; } }; + job.setName("Load Database"); job.setSystem(true); - job.schedule(1000L); // let the UI initialize so that we have a progress monitor + job.schedule(delay); // let the UI initialize so that we have a progress monitor } /* (non-Javadoc) @@ -634,18 +639,23 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis public void run() { if (MessageDialog.openQuestion(display.getActiveShell(), Messages.WaveformViewer_17, Messages.WaveformViewer_18)) { - Map state = new HashMap<>(); - saveWaveformViewerState(state); - waveformPane.getStreamList().clear(); - database.clear(); - if (filesToLoad.size() > 0) - loadDatabase(state); + reloadDatabase(); } } + }); fileMonitor.removeFileChangeListener(this); } + public void reloadDatabase() { + Map state = new HashMap<>(); + saveWaveformViewerState(state); + waveformPane.getStreamList().clear(); + database.clear(); + if (filesToLoad.size() > 0) + loadDatabase(state, 0L); + } + /** * Sets the part input. *