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.mail.gui.config.mailboximport;
18:
19: import javax.help.CSH;
20:
21: import net.javaprog.ui.wizard.DataLookup;
22: import net.javaprog.ui.wizard.DataModel;
23: import net.javaprog.ui.wizard.DefaultWizardModel;
24: import net.javaprog.ui.wizard.JavaHelpSupport;
25: import net.javaprog.ui.wizard.Step;
26: import net.javaprog.ui.wizard.Wizard;
27: import net.javaprog.ui.wizard.WizardModel;
28:
29: import org.columba.api.gui.frame.IFrameMediator;
30: import org.columba.api.plugin.IExtensionHandler;
31: import org.columba.api.plugin.PluginHandlerNotFoundException;
32: import org.columba.core.help.HelpManager;
33: import org.columba.core.plugin.PluginManager;
34: import org.columba.core.resourceloader.IconKeys;
35: import org.columba.core.resourceloader.ImageLoader;
36: import org.columba.mail.util.MailResourceLoader;
37:
38: /**
39: * Responsible for starting the mailbox import wizard.
40: */
41: public class ImportWizardLauncher {
42: private IFrameMediator mediator;
43:
44: public ImportWizardLauncher(IFrameMediator mediator) {
45: this .mediator = mediator;
46: }
47:
48: public void launchWizard() {
49: final IExtensionHandler pluginHandler;
50:
51: try {
52: pluginHandler = PluginManager.getInstance()
53: .getExtensionHandler("org.columba.mail.import");
54: } catch (PluginHandlerNotFoundException ex) {
55: throw new RuntimeException(ex);
56: }
57:
58: DataModel data = new DataModel();
59: data.registerDataLookup("Plugin.handler", new DataLookup() {
60: public Object lookupData() {
61: return pluginHandler;
62: }
63: });
64:
65: WizardModel model = new DefaultWizardModel(
66: new Step[] { new PluginStep(data),
67: new LocationStep(mediator, data) });
68: model.addWizardModelListener(new MailboxImporter(data));
69:
70: Wizard wizard = new Wizard(model, MailResourceLoader.getString(
71: "dialog", "mailboximport", "title"), ImageLoader
72: .getIcon(IconKeys.PREFERENCES));
73: wizard.setStepListRenderer(null);
74: CSH.setHelpIDString(wizard,
75: "organising_and_managing_your_email_1");
76: JavaHelpSupport.enableHelp(wizard, HelpManager.getInstance()
77: .getHelpBroker());
78: wizard.pack();
79: wizard.setLocationRelativeTo(null);
80: wizard.setVisible(true);
81: }
82: }
|