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


Java Templates.getTargetName方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: getNewClassFQN

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
private String getNewClassFQN(WizardDescriptor wd) {
    String className = Templates.getTargetName(wd);
    FileObject targetFolder = Templates.getTargetFolder(wd);
    ClassPath targetFolderClasspath = ClassPath.getClassPath(targetFolder, ClassPath.SOURCE);
    String pkg = targetFolderClasspath.getResourceName(targetFolder, '.', false);

    if (!pkg.isEmpty()) {
        return pkg + '.' + className;
    } else {
        return className;
    }
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:13,代码来源:ExplorerFactory.java

示例6: instantiate

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
public Set instantiate(ProgressHandle handle) throws IOException {
    handle.start();
    handle.progress(NbBundle.getMessage(AbstractMirahWizard.class, "LBL_NewMirahFileWizardIterator_WizardProgress_CreatingFile"));

    FileObject template = findCorrectTemplate();
    FileObject targetFolder = Templates.getTargetFolder(wiz);
    String targetName = Templates.getTargetName(wiz);

    DataFolder dFolder = DataFolder.findFolder(targetFolder);
    DataObject dTemplate = DataObject.find(template);

    String pkgName = getPackageName(targetFolder);
    DataObject dobj;
    if (pkgName == null) {
        dobj = dTemplate.createFromTemplate(dFolder, targetName);
    } else {
        dobj = dTemplate.createFromTemplate(dFolder, targetName, Collections.singletonMap("package", pkgName)); // NOI18N
    }

    FileObject createdFile = dobj.getPrimaryFile();
    
    Project proj = Templates.getProject(wiz);
    if (!MirahExtender.isActive(proj)) {
        MirahExtender.activate(proj);
    }
    System.out.println("About to check if mirah is current");
    
    if (!MirahExtender.isCurrent(proj)){
        System.out.println("Mirah is not current");
        MirahExtender.update(proj);
    }

    handle.finish();
    return Collections.singleton(createdFile);
}
 
开发者ID:shannah,项目名称:mirah-nbm,代码行数:37,代码来源:AbstractMirahWizard.java

示例7: instantiate

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
public Set instantiate() throws IOException {
    final FileObject targetFolder = Templates.getTargetFolder(wizard);
    final String targetName = Templates.getTargetName(wizard);

    final FileObject[] createdFile = { null };

    String version="";
    boolean addSpringToClassPath = (Boolean) wizard.getProperty(SpringXMLConfigNamespacesPanel.ADD_SPRING_TO_CLASSPATH);
    if (addSpringToClassPath) {
        Library[] libraries = { (Library) wizard.getProperty(SpringXMLConfigNamespacesPanel.SPRING_LIBRARY) };
        version = SpringUtilities.getSpringLibraryVersion(libraries[0]);
        addLibrariesToClassPath(libraries);
    } else {
        //Retriving Spring library version from ClassPath
        FileObject artifact = getSourceGroupArtifact(Templates.getProject(wizard),targetFolder);
        ClassPath cp = ClassPath.getClassPath(artifact, ClassPath.COMPILE);
        FileObject resource = null;
        if (cp != null) {
            resource = cp.findResource(SpringUtilities.SPRING_CLASS_NAME.replace('.', '/')+".class");    //NOI18N
        }


        if ( resource != null ) {
            FileObject ownerRoot = cp.findOwnerRoot(resource);
            version = findSpringVersion(ownerRoot);
        }
    }
    if (version == null || "".equals(version)) {    //NOI18N
        version = DEFAULT_SPRING_VERSION;
    }

    HashMap<String, Object> params = new HashMap<>();
    if (version.startsWith("3.") || version.startsWith("4.")) { //NOI18N
        params.put("version", version); //NOI18N
    }

    params.put("namespaces", getNamespacesList(version));   //NOI18N
    
    DataFolder dataFolder = DataFolder.findFolder(targetFolder);
    FileObject templateFO = Templates.getTemplate(wizard);
    DataObject templateDO = DataObject.find(templateFO);
    createdFile[0] = templateDO.createFromTemplate(dataFolder, targetName, params).getPrimaryFile();

    @SuppressWarnings("unchecked")
    Set<ConfigFileGroup> selectedGroups = (Set<ConfigFileGroup>) wizard.getProperty(SpringXMLConfigGroupPanel.CONFIG_FILE_GROUPS);
    addFileToConfigFileManager(selectedGroups != null ? selectedGroups : Collections.<ConfigFileGroup>emptySet(), FileUtil.toFile(createdFile[0]));
    
    return Collections.singleton(createdFile[0]);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:51,代码来源:NewSpringXMLConfigWizardIterator.java

示例8: readSettings

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Messages({
    "SimpleTargetChooserPanelGUI_no_source_folders=No source folders in project; perhaps it has been deleted?",
    "LBL_TemplatesPanel_Name=Choose File Type"
})
@Override public void readSettings(WizardDescriptor settings) {
    Boolean b = (Boolean) settings.getProperty(NewFileWizard.INCLUDES_TEMPLATES_WITH_PROJECTS);
    if (b != null && b.equals(Boolean.FALSE)) {
        includesTemplatesWithProject = false;
    }
    wizard = settings;
            
    if (noProjectFolders()) {
        wizard.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, SimpleTargetChooserPanelGUI_no_source_folders());
        return;
    }

    if ( gui == null ) {
        getComponent();
    }
    
    // Try to preselect a folder            
    FileObject preselectedTarget = Templates.getTargetFolder( wizard );
    if (preselectedTarget == null) {
        if (project != null) {
            preselectedTarget = project.getProjectDirectory();
        }
        else {
            String home = System.getProperty("user.home");
            if (home != null && new File(home).isDirectory()) {
                preselectedTarget = FileUtil.toFileObject(FileUtil.normalizeFile(new File(home)));
            }
        }
    }
    // Try to preserve the already entered target name
    String targetName = isFolder ? null : Templates.getTargetName( wizard );
    // Init values
    gui.initValues( Templates.getTemplate( wizard ), preselectedTarget, targetName, includesTemplatesWithProject );
    //only when we don't have a file from local filesystem
    if (preselectedTarget != null && FileUtil.toFile(preselectedTarget) == null) {
        try {
            fs = preselectedTarget.getFileSystem();
        } catch (FileStateInvalidException ex) {
            fs = null;
        }
    }        
    // XXX hack, TemplateWizard in final setTemplateImpl() forces new wizard's title
    // this name is used in NewFileWizard to modify the title
    Object substitute = gui.getClientProperty ("NewFileWizard_Title"); // NOI18N
    if (substitute != null) {
        wizard.putProperty ("NewFileWizard_Title", substitute); // NOI18N
    }
    
    wizard.putProperty(WizardDescriptor.PROP_CONTENT_DATA, new String[] {LBL_TemplatesPanel_Name(), LBL_SimpleTargetChooserPanel_Name()});
        
    if ( bottomPanel != null ) {
        bottomPanel.readSettings( settings );
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:59,代码来源:SimpleTargetChooserPanel.java

示例9: instantiate

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
public Set<FileObject> instantiate() throws IOException {
    saveSettings(wiz);        
    
    /* collect and build necessary data: */
    String name = Templates.getTargetName(wiz);
    FileObject targetFolder = Templates.getTargetFolder(wiz);
    if(targetFolder == null) {
        Logger.getLogger(NewTestWizardIterator.class.getName()).log(Level.INFO, "Target folder was null while creating new TestNG file");
        return null;
    }
    Project project = FileOwnerQuery.getOwner(targetFolder);
    if (project == null) {
        Logger.getLogger(NewTestWizardIterator.class.getName()).log(Level.INFO, "No project found for target folder: {0}", targetFolder);
        return null;
    }
    TestNGSupportImplementation testNGSupport = TestNGSupport.findTestNGSupport(project);
    if (testNGSupport == null) {
        Logger.getLogger(NewTestWizardIterator.class.getName()).log(Level.INFO, "No TestNGSupportImplementation found for target folder: {0}", targetFolder);
        return null;
    }
    testNGSupport.configureProject(targetFolder);
    
    Map<CommonPlugin.CreateTestParam, Object> params
            = CommonTestUtil.getSettingsMap(false);
    params.put(CommonPlugin.CreateTestParam.CLASS_NAME,
               Templates.getTargetName(wiz));
            
    if (!TestNGUtils.createTestActionCalled(new FileObject[] {targetFolder})) {
        return null;
    }

    /*
     * The TestNGPlugin instance must be initialized _before_ field
     * TestNGPluginTrampoline.DEFAULT gets accessed.
     * See issue #74744.
     */
    final FileObject[] testFileObjects
            = TestNGUtils.createTests(
                 null,
                 targetFolder,
                 params);
    
    if (testFileObjects == null) {
        throw new IOException();
    }
    
    FileObject createdFile = testFileObjects[0];
    return Collections.singleton(createdFile);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:50,代码来源:NewTestWizardIterator.java

示例10: instantiate

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
public Set<DataObject> instantiate() throws IOException {
    saveSettings(wizard);
    
    /* collect and build necessary data: */
    String name = Templates.getTargetName(wizard);
    FileObject targetFolder = Templates.getTargetFolder(wizard);
    
    Map<CreateTestParam, Object> params
            = JUnitTestUtil.getSettingsMap(false);
    params.put(CreateTestParam.CLASS_NAME,
               Templates.getTargetName(wizard));
            
    /* create the test class: */
    final JUnitPlugin plugin = JUnitTestUtil.getPluginForProject(
                                            Templates.getProject(wizard));
    
    if (!JUnitTestUtil.createTestActionCalled(
                                        plugin,
                                        new FileObject[] {targetFolder})) {
        return null;
    }

    /*
     * The JUnitPlugin instance must be initialized _before_ field
     * JUnitPluginTrampoline.DEFAULT gets accessed.
     * See issue #74744.
     */
    final FileObject[] testFileObjects
            = JUnitTestUtil.createTests(
                 plugin,
                 null,
                 targetFolder,
                 params);
    
    if (testFileObjects == null) {
        throw new IOException();
    }
    
    DataObject testDataObject;
    try {
        testDataObject = DataObject.find(testFileObjects[0]);
    } catch (DataObjectNotFoundException ex) {
        throw new IOException();
    }
    
    return Collections.singleton(testDataObject);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:49,代码来源:EmptyTestCaseWizardIterator.java

示例11: instantiate

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
public Set instantiate() throws IOException {
    FileObject targetFolder = Templates.getTargetFolder(wizardDescriptor);
    DataFolder targetDataFolder = DataFolder.findFolder(targetFolder);
    String targetName = Templates.getTargetName(wizardDescriptor);
    FileObject templateFileObject = Templates.getTemplate(wizardDescriptor);
    DataObject templateDataObject = DataObject.find(templateFileObject);


    DataObject newOne = templateDataObject.createFromTemplate(targetDataFolder, targetName);
    try {
        HibernateRevengDataObject hro = (HibernateRevengDataObject) newOne;
        HibernateReverseEngineering hre = hro.getHibernateReverseEngineering();

        // Add Schema Selection.
        int jx = hre.addSchemaSelection(true);
        if (dbTablesDescriptor.getCatalogName() != null && !"".equals(dbTablesDescriptor.getCatalogName())) {
            hre.setAttributeValue(HibernateReverseEngineering.SCHEMA_SELECTION, jx, CATALOG_NAME, dbTablesDescriptor.getCatalogName());
        } else {
            hre.setAttributeValue(HibernateReverseEngineering.SCHEMA_SELECTION, jx, CATALOG_NAME, null);
        }
        if (dbTablesDescriptor.getSchemaName() != null && !"".equals(dbTablesDescriptor.getSchemaName())) {
            hre.setAttributeValue(HibernateReverseEngineering.SCHEMA_SELECTION, jx, ATTRIBUTE_NAME, dbTablesDescriptor.getSchemaName());
        } else {
            hre.setAttributeValue(HibernateReverseEngineering.SCHEMA_SELECTION, jx, ATTRIBUTE_NAME, null);
        }

        // Add Table filters.
        List<Table> list = new ArrayList<Table> (dbTablesDescriptor.getSelectedTables());         
        for (int i = 0; i < list.size(); i++) {                
            int ix = hre.addTableFilter(true);
            hre.setAttributeValue(HibernateReverseEngineering.TABLE_FILTER, ix, CATALOG_NAME, null);
            hre.setAttributeValue(HibernateReverseEngineering.TABLE_FILTER, ix, ATTRIBUTE_NAME, null);
            hre.setAttributeValue(HibernateReverseEngineering.TABLE_FILTER, ix, MATCH_NAME, list.get(i).getName());
            hre.setAttributeValue(HibernateReverseEngineering.TABLE_FILTER, ix, EXCLUDE_NAME, null);
        }
        hro.addReveng();
        hro.save();            
        return Collections.singleton(hro.getPrimaryFile());
    } catch (Exception e) {
        return Collections.EMPTY_SET;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:43,代码来源:HibernateRevengWizard.java

示例12: instantiate

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
public Set<?> instantiate() throws IOException {

    FileObject createdFile = null;

    // Read Title from wizard 
    // String HtmlTitle = (String) wizard.getProperty(SNDefWizardPanel1.TITLE);
    // FreeMarker Template will get its variables from HashMap.
    // HashMap key is the variable name.
    SNDefVisualPanel1 panel1 = ((SNDefWizardPanel1) panels.get(1)).getComponent();
    SNDefVisualPanel2 panel2 = ((SNDefWizardPanel2) panels.get(2)).getComponent();
    SNDefVisualPanel2 panel3 = ((SNDefWizardPanel2) panels.get(3)).getComponent();

    Map args = new HashMap();
    args.put("defName", panel1.getDefName());
    args.put("defType", panel1.getDefType());
    args.put("description", panel1.getDefDescription());
    args.put("inputParams", panel2.getData());
    args.put("outputParams", panel3.getData());

    //Get the template and convert it:
    FileObject tplSnd = Templates.getTemplate(wizard);
    FileObject tplShd = tplSnd.getParent().getChildren()[0];

    DataObject templateSnd = DataObject.find(tplSnd);
    DataObject templateShd = DataObject.find(tplShd);

    //Get the package:
    FileObject dir = Templates.getTargetFolder(wizard);
    DataFolder df = DataFolder.findFolder(dir);

    ProjectAssetManager assetManager = new ProjectAssetManager(Templates.getProject(wizard), "assets");

    //Get the class:
    String targetName = Templates.getTargetName(wizard);
    String shaderName = targetName;
    String ext = ".frag";
    if (panel1.getDefType().equals("Vertex")) {
        ext = ".vert";
    }
    args.put("ext", ext);
    args.put("glslVersions", panel1.getGlslVersions());

    args.put("shaderSnippet", assetManager.getRelativeAssetPath(dir.getPath() + "/" + shaderName));

    //Define the template from the above,
    //passing the package, the file name, and the map of strings to the template:
    // DataObject dobj = templateSnd.createFromTemplate(df, targetName, args);
    for (String ver : panel1.getGlslVersions()) {
        templateShd.createFromTemplate(df, shaderName + ver + ext, args);
    }

    DataObject dobj = templateSnd.createFromTemplate(df, targetName, args);
    //Obtain a FileObject:
    createdFile = dobj.getPrimaryFile();

    // Return the created file.
    return Collections.singleton(createdFile);
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:60,代码来源:SNDefWizardIterator.java

示例13: instantiate

import org.netbeans.spi.project.ui.templates.support.Templates; //导入方法依赖的package包/类
@Override
public Set<?> instantiate() throws IOException {
    final List<String> entities = (List<String>) wizard.getProperty(WizardProperties.ENTITY_CLASS);
    final Project project = 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(project, 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(project, punit);
        }
    }
    final String title = NbBundle.getMessage(RevEngWizardDescriptor.class, "TITLE_Progress_JPA_Model"); //NOI18N
    final ProgressContributor progressContributor = AggregateProgressFactory.createProgressContributor(title);
    final AggregateProgressHandle handle = AggregateProgressFactory.createHandle(title, new ProgressContributor[]{progressContributor}, null, null);
    final ProgressPanel progressPanel = new ProgressPanel();
    final JComponent progressComponent = AggregateProgressFactory.createProgressComponent(handle);
    final ProgressReporter reporter = new ProgressReporterDelegate(progressContributor, progressPanel);
    final Runnable r = new Runnable() {
        @Override
        public void run() {
            try {
                handle.start();
                int progressStepCount = getProgressStepCount(entities.size());
                progressContributor.start(progressStepCount);
                generateJPAModel(reporter, entities, project, packageFileObject, fileName);
                progressContributor.progress(progressStepCount);
            } catch (IOException ioe) {
                Logger.getLogger(RevEngWizardDescriptor.class.getName()).log(Level.INFO, null, ioe);
                NotifyDescriptor nd = new NotifyDescriptor.Message(ioe.getLocalizedMessage(), NotifyDescriptor.ERROR_MESSAGE);
                DialogDisplayer.getDefault().notify(nd);
            } finally {
                progressContributor.finish();
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        progressPanel.close();
                    }
                });
                handle.finish();
            }
        }
    };

    // Ugly hack ensuring the progress dialog opens after the wizard closes. Needed because:
    // 1) the wizard is not closed in the AWT event in which instantiate() is called.
    //    Instead it is closed in an event scheduled by SwingUtilities.invokeLater().
    // 2) when a modal dialog is created its owner is set to the foremost modal
    //    dialog already displayed (if any). Because of #1 the wizard will be
    //    closed when the progress dialog is already open, and since the wizard
    //    is the owner of the progress dialog, the progress dialog is closed too.
    // The order of the events in the event queue:
    // -  this event
    // -  the first invocation event of our runnable
    // -  the invocation event which closes the wizard
    // -  the second invocation event of our runnable
    SwingUtilities.invokeLater(new Runnable() {

        private boolean first = true;

        @Override
        public void run() {
            if (!first) {
                RequestProcessor.getDefault().post(r);
                progressPanel.open(progressComponent, title);
            } else {
                first = false;
                SwingUtilities.invokeLater(this);
            }
        }
    });

    return Collections.singleton(DataFolder.findFolder(packageFileObject));
}
 
开发者ID:foxerfly,项目名称:Netbeans-JPA-Modeler,代码行数:78,代码来源:RevEngWizardDescriptor.java


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