OmegaT の背景に画像を表示します。
エディターに2つあるモード(インスタントスタートと翻訳文書)を透過的に管理する仕組みを導入
| @@ -76,7 +76,7 @@ | ||
| 76 | 76 | Map map = new HashMap<String, Parts>(); |
| 77 | 77 | |
| 78 | 78 | // MoeUI.Parts enum |
| 79 | - for (Parts part: Parts.values()) { | |
| 79 | + for (Parts part: Parts.configullables()) { | |
| 80 | 80 | map.put(part.name(), part); |
| 81 | 81 | } |
| 82 | 82 |
| @@ -30,6 +30,7 @@ | ||
| 30 | 30 | import java.awt.Graphics; |
| 31 | 31 | import java.awt.SystemColor; |
| 32 | 32 | import java.awt.image.BufferedImage; |
| 33 | +import java.util.ArrayList; | |
| 33 | 34 | import java.util.EnumMap; |
| 34 | 35 | import java.util.EnumSet; |
| 35 | 36 | import java.util.Map; |
| @@ -82,7 +83,17 @@ | ||
| 82 | 83 | MenuBar, StatusBar, ButtonPanel, PaneTitleBar, |
| 83 | 84 | // Built-in panes |
| 84 | 85 | EDITOR, MATCHES, GLOSSARY, NOTES, COMMENTS, MACHINE_TRANSLATE, |
| 85 | - DICTIONARY, MULTIPLE_TRANS | |
| 86 | + DICTIONARY, MULTIPLE_TRANS, | |
| 87 | + // INSTANT_START (Another view of EDITOR) | |
| 88 | + INSTANT_START; | |
| 89 | + | |
| 90 | + public static Parts[] configullables() { | |
| 91 | + Parts[] values = Parts.values(); | |
| 92 | + int length = values.length - 1; // leave INSTANT_START out | |
| 93 | + Parts[] ret = new Parts[length]; | |
| 94 | + System.arraycopy(values, 0, ret, 0, length); | |
| 95 | + return ret; | |
| 96 | + } | |
| 86 | 97 | } |
| 87 | 98 | |
| 88 | 99 | static { |
| @@ -114,18 +125,13 @@ | ||
| 114 | 125 | UIThreadsUtil.mustBeSwingThread(); |
| 115 | 126 | |
| 116 | 127 | if (target == Parts.MainWindow) { |
| 117 | - MoeRootPaneUI ui; | |
| 118 | - if (uis.containsKey(target)) { | |
| 119 | - ui = (MoeRootPaneUI) uis.get(target); | |
| 120 | - } else { | |
| 121 | - ui = new MoeRootPaneUI(); | |
| 122 | - rootPane.setUI(ui); | |
| 123 | - } | |
| 124 | - ui.setBackgroundImage(image); | |
| 125 | - uis.put(target, ui); | |
| 128 | + getRootPaneUI().setBackgroundImage(image); | |
| 126 | 129 | |
| 127 | 130 | } else if (target.compareTo(Parts.EDITOR) >= 0) { |
| 128 | 131 | getTextPaneUI(target).setBackgroundImage(image); |
| 132 | + if (target == Parts.EDITOR) { | |
| 133 | + getTextPaneUI(Parts.INSTANT_START).setBackgroundImage(image); | |
| 134 | + } | |
| 129 | 135 | } |
| 130 | 136 | } |
| 131 | 137 |
| @@ -133,18 +139,13 @@ | ||
| 133 | 139 | UIThreadsUtil.mustBeSwingThread(); |
| 134 | 140 | |
| 135 | 141 | if (target == Parts.MainWindow) { |
| 136 | - MoeRootPaneUI ui; | |
| 137 | - if (uis.containsKey(target)) { | |
| 138 | - ui = (MoeRootPaneUI) uis.get(target); | |
| 139 | - } else { | |
| 140 | - ui = new MoeRootPaneUI(); | |
| 141 | - rootPane.setUI(ui); | |
| 142 | - } | |
| 143 | - ui.setBackgroundColor(color); | |
| 144 | - uis.put(target, ui); | |
| 142 | + getRootPaneUI().setBackgroundColor(color); | |
| 145 | 143 | |
| 146 | 144 | } else if (target.compareTo(Parts.EDITOR) >= 0) { |
| 147 | 145 | getTextPaneUI(target).setBackgroundColor(color); |
| 146 | + if (target == Parts.EDITOR) { | |
| 147 | + getTextPaneUI(Parts.INSTANT_START).setBackgroundColor(color); | |
| 148 | + } | |
| 148 | 149 | } |
| 149 | 150 | } |
| 150 | 151 |
| @@ -152,15 +153,7 @@ | ||
| 152 | 153 | UIThreadsUtil.mustBeSwingThread(); |
| 153 | 154 | |
| 154 | 155 | if (target == Parts.MainWindow) { |
| 155 | - MoeRootPaneUI ui; | |
| 156 | - if (uis.containsKey(target)) { | |
| 157 | - ui = (MoeRootPaneUI) uis.get(target); | |
| 158 | - } else { | |
| 159 | - ui = new MoeRootPaneUI(); | |
| 160 | - rootPane.setUI(ui); | |
| 161 | - } | |
| 162 | - ui.setOpacity(opacity); | |
| 163 | - uis.put(target, ui); | |
| 156 | + getRootPaneUI().setOpacity(opacity); | |
| 164 | 157 | |
| 165 | 158 | } else { |
| 166 | 159 | // noop |
| @@ -186,7 +179,7 @@ | ||
| 186 | 179 | |
| 187 | 180 | case EDITOR: |
| 188 | 181 | UIThreadsUtil.mustBeSwingThread(); |
| 189 | - transparentInstantStart(desktop); | |
| 182 | + removeInstantStartBgColor(); | |
| 190 | 183 | |
| 191 | 184 | // エディター(インスタントスタートではない方) ペインに個別に |
| 192 | 185 | // 背景を設定するためには、結局プロジェクトのロード時に現在の |
| @@ -194,16 +187,19 @@ | ||
| 194 | 187 | // この行が実行される時点では、インスタントスタートと編集画面の |
| 195 | 188 | // どちらのモードか不明なので、いったん編集画面の設定を試みて、 |
| 196 | 189 | // 失敗したらプロジェクトのロード時に再試行するクロージャを投げる。 |
| 197 | - final JEditorPane editor = getJEditorPaneFromEditor(desktop); | |
| 198 | - final MoeTextPaneUI ui = getTextPaneUI(Parts.EDITOR); | |
| 199 | - if (editor == null || editor instanceof javax.swing.JTextPane) { | |
| 190 | + final JEditorPane editor = getJEditorPaneFromEditorView(); | |
| 191 | + final MoeTextPaneUI sourceUI = getTextPaneUI(Parts.INSTANT_START); | |
| 192 | + if (editor == null) { | |
| 200 | 193 | // Editor is not available yet. Wait for project open event. |
| 201 | - EditorUIRunner editorUIRunner = new EditorUIRunner(); | |
| 202 | - editorUIRunner.setBackgroundImage(ui.getBackgroundImage()); | |
| 203 | - editorUIRunner.setBackgroundColor(ui.getBackgroundColor()); | |
| 194 | + DocumentEditorUIRunner editorUIRunner = new DocumentEditorUIRunner(); | |
| 195 | + editorUIRunner.setBackgroundImage(sourceUI.getBackgroundImage()); | |
| 196 | + editorUIRunner.setBackgroundColor(sourceUI.getBackgroundColor()); | |
| 204 | 197 | CoreEvents.registerProjectChangeListener(editorUIRunner); |
| 205 | 198 | } else { |
| 206 | 199 | // Editor is found. Set UI and migrate highlighter. |
| 200 | + MoeTextPaneUI ui = getTextPaneUI(Parts.EDITOR); | |
| 201 | + ui.setBackgroundImage(sourceUI.getBackgroundImage()); | |
| 202 | + ui.setBackgroundColor(sourceUI.getBackgroundColor()); | |
| 207 | 203 | Highlighter h = editor.getHighlighter(); // save old highlighter |
| 208 | 204 | editor.setUI(ui); |
| 209 | 205 | editor.setHighlighter(h); // restore highlighter |
| @@ -225,7 +221,7 @@ | ||
| 225 | 221 | ui.setMarginTop(marginTop); |
| 226 | 222 | } |
| 227 | 223 | transparentRecursive(contentPane); |
| 228 | - transparentInstantStart(desktop); | |
| 224 | + removeInstantStartBgColor(); | |
| 229 | 225 | |
| 230 | 226 | // try to make transparent editor pane |
| 231 | 227 | //@@TODO エディターが除外パーツになっている場合を考慮 |
| @@ -241,6 +237,7 @@ | ||
| 241 | 237 | |
| 242 | 238 | @Override |
| 243 | 239 | public void onProjectChanged(PROJECT_CHANGE_TYPE eventType) { |
| 240 | + //@@TODO Runnerに移行 | |
| 244 | 241 | switch (eventType) { |
| 245 | 242 | case CREATE: |
| 246 | 243 | case LOAD: |
| @@ -264,21 +261,21 @@ | ||
| 264 | 261 | } |
| 265 | 262 | |
| 266 | 263 | private int getDockViewTitleBarHeight(DockingDesktop desktop) { |
| 267 | - Dockable dockable = null; | |
| 268 | - for (DockableState d: desktop.getDockables()) { | |
| 269 | - if (!isDockableIconized(d)) { | |
| 270 | - dockable = d.getDockable(); | |
| 271 | - break; | |
| 272 | - } | |
| 273 | - } | |
| 264 | + ArrayList<Dockable> dockables = desktop.getContext() | |
| 265 | + .getDockablesByState(desktop, DockableState.STATE_DOCKED); | |
| 266 | + if (!dockables.isEmpty()) { | |
| 267 | + Dockable dockable = dockables.get(0); | |
| 274 | 268 | |
| 275 | - // DockView | |
| 276 | - Container container = dockable.getComponent().getParent(); | |
| 277 | - DockView view = (DockView) container; | |
| 269 | + // DockView | |
| 270 | + Container container = dockable.getComponent().getParent(); | |
| 271 | + DockView view = (DockView) container; | |
| 278 | 272 | |
| 279 | - // TitleBar | |
| 280 | - DockViewTitleBar titleBar = view.getTitleBar(); | |
| 281 | - return titleBar.getHeight(); | |
| 273 | + // TitleBar | |
| 274 | + DockViewTitleBar titleBar = view.getTitleBar(); | |
| 275 | + return titleBar.getHeight(); | |
| 276 | + } else { | |
| 277 | + return 0; | |
| 278 | + } | |
| 282 | 279 | } |
| 283 | 280 | |
| 284 | 281 | private boolean transparentEditor() { |
| @@ -294,8 +291,8 @@ | ||
| 294 | 291 | |
| 295 | 292 | UIThreadsUtil.mustBeSwingThread(); |
| 296 | 293 | |
| 297 | - JEditorPane editor = getJEditorPaneFromEditor(desktop); | |
| 298 | - if (editor == null || editor instanceof javax.swing.JTextPane) { | |
| 294 | + JEditorPane editor = getJEditorPaneFromEditorView(); | |
| 295 | + if (editor == null) { | |
| 299 | 296 | return false; |
| 300 | 297 | } |
| 301 | 298 |
| @@ -309,58 +306,60 @@ | ||
| 309 | 306 | editor.setBackgroundImage(new Color( color.getRGB() & 0xffffff | 100 << 24, true)); |
| 310 | 307 | * */ |
| 311 | 308 | editor.setOpaque(false); |
| 309 | + isEditorTransparent = true; | |
| 312 | 310 | frame.repaint(); |
| 313 | 311 | return true; |
| 314 | 312 | } |
| 315 | 313 | |
| 316 | - private JEditorPane getJEditorPane(Parts pane) { | |
| 317 | -/* | |
| 318 | -dockable.getDockKey().getKey() | |
| 319 | - dockable.getComponent().class.name | |
| 320 | - dockable.getComponent().getViewport().getView().class.name | |
| 321 | -------------- | |
| 322 | -EDITOR | |
| 323 | - org.omegat.gui.main.DockablePanel | |
| 324 | -MATCHES | |
| 325 | - org.omegat.gui.main.DockableScrollPane | |
| 326 | - org.omegat.gui.matches.MatchesTextArea | |
| 327 | -GLOSSARY | |
| 328 | - org.omegat.gui.main.DockableScrollPane | |
| 329 | - org.omegat.gui.glossary.GlossaryTextArea | |
| 330 | -NOTES | |
| 331 | - org.omegat.gui.main.DockableScrollPane | |
| 332 | - org.omegat.gui.notes.NotesTextArea | |
| 333 | -COMMENTS | |
| 334 | - org.omegat.gui.main.DockableScrollPane | |
| 335 | - org.omegat.gui.comments.CommentsTextArea | |
| 336 | -MACHINE_TRANSLATE | |
| 337 | - org.omegat.gui.main.DockableScrollPane | |
| 338 | - org.omegat.gui.exttrans.MachineTranslateTextArea | |
| 339 | -DICTIONARY | |
| 340 | - org.omegat.gui.main.DockableScrollPane | |
| 341 | - org.omegat.gui.dictionaries.DictionariesTextArea | |
| 342 | -MULTIPLE_TRANS | |
| 343 | - org.omegat.gui.main.DockableScrollPane | |
| 344 | - org.omegat.gui.multtrans.MultipleTransPane | |
| 314 | + private JEditorPane getJEditorPane(Parts target) { | |
| 315 | + /* | |
| 316 | + dockable.getDockKey().getKey() | |
| 317 | + dockable.getComponent().class.name | |
| 318 | + dockable.getComponent().getViewport().getView().class.name | |
| 319 | + ------------- | |
| 320 | + EDITOR | |
| 321 | + org.omegat.gui.main.DockablePanel | |
| 322 | + MATCHES | |
| 323 | + org.omegat.gui.main.DockableScrollPane | |
| 324 | + org.omegat.gui.matches.MatchesTextArea | |
| 325 | + GLOSSARY | |
| 326 | + org.omegat.gui.main.DockableScrollPane | |
| 327 | + org.omegat.gui.glossary.GlossaryTextArea | |
| 328 | + NOTES | |
| 329 | + org.omegat.gui.main.DockableScrollPane | |
| 330 | + org.omegat.gui.notes.NotesTextArea | |
| 331 | + COMMENTS | |
| 332 | + org.omegat.gui.main.DockableScrollPane | |
| 333 | + org.omegat.gui.comments.CommentsTextArea | |
| 334 | + MACHINE_TRANSLATE | |
| 335 | + org.omegat.gui.main.DockableScrollPane | |
| 336 | + org.omegat.gui.exttrans.MachineTranslateTextArea | |
| 337 | + DICTIONARY | |
| 338 | + org.omegat.gui.main.DockableScrollPane | |
| 339 | + org.omegat.gui.dictionaries.DictionariesTextArea | |
| 340 | + MULTIPLE_TRANS | |
| 341 | + org.omegat.gui.main.DockableScrollPane | |
| 342 | + org.omegat.gui.multtrans.MultipleTransPane | |
| 345 | 343 | |
| 346 | - xxxTextArea は、基本的に全部 JEditorPane の拡張。 | |
| 347 | - MULTIPLE_TRANS も、同じ。 | |
| 348 | - EntryInfoThreadPane -> EntryInfoPane -> JTextPane -> JEditorPane という感じ。 | |
| 349 | - EDITOR だけちょっと特殊なので、分岐処理しておく。 | |
| 350 | -*/ | |
| 351 | - // エディターの場合 | |
| 352 | - if (pane == Parts.EDITOR) { | |
| 353 | - return getJEditorPaneFromEditor(desktop); | |
| 354 | - } else { | |
| 355 | - // エディター以外の場合 | |
| 356 | - final String PANE_NAME = pane.name(); | |
| 357 | - for (DockableState d: desktop.getDockables()) { | |
| 358 | - Dockable dockable = d.getDockable(); | |
| 359 | - if (dockable.getDockKey().getKey().equalsIgnoreCase(PANE_NAME)) { | |
| 344 | + xxxTextArea は、基本的に全部 JEditorPane の拡張。 | |
| 345 | + MULTIPLE_TRANS も、同じ。 | |
| 346 | + EntryInfoThreadPane -> EntryInfoPane -> JTextPane -> JEditorPane という感じ。 | |
| 347 | + EDITOR と INSTANT_START だけちょっと特殊なので、分岐処理しておく。 | |
| 348 | + */ | |
| 349 | + switch (target) { | |
| 350 | + case EDITOR: | |
| 351 | + return getJEditorPaneFromEditorView(); | |
| 352 | + case INSTANT_START: | |
| 353 | + return getJTextPaneFromInstantStartView(); | |
| 354 | + default: | |
| 355 | + // エディター以外の場合 | |
| 356 | + final String PANE_NAME = target.name(); | |
| 357 | + | |
| 358 | + Dockable dockable = desktop.getContext().getDockableByKey(PANE_NAME); | |
| 359 | + if (dockable != null) { | |
| 360 | 360 | JScrollPane sp = (JScrollPane) dockable.getComponent(); |
| 361 | - return (JTextPane) sp.getViewport().getView(); | |
| 362 | - } | |
| 363 | - } | |
| 361 | + return (JTextPane) sp.getViewport().getView(); | |
| 362 | + } | |
| 364 | 363 | } |
| 365 | 364 | return null; |
| 366 | 365 | } |
| @@ -427,23 +426,14 @@ | ||
| 427 | 426 | // + splitContainer(VERTICAL) <-- DockView.getParent() |
| 428 | 427 | // + DockView <-- Dockable.getParent() |
| 429 | 428 | // + Dockable <-- DockableState.getDockable() |
| 430 | - for (DockableState d : desktop.getDockables()) { | |
| 431 | - if (!isDockableIconized(d)) { | |
| 432 | - transparentRecursive(d); | |
| 433 | - } | |
| 429 | + ArrayList<Dockable> dockables = desktop.getContext() | |
| 430 | + .getDockablesByState(desktop, DockableState.STATE_DOCKED); | |
| 431 | + for (Dockable d : dockables) { | |
| 432 | + transparentRecursive(d); | |
| 434 | 433 | } |
| 435 | 434 | } |
| 436 | - private boolean isDockableIconized(DockableState dockableState) { | |
| 437 | - double width = dockableState.getPosition().getWidth(); | |
| 438 | 435 | |
| 439 | - // width (height や x, y でも可) が 0.0 以外の場合はアイコン化されている。 | |
| 440 | - // 他に適切な判定方法がありそうだけれども、分からなかったので、とりあえずこれで。 | |
| 441 | - return (width != 0.0); | |
| 442 | - } | |
| 443 | - | |
| 444 | - private void transparentRecursive(DockableState dockableState) { | |
| 445 | - Dockable dockable = dockableState.getDockable(); | |
| 446 | - | |
| 436 | + private void transparentRecursive(Dockable dockable) { | |
| 447 | 437 | // DockView |
| 448 | 438 | Container container = dockable.getComponent().getParent(); |
| 449 | 439 | DockView view = (DockView) container; |
| @@ -477,12 +467,12 @@ | ||
| 477 | 467 | } |
| 478 | 468 | } |
| 479 | 469 | |
| 480 | - private void transparentInstantStart(DockingDesktop desktop) { | |
| 470 | + private void removeInstantStartBgColor() { | |
| 481 | 471 | // お手軽スタートは、以下のような HTML で背景色が指定されている。 |
| 482 | 472 | // <body ... bgcolor="white" ...> |
| 483 | 473 | // そのため、コンポーネント自体を透過にしても、HTML Body 背景色の |
| 484 | 474 | // 白指定が効いて透過にならない。そこで、背景色指定を削除する。 |
| 485 | - JEditorPane ep = getJEditorPaneFromEditor(desktop); | |
| 475 | + JTextPane ep = getJTextPaneFromInstantStartView(); | |
| 486 | 476 | if (ep != null) { |
| 487 | 477 | ep.setText(ep.getText().replace(" bgcolor=\"white\"", "")); |
| 488 | 478 | ep.setCaretPosition(0); |
| @@ -539,30 +529,53 @@ | ||
| 539 | 529 | return panel == null ? null : (AutoHideButtonPanel) panel.getComponent(2); |
| 540 | 530 | } |
| 541 | 531 | |
| 542 | - private JEditorPane getJEditorPaneFromEditor(DockingDesktop desktop) { | |
| 543 | - for (DockableState d: desktop.getDockables()) { | |
| 544 | - Dockable dockable = d.getDockable(); | |
| 545 | - if (dockable.getDockKey().getKey().equals(Parts.EDITOR.name())) { | |
| 546 | - JScrollPane sp; | |
| 532 | + private JEditorPane getJEditorPaneFromEditorView() { | |
| 533 | + JEditorPane pane = getJEditorPaneFromEditor(); | |
| 534 | + return pane instanceof JTextPane ? null : pane; | |
| 535 | + | |
| 536 | + } | |
| 547 | 537 | |
| 548 | - // OmegaT 3.1.0 or later | |
| 549 | - if (dockable.getComponent() instanceof JPanel) { | |
| 550 | - // dockable.getComponent() => org.omegat.gui.main.DockablePanel | |
| 551 | - // extends JPanel implements Dockable | |
| 552 | - JPanel jp = (JPanel) dockable.getComponent(); | |
| 553 | - sp = (JScrollPane) jp.getComponent(0); | |
| 538 | + private JTextPane getJTextPaneFromInstantStartView() { | |
| 539 | + JEditorPane pane = getJEditorPaneFromEditor(); | |
| 540 | + return pane instanceof JTextPane ? (JTextPane) pane : null; | |
| 541 | + | |
| 542 | + } | |
| 554 | 543 | |
| 555 | - // less than OmegaT 3.1.0 | |
| 556 | - } else { | |
| 557 | - sp = (JScrollPane) dockable.getComponent(); | |
| 558 | - } | |
| 544 | + private JEditorPane getJEditorPaneFromEditor() { | |
| 545 | + Dockable dockable = desktop.getContext().getDockableByKey(Parts.EDITOR.name()); | |
| 546 | + if (dockable != null) { | |
| 547 | + JScrollPane sp; | |
| 559 | 548 | |
| 560 | - return (JEditorPane) sp.getViewport().getView(); | |
| 549 | + // OmegaT 3.1.0 or later | |
| 550 | + if (dockable.getComponent() instanceof JPanel) { | |
| 551 | + // dockable.getComponent() => org.omegat.gui.main.DockablePanel | |
| 552 | + // extends JPanel implements Dockable | |
| 553 | + JPanel jp = (JPanel) dockable.getComponent(); | |
| 554 | + sp = (JScrollPane) jp.getComponent(0); | |
| 555 | + | |
| 556 | + // less than OmegaT 3.1.0 | |
| 557 | + } else { | |
| 558 | + sp = (JScrollPane) dockable.getComponent(); | |
| 561 | 559 | } |
| 560 | + | |
| 561 | + return (JEditorPane) sp.getViewport().getView(); | |
| 562 | 562 | } |
| 563 | 563 | return null; |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | + private MoeRootPaneUI getRootPaneUI() { | |
| 567 | + MoeRootPaneUI ui; | |
| 568 | + Parts target = Parts.MainWindow; | |
| 569 | + if (uis.containsKey(target)) { | |
| 570 | + ui = (MoeRootPaneUI) uis.get(target); | |
| 571 | + } else { | |
| 572 | + ui = new MoeRootPaneUI(); | |
| 573 | + rootPane.setUI(ui); | |
| 574 | + uis.put(target, ui); | |
| 575 | + } | |
| 576 | + return ui; | |
| 577 | + } | |
| 578 | + | |
| 566 | 579 | private MoeTextPaneUI getTextPaneUI(Parts target) { |
| 567 | 580 | MoeTextPaneUI ui; |
| 568 | 581 | if (uis.containsKey(target)) { |
| @@ -570,14 +583,16 @@ | ||
| 570 | 583 | } else { |
| 571 | 584 | ui = new MoeTextPaneUI(); |
| 572 | 585 | JEditorPane pane = getJEditorPane(target); |
| 573 | - Highlighter h = pane.getHighlighter(); // save old highlighter | |
| 574 | - pane.setUI(ui); | |
| 575 | - pane.setHighlighter(h); // restore highlighter | |
| 576 | - if (!pane.isOpaque()) { | |
| 577 | - pane.setOpaque(true); | |
| 578 | - if (target == Parts.EDITOR) { | |
| 579 | - isEditorTransparent = false; | |
| 580 | - } | |
| 586 | + if (pane != null) { // EDITOR の場合は null になることがあるため | |
| 587 | + Highlighter h = pane.getHighlighter(); // save old highlighter | |
| 588 | + pane.setUI(ui); | |
| 589 | + pane.setHighlighter(h); // restore highlighter | |
| 590 | + if (!pane.isOpaque()) { | |
| 591 | + pane.setOpaque(true); | |
| 592 | + if (target == Parts.EDITOR) { | |
| 593 | + isEditorTransparent = false; | |
| 594 | + } | |
| 595 | + } | |
| 581 | 596 | } |
| 582 | 597 | uis.put(target, ui); |
| 583 | 598 | } |
| @@ -585,12 +600,12 @@ | ||
| 585 | 600 | } |
| 586 | 601 | |
| 587 | 602 | /** |
| 588 | - * エディター専用の UI です。プロジェクトの開始時にエディターに自身を UI と | |
| 603 | + * エディター専用の UI です。プロジェクトの開始時にエディターに自身をUI と | |
| 589 | 604 | * して自動設定します。 |
| 590 | - * 呼び出し側で、このクラスのインスタンスをプロジェクトイベントのリスナーに | |
| 591 | - * 登録しておく必要があります。 | |
| 605 | + * 呼び出し側では、このクラスのインスタンスをプロジェクトイベントのリスナー | |
| 606 | + * に登録しておく必要があります。 | |
| 592 | 607 | */ |
| 593 | - private class EditorUIRunner extends MoeTextPaneUI | |
| 608 | + private class DocumentEditorUIRunner extends MoeTextPaneUI | |
| 594 | 609 | implements IProjectEventListener, Runnable { |
| 595 | 610 | |
| 596 | 611 | @Override |
| @@ -598,10 +613,10 @@ | ||
| 598 | 613 | // 実行は一回きりで良いので、リスナー登録を解除する |
| 599 | 614 | CoreEvents.unregisterProjectChangeListener(this); |
| 600 | 615 | |
| 601 | - // エディターに UI を設定し、ハイライターを復元する | |
| 602 | - JEditorPane editor = getJEditorPaneFromEditor(desktop); | |
| 616 | + // エディターに UI(自身)を設定し、ハイライターを復元する | |
| 617 | + JEditorPane editor = getJEditorPaneFromEditor(); | |
| 603 | 618 | Highlighter h = editor.getHighlighter(); // save old highlighter |
| 604 | - editor.setUI(this); //@@TODO このインスタンスを管理する必要がある | |
| 619 | + editor.setUI(this); | |
| 605 | 620 | editor.setHighlighter(h); // restore highlighter |
| 606 | 621 | |
| 607 | 622 | // エディターが透明の場合は不透過に設定する |