0
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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 |
package com.nokia.s60tools.symbianfoundationtemplates.ui.wizards;
|
|
18 |
|
|
19 |
import java.util.AbstractList;
|
|
20 |
|
|
21 |
import org.eclipse.core.runtime.IStatus;
|
|
22 |
import org.eclipse.jface.wizard.WizardPage;
|
|
23 |
|
|
24 |
import com.nokia.s60tools.symbianfoundationtemplates.engine.OriginalTemplate;
|
|
25 |
|
|
26 |
/**
|
|
27 |
* Base template wizard page.
|
|
28 |
*
|
|
29 |
*/
|
|
30 |
public abstract class BaseTemplateWizardPage extends WizardPage {
|
|
31 |
/**
|
|
32 |
* The default constructor.
|
|
33 |
*
|
|
34 |
* @param title the page title
|
|
35 |
*/
|
|
36 |
protected BaseTemplateWizardPage(String title) {
|
|
37 |
super(title);
|
|
38 |
}
|
|
39 |
|
|
40 |
/**
|
|
41 |
* Apply the given status to the wizard.
|
|
42 |
*
|
|
43 |
* @param status the status of the page
|
|
44 |
*/
|
|
45 |
public void applyStatus(IStatus status) {
|
|
46 |
String message = status.getMessage();
|
|
47 |
|
|
48 |
switch(status.getSeverity()) {
|
|
49 |
case IStatus.OK:
|
|
50 |
setErrorMessage(null);
|
|
51 |
if(message.length() == 0)
|
|
52 |
setMessage(getPageMessage());
|
|
53 |
break;
|
|
54 |
case IStatus.WARNING:
|
|
55 |
setErrorMessage(null);
|
|
56 |
setMessage(message, WizardPage.WARNING);
|
|
57 |
break;
|
|
58 |
case IStatus.INFO:
|
|
59 |
setErrorMessage(null);
|
|
60 |
setMessage(message, WizardPage.INFORMATION);
|
|
61 |
break;
|
|
62 |
default:
|
|
63 |
setErrorMessage(message);
|
|
64 |
setMessage(null);
|
|
65 |
break;
|
|
66 |
}
|
|
67 |
}
|
|
68 |
|
|
69 |
/**
|
|
70 |
* Get templates from the page.
|
|
71 |
*
|
|
72 |
* @return the templates
|
|
73 |
*/
|
|
74 |
public abstract AbstractList<OriginalTemplate> getTemplates();
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Get this pages message for the wizard.
|
|
78 |
*
|
|
79 |
* @return the message
|
|
80 |
*/
|
|
81 |
public abstract String getPageMessage();
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Get the status of this page.
|
|
85 |
*
|
|
86 |
* @return the status
|
|
87 |
*/
|
|
88 |
public abstract IStatus getStatus();
|
|
89 |
|
|
90 |
/**
|
|
91 |
* Save the preferences to the preference store.
|
|
92 |
*
|
|
93 |
*/
|
|
94 |
protected abstract void savePreferencesToStore();
|
|
95 |
}
|