|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 package com.nokia.s60tools.ui.wizards; |
|
20 |
|
21 import org.eclipse.jface.dialogs.IPageChangedListener; |
|
22 import org.eclipse.jface.dialogs.PageChangedEvent; |
|
23 import org.eclipse.jface.resource.ImageDescriptor; |
|
24 import org.eclipse.jface.wizard.IWizardContainer; |
|
25 import org.eclipse.jface.wizard.Wizard; |
|
26 |
|
27 /** |
|
28 * This class defines common structure for all S60 tool wizards. |
|
29 * It can be subclasses in order to provide wizards that can |
|
30 * utilize these services provided. |
|
31 * |
|
32 * This class is planned to be used together with |
|
33 * <code>com.nokia.s60tools.ui.wizards.S60ToolsWizardPage</code> |
|
34 * class. |
|
35 * |
|
36 * @see com.nokia.s60tools.ui.wizards.S60ToolsWizardPage |
|
37 */ |
|
38 public abstract class S60ToolsWizard extends Wizard implements IPageChangedListener{ |
|
39 |
|
40 /** |
|
41 * Default constructor. |
|
42 */ |
|
43 protected S60ToolsWizard(){ |
|
44 init(); |
|
45 } |
|
46 |
|
47 /** |
|
48 * Constructor allowing to use product-specific banner image. |
|
49 * @param bannerImgDescriptor Banner image descriptor. |
|
50 */ |
|
51 protected S60ToolsWizard(ImageDescriptor bannerImgDescriptor){ |
|
52 setDefaultPageImageDescriptor(bannerImgDescriptor); |
|
53 init(); |
|
54 } |
|
55 |
|
56 /** |
|
57 * Initialized default settings for the wizard. |
|
58 */ |
|
59 private void init(){ |
|
60 //By default there is no wizard help available. Can be overridedn by sub classes. |
|
61 setHelpAvailable(false); |
|
62 //By default is no progress monitor is needed. Can be overridedn by sub classes. |
|
63 setNeedsProgressMonitor(false); |
|
64 } |
|
65 |
|
66 /** |
|
67 * Overrides the base class implementation from |
|
68 * <code>org.eclipse.jface.dialogs.IPageChangedListener</code>. |
|
69 * |
|
70 * This overridden implementation |
|
71 * gets current <code>S60ToolsWizardPage</code> instance and calls it |
|
72 * <code>recalculateButtonStates</code> and <code>setInitialFocus</code> methods |
|
73 * thus initializing page into correct initial state. |
|
74 * |
|
75 * @see com.nokia.s60tools.ui.wizards.S60ToolsWizardPage#recalculateButtonStates |
|
76 * @see com.nokia.s60tools.ui.wizards.S60ToolsWizardPage#setInitialFocus |
|
77 */ |
|
78 public void pageChanged(PageChangedEvent event) { |
|
79 // |
|
80 // Updating buttons states when the page is changed |
|
81 // |
|
82 IWizardContainer container = getContainer(); |
|
83 if(container != null){ |
|
84 S60ToolsWizardPage currPage = (S60ToolsWizardPage)container.getCurrentPage(); |
|
85 if(currPage != null){ |
|
86 currPage.recalculateButtonStates(); |
|
87 currPage.setInitialFocus(); |
|
88 } |
|
89 } |
|
90 } |
|
91 |
|
92 /** |
|
93 * Overrides the base class implementation from |
|
94 * <code>org.eclipse.jface.wizard.Wizard</code> |
|
95 * and defines this as abstract method, therefore enforcing |
|
96 * derived class to provide an implementation, which |
|
97 * would be otherwise optional. |
|
98 */ |
|
99 public abstract void addPages(); |
|
100 |
|
101 } |