/** Instantiate a template object. * Asks user for the target file's folder and creates the file. * Then runs the node delegate's {@link org.openide.nodes.NodeOperation#customize customizer} (if there is one). * Also the node's {@link Node#getDefaultAction default action}, if any, is run. * @param obj the template to use * @return set of created objects or null if user canceled the action * @exception IOException on I/O error * @see DataObject#createFromTemplate */ public static java.util.Set instantiateTemplate (org.openide.loaders.DataObject obj) throws IOException { // Create component for for file name input return NewTemplateAction.getWizard (null).instantiate (obj); } }
private void doShowWizard(DataObject template, Node node) { targetFolder = null; TemplateWizard wizard = getWizard (node); try { wizard.setTargetName (null); Set created = wizard.instantiate (template, targetFolder); if (created != null && wizard instanceof DefaultTemplateWizard) { // put the item in the recent list selectedTemplate = wizard.getTemplate(); if (selectedTemplate != null) { // bugfix #36604; notify that the list recent used templates changed recentChanged = addRecent (selectedTemplate); } } } catch (IOException e) { ErrorManager em = ErrorManager.getDefault(); em.annotate(e, NbBundle.getMessage(DataObject.class, "EXC_TemplateFailed")); em.notify(e); } }
String title = templateWizard.getTitleFormat().format(new Object[] { dob.getNodeDelegate().getDisplayName() }); templateWizard.setTitle(title); Set<DataObject> files = templateWizard.instantiate(dob); if (files != null && !files.isEmpty()) { MakeConfigurationDescriptor mkd = getMakeConfigurationDescriptor(project);
wizard.instantiate (obj, targetFolder); } catch (IOException e) { ErrorManager em = ErrorManager.getDefault();
instantiated = wizard.instantiate() != null; } catch (IOException e) { ErrorManager em = ErrorManager.getDefault();