KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > tool > service > eclipse > ui > ServiceArchiveWizard


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.service.eclipse.ui;
17
18
19 import org.apache.axis.tool.service.bean.WizardBean;
20 import org.apache.axis.tool.service.control.Controller;
21 import org.apache.axis.tool.service.control.ProcessException;
22 import org.apache.axis.tool.service.eclipse.plugin.ServiceArchiver;
23 import org.eclipse.jface.dialogs.MessageDialog;
24 import org.eclipse.jface.viewers.IStructuredSelection;
25 import org.eclipse.jface.wizard.IWizardPage;
26 import org.eclipse.jface.wizard.Wizard;
27 import org.eclipse.ui.INewWizard;
28 import org.eclipse.ui.IWorkbench;
29
30
31 /**
32  * @author Ajith
33  *
34  * TODO To change the template for this generated type comment go to Window -
35  * Preferences - Java - Code Style - Code Templates
36  */

37 public class ServiceArchiveWizard extends Wizard implements INewWizard {
38
39     private WizardPane1 wizardPane1;
40     private WizardPane2 wizardPane2;
41     private WizardPane3 wizardPane3;
42     private WizardPane4 wizardPane4;
43     
44     
45     /**
46      *
47      */

48     public ServiceArchiveWizard() {
49         super();
50         setWindowTitle(ServiceArchiver.getResourceString("main.title"));
51     }
52     
53     
54     
55     
56     /* (non-Javadoc)
57      * @see org.eclipse.jface.wizard.IWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
58      */

59     public IWizardPage getNextPage(IWizardPage page) {
60        IWizardPage pageout = super.getNextPage(page);
61        if (page.equals(wizardPane2)){
62            if (((WizardPane2)page).isSkipNextPage()){
63                pageout = super.getNextPage(pageout);
64            }
65        }
66        return pageout;
67     }
68    
69     /* (non-Javadoc)
70      * @see org.eclipse.jface.wizard.IWizard#addPages()
71      */

72     public void addPages() {
73         wizardPane1 = new WizardPane1();
74         this.addPage(wizardPane1);
75         wizardPane2 = new WizardPane2();
76         this.addPage(wizardPane2);
77         wizardPane3 = new WizardPane3();
78         this.addPage(wizardPane3);
79         wizardPane4 = new WizardPane4();
80         this.addPage(wizardPane4);
81     }
82     /* (non-Javadobc)
83      * @see org.eclipse.jface.wizard.IWizard#performFinish()
84      */

85     public boolean performFinish() {
86         //create a wizard bean
87
WizardBean wizBean = new WizardBean();
88         wizBean.setPage1bean(wizardPane1.getBean());
89         wizBean.setPage2bean(wizardPane2.getBean());
90         wizBean.setPage3bean(wizardPane4.getBean());
91         try {
92             new Controller().process(wizBean);
93             showSuccessMessage(" jar file creation successful! ");
94             return true;
95         } catch (ProcessException e) {
96             showErrorMessage(e.getMessage());
97             return false;
98         } catch (Exception JavaDoc e) {
99             showErrorMessage("Unknown Error! " +e.getMessage() );
100             return false;
101         }
102     
103         
104         
105     }
106     
107     
108     /* (non-Javadoc)
109      * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
110      */

111     public void init(IWorkbench workbench, IStructuredSelection selection) {
112         // TODO Auto-generated method stub
113

114     }
115     
116     private void showErrorMessage(String JavaDoc message){
117         MessageDialog.openError(this.getShell(),"Error",message);
118     }
119     
120     private void showSuccessMessage(String JavaDoc message){
121         MessageDialog.openInformation(this.getShell(),"Success",message);
122     }
123 }
124
Popular Tags