本文整理了Java中org.netbeans.spi.project.ui.templates.support.Templates.getTargetFolder()
方法的一些代码示例,展示了Templates.getTargetFolder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Templates.getTargetFolder()
方法的具体详情如下:
包路径:org.netbeans.spi.project.ui.templates.support.Templates
类名称:Templates
方法名:getTargetFolder
暂无
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project
@Override
public void readSettings(WizardDescriptor settings) {
this.settings = settings;
fetchNamespaces(Templates.getTargetFolder(settings));
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf
@Override
public Set<DataObject> instantiate(TemplateWizard wizard) throws IOException {
Project project = Templates.getProject( wizard );
String targetName = Templates.getTargetName(wizard);
FileObject targetDir = Templates.getTargetFolder(wizard);
FileObject fo = createFacesConfig(project, targetDir, targetName, true);
if (fo != null) {
return Collections.singleton(DataObject.find(fo));
} else {
return Collections.EMPTY_SET;
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-spring-beans
private void addLibrariesToClassPath(Library[] libraries) throws IOException {
FileObject artifact = getSourceGroupArtifact(Templates.getProject(wizard), Templates.getTargetFolder(wizard));
if (artifact != null) {
ProjectClassPathModifier.addLibraries(libraries, artifact, ClassPath.COMPILE);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-spring-beans
public void initialize(WizardDescriptor wizard) {
this.wizard = wizard;
if (Templates.getTargetFolder(wizard) == null) {
Project project = Templates.getProject(wizard);
SpringConfigFileLocationProvider provider = project != null ? project.getLookup().lookup(SpringConfigFileLocationProvider.class) : null;
FileObject location = provider != null ? provider.getLocation() : null;
if (location != null) {
Templates.setTargetFolder(wizard, location);
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project
private void setTargetFolder() {
if (Templates.getTargetFolder(wizard) != null) {
// already set
return;
}
if (phpProject == null) {
// not php project
return;
}
FileObject srcDir = ProjectPropertiesSupport.getSourcesDirectory(phpProject);
if (srcDir != null && srcDir.isValid()) {
Templates.setTargetFolder(wizard, srcDir);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-junit-ui
@Override
public Set<DataObject> instantiate() throws IOException {
saveSettings(wizard);
/* collect and build necessary data: */
String name = Templates.getTargetName(wizard);
FileObject targetFolder = Templates.getTargetFolder(wizard);
FileObject testRootFolder = findTestRootFolder(targetFolder);
assert testRootFolder != null;
/* create test class(es) for the selected source class: */
DataObject suite = JUnitUtils.createSuiteTest(testRootFolder, targetFolder, name, JUnitTestUtil.getSettingsMap(true));
if (suite != null) {
return Collections.singleton(suite);
} else {
throw new IOException();
}
}
代码示例来源:origin: AlexFalappa/nb-springboot
@Override
public Set<?> instantiate() throws IOException {
// Create file from template
String targetName = Templates.getTargetName(wizard);
FileObject foDir = Templates.getTargetFolder(wizard);
FileObject foTemplate = Templates.getTemplate(wizard);
DataObject doTemplate = DataObject.find(foTemplate);
DataFolder df = DataFolder.findFolder(foDir);
Map<String, Object> props = new HashMap<>();
props.put(WIZ_CRUD_METHODS, wizard.getProperty(WIZ_CRUD_METHODS));
props.put(WIZ_ERROR_HANDLING, wizard.getProperty(WIZ_ERROR_HANDLING));
DataObject doCreated = doTemplate.createFromTemplate(df, targetName, props);
FileObject foCreated = doCreated.getPrimaryFile();
return Collections.singleton(foCreated);
}
代码示例来源:origin: AlexFalappa/nb-springboot
@Override
public Set<?> instantiate() throws IOException {
// Create file from template
String targetName = Templates.getTargetName(wizard);
FileObject foDir = Templates.getTargetFolder(wizard);
FileObject foTemplate = Templates.getTemplate(wizard);
DataObject doTemplate = DataObject.find(foTemplate);
DataFolder df = DataFolder.findFolder(foDir);
Map<String, Object> props = new HashMap<>();
props.put(WIZ_BASE_INTERF, wizard.getProperty(WIZ_BASE_INTERF));
props.put(WIZ_ENTITY_CLASS, wizard.getProperty(WIZ_ENTITY_CLASS));
props.put(WIZ_ID_CLASS, wizard.getProperty(WIZ_ID_CLASS));
DataObject doCreated = doTemplate.createFromTemplate(df, targetName, props);
FileObject foCreated = doCreated.getPrimaryFile();
return Collections.singleton(foCreated);
}
代码示例来源:origin: AlexFalappa/nb-springboot
@Override
public Set<?> instantiate() throws IOException {
// Create file from template
String targetName = Templates.getTargetName(wizard);
FileObject foDir = Templates.getTargetFolder(wizard);
FileObject foTemplate = Templates.getTemplate(wizard);
DataObject doTemplate = DataObject.find(foTemplate);
DataFolder df = DataFolder.findFolder(foDir);
Map<String, Object> props = new HashMap<>();
props.put(WIZ_ERROR_HANDLING, wizard.getProperty(WIZ_ERROR_HANDLING));
DataObject doCreated = doTemplate.createFromTemplate(df, targetName, props);
FileObject foCreated = doCreated.getPrimaryFile();
return Collections.singleton(foCreated);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-project
public Set<FileObject> instantiate () throws IOException {
FileObject dir = Templates.getTargetFolder( wiz );
String targetName = Templates.getTargetName( wiz );
DataFolder df = DataFolder.findFolder( dir );
FileObject template = Templates.getTemplate( wiz );
FileObject createdFile = null;
DataObject dTemplate = DataObject.find( template );
// Work around #109569
Map<String, Object> props = new HashMap<String, Object>(wiz.getProperties());
props.remove("project"); // NOI18N
DataObject dobj = dTemplate.createFromTemplate( df, targetName, props);
createdFile = dobj.getPrimaryFile();
return Collections.singleton( createdFile );
}
代码示例来源:origin: AlexFalappa/nb-springboot
@Override
public Set<?> instantiate() throws IOException {
// Create file from template
String targetName = Templates.getTargetName(wizard);
FileObject foDir = Templates.getTargetFolder(wizard);
FileObject foTemplate = Templates.getTemplate(wizard);
DataObject doTemplate = DataObject.find(foTemplate);
DataFolder df = DataFolder.findFolder(foDir);
Map<String, Object> props = new HashMap<>();
props.put(WIZ_CRUD_METHODS, wizard.getProperty(WIZ_CRUD_METHODS));
props.put(WIZ_ERROR_HANDLING, wizard.getProperty(WIZ_ERROR_HANDLING));
DataObject doCreated = doTemplate.createFromTemplate(df, targetName, props);
FileObject foCreated = doCreated.getPrimaryFile();
return Collections.singleton(foCreated);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javafx2-project
@Override
public void readSettings(WizardDescriptor settings) {
this.settings = settings;
FileObject preselectedFolder = Templates.getTargetFolder(settings);
component.initValues(Templates.getTemplate(settings), preselectedFolder);
// XXX hack, TemplateWizard in final setTemplateImpl() forces new wizard's title
// this name is used in NewFileWizard to modify the title
Object substitute = component.getClientProperty("NewFileWizard_Title"); // NOI18N
if (substitute != null) {
settings.putProperty("NewFileWizard_Title", substitute); // NOI18N
}
}
代码示例来源:origin: AlexFalappa/nb-springboot
@Override
public Set<?> instantiate() throws IOException {
// Create file from template
String targetName = Templates.getTargetName(wizard);
FileObject foDir = Templates.getTargetFolder(wizard);
FileObject foTemplate = Templates.getTemplate(wizard);
DataObject doTemplate = DataObject.find(foTemplate);
DataFolder df = DataFolder.findFolder(foDir);
Map<String, Object> props = new HashMap<>();
props.put(WIZ_TECHNOLOGY, wizard.getProperty(WIZ_TECHNOLOGY));
props.put(WIZ_SAMPLE_OPS, wizard.getProperty(WIZ_SAMPLE_OPS));
DataObject doCreated = doTemplate.createFromTemplate(df, targetName, props);
FileObject foCreated = doCreated.getPrimaryFile();
return Collections.singleton(foCreated);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javafx2-project
@Override
public void readSettings(WizardDescriptor settings) {
this.settings = settings;
FileObject preselectedFolder = Templates.getTargetFolder(settings);
component.initValues(Templates.getTemplate(settings), preselectedFolder);
// XXX hack, TemplateWizard in final setTemplateImpl() forces new wizard's title
// this name is used in NewFileWizard to modify the title
Object substitute = component.getClientProperty("NewFileWizard_Title"); // NOI18N
if (substitute != null) {
settings.putProperty("NewFileWizard_Title", substitute); // NOI18N
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javafx2-project
@Override
public void readSettings(WizardDescriptor settings) {
this.settings = settings;
// Try to preselect a folder
FileObject preselectedFolder = Templates.getTargetFolder(settings);
// Init values
component.initValues(Templates.getTemplate(settings), preselectedFolder);
// XXX hack, TemplateWizard in final setTemplateImpl() forces new wizard's title
// this name is used in NewFileWizard to modify the title
Object substitute = component.getClientProperty("NewFileWizard_Title"); // NOI18N
if (substitute != null) {
settings.putProperty("NewFileWizard_Title", substitute); // NOI18N
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject
@Override
public Set<FileObject> instantiate() throws IOException {
FileObject dir = Templates.getTargetFolder(descriptor);
FileObject template = Templates.getTemplate(descriptor);
DataFolder dataFolder = DataFolder.findFolder(dir);
DataObject dataTemplate = DataObject.find(template);
DataObject createdFile = dataTemplate.createFromTemplate(dataFolder, Templates.getTargetName(descriptor));
return Collections.singleton(createdFile.getPrimaryFile());
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project
@Override
public Set<FileObject> instantiate() throws IOException {
FileObject dir = Templates.getTargetFolder(wizard);
FileObject template = Templates.getTemplate(wizard);
DataFolder dataFolder = DataFolder.findFolder(dir);
DataObject dataTemplate = DataObject.find(template);
DataObject createdFile = dataTemplate.createFromTemplate(dataFolder, Templates.getTargetName(wizard), getTemplateParams());
// #187374
try {
PhpProjectUtils.reformatFile(createdFile);
} catch (IOException exc) {
LOGGER.log(Level.WARNING, exc.getMessage(), exc);
}
return Collections.singleton(createdFile.getPrimaryFile());
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-spring-beans
public void readSettings(WizardDescriptor settings) {
Project project = Templates.getProject(settings);
FileObject targetFolder = Templates.getTargetFolder(settings);
FileObject artifact = NewSpringXMLConfigWizardIterator.getSourceGroupArtifact(project, targetFolder);
getComponent().setClassPath(ClassPath.getClassPath(artifact, ClassPath.COMPILE));
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-css-prep
@Override
public Set<FileObject> instantiate() throws IOException {
getBottomPanel().save();
FileObject dir = Templates.getTargetFolder(wizard);
FileObject template = Templates.getTemplate(wizard);
DataFolder dataFolder = DataFolder.findFolder(dir);
DataObject dataTemplate = DataObject.find(template);
DataObject createdFile = dataTemplate.createFromTemplate(dataFolder, Templates.getTargetName(wizard));
return Collections.singleton(createdFile.getPrimaryFile());
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf
private Set<DataObject> createTemplate(TemplateWizard wiz, DataFolder df, String targetName, FileObject cssFolder, JSFVersion jsfVersion) throws IOException {
CreateTemplateAction createTemplateAction = new CreateTemplateAction(
templatePanel.getComponent(),
Templates.getTargetName(wiz),
Templates.getTargetFolder(wiz),
cssFolder,
jsfVersion);
df.getPrimaryFile().getFileSystem().runAtomicAction(createTemplateAction);
FileObject target = df.getPrimaryFile().getFileObject(targetName, XHTML_EXT);
DataObject dob = DataObject.find(target);
JSFPaletteUtilities.reformat(dob);
return Collections.singleton(dob);
}
内容来源于网络,如有侵权,请联系作者删除!