KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > wizards > feature > NewFeatureProjectWizard


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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.pde.internal.ui.wizards.feature;
12
13 import org.eclipse.debug.core.ILaunchConfiguration;
14 import org.eclipse.jface.operation.IRunnableWithProgress;
15 import org.eclipse.pde.core.plugin.PluginRegistry;
16 import org.eclipse.pde.internal.ui.PDEPluginImages;
17 import org.eclipse.pde.internal.ui.PDEUIMessages;
18
19 public class NewFeatureProjectWizard extends AbstractNewFeatureWizard {
20
21     private String JavaDoc fId;
22     private String JavaDoc fVersion;
23     
24     public NewFeatureProjectWizard() {
25         super();
26         setDefaultPageImageDescriptor(PDEPluginImages.DESC_NEWFTRPRJ_WIZ);
27         setWindowTitle(PDEUIMessages.NewFeatureWizard_wtitle);
28     }
29     
30     public void addPages() {
31         super.addPages();
32         if (hasInterestingProjects()) {
33             fSecondPage = new PluginListPage();
34             addPage(fSecondPage);
35         }
36     }
37     
38     private boolean hasInterestingProjects() {
39         return PluginRegistry.getActiveModels().length > 0;
40     }
41     
42     protected AbstractFeatureSpecPage createFirstPage() {
43         return new FeatureSpecPage();
44     }
45
46     public String JavaDoc getFeatureId() {
47         return fId;
48     }
49     
50     public String JavaDoc getFeatureVersion() {
51         return fVersion;
52     }
53
54     protected IRunnableWithProgress getOperation() {
55         FeatureData data = fProvider.getFeatureData();
56         fId = data.id;
57         fVersion = data.version;
58         ILaunchConfiguration config= fProvider.getLaunchConfiguration();
59         if (config == null)
60             return new CreateFeatureProjectOperation(
61                     fProvider.getProject(),
62                     fProvider.getLocationPath(),
63                     data,
64                     fProvider.getPluginListSelection(),
65                     getShell());
66         return new CreateFeatureProjectFromLaunchOperation(
67                 fProvider.getProject(),
68                 fProvider.getLocationPath(),
69                 data,
70                 config,
71                 getShell());
72     }
73
74 }
75
Popular Tags