KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > ide > dialogs > MultiStepCapabilityWizard


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.ide.dialogs;
12
13 import org.eclipse.core.resources.IProject;
14 import org.eclipse.jface.window.Window;
15 import org.eclipse.ui.IWorkbenchWindow;
16 import org.eclipse.ui.PlatformUI;
17 import org.eclipse.ui.internal.ide.dialogs.InstallCapabilityStep.IProjectProvider;
18 import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
19
20 public abstract class MultiStepCapabilityWizard extends MultiStepWizard
21         implements IProjectProvider {
22     /**
23      * Creates an empty wizard
24      */

25     protected MultiStepCapabilityWizard() {
26         super();
27     }
28
29     /**
30      * Returns the IDs of the perspectives to present
31      * as choices to the user.
32      */

33     protected abstract String JavaDoc[] getPerspectiveChoices();
34
35     /* (non-Javadoc)
36      * Method declared on IWizard.
37      */

38     public boolean performFinish() {
39         if (!super.performFinish())
40             return false;
41
42         // Allow the user to choose which perspective to
43
// switch to.
44
if (isConfigureStepMode()) {
45             IWorkbenchWindow window = PlatformUI.getWorkbench()
46                     .getActiveWorkbenchWindow();
47             String JavaDoc[] perspIds = getPerspectiveChoices();
48             if (perspIds.length > 0) {
49                 ProjectPerspectiveChoiceDialog dialog;
50                 dialog = new ProjectPerspectiveChoiceDialog(window, perspIds);
51                 dialog.open();
52                 if (dialog.getReturnCode() == Window.OK)
53                     window = dialog.showChosenPerspective();
54             }
55
56             IProject project = getProject();
57             if (project != null) {
58                 BasicNewResourceWizard.selectAndReveal(project, window);
59             }
60         }
61
62         return true;
63     }
64 }
65
Popular Tags