/*******************************************************************************
 * Copyright (c) 2008, 2010 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.pde.internal.ua.ui.wizards.ctxhelp;

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.pde.internal.ui.IHelpContextIds;
import org.eclipse.pde.internal.ui.wizards.PDEWizardNewFileCreationPage;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;

/**
 * Wizard page to create a new context help xml file.
 *
 * @since 3.4
 * @see NewCtxHelpWizard
 */
public class NewCtxHelpWizardPage extends PDEWizardNewFileCreationPage {

	private static String EXTENSION = "xml"; //$NON-NLS-1$

	public NewCtxHelpWizardPage(String pageName, IStructuredSelection selection) {
		super(pageName, selection);
		setTitle(CtxWizardMessages.NewCtxHelpWizardPage_title);
		setDescription(CtxWizardMessages.NewCtxHelpWizardPage_description);
		// Force the file extension to be 'xml'
		setFileExtension(EXTENSION);
	}

	@Override
	protected void createAdvancedControls(Composite parent) {
		// We don't want any advanced controls showing up
	}

	@Override
	public void createControl(Composite parent) {
		super.createControl(parent);

		PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.NEW_CTX_HLP_PAGE);
	}

}
