01: /*******************************************************************************
02: * Copyright (c) 2000, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.wizards.feature;
11:
12: import org.eclipse.debug.core.ILaunchConfiguration;
13: import org.eclipse.jface.operation.IRunnableWithProgress;
14: import org.eclipse.pde.core.plugin.PluginRegistry;
15: import org.eclipse.pde.internal.ui.PDEPluginImages;
16: import org.eclipse.pde.internal.ui.PDEUIMessages;
17:
18: public class NewFeatureProjectWizard extends AbstractNewFeatureWizard {
19:
20: private String fId;
21: private String fVersion;
22:
23: public NewFeatureProjectWizard() {
24: super ();
25: setDefaultPageImageDescriptor(PDEPluginImages.DESC_NEWFTRPRJ_WIZ);
26: setWindowTitle(PDEUIMessages.NewFeatureWizard_wtitle);
27: }
28:
29: public void addPages() {
30: super .addPages();
31: if (hasInterestingProjects()) {
32: fSecondPage = new PluginListPage();
33: addPage(fSecondPage);
34: }
35: }
36:
37: private boolean hasInterestingProjects() {
38: return PluginRegistry.getActiveModels().length > 0;
39: }
40:
41: protected AbstractFeatureSpecPage createFirstPage() {
42: return new FeatureSpecPage();
43: }
44:
45: public String getFeatureId() {
46: return fId;
47: }
48:
49: public String getFeatureVersion() {
50: return fVersion;
51: }
52:
53: protected IRunnableWithProgress getOperation() {
54: FeatureData data = fProvider.getFeatureData();
55: fId = data.id;
56: fVersion = data.version;
57: ILaunchConfiguration config = fProvider
58: .getLaunchConfiguration();
59: if (config == null)
60: return new CreateFeatureProjectOperation(fProvider
61: .getProject(), fProvider.getLocationPath(), data,
62: fProvider.getPluginListSelection(), getShell());
63: return new CreateFeatureProjectFromLaunchOperation(fProvider
64: .getProject(), fProvider.getLocationPath(), data,
65: config, getShell());
66: }
67:
68: }
|