01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
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[] args = new Object[] { data.getData("Location.source"),
38: data.getData("Location.destination") };
39:
40: try {
41: String pluginID = (String) 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 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: }
|