本文整理了Java中org.netbeans.spi.project.ui.templates.support.Templates.getTargetName()
方法的一些代码示例,展示了Templates.getTargetName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Templates.getTargetName()
方法的具体详情如下:
包路径:org.netbeans.spi.project.ui.templates.support.Templates
类名称:Templates
方法名:getTargetName
暂无
代码示例来源: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-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_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_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-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_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: 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: 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-testng-ui
public Set<DataObject> instantiate() throws IOException {
FileObject targetFolder = Templates.getTargetFolder(wiz);
TestNGSupport.findTestNGSupport(FileOwnerQuery.getOwner(targetFolder)).configureProject(targetFolder);
String targetName = Templates.getTargetName(wiz);
DataFolder df = DataFolder.findFolder(targetFolder);
FileObject template = Templates.getTemplate(wiz);
DataObject dTemplate = DataObject.find(template);
String pkgName = getSelectedPackageName(targetFolder);
String suiteName = pkgName + " suite";
String projectName = ProjectUtils.getInformation(FileOwnerQuery.getOwner(targetFolder)).getName();
if (pkgName == null || pkgName.trim().length() < 1) {
pkgName = ".*"; //NOI18N
suiteName = "All tests for " + projectName;
}
Map<String, String> props = new HashMap<String, String>();
props.put("suiteName", projectName);
props.put("testName", suiteName);
props.put("pkg", pkgName);
DataObject dobj = dTemplate.createFromTemplate(df, targetName, props);
return Collections.singleton(dobj);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-selenium2-php
@Override
public Set instantiate() throws IOException {
FileObject createdFile = null;
FileObject targetFolder = Templates.getTargetFolder(wiz);
Selenium2SupportImpl selenium2Support = Selenium2Support.findSelenium2Support(FileOwnerQuery.getOwner(targetFolder));
if (selenium2Support == null) {
return Collections.singleton(createdFile);
}
selenium2Support.configureProject(targetFolder);
TestCreatorProvider.Context context = new TestCreatorProvider.Context(new FileObject[]{targetFolder});
context.setSingleClass(true);
context.setTargetFolder(targetFolder);
context.setTestClassName(Templates.getTargetName(wiz));
ArrayList<FileObject> createTests = Selenium2Support.createTests(context);
if (!createTests.isEmpty()) {
createdFile = createTests.get(0);
}
return Collections.singleton(createdFile);
}
代码示例来源:origin: AlexFalappa/nb-springboot
@Override
public Set<?> instantiate() throws IOException {
File fDir = panel.getComponent().getCreatedFile().getParentFile();
// ensure target folder exists and set it into Templates
fDir.mkdirs();
FileObject foDir = FileUtil.toFileObject(fDir);
Templates.setTargetFolder(wizard, foDir);
// Create file from template
FileObject foTemplate = Templates.getTemplate(wizard);
DataObject doTemplate = DataObject.find(foTemplate);
DataFolder df = DataFolder.findFolder(foDir);
DataObject doCreated = doTemplate.createFromTemplate(df, Templates.getTargetName(wizard));
FileObject foCreated = doCreated.getPrimaryFile();
return Collections.singleton(foCreated);
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-project-ui
@Override
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;
if (this.type == Type.PACKAGE) {
targetName = targetName.replace( '.', '/' ); // NOI18N
createdFile = FileUtil.createFolder( dir, targetName );
}
else {
DataObject dTemplate = DataObject.find( template );
DataObject dobj = dTemplate.createFromTemplate( df, targetName );
createdFile = dobj.getPrimaryFile();
}
return Collections.singleton( createdFile );
}
代码示例来源: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
@Override
public Set<DataObject> instantiate(TemplateWizard wiz) throws IOException {
DataObject result = null;
String targetName = Templates.getTargetName(wizard);
FileObject targetDir = Templates.getTargetFolder(wizard);
DataFolder df = DataFolder.findFolder(targetDir);
FileObject template = Templates.getTemplate( wizard );
DataObject dTemplate = DataObject.find(template);
HashMap<String, Object> templateProperties = new HashMap<String, Object>();
if (selectedText != null) {
templateProperties.put("implementation", selectedText); //NOI18N
}
Project project = Templates.getProject(wizard);
WebModule webModule = WebModule.getWebModule(project.getProjectDirectory());
if (webModule != null) {
JSFVersion version = JSFVersion.forWebModule(webModule);
if (version != null && version.isAtLeast(JSFVersion.JSF_2_2)) {
templateProperties.put("isJSF22", Boolean.TRUE); //NOI18N
}
}
result = dTemplate.createFromTemplate(df,targetName,templateProperties);
return Collections.singleton(result);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd
String targetName = Templates.getTargetName(wizard);
代码示例来源: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);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-project-jsf
String targetName = Templates.getTargetName( wizard );
内容来源于网络,如有侵权,请联系作者删除!