当前位置: 首页>>代码示例>>Java>>正文


Java Templates.getTargetFolder方法代码示例

本文整理汇总了Java中org.netbeans.spi.project.ui.templates.support.Templates.getTargetFolder方法的典型用法代码示例。如果您正苦于以下问题:Java Templates.getTargetFolder方法的具体用法?Java Templates.getTargetFolder怎么用?Java Templates.getTargetFolder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.spi.project.ui.templates.support.Templates的用法示例。


在下文中一共展示了Templates.getTargetFolder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readSettings

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
public void readSettings(WizardDescriptor wizard) {
    this.wizard = wizard;
    if ( gui != null ) {
        // Try to preselect a folder
        FileObject preselectedFolder = Templates.getTargetFolder( wizard );            
        // Init values
        gui.initValues( Templates.getTemplate( wizard ), preselectedFolder );
    }
    
    if ( bottomPanel != null ) {
        bottomPanel.readSettings(wizard);
    }        
    
    // XXX hack, TemplateWizard in final setTemplateImpl() forces new wizard's title
    // this name is used in NewFileWizard to modify the title
    if (gui != null) {
        Object substitute = gui.getClientProperty ("NewFileWizard_Title"); // NOI18N
        if (substitute != null) {
            wizard.putProperty ("NewFileWizard_Title", substitute); // NOI18N
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:JavaTargetChooserPanel.java

示例2: instantiate

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
public Set instantiate(ProgressHandle handle) throws IOException {
    Project project = Templates.getProject(wiz);
    FileObject tFolder = Templates.getTargetFolder(wiz);
    try {
        handle.start(100);
        handle.progress(NbBundle.getMessage(DBScriptWizard.class, "MSG_CreateFile"),5);
        FileObject sqlFile = tFolder.createData(Templates.getTargetName(wiz), EXTENSION);//NOI18N
        PersistenceEnvironment pe = project.getLookup().lookup(PersistenceEnvironment.class);
        if (sqlFile != null) {
            //execution
            run(project, sqlFile, pe, handle, false);
        }
        return Collections.singleton(sqlFile);
    } finally {
        handle.finish();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:DBScriptWizard.java

示例3: instantiate

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
public Set<?> instantiate() throws IOException {
    // TODO: Use RequestProcessor for instantiation, this takes too much time.
    String className = Templates.getTargetName(wizard);
    FileObject pkg = Templates.getTargetFolder(wizard);
    DataFolder targetFolder = DataFolder.findFolder(pkg);
    FileObject templateFile = Templates.getTemplate(wizard);
    DataObject templateDataObject = DataObject.find(templateFile);
    DataObject createdDataObject = templateDataObject.createFromTemplate(targetFolder, className);

    OpenCookie open = (OpenCookie) createdDataObject.getCookie(OpenCookie.class);
    if (open != null) {
        open.open();
    }
    return Collections.singleton(createdDataObject);
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:17,代码来源:NewPrimitiveWizardIterator.java

示例4: readSettings

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
public void readSettings(WizardDescriptor wizard) {
    this.wizard = wizard;
    if (gui != null) {
        // Try to preselect a folder
        FileObject preselectedFolder = Templates.getTargetFolder(wizard);            
        // Init values
        gui.initValues(Templates.getTemplate(wizard), preselectedFolder);
    }
    
    // XXX hack, TemplateWizard in final setTemplateImpl() forces new wizard's title
    // this name is used in NewFileWizard to modify the title
    if (gui != null) {
        Object substitute = gui.getClientProperty ("NewFileWizard_Title"); // NOI18N
        if (substitute != null) {
            wizard.putProperty ("NewFileWizard_Title", substitute); // NOI18N
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ModuleTargetChooserPanel.java

示例5: instantiate

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
/**
 * This is where, the schema gets instantiated from the template.
 */
public Set instantiate (TemplateWizard wizard) throws IOException {        
    FileObject dir = Templates.getTargetFolder( wizard );        
    DataFolder df = DataFolder.findFolder( dir );
    FileObject template = Templates.getTemplate( wizard );        
    DataObject dTemplate = DataObject.find( template );                
    DataObject dobj = dTemplate.createFromTemplate(df, Templates.getTargetName(wizard));
    if (dobj == null)
        return Collections.emptySet();
        
    encoding = EncodingUtil.getProjectEncoding(df.getPrimaryFile());
    if(!EncodingUtil.isValidEncoding(encoding))
        encoding = "UTF-8"; //NOI18N
    EditCookie edit = dobj.getCookie(EditCookie.class);
    if (edit != null) {
        EditorCookie editorCookie = dobj.getCookie(EditorCookie.class);
        Document doc = (Document)editorCookie.openDocument();
        fixEncoding(doc, encoding);
        SaveCookie save = dobj.getCookie(SaveCookie.class);
        if (save!=null) save.save();
    }
    
    return Collections.singleton(dobj.getPrimaryFile());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:DTDWizardIterator.java

示例6: instantiate

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:NewTestSuiteWizardIterator.java

示例7: instantiate

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@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);
}
 
开发者ID:AlexFalappa,项目名称:nb-springboot,代码行数:17,代码来源:RepoWizardIterator.java

示例8: updateCreatedFileText

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
public static void updateCreatedFileText(WizardDescriptor wizard, JComboBox cbxPackageName,
        JTextField txtName, JTextField txtCreatedFile, Language language) {
    String ext = language.equals(Language.JAVA) ? ".java" : ".scala";
    Project project = Templates.getProject(wizard);
    FileObject foTargetFolder = Templates.getTargetFolder(wizard);
    String completePath = null;
    String packagePart = cbxPackageName.getEditor().getItem().toString().replace(".", "/");
    if (foTargetFolder.getPath().contains(project.getProjectDirectory().getPath() + "/app")) {
        if (packagePart.isEmpty()) {
            completePath = project.getProjectDirectory().getPath() + "/app/" + txtName.getText() + ext;
        } else {
            completePath = project.getProjectDirectory().getPath() + "/app/" + packagePart + "/" + txtName.getText() + ext;
        }
    } else if (foTargetFolder.getPath().contains(project.getProjectDirectory().getPath() + "/test")) {
        if (packagePart.isEmpty()) {
            completePath = project.getProjectDirectory().getPath() + "/test/" + txtName.getText() + ext;
        } else {
            completePath = project.getProjectDirectory().getPath() + "/test/" + packagePart + "/" + txtName.getText() + ext;
        }
    }
    txtCreatedFile.setText(completePath);
}
 
开发者ID:pedrohidalgo,项目名称:pleasure,代码行数:23,代码来源:TemplateUtil.java

示例9: instantiate

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
/**
 * Returns set of instantiated objects. If instantiation fails then wizard
 * remains open to enable correct values.
 * 
 * @return  A set of objects created (the exact type is at the discretion
 *          of the caller)
 * @throws  IOException In case of a failing I/O-operation.
 */
@Override
public Set<?> instantiate() throws IOException
{
    FileObject template = Templates.getTemplate(wizard);
    DataObject templateDO = DataObject.find(template);
    FileObject targetFolder = Templates.getTargetFolder(wizard);
    DataFolder targetFolderDF = DataFolder.findFolder(targetFolder);
    String targetName = WizardUtils.toIdentifier(Templates.getTargetName(wizard));
    
    Map<String, Object> args = getTemplateParameters();
 
    DataObject createdTemplate = templateDO.createFromTemplate(targetFolderDF, targetName, args);
    FileObject createdFile = createdTemplate.getPrimaryFile();
    
    
    Boolean configureCustomProject = (Boolean) wizard.getProperty(AbstractWizardPanel.PROP_CONFIGURE_CUSTOM_PROJECT);
    
    if( configureCustomProject == true )
    {
        WizardUtils.createTestsRootFolder(Templates.getProject(wizard));
    }
    
    
    return Collections.singleton(createdFile);
}
 
开发者ID:offa,项目名称:NBCndUnit,代码行数:34,代码来源:AbstractWizardIterator.java

示例10: readSettings

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
        public void readSettings(WizardDescriptor settings) {
            wizardDescriptor = settings;
            wizardDescriptor.putProperty("NewFileWizard_Title", title); // NOI18N

            if (!componentInitialized) {
                componentInitialized = true;

                project = Templates.getProject(wizardDescriptor);
                cmp = false;//RelatedCMPWizard.isCMP(wizardDescriptor);
                ImportHelper helper = DBImportWizardDescriptor.getHelper(wizardDescriptor);
                DBSchemaFileList dbschemaFileList = helper.getDBSchemaFileList();
//                PersistenceGenerator persistenceGen = helper.getPersistenceGenerator();
                TableSource tableSource = helper.getTableSource();
                FileObject targetFolder = Templates.getTargetFolder(wizardDescriptor);

                getComponent().initialize(project, dbschemaFileList, null, tableSource, targetFolder);
            }
        }
 
开发者ID:jeddict,项目名称:jeddict,代码行数:20,代码来源:DatabaseTablesSelectorPanel.java

示例11: read

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
void read(WizardDescriptor settings) {
    FileObject targetFolder = Templates.getTargetFolder(settings);
    projectTextField.setText(ProjectUtils.getInformation(project).getDisplayName());
    SourceGroup[] sourceGroups = SourceGroupSupport.getJavaSourceGroups(project);
    SourceGroupUISupport.connect(locationComboBox, sourceGroups);
    packageComboBox.setRenderer(PackageView.listRenderer());
    updateSourceGroupPackages();

    // set default source group and package cf. targetFolder
    if (targetFolder != null) {
        SourceGroup targetSourceGroup = getFolderSourceGroup(sourceGroups, targetFolder);
        if (targetSourceGroup != null) {
            locationComboBox.setSelectedItem(targetSourceGroup);
            String targetPackage = SourceGroupSupport.getPackageForFolder(targetSourceGroup, targetFolder);
            if (targetPackage != null) {
                packageComboBoxEditor.setText(targetPackage);
            }
        }
    }
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:21,代码来源:JPAModelSetupPanelVisual.java

示例12: instantiate

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
public Set<?> instantiate() throws IOException {
    final Set<String> entities = new HashSet<>((List) wizard.getProperty(WizardProperties.ENTITY_CLASS));
    if (getProject() == null) {
        setProject(Templates.getProject(wizard));
    }
    final FileObject packageFileObject = Templates.getTargetFolder(wizard);
    final String fileName = Templates.getTargetName(wizard);
    boolean createPersistenceUnit = (Boolean) wizard.getProperty(org.netbeans.modules.j2ee.persistence.wizard.WizardProperties.CREATE_PERSISTENCE_UNIT);

    if (createPersistenceUnit) {
        PersistenceUnit punit = Util.buildPersistenceUnitUsingData(getProject(), puPanel.getPersistenceUnitName(), puPanel.getPersistenceConnection() != null ? puPanel.getPersistenceConnection().getName() : puPanel.getDatasource(), TableGeneration.NONE, puPanel.getSelectedProvider());
        ProviderUtil.setTableGeneration(punit, puPanel.getTableGeneration(), puPanel.getSelectedProvider());
        if (punit != null) {
            Util.addPersistenceUnitToProject(getProject(), punit);
        }
    }
    final String title = NbBundle.getMessage(RevEngWizardDescriptor.class, "TITLE_Progress_JPA_Model"); //NOI18N

    return instantiateJCREProcess(title, entities, packageFileObject, fileName, false, true);
}
 
开发者ID:jeddict,项目名称:jeddict,代码行数:22,代码来源:RevEngWizardDescriptor.java

示例13: readSettings

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
public void readSettings(Object settings) {
    wizardDescriptor = (WizardDescriptor) settings;
    wizardDescriptor.putProperty("NewFileWizard_Title", title);


    if (!componentInitialized) {
        componentInitialized = true;
        project = Templates.getProject(wizardDescriptor);
        FileObject targetFolder = Templates.getTargetFolder(wizardDescriptor);
        getComponent().initialize(project);
    }        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:HibernateRevengDbTablesWizardDescriptor.java

示例14: readSettings

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
public void readSettings(Object settings) {
    wizardDescriptor = (WizardDescriptor)settings;
    
    RelatedCMPHelper helper = RelatedCMPWizard.getHelper(wizardDescriptor);

    if (!componentInitialized) {
        componentInitialized = true;

        PersistenceGenerator persistenceGen = helper.getPersistenceGenerator();
        project = Templates.getProject(wizardDescriptor);
        FileObject targetFolder = Templates.getTargetFolder(wizardDescriptor);

        getComponent().initialize(persistenceGen, project, targetFolder);
    }

    TableSource tableSource = helper.getTableSource();
    String tableSourceName = null;
    if (tableSource != null) {
        // the name of the table source is only relevant if the source
        // was a data source of connection, since it will be sent to the
        // persistence unit panel, which only deals with data sources
        // or connections
        TableSource.Type tableSourceType = tableSource.getType();
        if (tableSourceType == TableSource.Type.DATA_SOURCE || tableSourceType == TableSource.Type.CONNECTION) {
            tableSourceName = tableSource.getName();
        }
    }

    getComponent().update(helper.getTableClosure(), tableSourceName);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:EntityClassesPanel.java

示例15: read

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
void read(WizardDescriptor settings) {
//        jsfFolder.setText((String) settings.getProperty(WizardProperties.JSF_FOLDER));
        
        project = Templates.getProject(settings);
        FileObject targetFolder = Templates.getTargetFolder(settings);
        
        projectTextField.setText(ProjectUtils.getInformation(project).getDisplayName());

         SourceGroup[] sourceGroups = SourceGroups.getJavaSourceGroups(project);      
         SourceGroupUISupport.connect(locationComboBox, sourceGroups);

        packageComboBox.setRenderer(PackageView.listRenderer());

        updateSourceGroupPackages();

        // set default source group and package cf. targetFolder
//        if (targetFolder != null) {
//            SourceGroup targetSourceGroup = SourceGroupSupport.getFolderSourceGroup(sourceGroups, targetFolder);
//            if (targetSourceGroup != null) {
//                locationComboBox.setSelectedItem(targetSourceGroup);
//                String targetPackage = SourceGroupSupport.getPackageForFolder(targetSourceGroup, targetFolder);
//                if (targetPackage != null) {
//                    packageComboBoxEditor.setText(targetPackage);
//                }
//            }
//            if (FileUtil.isParentOf(WebModule.getWebModule(
//                    targetFolder).getDocumentBase(), targetFolder)) {
//                Sources s = (Sources) Templates.getProject(wizard).getLookup().lookup(Sources.class);
//                SourceGroup[] groups = s.getSourceGroups(WebProjectConstants.TYPE_DOC_ROOT);
//                jsfFolder.setText("/"+JSFConfigUtilities.getResourcePath(groups,targetFolder,'/',true));
//            }
//        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:JpaControllerSetupPanelVisual.java


注:本文中的org.netbeans.spi.project.ui.templates.support.Templates.getTargetFolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。