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


Java Templates.setTargetName方法代码示例

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


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

示例1: storeSettings

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
public void storeSettings(WizardDescriptor wizard) { 
    Object value = wizard.getValue();
    if (WizardDescriptor.PREVIOUS_OPTION.equals(value) || WizardDescriptor.CANCEL_OPTION.equals(value) ||
            WizardDescriptor.CLOSED_OPTION.equals(value)) {
        return;
    }
    if( isValid() ) {
        if ( bottomPanel != null ) {
            bottomPanel.storeSettings( wizard );
        }
        Templates.setTargetFolder(wizard, getTargetFolderFromGUI(wizard));
        Templates.setTargetName(wizard, gui.getTargetName());
    }        
    if (WizardDescriptor.FINISH_OPTION.equals(value)) {
        wizard.putProperty("NewFileWizard_Title", null); // NOI18N
        wizard.putProperty(FOLDER_TO_DELETE, null);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:JavaTargetChooserPanel.java

示例2: storeSettings

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
public @Override void storeSettings(WizardDescriptor settings) {
    if (noProjectFolders()) {
        return;
    }

    if (WizardDescriptor.PREVIOUS_OPTION.equals(settings.getValue())) {
        return;
    }
    if(!WizardDescriptor.CANCEL_OPTION.equals(settings.getValue())
            && !WizardDescriptor.CLOSED_OPTION.equals(settings.getValue()) && isValid()) {
        if ( bottomPanel != null ) {
            bottomPanel.storeSettings( settings );
        }
        if ( gui == null ) {
            getComponent();
        }
        String name = gui.getTargetName ();
        if (name != null && name.indexOf ('/') > 0) { // NOI18N
            name = name.substring (name.lastIndexOf ('/') + 1);
        }
        
        Templates.setTargetFolder(settings, getTargetFolderFromGUI());
        Templates.setTargetName(settings, name);
    }
    settings.putProperty("NewFileWizard_Title", null); // NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:SimpleTargetChooserPanel.java

示例3: valid

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
boolean valid(WizardDescriptor wizardDescriptor) {
    if (txBaseName.getText().isEmpty()) {
        // Base name not specified
        wizardDescriptor.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, "Base name cannot be empty!");
        return false;
    }
    File f = getCreatedFile();
    if (f.exists()) {
        // Existing file
        wizardDescriptor.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, "Application properties file exists!");
        return false;
    }
    wizardDescriptor.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, "");
    final FileObject targetFolder = FileUtil.toFileObject(f.getParentFile());
    Templates.setTargetFolder(wizardDescriptor, targetFolder);
    Templates.setTargetName(wizardDescriptor, f.getName());
    return true;
}
 
开发者ID:AlexFalappa,项目名称:nb-springboot,代码行数:19,代码来源:ApplVisualPanel1.java

示例4: storeSettings

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
public void storeSettings(Object settings) {
    WizardDescriptor wizDescriptor = (WizardDescriptor) settings;
    SourceGroup sourceGroup = getComponent().getLocationValue();
    String packageName = getComponent().getPackageName().trim();
    FileObject packageFO = null;
    try {
        packageFO = SourceGroups.getFolderForPackage(sourceGroup, packageName, true);
    } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
    }
    Templates.setTargetFolder(wizDescriptor, packageFO);
    Templates.setTargetName(wizDescriptor, getComponent().getScriptName());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:DBScriptPanel.java

示例5: storeSettings

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
public void storeSettings(Object settings) {
    if ( WizardDescriptor.PREVIOUS_OPTION.equals(((WizardDescriptor)settings).getValue())
            || WizardDescriptor.CANCEL_OPTION.equals(((WizardDescriptor)settings).getValue())
            || WizardDescriptor.CLOSED_OPTION.equals(((WizardDescriptor)settings).getValue())) {
        return;
    }

    if( isValid() ) {
        File f = new File(myGui.getCreatedFilePath());
        File ff = new File(f.getParentFile().getPath());
        if ( !ff.exists() ) {
            try {
                FileUtil.createFolder(ff);
            } catch (IOException exc) {
                LOG.log(Level.INFO, null, exc);
            }
        }
        FileObject folder = FileUtil.toFileObject(ff);                

        Templates.setTargetFolder( (WizardDescriptor)settings, folder );
        Templates.setTargetName( (WizardDescriptor)settings, 
                myGui.getTargetName() );
        getProvider().storeSettings( this );
    }
    ((WizardDescriptor)settings).putProperty ("NewFileWizard_Title", null); // NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:TargetChooserPanel.java

示例6: store

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
void store(WizardDescriptor settings) {
    String pkg = getPackage();
    try {
        FileObject fo = getLocationValue().getRootFolder();
        String pkgSlashes = pkg.replace('.', '/');
        FileObject targetFolder = fo.getFileObject(pkgSlashes);
        if (targetFolder == null) {
            targetFolder = FileUtil.createFolder(fo, pkgSlashes);
        }
        Templates.setTargetFolder(settings, targetFolder);
        Templates.setTargetName(wizard, this.getFileName());
    } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
开发者ID:foxerfly,项目名称:Netbeans-JPA-Modeler,代码行数:16,代码来源:JPAModelSetupPanelVisual.java

示例7: instantiate

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
public Set<?> instantiate() throws IOException {
    final Project project = Templates.getProject(wizard);
    if (project == null) {
        return null;
    }
    NbMavenProject nbProj = project.getLookup().lookup(NbMavenProject.class);
    if (nbProj == null) {
        return null;
    }
    final URI[] resources = nbProj.getResources(false);
    if (resources.length == 0) {
        return null;
    }
    try {
        Path resourceFolder = FileUtil.archiveOrDirForURL(resources[0].toURL()).toPath();
        File fDir = resourceFolder.resolve("META-INF").toFile();
        // ensure target folder exists and set it into Templates
        fDir.mkdirs();
        FileObject foDir = FileUtil.toFileObject(fDir);
        Templates.setTargetFolder(wizard, foDir);
        // set target name into Templates and delete existing file if it exists
        final String targetName = "additional-spring-configuration-metadata.json";
        Templates.setTargetName(wizard, targetName);
        File fExisting = new File(fDir, targetName);
        if (fExisting.exists()) {
            fExisting.delete();
        }
        // create file from template
        FileObject foTemplate = Templates.getTemplate(wizard);
        DataObject doTemplate = DataObject.find(foTemplate);
        DataFolder df = DataFolder.findFolder(foDir);
        Map<String, Object> props = new HashMap<>();
        props.put(WIZ_SECT_PROPS, wizard.getProperty(WIZ_SECT_PROPS));
        props.put(WIZ_SECT_HINTS, wizard.getProperty(WIZ_SECT_HINTS));
        props.put(WIZ_SECT_HINTS_VALUES, wizard.getProperty(WIZ_SECT_HINTS_VALUES));
        props.put(WIZ_SECT_HINTS_PROVIDERS, wizard.getProperty(WIZ_SECT_HINTS_PROVIDERS));
        DataObject doCreated = doTemplate.createFromTemplate(df, targetName, props);
        FileObject foCreated = doCreated.getPrimaryFile();
        return Collections.singleton(foCreated);
    } catch (MalformedURLException ex) {
        Exceptions.printStackTrace(ex);
    }
    return null;
}
 
开发者ID:AlexFalappa,项目名称:nb-springboot,代码行数:46,代码来源:MetadataWizardIterator.java


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