This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 62000

Summary: Design a better way to access code clips
Product: ide Reporter: Petr Jiricka <pjiricka>
Component: UIAssignee: issues@ide <issues>
Status: NEW ---    
Severity: blocker CC: lkotouc, madamek, pbuzek, pchytil, ppisl
Priority: P2    
Version: 5.x   
Hardware: All   
OS: Windows XP   
Issue Type: ENHANCEMENT Exception Reporter:

Description Petr Jiricka 2005-08-09 18:04:27 UTC
The code clips feature as designed for NetBeans 4.2 is really useful in many
ways. However, it has a couple serious disadvantages:

- Using a Code Clip usually represents a stopper in the flow of user's work.
Typically the user is working in the editor using the keyboard, however to
insert a code clip, she will typically reach for the mouse and use the mouse to
insert code clip, whether by doubleclicking, or by drag & drop. This slows the
work down.
- The code clips palette takes up screen estate in the editor.

So, it would be nice to have a way of quickly adding chunks of source code to
the code editor without the above disadvantages, but while preserving the
advantages of the code clips palette (some of which are not currently doable
with code completion or live templates), including the following:

1/ This feature is easily discoverable, it is very intuitive to find out how to
add a code snippet. 
2/ It is easy to see all code clips available in the IDE in a very organized
way, sorted by logical categories. So it is easy to find the code clip the user
is looking for.
3/ It is (potentially) possible to create one's own clips with custom code.
4/ Inserting a code clip does not require the knowledge of (even a part of) its
name, the user does not need to know the initial few letters of the code etc.
5/ The number of code clips can scale to hunderds or more without the user being
6/ Code clips can provide an intuitive customization dialog, which asks the user
for additional information, while supporting the correct choices through
suitable UI (comboboxes, Browse buttons, radio buttons etc.)
7/ A single code clip may generate very diverse sets of code based on user's
customizations, for example the "Call EJB" code clip may either add code to the
current class, or create a new class (ServiceLocator) and generate code that
calls this new class.
Comment 1 Petr Jiricka 2012-01-11 09:02:56 UTC
Update: Currently the Insert Code action (Ctrl+I; present in the editor popup menu) partly adresses this need, however is has discoverability issues. Many useful code snippets are available through Ctrl+I, but I fear that users often don't know about them. 
Another problem with Insert Code is UI scalability - it works well for 5-10 code clips, but not if we wanted to put e.g. 50 code clips into it. With Palette, this is not an issue.