1 | package org.columba.mail.filter.plugins;↵ | | 1 | package org.columba.mail.filter.plugins;↵
|
|
2 | import javax.swing.JOptionPane;↵ | | 2 | import javax.swing.JOptionPane;↵
|
|
3 | import org.columba.api.command.ICommand;↵ | | 3 | import org.columba.api.command.ICommand;↵
|
4 | import org.columba.core.filter.AbstractFilterAction;↵ | | 4 | import org.columba.core.filter.AbstractFilterAction;↵
|
5 | import org.columba.core.filter.FilterAction;↵ | | 5 | import org.columba.core.filter.FilterAction;↵
|
6 | import org.columba.core.filter.IFilterAction;↵ | | 6 | import org.columba.core.filter.IFilterAction;↵
|
7 | import org.columba.core.folder.api.IFolder;↵ | | 7 | import org.columba.core.folder.api.IFolder;↵
|
8 | import org.columba.core.gui.frame.FrameManager;↵ | | 8 | import org.columba.core.gui.frame.FrameManager;↵
|
9 | import org.columba.mail.command.MailFolderCommandReference;↵ | | 9 | import org.columba.mail.command.MailFolderCommandReference;↵
|
10 | import org.columba.mail.folder.IMailbox;↵ | | 10 | import org.columba.mail.folder.IMailbox;↵
|
11 | import org.columba.mail.folder.command.CopyMessageCommand;↵ | | 11 | import org.columba.mail.folder.command.MoveMessageCommand;↵
|
12 | import org.columba.mail.gui.tree.FolderTreeModel;↵ | | 12 | import org.columba.mail.gui.tree.FolderTreeModel;↵
|
|
13 | /**↵ | | 13 | /**↵
|
14 | * @author freddy↵ | | 14 | * @author freddy↵
|
15 | *↵ | | 15 | *↵
|
16 | * To change this generated comment edit the template variable "typecomment":↵ | | 16 | * To change this generated comment edit the template variable "typecomment":↵
|
17 | * Window>Preferences>Java>Templates. To enable and disable the creation of type↵ | | 17 | * Window>Preferences>Java>Templates. To enable and disable the creation of type↵
|
18 | * comments go to Window>Preferences>Java>Code Generation.↵ | | 18 | * comments go to Window>Preferences>Java>Code Generation.↵
|
19 | */↵ | | 19 | */↵
|
20 | public class CopyMessageAction extends AbstractFilterAction {↵ | | 20 | public class MoveMessageAction extends AbstractFilterAction {↵
|
21 | ↵ | | 21 | /**↵
|
| | | 22 | * @see org.columba.modules.mail.filter.action.AbstractFilterAction#execute()↵
|
| | | 23 | *↵
|
| | | 24 | * move message from source- to destination-folder↵
|
| | | 25 | */↵
|
22 | public ICommand getCommand(IFilterAction filterAction,↵ | | 26 | public ICommand getCommand(IFilterAction filterAction,↵
|
23 | IFolder srcFolder, Object[] uids) throws Exception {↵ | | 27 | IFolder srcFolder, Object[] uids) throws Exception {↵
|
24 | String uid = filterAction.getUid();↵ | | 28 | String uid = filterAction.getUid();↵
|
|
25 | IMailbox destFolder = (IMailbox) FolderTreeModel.getInstance()↵ | | 29 | IMailbox destFolder = (IMailbox) FolderTreeModel.getInstance()↵
|
26 | .getFolder(uid);↵ | | 30 | .getFolder(uid);↵
|
|
27 | if (destFolder == null) {↵ | | 31 | if (destFolder == null) {↵
|
28 | JOptionPane↵ | | 32 | JOptionPane↵
|
29 | .showMessageDialog(↵ | | 33 | .showMessageDialog(↵
|
30 | FrameManager.getInstance()↵ | | 34 | FrameManager.getInstance()↵
|
31 | .getActiveFrame(),↵ | | 35 | .getActiveFrame(),↵
|
32 | "Unable to find destination folder, please correct the destination folder path for this filter");↵ | | 36 | "Unable to find destination folder, please correct the destination folder path for this filter");↵
|
33 | throw new Exception("File not found");↵ | | 37 | throw new Exception("File not found");↵
|
34 | }↵ | | 38 | }↵
|
|
35 | MailFolderCommandReference r = new MailFolderCommandReference(srcFolder,↵ | | 39 | MailFolderCommandReference r = new MailFolderCommandReference(srcFolder,↵
|
36 | destFolder, uids);↵ | | 40 | destFolder, uids);↵
|
|
37 | CopyMessageCommand c = new CopyMessageCommand(r);↵ | | 41 | MoveMessageCommand c = new MoveMessageCommand(r);↵
|
|
38 | return c;↵ | | 42 | return c;↵
|
39 | } | | 43 | }
|