001: /*
002: * MailCommands.java
003: *
004: * Copyright (C) 1998-2003 Peter Graves
005: * $Id: MailCommands.java,v 1.4 2003/07/04 15:01:13 piso Exp $
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License
009: * as published by the Free Software Foundation; either version 2
010: * of the License, or (at your option) any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
020: */
021:
022: package org.armedbear.j.mail;
023:
024: import java.awt.AWTEvent;
025: import java.awt.event.MouseEvent;
026: import java.util.List;
027: import org.armedbear.j.Buffer;
028: import org.armedbear.j.BufferIterator;
029: import org.armedbear.j.Constants;
030: import org.armedbear.j.Debug;
031: import org.armedbear.j.Directories;
032: import org.armedbear.j.Editor;
033: import org.armedbear.j.File;
034: import org.armedbear.j.Frame;
035: import org.armedbear.j.FastStringBuffer;
036: import org.armedbear.j.History;
037: import org.armedbear.j.IdleThread;
038: import org.armedbear.j.InputDialog;
039: import org.armedbear.j.Line;
040: import org.armedbear.j.Log;
041: import org.armedbear.j.MessageDialog;
042: import org.armedbear.j.PasswordDialog;
043: import org.armedbear.j.Position;
044: import org.armedbear.j.Property;
045: import org.armedbear.j.Sidebar;
046: import org.armedbear.j.SimpleEdit;
047:
048: public final class MailCommands implements Constants {
049: public static void inbox() {
050: if (!Editor.isMailEnabled())
051: return;
052: final Editor editor = Editor.currentEditor();
053: String inbox = Editor.preferences().getStringProperty(
054: Property.INBOX);
055: if (inbox != null)
056: openMailbox(editor, inbox);
057: else
058: openMailbox(editor); // Prompt for mailbox.
059: }
060:
061: public static void openMailbox() {
062: if (!Editor.isMailEnabled())
063: return;
064: final Editor editor = Editor.currentEditor();
065: openMailbox(editor);
066: }
067:
068: public static void openMailbox(String args) {
069: openMailbox(Editor.currentEditor(), args);
070: }
071:
072: private static void openMailbox(Editor editor) {
073: InputDialog d = new InputDialog(editor, "Mailbox:",
074: "Open Mailbox", null);
075: d.setHistory(new History("openMailbox"));
076: editor.centerDialog(d);
077: d.show();
078: String s = d.getInput();
079: if (s == null || s.length() == 0)
080: return;
081: editor.repaintNow();
082: openMailbox(editor, s);
083: }
084:
085: public static void openMailbox(Editor editor, String input) {
086: final MailboxURL url = MailboxURL.parse(input);
087: if (url != null)
088: openMailbox(editor, url);
089: else
090: MessageDialog.showMessageDialog("Invalid mailbox name",
091: "Open Mailbox");
092: }
093:
094: public static void openMailbox(Editor editor, MailboxURL url) {
095: String limitPattern = url.getLimitPattern();
096: Log.debug("limitPattern = |" + limitPattern + "|");
097: MailboxFilter filter = null;
098: boolean badLimitPattern = false;
099: if (limitPattern != null) {
100: filter = MailboxFilter.getMailboxFilter(limitPattern);
101: if (filter == null) {
102: MessageDialog.showMessageDialog("Bad limit pattern",
103: "Open Mailbox");
104: limitPattern = null;
105: badLimitPattern = true;
106: }
107: }
108: if (url instanceof ImapURL || url instanceof PopURL) {
109: Mailbox mb = getMailbox(editor, url);
110: if (mb != null) {
111: if (mb.isLoaded()) {
112: if (filter != null && mb.getLimitFilter() == null) {
113: mb.limit(filter);
114: mb.setLimitPattern(limitPattern);
115: } else if (!badLimitPattern
116: && mb == Editor.currentEditor().getBuffer()) {
117: mb.limit(filter);
118: mb.setLimitPattern(limitPattern);
119: }
120: } else {
121: mb.setLimitFilter(filter);
122: mb.setLimitPattern(limitPattern);
123: }
124: editor.makeNext(mb);
125: editor.switchToBuffer(mb);
126: FolderTreeModel.getDefaultModel()
127: .maybeAddNodeForFolder(url);
128: // Add appropriate idle thread tasks.
129: IdleThread idleThread = IdleThread.getInstance();
130: if (idleThread != null) {
131: idleThread
132: .maybeAddTask(CheckMailTask.getInstance());
133: if (mb instanceof PopMailbox)
134: idleThread.maybeAddTask(RewriteMailboxesTask
135: .getInstance());
136: }
137: }
138: } else {
139: // Local mailbox (or local drafts folder).
140: Debug.assertTrue(url instanceof LocalMailboxURL);
141: final File file = ((LocalMailboxURL) url).getFile();
142: Mailbox mb = null;
143: for (BufferIterator it = new BufferIterator(); it.hasNext();) {
144: Buffer buf = it.nextBuffer();
145: if (buf instanceof LocalMailbox) {
146: if (((LocalMailbox) buf).getMailboxFile().equals(
147: file)) {
148: mb = (LocalMailbox) buf;
149: break;
150: }
151: } else if (buf instanceof Drafts) {
152: if (((Drafts) buf).getDirectory().equals(file)) {
153: mb = (Drafts) buf;
154: break;
155: }
156: }
157: }
158: if (mb == null) {
159: // Not found.
160: if (file.equals(Directories.getDraftsFolder()))
161: mb = new Drafts((LocalMailboxURL) url);
162: else
163: mb = new LocalMailbox((LocalMailboxURL) url);
164: }
165: mb.setLimitFilter(filter);
166: mb.setLimitPattern(limitPattern);
167: editor.makeNext(mb);
168: editor.switchToBuffer(mb);
169: }
170: }
171:
172: public static Buffer getMailboxBuffer(Editor editor, MailboxURL url) {
173: return getMailbox(editor, url);
174: }
175:
176: public static Mailbox getMailbox(Editor editor, MailboxURL url) {
177: if (url instanceof ImapURL) {
178: // IMAP.
179: for (BufferIterator it = new BufferIterator(); it.hasNext();) {
180: Buffer buf = it.nextBuffer();
181: if (buf instanceof ImapMailbox) {
182: ImapMailbox mb = (ImapMailbox) buf;
183: if (mb.getUrl().equals(url))
184: return mb;
185: }
186: }
187: final ImapURL imapUrl = (ImapURL) url;
188: ImapSession session = ImapSession.getSession(imapUrl);
189: if (session == null) {
190: String user = imapUrl.getUser();
191: if (user == null) {
192: user = InputDialog.showInputDialog(editor,
193: "Login:", "Login on " + imapUrl.getHost());
194: if (user == null || user.length() == 0)
195: return null;
196: session = ImapSession.getSession(imapUrl, user);
197: }
198: if (session == null) {
199: String password = PasswordDialog
200: .showPasswordDialog(editor, "Password:",
201: "Password");
202: if (password == null || password.length() == 0)
203: return null;
204: session = ImapSession.getSession(imapUrl, user,
205: password);
206: }
207: }
208: if (session != null)
209: return new ImapMailbox(imapUrl, session);
210: } else if (url instanceof PopURL) {
211: for (BufferIterator it = new BufferIterator(); it.hasNext();) {
212: Buffer buf = it.nextBuffer();
213: if (buf instanceof PopMailbox) {
214: PopMailbox mb = (PopMailbox) buf;
215: if (mb.getUrl().equals(url))
216: return mb;
217: }
218: }
219: final PopURL popUrl = (PopURL) url;
220: PopSession session = PopSession.getSession(popUrl);
221: if (session == null) {
222: String user = popUrl.getUser();
223: if (user == null) {
224: user = InputDialog.showInputDialog(editor,
225: "Login:", "Login on " + popUrl.getHost());
226: if (user == null || user.length() == 0)
227: return null;
228: session = PopSession.getSession(popUrl, user);
229: }
230: if (session == null) {
231: String password = PasswordDialog
232: .showPasswordDialog(editor, "Password:",
233: "Password");
234: if (password == null || password.length() == 0)
235: return null;
236: session = PopSession.getSession(popUrl, user,
237: password);
238: }
239: }
240: if (session != null)
241: return new PopMailbox(popUrl, session);
242: }
243: return null;
244: }
245:
246: public static void compose() {
247: if (!Editor.isMailEnabled())
248: return;
249: activateMailCompositionBuffer(Editor.currentEditor(),
250: new SendMail());
251: }
252:
253: public static void ccGroup() {
254: final Buffer buffer = Editor.currentEditor().getBuffer();
255: if (buffer instanceof SendMail)
256: ((SendMail) buffer).ccGroup();
257: }
258:
259: public static void attachFile() {
260: final Buffer buffer = Editor.currentEditor().getBuffer();
261: if (buffer instanceof SendMail)
262: ((SendMail) buffer).attachFile();
263: }
264:
265: public static void send() {
266: final Buffer buffer = Editor.currentEditor().getBuffer();
267: if (buffer instanceof SendMail)
268: ((SendMail) buffer).send();
269: }
270:
271: public static void sendMailElectricColon() {
272: final Editor editor = Editor.currentEditor();
273: final Line dotLine = editor.getDotLine();
274: final int dotOffset = editor.getDotOffset();
275: if (editor.getModeId() != SEND_MAIL_MODE
276: || editor.getMark() != null
277: || dotOffset != dotLine.length()) {
278: editor.insertNormalChar(':');
279: return;
280: }
281: final SendMail sm = (SendMail) editor.getBuffer();
282: if (sm.isHeaderLine(dotLine)) {
283: // If the line begins with maybe some whitespace, followed by some
284: // non-whitespace chars and now a colon, force the non-whitespace
285: // chars (the header name) into column 0.
286: int i;
287: for (i = 0; i < dotOffset; i++) {
288: char c = dotLine.charAt(i);
289: if (c != ' ' && c != '\t')
290: break;
291: }
292: if (i == dotOffset) {
293: // The colon we're inserting will be the first non-whitespace
294: // character.
295: editor.insertNormalChar(':');
296: return;
297: }
298: final int begin = i;
299: for (++i; i < dotOffset; i++) {
300: char c = dotLine.charAt(i);
301: if (c == ' ' || c == '\t') {
302: // Whitespace after non-whitespace: don't be electric.
303: editor.insertNormalChar(':');
304: return;
305: }
306: }
307: try {
308: sm.lockWrite();
309: } catch (InterruptedException e) {
310: Log.error(e);
311: return;
312: }
313: try {
314: editor.addUndo(SimpleEdit.LINE_EDIT);
315: dotLine.setText(dotLine.substring(begin).concat(":"));
316: sm.modified();
317: } finally {
318: sm.unlockWrite();
319: }
320: editor.getDot().setOffset(dotLine.length());
321: editor.moveCaretToDotCol();
322: Editor.updateInAllEditors(dotLine);
323: } else
324: editor.insertNormalChar(':');
325: }
326:
327: public static void sendMailTab() {
328: final Editor editor = Editor.currentEditor();
329: final Buffer buffer = editor.getBuffer();
330: if (buffer instanceof SendMail)
331: ((SendMail) buffer).tab(editor);
332: }
333:
334: public static void sendMailBackTab() {
335: final Editor editor = Editor.currentEditor();
336: final Buffer buffer = editor.getBuffer();
337: if (buffer instanceof SendMail)
338: ((SendMail) buffer).backTab(editor);
339: }
340:
341: public static void messageMoveToFolder() {
342: final Buffer buffer = Editor.currentEditor().getBuffer();
343: if (buffer instanceof MessageBuffer)
344: ((MessageBuffer) buffer).moveMessage();
345: }
346:
347: public static void messageDelete() {
348: final Buffer buffer = Editor.currentEditor().getBuffer();
349: if (buffer instanceof MessageBuffer)
350: ((MessageBuffer) buffer).deleteMessage();
351: }
352:
353: public static void messageFlag() {
354: final Buffer buffer = Editor.currentEditor().getBuffer();
355: if (buffer instanceof MessageBuffer)
356: ((MessageBuffer) buffer).flagMessage();
357: }
358:
359: public static void messageNext() {
360: final Buffer buffer = Editor.currentEditor().getBuffer();
361: if (buffer instanceof NewsGroupMessageBuffer)
362: ((NewsGroupMessageBuffer) buffer).nextArticle();
363: else if (buffer instanceof MessageBuffer)
364: ((MessageBuffer) buffer).nextMessage();
365: }
366:
367: public static void messagePrevious() {
368: final Buffer buffer = Editor.currentEditor().getBuffer();
369: if (buffer instanceof NewsGroupMessageBuffer)
370: ((NewsGroupMessageBuffer) buffer).previousArticle();
371: else if (buffer instanceof MessageBuffer)
372: ((MessageBuffer) buffer).previousMessage();
373: }
374:
375: public static void messageNextInThread() {
376: final Buffer buffer = Editor.currentEditor().getBuffer();
377: if (buffer instanceof MessageBuffer)
378: ((MessageBuffer) buffer).nextInThread();
379: }
380:
381: public static void messagePreviousInThread() {
382: final Buffer buffer = Editor.currentEditor().getBuffer();
383: if (buffer instanceof MessageBuffer)
384: ((MessageBuffer) buffer).previousInThread();
385: }
386:
387: public static void messageParent() {
388: final Buffer buffer = Editor.currentEditor().getBuffer();
389: if (buffer instanceof MessageBuffer)
390: ((MessageBuffer) buffer).parentMessage();
391: }
392:
393: public static void messageForward() {
394: final Editor editor = Editor.currentEditor();
395: final Buffer buffer = editor.getBuffer();
396: if (buffer instanceof MessageBuffer) {
397: MessageBuffer messageBuffer = (MessageBuffer) buffer;
398: SendMail sm = new SendMail(messageBuffer);
399: activateMailCompositionBuffer(editor, sm);
400: }
401: }
402:
403: public static void messageReplyToSender() {
404: messageReply(false);
405: }
406:
407: public static void messageReplyToGroup() {
408: messageReply(true);
409: }
410:
411: private static void messageReply(boolean replyToGroup) {
412: Editor editor = Editor.currentEditor();
413: final Buffer buffer = editor.getBuffer();
414: if (buffer instanceof MessageBuffer) {
415: MessageBuffer messageBuffer = (MessageBuffer) buffer;
416: if (messageBuffer.getMailbox() != null) {
417: SendMail sm = new SendMail(messageBuffer, replyToGroup);
418: activateMailCompositionBuffer(editor, sm);
419: }
420: }
421: }
422:
423: private static void activateMailCompositionBuffer(Editor editor,
424: SendMail sm) {
425: editor.makeNext(sm);
426: Frame frame = editor.getFrame();
427: editor.switchToBuffer(sm);
428: // Switching buffers might close the original editor.
429: Editor ed = frame.contains(editor) ? editor : frame
430: .getCurrentEditor();
431: if (ed.getBuffer() == sm) {
432: ed.setDot(sm.getInitialDotPos());
433: ed.moveCaretToDotCol();
434: ed.updateDisplay();
435: }
436: }
437:
438: public static final void messageIndex() {
439: messageIndex(Editor.currentEditor());
440: }
441:
442: public static void messageIndex(Editor editor) {
443: final Buffer buffer = editor.getBuffer();
444: if (buffer instanceof MessageBuffer) {
445: MessageBuffer messageBuffer = (MessageBuffer) buffer;
446: Mailbox mailbox = messageBuffer.getMailbox();
447: if (mailbox == null)
448: return;
449: for (BufferIterator it = new BufferIterator(); it.hasNext();) {
450: Buffer buf = it.nextBuffer();
451: if (buf == mailbox) {
452: final Line line = mailbox
453: .getLineForEntry(messageBuffer
454: .getMailboxEntry());
455: if (editor == Editor.currentEditor()) {
456: Editor otherEditor = editor.getOtherEditor();
457: if (otherEditor != null
458: && messageBuffer.isTransient()) {
459: messageBuffer.saveWindowState(editor);
460: editor.otherWindow();
461: editor.unsplitWindow();
462: editor = Editor.currentEditor();
463: }
464: }
465: editor.activate(mailbox);
466: messageBuffer.kill();
467: Sidebar.refreshSidebarInAllFrames();
468: if (line != null) {
469: editor.getDot().moveTo(line, 0);
470: editor.setUpdateFlag(REFRAME);
471: editor.setMark(null);
472: editor.moveCaretToDotCol();
473: }
474: return;
475: }
476: }
477: }
478: }
479:
480: public static void mailboxLastMessage() {
481: final Editor editor = Editor.currentEditor();
482: final Buffer buffer = editor.getBuffer();
483: if (buffer instanceof Mailbox) {
484: if (editor.getDot() != null) {
485: Position end = buffer.getEnd();
486: if (end != null) {
487: editor.moveDotTo(end.getLine(), 0);
488: editor.setUpdateFlag(REFRAME);
489: }
490: }
491: }
492: }
493:
494: public static void mailboxGetNewMessages() {
495: final Buffer buffer = Editor.currentEditor().getBuffer();
496: if (buffer instanceof Mailbox)
497: ((Mailbox) buffer).getNewMessages();
498: }
499:
500: public static void mailboxLimit() {
501: final Buffer buffer = Editor.currentEditor().getBuffer();
502: if (buffer instanceof Mailbox)
503: ((Mailbox) buffer).limit();
504: }
505:
506: public static void mailboxUnlimit() {
507: final Buffer buffer = Editor.currentEditor().getBuffer();
508: if (buffer instanceof Mailbox)
509: ((Mailbox) buffer).unlimit();
510: }
511:
512: public static void mailboxReadMessage() {
513: mailboxReadMessage(false);
514: }
515:
516: public static void mailboxReadMessageOtherWindow() {
517: mailboxReadMessage(true);
518: }
519:
520: private static void mailboxReadMessage(boolean useOtherWindow) {
521: final Editor editor = Editor.currentEditor();
522: final Buffer buffer = editor.getBuffer();
523: if (buffer instanceof Mailbox && editor.getDot() != null) {
524: // If this method is invoked via a mouse event mapping, move dot to
525: // location of mouse click first.
526: AWTEvent e = editor.getDispatcher().getLastEvent();
527: if (e instanceof MouseEvent)
528: editor.mouseMoveDotToPoint((MouseEvent) e);
529: if (useOtherWindow)
530: ((Mailbox) buffer).readMessageOtherWindow(editor
531: .getDotLine());
532: else
533: ((Mailbox) buffer).readMessage(editor.getDotLine());
534: }
535: }
536:
537: public static void mailboxCreateFolder() {
538: final Buffer buffer = Editor.currentEditor().getBuffer();
539: if (buffer instanceof Mailbox)
540: ((Mailbox) buffer).createFolder();
541: }
542:
543: public static void mailboxDeleteFolder() {
544: final Buffer buffer = Editor.currentEditor().getBuffer();
545: if (buffer instanceof Mailbox)
546: ((Mailbox) buffer).deleteFolder();
547: }
548:
549: public static void mailboxSaveToFolder() {
550: final Buffer buffer = Editor.currentEditor().getBuffer();
551: if (buffer instanceof Mailbox)
552: ((Mailbox) buffer).saveToFolder();
553: }
554:
555: public static void mailboxMoveToFolder() {
556: final Buffer buffer = Editor.currentEditor().getBuffer();
557: if (buffer instanceof Mailbox)
558: ((Mailbox) buffer).moveToFolder();
559: }
560:
561: public static void mailboxDelete() {
562: final Buffer buffer = Editor.currentEditor().getBuffer();
563: if (buffer instanceof Mailbox)
564: ((Mailbox) buffer).delete();
565: }
566:
567: public static void mailboxUndelete() {
568: final Buffer buffer = Editor.currentEditor().getBuffer();
569: if (buffer instanceof Mailbox)
570: ((Mailbox) buffer).undelete();
571: }
572:
573: public static void mailboxMarkRead() {
574: final Buffer buffer = Editor.currentEditor().getBuffer();
575: if (buffer instanceof Mailbox)
576: ((Mailbox) buffer).markRead();
577: }
578:
579: public static void mailboxMarkUnread() {
580: final Buffer buffer = Editor.currentEditor().getBuffer();
581: if (buffer instanceof Mailbox)
582: ((Mailbox) buffer).markUnread();
583: }
584:
585: public static void mailboxFlag() {
586: final Buffer buffer = Editor.currentEditor().getBuffer();
587: if (buffer instanceof Mailbox)
588: ((Mailbox) buffer).flag();
589: }
590:
591: public static void mailboxTag() {
592: final Editor editor = Editor.currentEditor();
593: final Buffer buffer = editor.getBuffer();
594: if (buffer instanceof Mailbox)
595: ((Mailbox) buffer).tag(editor, editor.getDotLine());
596: }
597:
598: public static void mailboxTagPattern() {
599: final Buffer buffer = Editor.currentEditor().getBuffer();
600: if (buffer instanceof Mailbox)
601: ((Mailbox) buffer).tagPattern();
602: }
603:
604: public static void mailboxUntagAll() {
605: final Buffer buffer = Editor.currentEditor().getBuffer();
606: if (buffer instanceof Mailbox)
607: ((Mailbox) buffer).untagAll();
608: }
609:
610: public static void mailboxToggleRaw() {
611: final Buffer buffer = Editor.currentEditor().getBuffer();
612: if (buffer instanceof Mailbox)
613: ((Mailbox) buffer).toggleRaw();
614: }
615:
616: public static void mailboxExpunge() {
617: final Buffer buffer = Editor.currentEditor().getBuffer();
618: if (buffer instanceof Mailbox)
619: ((Mailbox) buffer).expunge();
620: }
621:
622: public static final void mailboxStop() {
623: Editor.currentEditor().cancelBackgroundProcess();
624: }
625:
626: public static void messageToggleHeaders() {
627: final Buffer buffer = Editor.currentEditor().getBuffer();
628: if (buffer instanceof MessageBuffer)
629: ((MessageBuffer) buffer).toggleHeaders();
630: }
631:
632: public static void messageToggleRaw() {
633: final Buffer buffer = Editor.currentEditor().getBuffer();
634: if (buffer instanceof MessageBuffer)
635: ((MessageBuffer) buffer).toggleRaw();
636: }
637:
638: public static void messageToggleWrap() {
639: final Buffer buffer = Editor.currentEditor().getBuffer();
640: if (buffer instanceof MessageBuffer)
641: ((MessageBuffer) buffer).toggleWrap();
642: }
643:
644: public static void messageViewAttachment() {
645: final Buffer buffer = Editor.currentEditor().getBuffer();
646: if (buffer instanceof MessageBuffer)
647: ((MessageBuffer) buffer).viewAttachment();
648: else if (buffer instanceof NewsGroupMessageBuffer)
649: ((NewsGroupMessageBuffer) buffer).viewInline();
650: }
651:
652: public static void messageSaveAttachment() {
653: final Buffer buffer = Editor.currentEditor().getBuffer();
654: if (buffer instanceof MessageBuffer)
655: ((MessageBuffer) buffer).saveAttachment();
656: }
657:
658: public static void bounce() {
659: final Editor editor = Editor.currentEditor();
660: final Buffer buffer = editor.getBuffer();
661: if (buffer instanceof Mailbox)
662: ((Mailbox) buffer).bounce();
663: else if (buffer instanceof MessageBuffer)
664: ((MessageBuffer) buffer).bounce();
665: }
666:
667: public static MailAddress[] bounceGetTo(Editor editor, int count) {
668: FastStringBuffer sb = new FastStringBuffer("Bounce ");
669: sb.append(count);
670: sb.append(" message");
671: if (count > 1)
672: sb.append('s');
673: sb.append(" to:");
674: InputDialog d = new InputDialog(editor, sb.toString(),
675: "Bounce", null);
676: d.setHistory(new History("bounceMessage"));
677: editor.centerDialog(d);
678: d.show();
679: String input = d.getInput();
680: if (input == null)
681: return null;
682: MailAddress[] to = MailAddress.parseAddresses(input);
683: if (to == null || to.length == 0)
684: return null;
685: return to;
686: }
687:
688: public static void toggleGroupByThread() {
689: final Buffer buffer = Editor.currentEditor().getBuffer();
690: if (buffer instanceof Mailbox)
691: ((Mailbox) buffer).toggleGroupByThread();
692: }
693:
694: public static void foldThread() {
695: final Editor editor = Editor.currentEditor();
696: final Buffer buffer = editor.getBuffer();
697: if (buffer instanceof Mailbox)
698: ((Mailbox) buffer).foldThread(editor.getDotLine());
699: }
700:
701: public static void foldThreads() {
702: final Editor editor = Editor.currentEditor();
703: final Buffer buffer = editor.getBuffer();
704: if (buffer instanceof Mailbox)
705: ((Mailbox) buffer).foldThreads();
706: }
707: }
|