Presentation

Download Report

Transcript Presentation

Douglas C. Engelbart
* January 30th 1925
+ July 2nd 2013
Mouse-free Days
1. Learn new shortcuts (cheat sheet)
2. Lot of scenarios which require
mouse interaction
3. It isn‘t that unproductive
Stop Clicking – Be Productive
Introducing Template-based Postfix Code Completion
Nicolaj Hoess
Student
Example 1
Example 2
Keystroke-Level Model
David E. Kieras
Keystroke-Level Model
David E. Kieras
• Mousing
• Keyboarding
• Point mouse
• Clicking
Repos. Caret
400ms
400ms
1100ms
100ms
2000ms
*
2
4000ms
Using shortcuts – time-saving?
• > 3000ms
• Limited „shortcut memory“
• „2 second Amnesia“
Using shortcuts – time-saving!
Ctrl
D
Ctrl
Shift
Alt
Delete a line
C
▲
Move line(s) up/down
▼
Alt
◄ ►
Ctrl
Shift
Toggle comment
Switch to previously/next opened editor
T
Search Type dialog
http://www.vogella.com/tutorials/EclipseShortcuts/article.html
Postfix Code Completion
Postfix Code Completion
Template-System
singleton-Template
private static volatile ${enclosing_type} instance;
private ${enclosing_type}() { }
public static ${enclosing_type} getInstance(){
${enclosing_type} l = instance;
if (l == null){
synchronized(${enclosing_type}.class) {
l = instance;
if (l == null)
instance = (l = new ${enclosing_type}());
}
}
return instance;
}
singleton-Template
private static volatile ${enclosing_type} instance;
private ${enclosing_type}() { }
public static ${enclosing_type} getInstance(){
${enclosing_type} l = instance;
if (l == null){
synchronized(${enclosing_type}.class) {
l = instance;
if (l == null)
instance = (l = new ${enclosing_type}());
}
}
return instance;
}
fileread-Template
${:import(java.nio.file.Files,
java.nio.file.Paths,
java.nio.charset.Charset,
java.io.IOException,
java.io.BufferedReader)}
try (BufferedReader in = Files.newBufferedReader(
Paths.get(${fileName:var(String)}),
Charset.forName("UTF-8"))) {
String line = null;
while ((line = in.readLine()) != null) {
${cursor}
}
} catch (IOException e) {
System.err.println("Unable to open file " + ${fileName});
}
fileread-Template
${:import(java.nio.file.Files,
java.nio.file.Paths,
java.nio.charset.Charset,
java.io.IOException,
java.io.BufferedReader)}
try (BufferedReader in = Files.newBufferedReader(
Paths.get(${fileName:var(String)}),
Charset.forName("UTF-8"))) {
String line = null;
while ((line = in.readLine()) != null) {
${cursor}
}
} catch (IOException e) {
System.err.println("Unable to open file " + ${fileName});
}
Template-based Postfix Code Completion
.var-Template
${n:newType(i)} ${v:newName(n)} = ${i:inner_expression};
.var-Template
${n:newType(i)} ${v:newName(n)} = ${i:inner_expression};
.field-Template
${field:newField(i)} = ${i:inner_expression};
.field-Template
${field:newField(i)} = ${i:inner_expression};
.nnull-Template
if (${i:inner_expression(java.lang.Object,
array)} != null) {
${cursor}
}
.nnull-Template
if (${i:inner_expression(java.lang.Object,
array)} != null) {
${cursor}
}
“
This is pretty cool, at least for
assigning new fields, but for all the
other scenarios it‘s useless…“
Mapping Thoughts to Code
“… now I need to get all participants of
eclipseCon and …”
eclipseCon.getParticipants()
Mapping Thoughts to Code
“… now I need to get all participants of
eclipseCon and iterate over them”
Participant p
for ( Person p
: eclipseCon.getParticipants()) {
... x
Mapping Thoughts to Code
“… now I need to get all participants of
eclipseCon and iterate over them”
eclipseCon.getParticipants().for
.for-Template
for (${t:newActualType(i)} ${n:newName(t)} :
${i:inner_expression(java.lang.Iterable,array)}) {
${cursor}
}
.for-Template
for (${t:newActualType(i)} ${n:newName(t)} :
${i:inner_expression(java.lang.Iterable,array)}) {
${cursor}
}
.const-Template
${:newField(i,false,true,true,true)}${i:inner_expression(novalue)}
public modifier
static modifier
final modifier
initialize
.constpub-Template
prevents output
${:newField(i,true,true,true,true)}${i:inner_expression(novalue)}
.const-Template
${:newField(i,false,true,true,true)}${i:inner_expression(novalue)}
public modifier
static modifier
final modifier
initialize
.constpub-Template
prevents output
${:newField(i,true,true,true,true)}${i:inner_expression(novalue)}
What else?
What else?
How can you get it?
• Update Site for Luna+:
• Update Site for Juno 3.8:
http://goo.gl/wt4B14
http://goo.gl/zx36ot
• github:
/trylimits/Eclipse-Postfix-Code-Completion
• Eclipse Bug Tracker:
#433500
• Support:
github bug tracker, or
[email protected]
Thank you! Questions?
Don‘t forget to evaluate the session. I appreciate a +1!
Acknowledgements:
Marco Descher, Lars Vogel, University of Applied Sciences Vorarlberg, …