NewEmptyFile

New Empty Editor Window

From the discussion on nb-feedback: There was a request for making it possible to create a new empty editor window w/o having to specify a file name and location (or even having to go through a wizard). New file can be created on MemoryFS, like the example from sketsa shows. The IDE should try to guess the mime type from context (active project?) and also let the user to change the mime type (popup menu). Alternatively the IDE could ask the user to select the mime type, although that means the UI would not be completely simple (one keystroke to open the editor). When the user saves the file it should behave as Save As. The implementation used by sketsa would not work for NetBeans because the code they used for handling the first Save would have to be copied for every type of file. Not a problem for sketsa which only handles one or a few file types.

Additional comment: this additional comment maybe shortsighted (due the complexity of various modules), but is it possible to create generic implementation of Save As by simple serialize as text file for source related content and binary serialize for binary file eg: image, etc. All module should inherit from that generic DataObject / EditorSupport that implement that generic Save As behaviour. For more specific save as, the module implementator should inherit and provide the specific behaviour, otherwise the parent object just handle it using the generic as above. Combination of mime types or file extension could help as well for the generic save as behaviour.

New Empty File

Based on NewFileWizard specification there are 135 different file templates/wizards in NetBeans.

Some of the templates create empty files, their value is in selecting the extension for the user instead of typing it. Other templates create non empty files but the content is always the same and trivial and the content can be determined by extension. Finding a correct template is harder then just typing the extension. There is also possibly a concern that the user will not create files of types that are not supported by NetBeans. This may be an artificial problem that is caused partly by NetBeans' focus on providing templates for every type of empty file, partly by the fact the Empty File template is well hidden, partly by NetBeans supporting too few file types.

Some templates create a very similar content to other templates. For example the Java Interface template differs from the Java Class template only by one word (this is the case for most Java templates).

Here are the numbers:

Template categories 19
Templates 135
Duplicates (same template in multiple categories) 7
Unique templates 128
Templates which create empty files 8
Unique non empty templates 120
Templates with trivial content which can be determined by extension 15
Trivial templates, same can be done by using another template and trivial editing 10
Folder template 1
Useful Wizards that create non trivial files based on input 94


See the detailed data below.

This means the a much simpler New Empty File dialog can be used without any change and give perfect results for 8 templates. With the same simple UI and a small change in implementation (find the default template for file's extension and use it) New Empty File can be used instead of another 15 file templates with exactly the same results and for 10 more file templates with very similar results. Usage of a total of 33 templates can be replaced by a very simple dialog. For the rest the user can still go to the current New File dialog. Another benefit would be eliminating those 8 empty templates from the New File Wizard.

The UI for the New Empty File can be as simple as the New > Empty File in popup menu on folders in Favorites tab:

+----------------------+
| New File             |
+----------------------+
|                      |
| File Name: --------- |
|                      |
|        [[OK | OK]] [Cancel] |
+----------------------+


Detailed data:

The Tag column means:

  • * empty template
  • X is a duplicate template (one that is also in another category, only one of those is not marked with X)
  • # trivial template content, can be guessed based on extension
  • $ content very similar to the template that would be guessed based on extension
Category Template Tag
AWT GUI Forms Applet Form
AWT GUI Forms Dialog Form
AWT GUI Forms Frame Form
AWT GUI Forms Panel Form
CDC AGUI Xlet Form
CDC Personal Profiler Xlet Form
CDC Ricoh Xlet
CDC Xlet
Enterprise Caching Service Locator
Enterprise Message-Driven Bean
Enterprise Service Locator
Enterprise Session Bean
Enterprise Standard Deployment Descriptor
GlassFish GlassFish Deployment Descriptor
GlassFish JavaMail Resource
GlassFish JDBC Connection Pool
GlassFish JDBC Resource
GlassFish JMS Resource
GlassFish Persistence Resource
Java Applet
Java Empty Java File *
Java JApplet $
Java Java Annotation Type $
Java Java Class #
Java Java Enum $
Java Java Exception $
Java Java Interface $
Java Java Main Class $
Java Java Package
Java Java Package Info $
Java Server Faces JSF Managed Bean
Java Server Faces Visual Web JSF Application Bean
Java Server Faces Visual Web JSF Page
Java Server Faces Visual Web JSF Page Fragment
Java Server Faces Visual Web JSF Request Bean
Java Server Faces Visual Web JSF Session Bean
JUnit JUnit Test
JUnit JUnit Test for Existing Class
JUnit JUnit Test Suite
MIDP Empty J2ME Unit Test *
MIDP Hello Visual MIDlet (Old Version) ???
MIDP J2ME Web Service Client
MIDP Localization Support Class
MIDP MIDlet
MIDP MIDP Canvas
MIDP Visual Design ???
MIDP Visual Game Design
MIDP Visual MIDlet
MIDP Visual MIDlet (Old Version) ???
Module Development Action
Module Development File Type
Module Development Java SE Library Desriptor
Module Development JavaHelp Help Set
Module Development Module Installer
Module Development Options Panel
Module Development Project Template
Module Development Update Center
Module Development Window Component
Module Development Wizard
Other Ant Build Script #
Other CSS File ??? X
Other Custom Ant Task
Other Empty File *
Other Folder F
Other HTML File X
Other JavaScript File X
Other JNLP File #
Other JSON *
Other Properties File *
Other Ruby Script *
Other SQL File *
Persistence Database Schema
Persistence Entity Class
Persistence Entity Classes from Database
Persistence Persistence Unit
Persistence SQL File X
Ruby $Rakefile $
Ruby $Ruby Class $
Ruby $Ruby Module $
Ruby Empty Ruby Script X
Ruby RHTML File #
Ruby RJS #
Ruby Ruby Unit Test
Ruby Ruby Unit Test Suite
SOA BPEL Process
SOA Intelligent Event Processor
SOA SQL File X
SOA WSDL from Database
SOA XSLT Service
Struts Struts Action
Struts Struts ActionForm Bean
Swing GUI Forms Application Sample Form ???
Swing GUI Forms Bean Form
Swing GUI Forms JApplet Form
Swing GUI Forms JDialog Form
Swing GUI Forms JFrame Form
Swing GUI Forms JInternalFrame Form
Swing GUI Forms JPanel Form
Swing GUI Forms Master/Detail Sample Form ???
Swing GUI Forms MDI Application Sample Form ???
Swing GUI Forms OK/Cancel Dialog Sample Form ???
UML Diagram
UML Element
UML Package
Web #Tag File #
Web #Tag Library Descriptor #
Web Caching Service Locator ???
Web CSS #
Web Filter
Web HTML #
Web JavaScript File *
Web JSP #
Web Service Locator ???
Web Servlet
Web Tag Handler
Web Web Application Listener
Web Services #WSDL File ??? X
Web Services Logical Handler
Web Services Message Handler
Web Services REST Web Services from Entity Classes
Web Services Secure Token Service
Web Services Web Service
Web Services Web Service Client
Web Services Web Service from WSDL
XML #WSDL Document ??? #
XML #XML File #
XML #XML Schema #
XML #XSL Stylesheet #
XML DTD Entity #
XML External WSDL Document(s) ???
XML External XML Schema Document(s) ???
XML Loan Application Sample Schema ???
XML OASIS XML Catalog
XML Purchase Order Sample Schema ???
XML XML Parsed Entity
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo