Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 5b9659e0e7578a3c0cca5b2a073e66ea7fcf7524 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*******************************************************************************
 * Copyright (c) 2005, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*
 * Created on Mar 23, 2005
 */
package org.eclipse.jst.j2ee.internal.wizard;

import java.net.MalformedURLException;
import java.net.URL;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jst.j2ee.internal.earcreation.DefaultJ2EEComponentCreationDataModelProvider;
import org.eclipse.jst.j2ee.internal.earcreation.IDefaultJ2EEComponentCreationDataModelProperties;
import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard;

public class DefaultJ2EEComponentCreationWizard extends DataModelWizard {
	private static final String SELECTION_PG = "selection"; //$NON-NLS-1$

	/**
	 * @param model
	 */
	public DefaultJ2EEComponentCreationWizard(IDataModel model) {
		super(model);
		initialize();
	}

	/**
	 *  
	 */
	public DefaultJ2EEComponentCreationWizard() {
		super();
		initialize();
	}

	/**
	 *  
	 */
	private void initialize() {
		setWindowTitle(J2EEUIMessages.getResourceString(J2EEUIMessages.DEFAULT_COMPONENT_WIZ_TITLE));
		String iconPath = "icons/full/"; //$NON-NLS-1$
		try {
			URL installURL = IDEWorkbenchPlugin.getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
			URL url = new URL(installURL, iconPath + "wizban/new_wiz.png"); //$NON-NLS-1$
			ImageDescriptor desc = ImageDescriptor.createFromURL(url);
			setDefaultPageImageDescriptor(desc);
		} catch (MalformedURLException e) {
			// Should not happen. Ignore.
		}
		setNeedsProgressMonitor(true);
		setForcePreviousAndNextButtons(true);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.jface.wizard.Wizard#addPages()
	 */
	@Override
	public void doAddPages() {
		addPage(new NewJ2EEComponentSelectionPage(getDataModel(), SELECTION_PG));
	}

	@Override
	public boolean canFinish() {
		if (!super.canFinish()) {
			return false;
		}
		return getDataModel().getBooleanProperty(IDefaultJ2EEComponentCreationDataModelProperties.ENABLED);
	}

    @Override
	protected IDataModelProvider getDefaultProvider() {
        return new DefaultJ2EEComponentCreationDataModelProvider();
    }
}

Back to the top