Wednesday, December 17, 2008

Most Used Eclipse Shortcuts

This list is I believe (becoz i use : ) ), the most used eclipse shortcuts, be it myEclipse, IRAD's eclipse, CFEclipse or any other flavor of eclipse.

These are mostly the ones you use to edit text in the editor and also has the most important ones for searching.

I am sure at least 3 to 4 shortcuts here will be new for every avid shortcut users.

ctrl + shift + t
search for (java) types
you can enter only the uppercase letters of your wanted class or interface. eclipse will bring only such types to the top which contains these uppercase letters inside their names.
i.e. entering BAD finds BaseAccountData or BindAccountDAO etc

ctrl + shift + r
searches for any resources .
the same is true for search with uppercase letters as mentioned above. beside types, eclipse will list any other resources, i.e. jsp, xml, properties, ...

ctrl + o
searches for a method inside a type. let you jump quickly to the beginning of a method.

F3
opens the declaration of a type. let you jump quickly from a type to another type. just place the cursor to the declared type you want to jump to and hit F3. you can alternatively push ctrl and click onto the type you want to open.

alt + arrow left / rigth
lets you jump right back (and forth) to the location (i.e. type declaration) you came from.

ctrl + t
shows the type hierarchy of a type. just place the cursor to the declared type with the wanted hierarchy and hit ctrl + t. now you can scroll through the hierarchy (arrow up / down) and open the desired supertype or subtype (by hitting enter).

ctrl + shift + g
searches for all references of a type or method. just place the cursor the the declaration of the type or method and hit ctrl + shift + g. now you have an overview of all types in workspace which references your class / method.


Ctrl+(shift+)k
-> Searching forward (backward) for the last highlighted text

Ctrl+. -> Go to the next warning / error
Ctrl+, -> Go to the previous warning / error
* works in Javaperspective, not e.g. in phpeclipse

Ctrl+shift+l -> List of many available Shortcuts


Alt + Shift + J, release then press X
runs the program

Ctrl + NumPad - or +
to collapse/uncollapse

Ctrl + NumPad * (multiply key)
To expand all

Ctrl + NumPad / (divide key)
to collapse all

Alt+Shift+Q, B
Show all breakpoints

Alt+Shift+Q, H
Cheat sheets

Alt+Shift+Q, C
Show console

Ctrl+Shift+X
To upper case

Ctrl+Shift+Y
To lower case

Ctrl+Shift+Up
Go to previous member

Ctrl+Shift+Down
Go to next member

Ctrl+Shift+P
Go to matching bracket

Ctrl+Alt+H
Open call hierarchy

Alt + Shift + S
source quick menu

Ctrl + Shift + \ or / or C
comment uncomment block

Ctrl + /
toggle selection comment


Ctrl + L
Shift left

Ctrl + 3
Pretty much lets you search anything and everything

Ctrl + E
Same as ctrl + F6

Saturday, September 13, 2008

Digit to Two Letter Word Converter Utility

/*
* A utility for displaying combinations of letter groups, two at a time.
* The user will enter digits (0-9) on a cell-phone numeric pad, letter groups
* for each digits(eg. "ABC", "WXYX" etc are stored in a map using the letter
* key for each. Keys entered at command line by user, are mapped to their
* corresponding values("letter groups") and are retrieved and saved into
* an String array.
*
* The string arry then is passed along with other info to make the combinations.
*
* There is no definate requirement for this utility, so it servs to give a general
* idea of how user input are mapped to values and how they are combined into meaningful
* two-letter words.
*
* Please feel free to call if you need to.
*
* Assumptions: 1.Combination of two letters are to be displayed
* 2. The order of letter-group to be used for first letter doesn't matter.
* eg. if "ABC" "DEF" are entered this utility could either print:
* AD, AE, AF, BD, BE, BF, CD, CE, CF
* or
* DA, DB, DC, EA, EB, EC, FA, FB, FC
*
*
* Author Date Category
* Nirmal Singh Sep. 13th 2008 General/Utilities
*
*
* note: I can produce a more refined version, depending on input/comments in case
* somebody needs this utility for ceartain use.
*
*
*/

package mine_code;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class TwoLetterCombination
{
public static void main(String[] args)
{

getCommandLineArgsProcess(args);
}

private static void getCommandLineArgsProcess(String[] privateArgs)
{
System.out.println("Please enter digits 0-9 and ");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String s = null;

try
{
s = in.readLine();
String[] strKeys = new String[s.length()];
int[] intKeys = new int[s.length()];

for(int b=0;b {
strKeys[b] = String.valueOf(s.charAt(b));
intKeys[b] = Integer.valueOf(strKeys[b]);
}

callToCopy(strKeys,intKeys, s);
}

catch (IOException e)
{
e.printStackTrace();
}
//System.out.println("Digits entered are: " + s);
}

public static void callToCopy(String[] strArr, int[] intArr, String s)
{
String[] targetArr = new String[strArr.length];
Map myHash = new HashMap();
for(int g=0;g {
targetArr[g] = strArr[g];

switch (intArr[g])
{
case 0: myHash.put(0, " ");break;
case 1: myHash.put(1, " "); break;
case 2: myHash.put(2, "ABC"); break;
case 3: myHash.put(3, "DEF"); break;
case 4: myHash.put(4, "GHI"); break;
case 5: myHash.put(5, "JKL"); break;
case 6: myHash.put(6, "MNO"); break;
case 7: myHash.put(7, "PQRS"); break;
case 8: myHash.put(8, "TUV"); break;
case 9: myHash.put(9, "WXYZ"); break;
}
}
printCombinations(myHash, s);
}

public static void printCombinations(Map myHash, String s)
{
Iterator it = (myHash.keySet()).iterator();
String[] values = new String[myHash.size()];
int arrSize=0;
System.out.println("Digits entered are: " + s);
System.out.println("The following are digits entered and their corresponding letter"+
"groups: ");
System.out.println();

while(it.hasNext())
{
int key = (Integer)it.next();
values[arrSize] = myHash.get(key).toString();
System.out.println(key + " " + values[arrSize]);
arrSize++;
}

int sizeOfArr =arrSize;
System.out.println();
System.out.println("The following are combinations of the letters: ");
System.out.println("Three blank spaces are stored for each 1 and 0 digits "+'\n'+
"and I am displaying the spaces along with the corresponding "+'\n'+
"letters as part of combination. ");
System.out.println();
for(int m=0; m {
for( int k=0;k {
if(m+1 {
for( int j=0;j {
String tempStr;
char firstChar, secondChar;
firstChar = values[m].charAt(k);
secondChar = values[m+1].charAt(j);
tempStr = firstChar+""+secondChar+"";
System.out.println(tempStr);
}
}
}
}
}
}