2021-01-18 9:00 JST 〜 メンテナンスによるサービス全停止予定
  • R/O
  • SSH
  • HTTPS

nine: コミット


コミットメタ情報

リビジョン65 (tree)
日時2009-10-12 15:23:50
作者mshio

ログメッセージ

change how to manage the minibuffer object and API to get it.

変更サマリ

差分

--- nine-buffers/trunk/src/jp/sourceforge/nine/bufferlist/BufferlistTableData.java (revision 64)
+++ nine-buffers/trunk/src/jp/sourceforge/nine/bufferlist/BufferlistTableData.java (revision 65)
@@ -30,7 +30,7 @@
3030 import jp.sourceforge.nine.MainTableData;
3131 import jp.sourceforge.nine.MainTablePane;
3232 import jp.sourceforge.nine.MainTextPane;
33-import jp.sourceforge.nine.RootPanel;
33+import jp.sourceforge.nine.MinibufferPanel;
3434 import jp.sourceforge.nine.action.bufferlist.BuffersSwitchBufferCommand;
3535 import jp.sourceforge.nine.buffer.BufferManager;
3636 import jp.sourceforge.nine.util.NineUtilities;
@@ -284,10 +284,9 @@
284284 if (o instanceof MainTablePane) { table = (MainTablePane) o; }
285285 if (table == null) { return; }
286286
287- final RootPanel p = NineUtilities.getRootPanel(table);
288-
287+ final MinibufferPanel minibuffer = NineUtilities.getMinibufferPanel(table);
289288 SwingUtilities.invokeLater(new Runnable() {
290- public void run() { p.minibuffer().acceptUserInput(); }
289+ public void run() { minibuffer.acceptUserInput(); }
291290 });
292291
293292 new BuffersSwitchBufferCommand(table).execute();
--- nine-buffers/trunk/src/jp/sourceforge/nine/action/bufferlist/BuffersSwitchBufferCommand.java (revision 64)
+++ nine-buffers/trunk/src/jp/sourceforge/nine/action/bufferlist/BuffersSwitchBufferCommand.java (revision 65)
@@ -25,6 +25,7 @@
2525
2626 import jp.sourceforge.nine.MainBufferPane;
2727 import jp.sourceforge.nine.MainTablePane;
28+import jp.sourceforge.nine.MinibufferPanel;
2829 import jp.sourceforge.nine.RootPanel;
2930 import jp.sourceforge.nine.action.util.BufferSwitcher;
3031 import jp.sourceforge.nine.action.util.Command;
@@ -57,12 +58,13 @@
5758 requestedPane = BufferManager.getInstance().getBuffer(name);
5859 }
5960 final RootPanel rootPanel = NineUtilities.getRootPanel(tablePane);
61+ final MinibufferPanel minibuffer = NineUtilities.getMinibufferPanel(tablePane);
6062 String ret = null;
6163 if (requestedPane != null) {
6264 if (! checkOnly) {
6365 SwingUtilities.invokeLater(new Runnable() {
6466 public void run() {
65- rootPanel.minibuffer().acceptUserInput();
67+ minibuffer.acceptUserInput();
6668 }
6769 });
6870 Runnable r = new BufferSwitcher(rootPanel, requestedPane);
--- nine-buffers/trunk/src/jp/sourceforge/nine/action/bufferlist/AbstractSwitchBufferAction.java (revision 64)
+++ nine-buffers/trunk/src/jp/sourceforge/nine/action/bufferlist/AbstractSwitchBufferAction.java (revision 65)
@@ -22,7 +22,6 @@
2222
2323 import jp.sourceforge.nine.MainTablePane;
2424 import jp.sourceforge.nine.MinibufferPanel;
25-import jp.sourceforge.nine.RootPanel;
2625 import jp.sourceforge.nine.action.table.TableAction;
2726 import jp.sourceforge.nine.util.NineUtilities;
2827
@@ -37,9 +36,7 @@
3736 MainTablePane tablePane = getMainTablePane(e);
3837 if (tablePane == null) { return; }
3938
40- final RootPanel p = NineUtilities.getRootPanel(tablePane);
41- final MinibufferPanel m = p.minibuffer();
42-
39+ final MinibufferPanel m = NineUtilities.getMinibufferPanel(tablePane);
4340 final String msg = execute(tablePane, e);
4441 m.reset(msg == null ? "" : msg);
4542 }
--- nine/trunk/src/jp/sourceforge/nine/MainTablePane.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/MainTablePane.java (revision 65)
@@ -27,7 +27,6 @@
2727 import java.awt.event.MouseEvent;
2828 import java.io.File;
2929
30-import javax.swing.JComponent;
3130 import javax.swing.JTable;
3231 import javax.swing.ListSelectionModel;
3332 import javax.swing.table.JTableHeader;
@@ -185,13 +184,14 @@
185184 addFocusListener(new FocusListener() {
186185 public void focusGained(FocusEvent e) {
187186 Component c = e.getComponent();
188- MainBufferPane b = (MainBufferPane)c;
189-
190- RootPanel r = NineUtilities.getRootPanel((JComponent)b);
191- if (r != null) r.setCurrentBufferPanel(b);
192- MainTablePane m = (MainTablePane) c;
193- m.setSelectionBackground(defaultSelectionBackgroundColor);
194- m.getWindow().getModeLine().setForegroundColor(Color.BLACK);
187+ if (c != null && c instanceof MainTablePane) {
188+ MainBufferPane b = (MainBufferPane) c;
189+ RootPanel r = NineUtilities.getRootPanel(c);
190+ if (r != null) { r.setCurrentBufferPanel(b); }
191+ MainTablePane m = (MainTablePane) c;
192+ m.setSelectionBackground(defaultSelectionBackgroundColor);
193+ m.getWindow().getModeLine().setForegroundColor(Color.BLACK);
194+ }
195195 }
196196 public void focusLost(FocusEvent e) {
197197 Component c = e.getComponent();
--- nine/trunk/src/jp/sourceforge/nine/BufferWindow.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/BufferWindow.java (revision 65)
@@ -255,11 +255,21 @@
255255 int direction = orientation == VERTICAL_SPLIT ? 0 : 1;
256256 final NineLayout.Constraints c = new NineLayout.Constraints(direction, this);
257257 final RootPanel root = NineUtilities.getRootPanel(this);
258- root.minibuffer().acceptUserInput();
259- root.add(buffer.getWindow(), c);
260- root.minibuffer().reset();
258+ MinibufferPanel m = getMinibufferPanel();
259+ if (m != null && root != null) {
260+ m.acceptUserInput();
261+ root.add(buffer.getWindow(), c);
262+ m.reset();
263+ }
261264 }
262265
266+ private MinibufferPanel getMinibufferPanel() {
267+ MinibufferPanel ret = null;
268+ NineFrame f = NineUtilities.getNineFrame(this);
269+ if (f != null) { ret = f.getMinibufferPanel(); }
270+ return ret;
271+ }
272+
263273 /**
264274 * Shows a {@code LineNumberView} component, only when
265275 * the buffer window has a buffer of which type is
--- nine/trunk/src/jp/sourceforge/nine/RootPanel.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/RootPanel.java (revision 65)
@@ -20,11 +20,9 @@
2020
2121 import java.awt.Component;
2222 import java.awt.Cursor;
23-import java.awt.Frame;
2423 import java.awt.LayoutManager;
2524 import java.awt.Point;
2625 import java.awt.Rectangle;
27-import java.awt.Window;
2826 import java.awt.event.MouseAdapter;
2927 import java.awt.event.MouseEvent;
3028 import java.awt.event.MouseMotionListener;
@@ -34,10 +32,11 @@
3432 import javax.swing.SwingUtilities;
3533
3634 import jp.sourceforge.nine.buffer.BufferManager;
35+import jp.sourceforge.nine.util.NineUtilities;
3736
3837 public class RootPanel extends JPanel {
39-
40- private static final long serialVersionUID = -517639066431514619L;
38+ private static final long serialVersionUID = 272103057939167551L;
39+ private static final String CAPTION_FORMAT = "%s - %s";
4140 private MainBufferPane currentbuffer;
4241 final DividerMouseMotionListener dividerListener;
4342
@@ -60,39 +59,29 @@
6059 setOpaque(true);
6160 }
6261
63- public MinibufferPanel minibuffer() {
64- MinibufferPanel ret = null;
65- Window w = SwingUtilities.getWindowAncestor(this);
66- if (w instanceof NineFrame) {
67- ret = ((NineFrame) w).getMinibufferPanel();
68- }
69- return ret;
70- }
71-
62+ /**
63+ * Returns a {@code MainBufferPane} object which is the current buffer.
64+ * @return {@code MainBufferPane} which is the current buffer
65+ */
7266 public MainBufferPane currentBufferPanel() {
7367 return currentbuffer;
7468 }
7569
70+ /**
71+ * Sets the specified buffer as the current buffer.
72+ *
73+ * @param buffer {@code MainBufferPane} to be the current buffer
74+ */
7675 public void setCurrentBufferPanel(MainBufferPane buffer) {
7776 currentbuffer = buffer;
78- switchFrameTitle(buffer.getBufferName());
79- }
80-
81- public void setMinibufferLocation(final String location) {
82- Window w = SwingUtilities.getWindowAncestor(RootPanel.this);
83- if (w instanceof NineFrame) {
84- ((NineFrame) w).moveMinibufferLocation(location);
77+ String n = buffer.getBufferName();
78+ NineFrame f = NineUtilities.getNineFrame(this);
79+ if (f != null) {
80+ String t = String.format(CAPTION_FORMAT, n, Main.APPLICATION_NAME);
81+ f.setTitle(t);
8582 }
8683 }
8784
88- private void switchFrameTitle(String bufferName) {
89- Window w = SwingUtilities.getWindowAncestor(this);
90- if (w != null && w instanceof Frame) {
91- String t = String.format("%s - %s", bufferName, Main.APPLICATION_NAME);
92- ((Frame) w).setTitle(t);
93- }
94- }
95-
9685 public void replace(Component currentComponent, final Component newComponent) {
9786 LayoutManager manager = getLayout();
9887 if (manager instanceof NineLayout) {
@@ -117,9 +106,12 @@
117106
118107
119108 class DividerMouseMotionListener extends MouseAdapter implements MouseMotionListener {
120- List<NineDivider> dividers = null;
121- NineDivider clickedDivider = null;
109+ private static final Cursor S_RESIZE_CURSOR = new Cursor(Cursor.S_RESIZE_CURSOR);
110+ private static final Cursor E_RESIZE_CURSOR = new Cursor(Cursor.E_RESIZE_CURSOR);
122111
112+ private List<NineDivider> dividers = null;
113+ private NineDivider clickedDivider = null;
114+
123115 void setDividers(List<NineDivider> dividers) {
124116 this.dividers = dividers;
125117 }
@@ -134,7 +126,6 @@
134126 clickedDivider = null;
135127 }
136128
137- @Override
138129 public void mouseDragged(final MouseEvent e) {
139130 if (clickedDivider == null) {
140131 clickedDivider = searchCurrentDivider(e);
@@ -144,20 +135,7 @@
144135 Rectangle rec = panel.rectangle;
145136 if (rec == null) { return; }
146137
147- float loc;
148- if (clickedDivider.direction == 0) {
149- int y = e.getPoint().y;
150- float top = (float) rec.getY();
151- float bottom = (float) rec.getY() + (float) rec.getHeight();
152- float height = bottom - top;
153- loc = (y - top) / height;
154- } else {
155- int x = e.getPoint().x;
156- float left = (float) rec.getX();
157- float right = (float) rec.getX() + (float) rec.getWidth();
158- float width = right - left;
159- loc = (x - left) / width;
160- }
138+ float loc = getDividerLocation(clickedDivider.direction, e.getPoint(), rec);
161139 // TODO:
162140 if (loc >= 0.1 && loc <= 0.9) {
163141 panel.setDividerLocation(loc);
@@ -165,11 +143,10 @@
165143
166144 RootPanel rootPanel = (RootPanel) e.getSource();
167145 rootPanel.revalidate();
168- rootPanel.repaint();
146+// rootPanel.repaint();
169147 }
170148 }
171149
172- @Override
173150 public void mouseMoved(MouseEvent e) {
174151 if (dividers == null) { return; }
175152 Component c = e.getComponent();
@@ -177,12 +154,18 @@
177154
178155 NineDivider d = searchCurrentDivider(e);
179156 if (d != null) {
180- Cursor cur = new Cursor(d.direction == 0 ?
181- Cursor.S_RESIZE_CURSOR : Cursor.E_RESIZE_CURSOR);
157+ Cursor cur = d.direction == 0 ? S_RESIZE_CURSOR : E_RESIZE_CURSOR;
182158 c.setCursor(cur);
183159 }
184160 }
185161
162+ /**
163+ * Returns the information of a divider which the mouse cursor is moved on.
164+ *
165+ * @param e current {@code MouseEvent} object
166+ * @return {@code NineDivider} object which the mouse cursor is moved on,
167+ * or {@code null} if it is not on any dividers.
168+ */
186169 private NineDivider searchCurrentDivider(MouseEvent e) {
187170 NineDivider ret = null;
188171 Point p = e.getPoint();
@@ -196,4 +179,22 @@
196179 }
197180 return ret;
198181 }
182+
183+ private float getDividerLocation(int direction, Point pos, Rectangle rec) {
184+ float loc;
185+ if (clickedDivider.direction == 0) {
186+ int y = pos.y;
187+ float top = (float) rec.getY();
188+ float bottom = (float) rec.getY() + (float) rec.getHeight();
189+ float height = bottom - top;
190+ loc = (y - top) / height;
191+ } else {
192+ int x = pos.x;
193+ float left = (float) rec.getX();
194+ float right = (float) rec.getX() + (float) rec.getWidth();
195+ float width = right - left;
196+ loc = (x - left) / width;
197+ }
198+ return loc;
199+ }
199200 }
--- nine/trunk/src/jp/sourceforge/nine/NineFrame.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/NineFrame.java (revision 65)
@@ -30,7 +30,6 @@
3030
3131 public class NineFrame extends JFrame {
3232 private static final long serialVersionUID = -1709487996193137453L;
33-
3433 private final MinibufferPanel minibuffer;
3534
3635 public NineFrame(String caption) {
@@ -51,7 +50,7 @@
5150 return minibuffer;
5251 }
5352
54- void moveMinibufferLocation(final String location) {
53+ public void moveMinibufferLocation(final String location) {
5554 SwingUtilities.invokeLater(new Runnable() {
5655 public void run() {
5756 remove(minibuffer);
--- nine/trunk/src/jp/sourceforge/nine/keymap/JmKeymapMaker.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/keymap/JmKeymapMaker.java (revision 65)
@@ -42,7 +42,6 @@
4242 import jp.sourceforge.nine.Main;
4343 import jp.sourceforge.nine.MainBufferPane;
4444 import jp.sourceforge.nine.MinibufferPanel;
45-import jp.sourceforge.nine.RootPanel;
4645 import jp.sourceforge.nine.action.util.ActionArgument;
4746 import jp.sourceforge.nine.action.util.ArgumentActionEvent;
4847 import jp.sourceforge.nine.js.KeyboardSettings;
@@ -348,9 +347,8 @@
348347 }
349348
350349 if (message != null && message.length() != 0) {
351- final JComponent c = (JComponent) bufferPane;
352- final RootPanel r = NineUtilities.getRootPanel(c);
353- final MinibufferPanel m = r.minibuffer();
350+ final Component c = (Component) bufferPane;
351+ MinibufferPanel m = NineUtilities.getMinibufferPanel(c);
354352 StringBuilder sb = new StringBuilder(message.length());
355353 if (append) {
356354 sb.append(m.getTextFromLabel());
--- nine/trunk/src/jp/sourceforge/nine/SquareCaret.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/SquareCaret.java (revision 65)
@@ -65,7 +65,7 @@
6565 }
6666
6767 // This method is originated from the same name method of
68- // javax.swing.text.DefaultCaret in JDK 1.6 source codes.
68+ // javax.swing.text.DefaultCaret in OpenJDK 1.6 source codes.
6969 private boolean _contains(int X, int Y, int W, int H) {
7070 int w = this.width;
7171 int h = this.height;
--- nine/trunk/src/jp/sourceforge/nine/Main.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/Main.java (revision 65)
@@ -71,7 +71,7 @@
7171 /** The only instance of this application */
7272 public final static Main application = new Main();
7373 /** A collection of frames (this application is multiple frame) */
74- private final List<JFrame> frames;
74+ private final List<NineFrame> frames;
7575 /** A document object of the buffer for log messages */
7676 static MarkableDocument messageDoc = null;
7777
@@ -96,7 +96,7 @@
9696 }
9797
9898 private Main() {
99- frames = new LinkedList<JFrame>();
99+ frames = new LinkedList<NineFrame>();
100100 }
101101
102102 /**
@@ -146,7 +146,7 @@
146146 *
147147 * @param frame the frame to be closed
148148 */
149- public void deleteFrame(JFrame frame) {
149+ public void deleteFrame(NineFrame frame) {
150150 if (frames.size() == 1) {
151151 frame.requestFocusInWindow();
152152 confirmBeforeQuit();
@@ -218,7 +218,7 @@
218218 // TODO
219219 Action a = new SaveBuffersKillNineAction();
220220 MainBufferPane current = null;
221- JFrame f = frames.get(0);
221+ NineFrame f = frames.get(0);
222222 Component[] comps = f.getContentPane().getComponents();
223223 for (Component c : comps) {
224224 if (c instanceof RootPanel) {
--- nine/trunk/src/jp/sourceforge/nine/NineWrappedPlainView.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/NineWrappedPlainView.java (revision 65)
@@ -353,7 +353,7 @@
353353 }
354354
355355 // This inner class is originated from the same name class of
356- // javax.swing.text.WrappedPlainView in JDK 1.6 source codes,
356+ // javax.swing.text.WrappedPlainView in OpenJDK 1.6 source codes,
357357 // and I modified it a little.
358358 /**
359359 * Simple view of a line that wraps if it doesn't
--- nine/trunk/src/jp/sourceforge/nine/MainTextPane.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/MainTextPane.java (revision 65)
@@ -217,7 +217,7 @@
217217 public void focusGained(FocusEvent e) {
218218 Component c = e.getComponent();
219219 MainTextPane b = (MainTextPane) c;
220- RootPanel r = NineUtilities.getRootPanel(b);
220+ RootPanel r = NineUtilities.getRootPanel(c);
221221 if (r != null) { r.setCurrentBufferPanel(b); }
222222 updateWindowModified();
223223 repaint();
@@ -228,8 +228,9 @@
228228 public void focusLost(final FocusEvent e) {
229229 SwingUtilities.invokeLater(new Runnable() {
230230 public void run() {
231- MainTextPane m = (MainTextPane) e.getComponent();
232- RootPanel r = NineUtilities.getRootPanel(m);
231+ Component c = e.getComponent();
232+ MainTextPane m = (MainTextPane) c;
233+ RootPanel r = NineUtilities.getRootPanel(c);
233234 if (r != null && m != r.currentBufferPanel()) {
234235 bufferWindow.focusLost();
235236 }
@@ -649,11 +650,7 @@
649650 List<File> fs = (List<File>) o;
650651 File target = fs.get(0);
651652 FindFileCommand c = new FindFileCommand(target);
652- root.minibuffer().acceptUserInput();
653653 SwingUtilities.invokeLater(new BufferSwitcher(root, c.execute()));
654- SwingUtilities.invokeLater(new Runnable() {
655- public void run() { root.minibuffer().reset(); }
656- });
657654 } catch (UnsupportedFlavorException e) {
658655 e.printStackTrace();
659656 } catch (FileNotFoundException e) {
@@ -664,7 +661,8 @@
664661 e.printStackTrace();
665662 } catch (FileIsNotReadableException e) {
666663 NineUtilities.beep(root);
667- root.minibuffer().reset(e.getMessage());
664+ MinibufferPanel minibuffer = getMinibufferPanel();
665+ minibuffer.reset(e.getMessage());
668666 }
669667 dtde.dropComplete(true);
670668 } else {
@@ -671,6 +669,13 @@
671669 dtde.rejectDrop();
672670 }
673671 }
672+
673+ private MinibufferPanel getMinibufferPanel() {
674+ MinibufferPanel ret = null;
675+ NineFrame f = NineUtilities.getNineFrame(MainTextPane.this);
676+ if (f != null) { ret = f.getMinibufferPanel(); }
677+ return ret;
678+ }
674679 }
675680
676681 }
--- nine/trunk/src/jp/sourceforge/nine/action/MinibufferPopupAction.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/MinibufferPopupAction.java (revision 65)
@@ -98,9 +98,7 @@
9898 if (o instanceof JTextComponent) {
9999 textComponent = (JTextComponent) o;
100100 rootPanel = NineUtilities.getRootPanel(textComponent);
101- if (rootPanel != null) {
102- minibuffer = rootPanel.minibuffer();
103- }
101+ minibuffer = NineUtilities.getMinibufferPanel(textComponent);
104102 }
105103 return textComponent != null &&
106104 rootPanel != null && minibuffer != null;
--- nine/trunk/src/jp/sourceforge/nine/action/ISearchAction.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/ISearchAction.java (revision 65)
@@ -39,7 +39,7 @@
3939
4040 import jp.sourceforge.nine.BasicTextPane;
4141 import jp.sourceforge.nine.MainTextPane;
42-import jp.sourceforge.nine.RootPanel;
42+import jp.sourceforge.nine.MinibufferPanel;
4343 import jp.sourceforge.nine.keymap.JmKeymap;
4444 import jp.sourceforge.nine.keymap.JmKeymapMaker;
4545 import jp.sourceforge.nine.util.MessageUtility;
@@ -52,8 +52,8 @@
5252 /** text for displaying on the minibuffer */
5353 private final String labelText;
5454
55- private RootPanel root = null;
5655 private MainTextPane target = null;
56+ private MinibufferPanel minibuffer = null;
5757
5858 /** the name of action which is binded to backspace key */
5959 private String bsActionName = null;
@@ -185,8 +185,8 @@
185185 */
186186 public void actionPerformed(ActionEvent e) {
187187 JTextComponent c = getTextComponent(e);
188- root = NineUtilities.getRootPanel(c);
189- root.minibuffer().setTextToLabel(labelText);
188+ minibuffer = NineUtilities.getMinibufferPanel(c);
189+ minibuffer.setTextToLabel(labelText);
190190
191191 modifyKeymap(c);
192192
@@ -268,7 +268,7 @@
268268 if (sb.length() <= 0 && prevKeyword != null) {
269269 sb.append(prevKeyword);
270270 }
271- root.minibuffer().setTextToLabel(labelText + sb.toString());
271+ minibuffer.setTextToLabel(labelText + sb.toString());
272272 search(sb.toString(), directionForward);
273273 SwingUtilities.invokeLater(new Runnable() {
274274 public void run() {
@@ -283,7 +283,7 @@
283283 if (! directionForward) { key += "-backward"; }
284284 String f = msg.getString(key);
285285 String s = MessageFormat.format(f, text);
286- root.minibuffer().reset(s);
286+ minibuffer.reset(s);
287287 }
288288
289289 private void search(final String str, boolean directionForward) {
@@ -352,12 +352,12 @@
352352 if (! ctrlPressed && ! altPressed && ! metaPressed) {
353353 if (code >= 0x20 && code != 0x7f) {
354354 sb.append(code);
355- root.minibuffer().appendTextToLabel(c);
355+ minibuffer.appendTextToLabel(c);
356356 search(sb.toString(), directionForward);
357357 } else if (code == '\b' && sb.length() > 0) {
358358 sb.deleteCharAt(sb.length() - 1);
359359 String buf = sb.toString();
360- root.minibuffer().setTextToLabel(labelText + buf);
360+ minibuffer.setTextToLabel(labelText + buf);
361361 search(buf, directionForward);
362362 } else if (code == '\n') {
363363 // TODO
@@ -369,8 +369,8 @@
369369 }
370370
371371 private void exitISearchAction() {
372- if (! root.minibuffer().getTextFromLabel().equals("Quit")) {
373- root.minibuffer().setTextToLabel(" ");
372+ if (! minibuffer.getTextFromLabel().equals("Quit")) {
373+ minibuffer.setTextToLabel(" ");
374374 // set mark
375375 try {
376376 Document d = target.getDocument();
@@ -393,7 +393,7 @@
393393
394394 public void actionPerformed(ActionEvent e) {
395395 target.setCaretPosition(originalCaretPosition);
396- root.minibuffer().setTextToLabel("Quit");
396+ minibuffer.setTextToLabel("Quit");
397397 }
398398 }
399399 }
--- nine/trunk/src/jp/sourceforge/nine/action/QuotedInsertAction.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/QuotedInsertAction.java (revision 65)
@@ -54,7 +54,7 @@
5454 public void perform(ActionEvent e) {
5555 JTextComponent t = getTextComponent(e);
5656 RootPanel rootPanel = NineUtilities.getRootPanel(t);
57- minibuffer = rootPanel.minibuffer();
57+ minibuffer = NineUtilities.getMinibufferPanel(t);
5858 mainBuffer = rootPanel.currentBufferPanel();
5959 if (mainBuffer instanceof BasicTextPane) {
6060 minibuffer.reset("C-q ");
--- nine/trunk/src/jp/sourceforge/nine/action/ExchangePointAndMarkAction.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/ExchangePointAndMarkAction.java (revision 65)
@@ -72,7 +72,7 @@
7272 private void showNoMarkSetMessage(JTextComponent component) {
7373 MessageUtility msg = MessageUtility.instance;
7474 String s = msg.getString("exchange-point-and-mark.no-mark");
75- NineUtilities.getRootPanel(component).minibuffer().reset(s);
75+ NineUtilities.getMinibufferPanel(component).reset(s);
7676 }
7777
7878 }
--- nine/trunk/src/jp/sourceforge/nine/action/MinibufferCancelAction.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/MinibufferCancelAction.java (revision 65)
@@ -25,6 +25,7 @@
2525 import javax.swing.text.TextAction;
2626
2727 import jp.sourceforge.nine.MainTextPane;
28+import jp.sourceforge.nine.MinibufferPanel;
2829 import jp.sourceforge.nine.RootPanel;
2930 import jp.sourceforge.nine.util.NineUtilities;
3031
@@ -46,7 +47,8 @@
4647 ((MainTextPane) p.currentBufferPanel()).setMark(null);
4748 }
4849 p.currentBufferPanel().requestFocusInWindow();
49- p.minibuffer().reset("Quit");
50+ MinibufferPanel m = NineUtilities.getMinibufferPanel(t);
51+ m.reset("Quit");
5052
5153 CaretListener[] ls = t.getCaretListeners();
5254 for (CaretListener l : ls) {
--- nine/trunk/src/jp/sourceforge/nine/action/KeyboardQuitAction.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/KeyboardQuitAction.java (revision 65)
@@ -24,6 +24,7 @@
2424
2525 import jp.sourceforge.nine.MainBufferPane;
2626 import jp.sourceforge.nine.MainTextPane;
27+import jp.sourceforge.nine.MinibufferPanel;
2728 import jp.sourceforge.nine.RootPanel;
2829 import jp.sourceforge.nine.util.MessageUtility;
2930 import jp.sourceforge.nine.util.NineUtilities;
@@ -53,13 +54,13 @@
5354 if (m instanceof MainTextPane) {
5455 ((MainTextPane) m).setMark(null);
5556 }
56- showAbortMessage(p);
57+ showAbortMessage(NineUtilities.getMinibufferPanel(t));
5758 }
5859 }
5960
60- private void showAbortMessage(RootPanel root) {
61+ private void showAbortMessage(MinibufferPanel minibuffer) {
6162 MessageUtility msg = MessageUtility.instance;
6263 String s = msg.getString(QUIT_LABEL_KEY);
63- root.minibuffer().reset(s);
64+ minibuffer.reset(s);
6465 }
6566 }
--- nine/trunk/src/jp/sourceforge/nine/action/UndoAction.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/UndoAction.java (revision 65)
@@ -54,7 +54,7 @@
5454 }
5555
5656 private void showErrorMessage(MainTextPane textPane) {
57- MinibufferPanel m = NineUtilities.getRootPanel(textPane).minibuffer();
57+ MinibufferPanel m = NineUtilities.getMinibufferPanel(textPane);
5858 MessageUtility msg = MessageUtility.instance;
5959 String s = msg.getString("undo.no-further-undo-information");
6060 m.setTextToLabel(s);
--- nine/trunk/src/jp/sourceforge/nine/action/DeleteFrameAction.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/DeleteFrameAction.java (revision 65)
@@ -19,16 +19,16 @@
1919
2020 package jp.sourceforge.nine.action;
2121
22-import java.awt.Window;
2322 import java.awt.event.ActionEvent;
2423
2524 import javax.swing.JComponent;
2625 import javax.swing.JFrame;
27-import javax.swing.SwingUtilities;
2826
2927 import jp.sourceforge.nine.Main;
30-import jp.sourceforge.nine.RootPanel;
28+import jp.sourceforge.nine.MinibufferPanel;
29+import jp.sourceforge.nine.NineFrame;
3130 import jp.sourceforge.nine.util.MessageUtility;
31+import jp.sourceforge.nine.util.NineLogger;
3232 import jp.sourceforge.nine.util.NineUtilities;
3333
3434 public class DeleteFrameAction extends ScriptableTextAction {
@@ -47,9 +47,10 @@
4747 showErrorMessage(e);
4848 } else {
4949 JComponent c = getTextComponent(e);
50- Window w = SwingUtilities.getWindowAncestor(c);
51- JFrame frame = (JFrame) w;
52- Main.application.deleteFrame(frame);
50+ if (c != null) {
51+ NineFrame f = NineUtilities.getNineFrame(c);
52+ Main.application.deleteFrame(f);
53+ }
5354 }
5455 }
5556
@@ -56,8 +57,14 @@
5657 private void showErrorMessage(ActionEvent e) {
5758 MessageUtility msg = MessageUtility.instance;
5859 String s = msg.getString(SOLE_FRAME_MSG_KEY);
59- RootPanel root = NineUtilities.getRootPanel(getTextComponent(e));
60- root.minibuffer().reset(s);
60+ JComponent t = getTextComponent(e);
61+ if (t != null) {
62+ MinibufferPanel m = NineUtilities.getMinibufferPanel(t);
63+ m.reset(s);
64+ } else {
65+ String str = "Cannot get JTextComponent object from ActionEvent.";
66+ NineLogger.instance.warning(str, null);
67+ }
6168 }
6269
6370 }
--- nine/trunk/src/jp/sourceforge/nine/action/SaveBufferAction.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/SaveBufferAction.java (revision 65)
@@ -26,7 +26,6 @@
2626 import javax.swing.text.JTextComponent;
2727
2828 import jp.sourceforge.nine.MainTextPane;
29-import jp.sourceforge.nine.RootPanel;
3029 import jp.sourceforge.nine.action.util.SaveBufferCommand;
3130 import jp.sourceforge.nine.util.MessageUtility;
3231 import jp.sourceforge.nine.util.NineUtilities;
@@ -70,8 +69,8 @@
7069 private void showNoNeedToSaveMessage(ActionEvent e) {
7170 MessageUtility msg = MessageUtility.instance;
7271 String s = msg.getString("save-buffer.no-need");
73- RootPanel root = NineUtilities.getRootPanel(getTextComponent(e));
74- root.minibuffer().reset(s);
72+ JTextComponent c = getTextComponent(e);
73+ if (c != null) { NineUtilities.getMinibufferPanel(c).reset(s); }
7574 }
7675
7776 private void write(MainTextPane textPane) {
@@ -81,8 +80,7 @@
8180 try {
8281 s.execute();
8382 String m = getResultMessage(f.getPath());
84- RootPanel p = NineUtilities.getRootPanel(textPane);
85- p.minibuffer().setTextToLabel(m);
83+ NineUtilities.getMinibufferPanel(textPane).setTextToLabel(m);
8684 } catch (IOException e) {
8785 e.printStackTrace();
8886 // TODO: MUST show some messages.
--- nine/trunk/src/jp/sourceforge/nine/action/ListBuffersAction.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/ListBuffersAction.java (revision 65)
@@ -32,6 +32,7 @@
3232 import jp.sourceforge.nine.MainBufferPane;
3333 import jp.sourceforge.nine.MainTableData;
3434 import jp.sourceforge.nine.MainTablePane;
35+import jp.sourceforge.nine.MinibufferPanel;
3536 import jp.sourceforge.nine.RootPanel;
3637 import jp.sourceforge.nine.buffer.BufferManager;
3738 import jp.sourceforge.nine.util.NineUtilities;
@@ -52,7 +53,7 @@
5253 // TODO: when this component is null, the app should throw any errors?
5354 if (comp == null) { return; }
5455 final RootPanel rootPanel = NineUtilities.getRootPanel(comp);
55- final MainBufferPane mb = rootPanel.currentBufferPanel();
56+ final MainBufferPane mainBuffer = rootPanel.currentBufferPanel();
5657
5758 try {
5859 MainTableData data = getBufferListTableData();
@@ -62,10 +63,11 @@
6263 manager.addBuffer(table);
6364 SwingUtilities.invokeLater(new Runnable() {
6465 public void run() {
65- rootPanel.minibuffer().acceptUserInput();
66+ MinibufferPanel m = NineUtilities.getMinibufferPanel(rootPanel);
67+ m.acceptUserInput();
6668 showBuffer(rootPanel, table);
67- rootPanel.minibuffer().reset();
68- mb.requestFocusInWindow();
69+ m.reset();
70+ mainBuffer.requestFocusInWindow();
6971 }
7072 });
7173 } catch (ClassNotFoundException ex) {
--- nine/trunk/src/jp/sourceforge/nine/action/util/BufferSwitcher.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/util/BufferSwitcher.java (revision 65)
@@ -23,13 +23,17 @@
2323
2424 import jp.sourceforge.nine.BufferWindow;
2525 import jp.sourceforge.nine.MainBufferPane;
26+import jp.sourceforge.nine.MinibufferPanel;
27+import jp.sourceforge.nine.NineFrame;
2628 import jp.sourceforge.nine.RootPanel;
2729 import jp.sourceforge.nine.buffer.BufferManager;
30+import jp.sourceforge.nine.util.NineLogger;
2831 import jp.sourceforge.nine.util.NineUtilities;
2932
3033 public class BufferSwitcher implements Runnable {
3134 private final MainBufferPane bufferPane;
3235 private final RootPanel rootPanel;
36+ private final MinibufferPanel minibuffer;
3337 private final MainBufferPane bufferToBeReplaced;
3438 private boolean requestFocus = true;
3539
@@ -46,6 +50,8 @@
4650 this.bufferPane = newBuffer;
4751 this.bufferToBeReplaced = toBeReplaced;
4852 this.rootPanel = rootPanel;
53+ NineFrame f = NineUtilities.getNineFrame(rootPanel);
54+ minibuffer = f != null ? f.getMinibufferPanel() : null;
4955 BufferManager.getInstance().addBuffer(toBeReplaced);
5056 }
5157
@@ -59,9 +65,14 @@
5965 public void run() {
6066 final BufferWindow bp = bufferToBeReplaced.getWindow();
6167
62- rootPanel.minibuffer().acceptUserInput();
68+ if (minibuffer == null) {
69+ NineLogger.instance.severe("minibuffer is not found.", null);
70+ return;
71+ }
72+
73+ minibuffer.acceptUserInput();
6374 rootPanel.replace(bp, bufferPane.getWindow());
64- rootPanel.minibuffer().reset();
75+ minibuffer.reset();
6576
6677 SwingUtilities.invokeLater(new Runnable() {
6778 public void run() {
--- nine/trunk/src/jp/sourceforge/nine/action/util/KillBufferCommand.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/util/KillBufferCommand.java (revision 65)
@@ -30,6 +30,7 @@
3030 import jp.sourceforge.nine.MinibufferPanel;
3131 import jp.sourceforge.nine.RootPanel;
3232 import jp.sourceforge.nine.buffer.BufferManager;
33+import jp.sourceforge.nine.util.NineUtilities;
3334
3435 public class KillBufferCommand implements Command<Void> {
3536 final String bufferName;
@@ -73,7 +74,9 @@
7374 ((BufferWindow) c).getContent().requestFocusInWindow();
7475 }
7576 }
76- if (minibufferReset) { rootPanel.minibuffer().reset(); }
77+ if (minibufferReset) {
78+ NineUtilities.getMinibufferPanel(rootPanel).reset();
79+ }
7780 }
7881 });
7982
@@ -92,7 +95,7 @@
9295 rootPanel.currentBufferPanel().requestFocusInWindow();
9396 }
9497 if (minibufferReset) {
95- MinibufferPanel m = rootPanel.minibuffer();
98+ MinibufferPanel m = NineUtilities.getMinibufferPanel(rootPanel);
9699 m.reset();
97100 }
98101 }
--- nine/trunk/src/jp/sourceforge/nine/action/KillRing.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/KillRing.java (revision 65)
@@ -25,7 +25,7 @@
2525
2626 import javax.swing.text.JTextComponent;
2727
28-import jp.sourceforge.nine.RootPanel;
28+import jp.sourceforge.nine.MinibufferPanel;
2929 import jp.sourceforge.nine.util.MessageUtility;
3030 import jp.sourceforge.nine.util.NineUtilities;
3131
@@ -132,8 +132,8 @@
132132 private void showNotYankErrorMessage(JTextComponent component) {
133133 MessageUtility msg = MessageUtility.instance;
134134 String s = msg.getString(NOT_YANK_LABEL_KEY);
135- RootPanel root = NineUtilities.getRootPanel(component);
136- root.minibuffer().reset(s);
135+ MinibufferPanel m = NineUtilities.getMinibufferPanel(component);
136+ m.reset(s);
137137 }
138138
139139 private void paste(JTextComponent textComponent, String buffer) {
--- nine/trunk/src/jp/sourceforge/nine/action/DeleteOtherWindowsAction.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/DeleteOtherWindowsAction.java (revision 65)
@@ -21,9 +21,9 @@
2121 import java.awt.Component;
2222 import java.awt.event.ActionEvent;
2323
24-import javax.swing.JComponent;
2524 import javax.swing.SwingUtilities;
2625
26+import jp.sourceforge.nine.MinibufferPanel;
2727 import jp.sourceforge.nine.RootPanel;
2828 import jp.sourceforge.nine.util.NineUtilities;
2929
@@ -53,19 +53,23 @@
5353 */
5454 @Override
5555 public void perform(final ActionEvent e) {
56- final Object o = e.getSource();
57- final RootPanel rootPanel = NineUtilities.getRootPanel((JComponent) o);
58- rootPanel.minibuffer().acceptUserInput();
59- SwingUtilities.invokeLater(new Runnable() {
60- public void run() {
61- final Component[] components = rootPanel.getComponents();
62- for (final Component c : components) {
63- rootPanel.remove(c);
56+ Object o = e.getSource();
57+ if (o != null && o instanceof Component) {
58+ Component c = (Component) o;
59+ final RootPanel rootPanel = NineUtilities.getRootPanel(c);
60+ final MinibufferPanel minibuffer = NineUtilities.getMinibufferPanel(c);
61+ minibuffer.acceptUserInput();
62+ SwingUtilities.invokeLater(new Runnable() {
63+ public void run() {
64+ final Component[] components = rootPanel.getComponents();
65+ for (final Component c : components) {
66+ rootPanel.remove(c);
67+ }
68+ rootPanel.add(rootPanel.currentBufferPanel().getWindow());
69+ rootPanel.repaint();
70+ minibuffer.reset();
6471 }
65- rootPanel.add(rootPanel.currentBufferPanel().getWindow());
66- rootPanel.repaint();
67- rootPanel.minibuffer().reset();
68- }
69- });
72+ });
73+ }
7074 }
7175 }
--- nine/trunk/src/jp/sourceforge/nine/action/BufferSuggestionAction.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/BufferSuggestionAction.java (revision 65)
@@ -27,7 +27,7 @@
2727 import javax.swing.KeyStroke;
2828 import javax.swing.text.JTextComponent;
2929
30-import jp.sourceforge.nine.RootPanel;
30+import jp.sourceforge.nine.MinibufferPanel;
3131 import jp.sourceforge.nine.buffer.BufferManager;
3232 import jp.sourceforge.nine.util.NineUtilities;
3333
@@ -40,10 +40,10 @@
4040 Object o = e.getSource(); // This must be a minibuffer.
4141 assert o instanceof JTextComponent;
4242 JTextComponent t = (JTextComponent) o;
43- RootPanel root = NineUtilities.getRootPanel(t);
43+ MinibufferPanel minibuffer = NineUtilities.getMinibufferPanel(t);
4444
4545 if (showSuggestionPopup(t)) {
46- String nm = root.minibuffer().getTextFromInputArea();
46+ String nm = minibuffer.getTextFromInputArea();
4747 String[] all = BufferManager.getInstance().getBufferNames();
4848 String[] matches = all;
4949 if (nm != null && nm.length() > 0) {
@@ -54,7 +54,7 @@
5454 (matches != null && matches.length == 0)) {
5555 NineUtilities.beep(t);
5656 } else if (matches.length == 1) {
57- root.minibuffer().setTextToInputArea(matches[0]);
57+ minibuffer.setTextToInputArea(matches[0]);
5858 if (popup != null) { popup.hide(); }
5959 } else {
6060 popup = new BufferSuggestionPopup(t,
--- nine/trunk/src/jp/sourceforge/nine/action/DeleteWindowAction.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/DeleteWindowAction.java (revision 65)
@@ -18,11 +18,11 @@
1818 */
1919 package jp.sourceforge.nine.action;
2020
21+import java.awt.Component;
2122 import java.awt.event.ActionEvent;
2223
23-import javax.swing.JComponent;
24-
2524 import jp.sourceforge.nine.MainBufferPane;
25+import jp.sourceforge.nine.MinibufferPanel;
2626 import jp.sourceforge.nine.RootPanel;
2727 import jp.sourceforge.nine.util.MessageUtility;
2828 import jp.sourceforge.nine.util.NineUtilities;
@@ -45,26 +45,27 @@
4545 @Override
4646 public void perform(ActionEvent e) {
4747 Object o = e.getSource();
48- JComponent c = o instanceof JComponent ? (JComponent) o : null;
48+ Component c = o instanceof Component ? (Component) o : null;
4949 if (c != null) {
5050 final RootPanel r = NineUtilities.getRootPanel(c);
5151 final MainBufferPane current = r.currentBufferPanel();
52+ MinibufferPanel minibuffer = NineUtilities.getMinibufferPanel(c);
5253
5354 if (r.getComponentCount() == 1) {
54- showCannotDeleteMessage(r);
55+ showCannotDeleteMessage(minibuffer);
5556 } else {
56- r.minibuffer().acceptUserInput();
57+ minibuffer.acceptUserInput();
5758 r.remove(current.getWindow());
5859 r.repaint();
59- r.minibuffer().reset();
60+ minibuffer.reset();
6061 }
6162 }
6263 }
6364
64- private void showCannotDeleteMessage(RootPanel root) {
65+ private void showCannotDeleteMessage(MinibufferPanel minibuffer) {
6566 MessageUtility msg = MessageUtility.instance;
6667 String s = msg.getString(KILLING_SOLE_WINDOW_LABEL_KEY);
67- root.minibuffer().reset(s);
68+ minibuffer.reset(s);
6869 }
6970
7071 }
--- nine/trunk/src/jp/sourceforge/nine/action/SetMinibufferLocation.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/SetMinibufferLocation.java (revision 65)
@@ -1,9 +1,19 @@
11 /*
22 * Copyright (C) 2008-2009, mshio <mshio@users.sourceforge.jp>
3- * This code is free software; you can redistribute it and/or
4- * modify it under the terms of the GPLv2, as published by
5- * the Free Software Foundation.
63 *
4+ * This program is free software: you can redistribute it and/or
5+ * modify it under the terms of the GNU General Public License
6+ * as published by the Free Software Foundation; either version 2
7+ * of the License, or 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+ * ---
717 * Require JDK 1.5 (or later)
818 */
919 package jp.sourceforge.nine.action;
@@ -13,7 +23,7 @@
1323
1424 import javax.swing.JComponent;
1525
16-import jp.sourceforge.nine.RootPanel;
26+import jp.sourceforge.nine.NineFrame;
1727 import jp.sourceforge.nine.util.NineUtilities;
1828
1929 public class SetMinibufferLocation extends ScriptableTextAction {
@@ -29,8 +39,8 @@
2939 @Override
3040 public void perform(ActionEvent e) {
3141 JComponent c = getTextComponent(e);
32- RootPanel r = NineUtilities.getRootPanel(c);
33- r.setMinibufferLocation(south ? BorderLayout.SOUTH : BorderLayout.NORTH);
42+ NineFrame f = NineUtilities.getNineFrame(c);
43+ f.moveMinibufferLocation(south ? BorderLayout.SOUTH : BorderLayout.NORTH);
3444 }
3545
3646 }
--- nine/trunk/src/jp/sourceforge/nine/action/NineMinibufferAction.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/NineMinibufferAction.java (revision 65)
@@ -19,6 +19,7 @@
1919
2020 package jp.sourceforge.nine.action;
2121
22+import java.awt.Component;
2223 import java.awt.event.ActionEvent;
2324
2425 import javax.swing.Action;
@@ -128,7 +129,7 @@
128129
129130 private RootPanel getRootPanel(ActionEvent e) {
130131 Object o = e.getSource();
131- if (o instanceof JComponent) {
132+ if (o instanceof Component) {
132133 return rootPanel = NineUtilities.getRootPanel((JComponent) o);
133134 }
134135 return rootPanel = null;
@@ -136,6 +137,6 @@
136137
137138 private MinibufferPanel getMinibufferPanel(ActionEvent e) {
138139 RootPanel r = getRootPanel(e);
139- return r == null ? null : r.minibuffer();
140+ return r != null ? NineUtilities.getMinibufferPanel(r) : null;
140141 }
141142 }
--- nine/trunk/src/jp/sourceforge/nine/action/ZapToCharAction.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/action/ZapToCharAction.java (revision 65)
@@ -23,7 +23,6 @@
2323 import java.text.MessageFormat;
2424
2525 import javax.swing.Action;
26-import javax.swing.JComponent;
2726 import javax.swing.SwingUtilities;
2827 import javax.swing.text.JTextComponent;
2928
@@ -35,7 +34,7 @@
3534 import jp.sourceforge.nine.util.NineUtilities;
3635
3736 public class ZapToCharAction extends ScriptableTextAction {
38- private static final long serialVersionUID = 4311147072413432431L;
37+ private static final long serialVersionUID = -3093295077737319486L;
3938 public static final String ACTION_NAME = "zap-to-char";
4039 static final String PROMPT_KEY = "zap-to-char";
4140 static final String FAILED_MSG_KEY = "zap-to-char.failed";
@@ -57,7 +56,7 @@
5756 }
5857 if (target == null) { return; }
5958
60- MinibufferPanel m = root.minibuffer();
59+ MinibufferPanel m = NineUtilities.getMinibufferPanel(t);
6160 m.reset(getPromptLabel());
6261
6362 modifyAction();
@@ -86,7 +85,7 @@
8685 private static final long serialVersionUID = -6811784214710089116L;
8786
8887 public void actionPerformed(ActionEvent e) {
89- MinibufferPanel mb = getRootPanel(e).minibuffer();
88+ MinibufferPanel mb = NineUtilities.getMinibufferPanel(getTextComponent(e));
9089
9190 String str = e.getActionCommand();
9291 int pos = target.getCaretPosition();
@@ -118,14 +117,6 @@
118117 return MessageFormat.format(f, command);
119118 }
120119
121- private RootPanel getRootPanel(ActionEvent e) {
122- Object o = e.getSource();
123- if (o instanceof JComponent) {
124- return NineUtilities.getRootPanel((JComponent) o);
125- }
126- return null;
127- }
128-
129120 }
130121
131122 }
--- nine/trunk/src/jp/sourceforge/nine/util/NineUtilities.java (revision 64)
+++ nine/trunk/src/jp/sourceforge/nine/util/NineUtilities.java (revision 65)
@@ -43,6 +43,7 @@
4343
4444 import jp.sourceforge.nine.MainBufferPane;
4545 import jp.sourceforge.nine.MinibufferPanel;
46+import jp.sourceforge.nine.NineFrame;
4647 import jp.sourceforge.nine.RootPanel;
4748 import jp.sourceforge.nine.js.FrameSettings;
4849
@@ -64,7 +65,7 @@
6465 * returns its {@code RootPanel} ancestor.
6566 * @return the {@code RootPanel} for component or {@code null}.
6667 */
67- public static RootPanel getRootPanel(JComponent component) {
68+ public static RootPanel getRootPanel(Component component) {
6869 Container c = component instanceof Container ?
6970 (Container) component : component.getParent();
7071 if (c == null) { return null; }
@@ -92,6 +93,21 @@
9293 return null;
9394 }
9495
96+ public static NineFrame getNineFrame(Component component) {
97+ Window w = SwingUtilities.getWindowAncestor(component);
98+ if (w instanceof NineFrame) {
99+ return (NineFrame) w;
100+ }
101+ return null;
102+ }
103+
104+ public static MinibufferPanel getMinibufferPanel(Component component) {
105+ MinibufferPanel ret = null;
106+ NineFrame f = getNineFrame(component);
107+ if (f != null) { ret = f.getMinibufferPanel(); }
108+ return ret;
109+ }
110+
95111 /**
96112 * 次にフォーカスを取得するコンポーネントを返します。
97113 * <p>
--- nine-dired/trunk/src/jp/sourceforge/nine/dired/DiredTableData.java (revision 64)
+++ nine-dired/trunk/src/jp/sourceforge/nine/dired/DiredTableData.java (revision 65)
@@ -35,7 +35,7 @@
3535
3636 import jp.sourceforge.nine.MainTableData;
3737 import jp.sourceforge.nine.MainTablePane;
38-import jp.sourceforge.nine.RootPanel;
38+import jp.sourceforge.nine.MinibufferPanel;
3939 import jp.sourceforge.nine.action.dired.DiredFindFileCommand;
4040 import jp.sourceforge.nine.dired.DiredTableColumnModel.ExpansionToggleBorder;
4141 import jp.sourceforge.nine.util.NineUtilities;
@@ -165,10 +165,9 @@
165165 if (o instanceof MainTablePane) table = (MainTablePane)o;
166166 if (table == null) return;
167167
168- final RootPanel p = NineUtilities.getRootPanel(table);
169-
168+ final MinibufferPanel minibuffer = NineUtilities.getMinibufferPanel(table);
170169 SwingUtilities.invokeLater(new Runnable() {
171- public void run() { p.minibuffer().acceptUserInput(); }
170+ public void run() { minibuffer.acceptUserInput(); }
172171 });
173172
174173 new DiredFindFileCommand(table).execute();
--- nine-dired/trunk/src/jp/sourceforge/nine/action/dired/DiredFindFileCommand.java (revision 64)
+++ nine-dired/trunk/src/jp/sourceforge/nine/action/dired/DiredFindFileCommand.java (revision 65)
@@ -16,6 +16,7 @@
1616
1717 import jp.sourceforge.nine.MainBufferPane;
1818 import jp.sourceforge.nine.MainTablePane;
19+import jp.sourceforge.nine.MinibufferPanel;
1920 import jp.sourceforge.nine.RootPanel;
2021 import jp.sourceforge.nine.action.TargetWindow;
2122 import jp.sourceforge.nine.action.util.BufferSwitcher;
@@ -42,6 +43,7 @@
4243
4344 public Boolean execute() {
4445 RootPanel rootPanel = NineUtilities.getRootPanel(table);
46+ MinibufferPanel minibuffer = NineUtilities.getMinibufferPanel(table);
4547 int row = table.getSelectedRow();
4648
4749 File requested;
@@ -61,21 +63,21 @@
6163
6264 MainBufferPane m = BufferManager.getInstance().getBuffer(requested);
6365 if (m == null) {
64- open(rootPanel, requested);
66+ open(rootPanel, requested, minibuffer);
6567 } else {
6668 Runnable r = new BufferSwitcher(rootPanel, m);
6769 SwingUtilities.invokeLater(r);
68- rootPanel.minibuffer().reset();
70+ minibuffer.reset();
6971 }
7072 return true;
7173 }
7274
73- private void open(final RootPanel rootPanel, File requested) {
75+ private void open(final RootPanel rootPanel, File requested, MinibufferPanel minibuffer) {
7476 FindFileCommand c = new FindFileCommand(requested);
75- rootPanel.minibuffer().acceptUserInput();
77+ minibuffer.acceptUserInput();
7678 try {
7779 showBuffer(rootPanel, c.execute());
78- rootPanel.minibuffer().reset();
80+ minibuffer.reset();
7981 } catch (FileNotFoundException e) {
8082 e.printStackTrace();
8183 } catch (IOException e) {
@@ -84,7 +86,7 @@
8486 e.printStackTrace();
8587 } catch (FileIsNotReadableException e) {
8688 NineUtilities.beep(rootPanel);
87- rootPanel.minibuffer().reset(e.getMessage());
89+ minibuffer.reset(e.getMessage());
8890 }
8991 }
9092
旧リポジトリブラウザで表示