KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > addressbook > gui > dialog > importfilter > AddressbookImporter


1 //The contents of this file are subject to the Mozilla Public License Version 1.1
2
//(the "License"); you may not use this file except in compliance with the
3
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
4
//
5
//Software distributed under the License is distributed on an "AS IS" basis,
6
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7
//for the specific language governing rights and
8
//limitations under the License.
9
//
10
//The Original Code is "The Columba Project"
11
//
12
//The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14
//
15
//All Rights Reserved.
16
package org.columba.addressbook.gui.dialog.importfilter;
17
18 import net.javaprog.ui.wizard.DataModel;
19 import net.javaprog.ui.wizard.WizardModelEvent;
20 import net.javaprog.ui.wizard.WizardModelListener;
21
22 import org.columba.addressbook.folder.importfilter.DefaultAddressbookImporter;
23 import org.columba.api.plugin.IExtension;
24 import org.columba.api.plugin.IExtensionHandler;
25
26 class AddressbookImporter implements WizardModelListener {
27     protected DataModel data;
28
29     public AddressbookImporter(DataModel data) {
30         this.data = data;
31     }
32
33     public void wizardFinished(WizardModelEvent e) {
34         IExtensionHandler pluginHandler = (IExtensionHandler) data
35                 .getData("Plugin.handler");
36         DefaultAddressbookImporter importer = null;
37         Object JavaDoc[] args = new Object JavaDoc[] { data.getData("Location.source"),
38                 data.getData("Location.destination") };
39
40         try {
41             String JavaDoc pluginID = (String JavaDoc) data.getData("Plugin.ID");
42             IExtension extension = pluginHandler.getExtension(pluginID);
43
44             importer = (DefaultAddressbookImporter) extension
45                     .instanciateExtension(args);
46
47             importer.run();
48         } catch (Exception JavaDoc ex) {
49             ex.printStackTrace();
50
51             if (ex.getCause() != null) {
52                 ex.getCause().printStackTrace();
53             }
54
55             return;
56         }
57     }
58
59     public void stepShown(WizardModelEvent e) {
60     }
61
62     public void wizardCanceled(WizardModelEvent e) {
63     }
64
65     public void wizardModelChanged(WizardModelEvent e) {
66     }
67 }
68
Popular Tags