package org.csstudio.opibuilder.wizards;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

import org.csstudio.platform.ui.wizards.WizardNewFileCreationPage;
import org.eclipse.jface.viewers.IStructuredSelection;

/**Wizard page for the creation of new javascript files.
 * @author Xihui Chen
 *
 */
public class NewJavaScriptWizardPage extends WizardNewFileCreationPage {

	public NewJavaScriptWizardPage(String pageName, IStructuredSelection selection) {
		super(pageName, selection);
		setTitle("Create a new javascript");
		setDescription("Create a new javascript in the selected project or folder.");
	}
	
	@Override
	protected InputStream getInitialContents() {
		String s = "importPackage(Packages.org.csstudio.platform.data);\n";
		InputStream result = new ByteArrayInputStream(s.getBytes());
		return result;
	}
	
	
	@Override
	protected String getNewFileLabel() {
		return "Javascript File Name:";
	}
	
	@Override
	public String getFileExtension() {
		return "js"; //$NON-NLS-1$
	}

}

@@ -732,27 +732,49 @@
 dio.
-platform.data);%5Cn%22;
+opibuilder.scriptUtil);%5Cn%22; //$NON-NLS-1$
 %0A%09%09I

add ScriptUtil