站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.0.0

Templates (NetBeans Project UI API) - NetBeans API Javadoc 5.0.0

 

org.netbeans.spi.project.ui.templates.support
Class Templates

java.lang.Object
  extended byorg.netbeans.spi.project.ui.templates.support.Templates

public class Templates
extends Object

Default implementations of template UI.


Method Summary
static WizardDescriptor.Panel createSimpleTargetChooser(Project project, SourceGroup[] folders)
          Create a basic target chooser suitable for many kinds of templates.
static WizardDescriptor.Panel createSimpleTargetChooser(Project project, SourceGroup[] folders, WizardDescriptor.Panel bottomPanel)
          Create a basic target chooser suitable for many kinds of templates.
static FileObject getExistingSourcesFolder(WizardDescriptor wizardDescriptor)
          Find the existing sources folder selected for a custom template wizard iterator.
static Project getProject(WizardDescriptor wizardDescriptor)
          Find the project selected for a custom template wizard iterator.
static FileObject getTargetFolder(WizardDescriptor wizardDescriptor)
          Find the target folder selected for a custom template wizard iterator.
static String getTargetName(WizardDescriptor wizardDescriptor)
          Method to communicate current choice of target name to a custom WizardDescriptor.InstantiatingIterator associated with particular template.
static FileObject getTemplate(WizardDescriptor wizardDescriptor)
          Find the template with which a custom template wizard iterator is associated.
static void setTargetFolder(WizardDescriptor wizardDescriptor, FileObject folder)
          Stores a target folder so that it can be remembered later using getTargetFolder(org.openide.WizardDescriptor).
static void setTargetName(WizardDescriptor wizardDescriptor, String targetName)
          Sets the target name for given WizardDescriptor to be used from custom target choosers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProject

public static Project getProject(WizardDescriptor wizardDescriptor)
Find the project selected for a custom template wizard iterator.

If the user selects File | New File, this will be the project chosen in the first panel. If the user selects New from org.netbeans.modules.project.ui.actions.Actions#newFileAction, this will be the project on which the context menu was invoked.

Parameters:
wizardDescriptor - the wizard as passed to WizardDescriptor.InstantiatingIterator#initialize or TemplateWizard.Iterator#initialize
Returns:
the project into which the user has requested this iterator create a file (or null if not set)

getTemplate

public static FileObject getTemplate(WizardDescriptor wizardDescriptor)
Find the template with which a custom template wizard iterator is associated.

If the user selects File | New File, this will be the template chosen in the first panel. If the user selects New from org.netbeans.modules.project.ui.actions.Actions#newFileAction, this will be the template selected from the context submenu.

Parameters:
wizardDescriptor - the wizard as passed to WizardDescriptor.InstantiatingIterator#initialize or TemplateWizard.Iterator#initialize
Returns:
the corresponding template marker file (or null if not set)

getTargetFolder

public static FileObject getTargetFolder(WizardDescriptor wizardDescriptor)
Find the target folder selected for a custom template wizard iterator.

If the user selects File | New File this may not be set, unless you have called setTargetFolder(org.openide.WizardDescriptor, org.openide.filesystems.FileObject) in an earlier panel (such as that created by createSimpleTargetChooser(Project,SourceGroup[])). It may however have a preselected folder, e.g. if the user invoked New from the context menu of a folder.

Parameters:
wizardDescriptor - the wizard as passed to WizardDescriptor.InstantiatingIterator#initialize or TemplateWizard.Iterator#initialize
Returns:
the folder into which the user has requested this iterator create a file (or null if not set)

getExistingSourcesFolder

public static FileObject getExistingSourcesFolder(WizardDescriptor wizardDescriptor)
Find the existing sources folder selected for a custom template wizard iterator.

This may not be set, unless you have CommonProjectActions.newProjectAction with CommonProjectActions.EXISTING_SOURCES_FOLDER value.

Parameters:
wizardDescriptor - the wizard as passed to WizardDescriptor.InstantiatingIterator#initialize or TemplateWizard.Iterator#initialize
Returns:
the existing sources folder from which the user has requested this iterator to create a project
Since:
1.3 (17th May 2005)

setTargetFolder

public static void setTargetFolder(WizardDescriptor wizardDescriptor,
                                   FileObject folder)
Stores a target folder so that it can be remembered later using getTargetFolder(org.openide.WizardDescriptor).

Parameters:
wizardDescriptor - a template wizard
folder - a target folder to remember

getTargetName

public static String getTargetName(WizardDescriptor wizardDescriptor)
Method to communicate current choice of target name to a custom WizardDescriptor.InstantiatingIterator associated with particular template.

XXX why is this public? only used from NewFileIterator in projectui?


setTargetName

public static void setTargetName(WizardDescriptor wizardDescriptor,
                                 String targetName)
Sets the target name for given WizardDescriptor to be used from custom target choosers

XXX why is this public? only used from SimpleTargetChooserPanel in projectui?


createSimpleTargetChooser

public static WizardDescriptor.Panel createSimpleTargetChooser(Project project,
                                                               SourceGroup[] folders)
Create a basic target chooser suitable for many kinds of templates. The user is prompted to choose a location for the new file and a (base) name. Instantiation is handled by DataObject.createFromTemplate(org.openide.loaders.DataFolder).

Parameters:
project - The project to work on.
folders - a list of possible roots to create the new file in
Returns:
a wizard panel(s) prompting the user to choose a name and location

createSimpleTargetChooser

public static WizardDescriptor.Panel createSimpleTargetChooser(Project project,
                                                               SourceGroup[] folders,
                                                               WizardDescriptor.Panel bottomPanel)
Create a basic target chooser suitable for many kinds of templates. The user is prompted to choose a location for the new file and a (base) name. Instantiation is handled by DataObject.createFromTemplate(org.openide.loaders.DataFolder). Resulting panel can be decorated with additional panel placed below the standard target chooser.

Parameters:
project - The project to work on.
folders - a list of possible roots to create the new file in
bottomPanel - panel which should be placed underneth the default chooser
Returns:
a wizard panel(s) prompting the user to choose a name and location

 

Built on May 3 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.