Search in sources :

Example 1 with TemplateSelectionWizardPage

use of org.bndtools.core.ui.wizards.shared.TemplateSelectionWizardPage 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("«Empty»", 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)

Example 2 with TemplateSelectionWizardPage

use of org.bndtools.core.ui.wizards.shared.TemplateSelectionWizardPage in project bndtools by bndtools.

the class WorkspaceSetupWizard method init.

@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
    this.workbench = workbench;
    setupPage = new WorkspaceSetupWizardPage();
    updateSetupPageForExistingProjects();
    templatePage = new TemplateSelectionWizardPage("workspaceTemplateSelection", "workspace", null);
    templatePage.setTitle("Select Workspace Template");
    previewPage = new WorkspacePreviewPage();
    previewPage.setTargetDir(setupPage.getLocation().toFile());
    setupPage.addPropertyChangeListener(WorkspaceLocationPart.PROP_LOCATION, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            previewPage.setTargetDir(setupPage.getLocation().toFile());
        }
    });
    templatePage.addPropertyChangeListener(TemplateSelectionWizardPage.PROP_TEMPLATE, new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            Template template = templatePage.getTemplate();
            previewPage.setTemplate(template);
        }
    });
}
Also used : TemplateSelectionWizardPage(org.bndtools.core.ui.wizards.shared.TemplateSelectionWizardPage) PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) Template(org.bndtools.templating.Template)

Aggregations

PropertyChangeEvent (java.beans.PropertyChangeEvent)2 PropertyChangeListener (java.beans.PropertyChangeListener)2 TemplateSelectionWizardPage (org.bndtools.core.ui.wizards.shared.TemplateSelectionWizardPage)2 InputStream (java.io.InputStream)1 BuiltInTemplate (org.bndtools.core.ui.wizards.shared.BuiltInTemplate)1 TemplateParamsWizardPage (org.bndtools.core.ui.wizards.shared.TemplateParamsWizardPage)1 StringResource (org.bndtools.templating.StringResource)1 Template (org.bndtools.templating.Template)1 PartInitException (org.eclipse.ui.PartInitException)1 WizardNewFileCreationPage (org.eclipse.ui.dialogs.WizardNewFileCreationPage)1