Friday, July 31, 2015

Using emacs to paste multiple lines into a rectangle-this does not seem to work in Eclipse block mode

Lets say you have several lines that you want to paste into a rectangle so that the lines are inserted into each block.

case ACCESSORIES           : { }    
case AVAILABILITY          : { } 
case BRANDLOGO             : { } 
case BRANDNAME             : { } 
case BRANDPARTNUMBER       : { } 
case BRANDPRODUCTPAGE      : { } 
case BRANDSUGGESTEDPRICE   : { } 
case BRANDSUPPORTPHONE     : { } 
case BRANDWEBSITE          : { } 


Copy the code to paste into the empty braces, 

Availability schema = SchemaRegistry.getSchemaByClass(Availability.class);
String schemaName = schema.getName();

return schemaName;

Now you want to paste in the following code into each set of braces.
This paste operation does not seem to work in Eclipse. However, in Emacs use insert rectangle (cantle x-r-t) to paste the lines into each set of braces. Use control-space and the arrow keys to select the rectangle inside of the braces. Then use control-Y or command-v on the Mac to paste the contents into the mini buffer and hit return. the multiple lines of text are pasted into each set of braces



case ACCESSORIES           : {
Accessories schema = SchemaRegistry.getSchemaByClass(Accessories.class);
String schemaName = schema.getName();
return schemaName;
 }    
case AVAILABILITY          : {
Accessories schema = SchemaRegistry.getSchemaByClass(Accessories.class);
String schemaName = schema.getName();
return schemaName;
 } 
case BRANDLOGO             : {
Accessories schema = SchemaRegistry.getSchemaByClass(Accessories.class);
String schemaName = schema.getName();
return schemaName;
 } 
case BRANDNAME             : {
Accessories schema = SchemaRegistry.getSchemaByClass(Accessories.class);
String schemaName = schema.getName();
return schemaName;
 } 
case BRANDPARTNUMBER       : {
Accessories schema = SchemaRegistry.getSchemaByClass(Accessories.class);
String schemaName = schema.getName();
return schemaName;
 } 
case BRANDPRODUCTPAGE      : {
Accessories schema = SchemaRegistry.getSchemaByClass(Accessories.class);
String schemaName = schema.getName();
return schemaName;
 } 
}