• R/O
  • SSH
  • HTTPS

コミット

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonbathyscaphephpgamewindowsguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

OmegaT の翻訳状況(Statistics)を Excel で表示します。


コミットメタ情報

リビジョン2 (tree)
日時2013-12-01 01:20:28
作者yu-tang

ログメッセージ

Change template files name

変更サマリ

差分

--- src/jp/sourceforge/users/yutang/omegat/plugin/stats2excel/ExcelModel.java (revision 1)
+++ src/jp/sourceforge/users/yutang/omegat/plugin/stats2excel/ExcelModel.java (revision 2)
@@ -36,8 +36,8 @@
3636 public class ExcelModel {
3737 private static final String CONFIG_DIR_NAME = "stats2excel";
3838 private static final String WSF_NAME = "Stats2Excel.wsf";
39- private static final String LEGACY_TEMPLATE_NAME = "Template.xlt";
40- private static final String TEMPLATE_NAME = "Template.xltx";
39+ private static final String LEGACY_STANDARD_TEMPLATE_NAME = "StandardTemplate.xlt";
40+ private static final String STANDARD_TEMPLATE_NAME = "StandardTemplate.xltx";
4141 private static final String TXT_NAME = "Stats2Excel.txt";
4242 private static final File _wsf;
4343 private static final File _txt;
@@ -141,8 +141,8 @@
141141 }
142142
143143 String templateName = installedExcelVersion >= 12 ?
144- TEMPLATE_NAME : // Excel 2007 or later
145- LEGACY_TEMPLATE_NAME; // Excel 2003 or earlier
144+ STANDARD_TEMPLATE_NAME : // Excel 2007 or later
145+ LEGACY_STANDARD_TEMPLATE_NAME; // Excel 2003 or earlier
146146 File template = new File(parent, templateName);
147147
148148 if (! template.exists()) {
@@ -195,7 +195,7 @@
195195 return _txt;
196196 }
197197
198- private static boolean activate() throws IOException, InterruptedException {
198+ public static boolean activate() throws IOException, InterruptedException {
199199 final Command command = new Command();
200200 final String job = "activate";
201201 final int ret = command.execWSF(job, windowTitle);
--- src/jp/sourceforge/users/yutang/omegat/plugin/stats2excel/SplashStatisticsWindow.java (revision 1)
+++ src/jp/sourceforge/users/yutang/omegat/plugin/stats2excel/SplashStatisticsWindow.java (revision 2)
@@ -16,6 +16,12 @@
1616
1717 package jp.sourceforge.users.yutang.omegat.plugin.stats2excel;
1818
19+import java.awt.event.WindowAdapter;
20+import java.awt.event.WindowEvent;
21+import java.io.IOException;
22+import java.util.concurrent.Executors;
23+import java.util.concurrent.ScheduledExecutorService;
24+import java.util.concurrent.TimeUnit;
1925 import org.omegat.gui.stat.StatisticsWindow;
2026 import org.omegat.util.Log;
2127 import org.omegat.util.StaticUtils;
@@ -26,8 +32,23 @@
2632 */
2733 public class SplashStatisticsWindow extends StatisticsWindow {
2834
35+ private ScheduledExecutorService service = null;
36+ private boolean isErrorOnDisplay = false;
37+
2938 public SplashStatisticsWindow(STAT_TYPE statType) {
3039 super(statType);
40+
41+ this.addWindowListener(new WindowAdapter() {
42+
43+ @Override
44+ public void windowClosing(WindowEvent e) {
45+ if (service != null && !service.isShutdown()) {
46+ service.shutdown();
47+ service = null;
48+ }
49+ }
50+
51+ });
3152 setSize(400, 100);
3253 }
3354
@@ -38,7 +59,7 @@
3859 throw new Exception("Error: Statistcs result is empty.");
3960 }
4061
41- super.displayData(L10n.getProgressMsgLaunchingExcel());
62+ setText(L10n.getProgressMsgLaunchingExcel());
4263
4364 String title = StaticUtils.format(
4465 L10n.getExcelWindowTitle(),
@@ -46,14 +67,46 @@
4667 ExcelModel.setWindowTitle(title);
4768 ExcelModel.display(result);
4869 } catch (Exception ex) {
70+ isErrorOnDisplay = true;
4971 Log.log(ex);
50- super.displayData(ex.getMessage());
72+ setText(ex.getMessage());
5173 }
5274 }
5375
5476 @Override
5577 public void finishData() {
56- dispose();
78+ if (isErrorOnDisplay) {
79+ return;
80+ }
81+
82+ service = Executors.newSingleThreadScheduledExecutor();
83+
84+ service.scheduleWithFixedDelay(new Runnable() {
85+
86+ @Override
87+ public void run() {
88+ try {
89+ if (ExcelModel.activate()) {
90+ service.shutdown();
91+ service = null;
92+ dispose();
93+ }
94+ } catch (IOException ex) {
95+ Log.log(ex);
96+ setText(ex.getLocalizedMessage());
97+ service.shutdown();
98+ service =null;
99+ } catch (InterruptedException ex) {
100+ Log.log(ex);
101+ setText(ex.getLocalizedMessage());
102+ service.shutdown();
103+ service =null;
104+ }
105+ }
106+ }, 0, 500, TimeUnit.MILLISECONDS);
57107 }
58108
109+ private void setText(String text) {
110+ super.displayData(text);
111+ }
59112 }