Search in sources :

Example 11 with WizardNewFileCreationPage

use of org.eclipse.ui.dialogs.WizardNewFileCreationPage in project bndtools by bndtools.

the class BndRunFileWizard method init.

@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
    this.workbench = workbench;
    mainPage = new WizardNewFileCreationPage("newFilePage", selection) {

        @Override
        protected InputStream getInitialContents() {
            try {
                return getTemplateContents(getFileName());
            } catch (Exception e) {
                throw new WrappingException(e);
            }
        }
    };
    mainPage.setTitle("New Bnd Run Descriptor");
    // $NON-NLS-1$
    mainPage.setFileExtension("bndrun");
    mainPage.setAllowExistingResources(false);
    BuiltInTemplate baseTemplate = new BuiltInTemplate("\u00abEmpty\u00bb", DEFAULT_TEMPLATE_ENGINE);
    baseTemplate.addInputResource("$fileName$", new StringResource(""));
    baseTemplate.setHelpPath("docs/empty_run.xml");
    templatePage = new TemplateSelectionWizardPage("runTemplateSelection", "bndrun", baseTemplate);
    templatePage.setTitle("Select Run Descriptor Template");
    paramsPage = new TemplateParamsWizardPage(PROPS);
    templatePage.addPropertyChangeListener(TemplateSelectionWizardPage.PROP_TEMPLATE, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            paramsPage.setTemplate(templatePage.getTemplate());
        }
    });
}
Also used : BuiltInTemplate(org.bndtools.core.ui.wizards.shared.BuiltInTemplate) StringResource(org.bndtools.templating.StringResource) TemplateSelectionWizardPage(org.bndtools.core.ui.wizards.shared.TemplateSelectionWizardPage) TemplateParamsWizardPage(org.bndtools.core.ui.wizards.shared.TemplateParamsWizardPage) PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) InputStream(java.io.InputStream) WizardNewFileCreationPage(org.eclipse.ui.dialogs.WizardNewFileCreationPage) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

WizardNewFileCreationPage (org.eclipse.ui.dialogs.WizardNewFileCreationPage)11 InputStream (java.io.InputStream)3 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)3 WizardDialog (org.eclipse.jface.wizard.WizardDialog)3 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)3 NewConfigurationWizard (org.hibernate.eclipse.console.wizards.NewConfigurationWizard)3 IJavaProject (org.eclipse.jdt.core.IJavaProject)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 IWizardPage (org.eclipse.jface.wizard.IWizardPage)2 NewConfigurationWizardPage (org.hibernate.eclipse.console.wizards.NewConfigurationWizardPage)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 BuiltInTemplate (org.bndtools.core.ui.wizards.shared.BuiltInTemplate)1 TemplateParamsWizardPage (org.bndtools.core.ui.wizards.shared.TemplateParamsWizardPage)1 TemplateSelectionWizardPage (org.bndtools.core.ui.wizards.shared.TemplateSelectionWizardPage)1 StringResource (org.bndtools.templating.StringResource)1 IContainer (org.eclipse.core.resources.IContainer)1 IFile (org.eclipse.core.resources.IFile)1 IResource (org.eclipse.core.resources.IResource)1