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:
17: package org.columba.addressbook.gui.dialog.importfilter;
18:
19: import net.javaprog.ui.wizard.DataLookup;
20: import net.javaprog.ui.wizard.DataModel;
21: import net.javaprog.ui.wizard.DefaultWizardModel;
22: import net.javaprog.ui.wizard.Step;
23: import net.javaprog.ui.wizard.Wizard;
24: import net.javaprog.ui.wizard.WizardModel;
25:
26: import org.columba.addressbook.util.AddressbookResourceLoader;
27: import org.columba.api.plugin.IExtensionHandler;
28: import org.columba.api.plugin.PluginHandlerNotFoundException;
29: import org.columba.core.plugin.PluginManager;
30: import org.columba.core.resourceloader.IconKeys;
31: import org.columba.core.resourceloader.ImageLoader;
32:
33: /**
34: * Responsible for launching the addressbook import wizard.
35: */
36: public class ImportWizardLauncher {
37: public ImportWizardLauncher() {
38: }
39:
40: public void launchWizard() {
41: final IExtensionHandler pluginHandler;
42:
43: try {
44: pluginHandler = PluginManager.getInstance()
45: .getExtensionHandler(
46: "org.columba.addressbook.import");
47: } catch (PluginHandlerNotFoundException ex) {
48: throw new RuntimeException(ex);
49: }
50:
51: DataModel data = new DataModel();
52: data.registerDataLookup("Plugin.handler", new DataLookup() {
53: public Object lookupData() {
54: return pluginHandler;
55: }
56: });
57:
58: WizardModel model = new DefaultWizardModel(new Step[] {
59: new PluginStep(data), new LocationStep(data) });
60: model.addWizardModelListener(new AddressbookImporter(data));
61:
62: Wizard wizard = new Wizard(model, AddressbookResourceLoader
63: .getString("dialog", "addressbookimport", "title"),
64: ImageLoader.getSmallIcon(IconKeys.PREFERENCES));
65: wizard.setStepListRenderer(null);
66: wizard.pack();
67: wizard.setLocationRelativeTo(null);
68: wizard.setVisible(true);
69: }
70: }
|