KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > tool > codegen > eclipse > ui > AbstractWizardPage


1 /*
2  * Copyright 2004,2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.axis.tool.codegen.eclipse.ui;
17
18 import org.apache.axis.tool.codegen.eclipse.plugin.CodegenWizardPlugin;
19 import org.apache.axis.tool.codegen.eclipse.util.SettingsConstants;
20 import org.eclipse.jface.dialogs.IDialogSettings;
21 import org.eclipse.jface.wizard.WizardPage;
22
23 public abstract class AbstractWizardPage extends WizardPage implements SettingsConstants {
24     
25     protected IDialogSettings settings;
26     protected boolean restoredFromPreviousSettings = false;
27     
28     public AbstractWizardPage(String JavaDoc pageName){
29         super(pageName+".name");
30         init(pageName);
31     }
32     
33     protected void init(String JavaDoc pageName){
34         setTitle(CodegenWizardPlugin.getResourceString(pageName+".title"));
35         setDescription(CodegenWizardPlugin.getResourceString(pageName+".desc"));
36         setImageDescriptor(CodegenWizardPlugin.getWizardImageDescriptor());
37         
38         /*
39          * Get the settings for this page. If there is no section in the
40          * Plugin's settings for this OptionsPage, create a new section
41          */

42         IDialogSettings rootSettings = CodegenWizardPlugin.getDefault()
43                 .getDialogSettings();
44         IDialogSettings section = rootSettings.getSection(this.getClass()
45                 .getName());
46         if (section == null) {
47             settings = rootSettings.addNewSection(this.getClass().getName());
48             restoredFromPreviousSettings = false;
49             initializeDefaultSettings();
50         } else {
51             restoredFromPreviousSettings=true;
52             settings = section;
53         }
54     }
55
56     protected void updateStatus(String JavaDoc message) {
57         setErrorMessage(message);
58         setPageComplete(message == null);
59     }
60
61     protected abstract void initializeDefaultSettings();
62    
63     public abstract int getPageType() ;
64 }
65
Popular Tags