View stunning SlideShares in full-screen with the new iOS app!Introducing SlideShare for AndroidExplore all your favorite topics in the SlideShare appGet the SlideShare app to Save for Later — even offline
View stunning SlideShares in full-screen with the new Android app!View stunning SlideShares in full-screen with the new iOS app!
As an alternative to the New main menu command, you can create Java artifacts using the Java perspective toolbar.
1. Create Java Project 2. Create Java Package 3. Create Java Class a. Create Visual class b. Create Java class c. Create Java interface d. Create Java Enum e. Create Annotation f. Create JUnit Test Case 4. Launch New_configuration (for Code Analysis) 5. Debug Java Application 6. Run Java Application 7. Profile Java Application 8. Run External Tools 9. Open Type 10. Open Search Dialog 1 2 3 4 5 6 7 8 9 10 a b c d e f
In the Java perspective, right-click a Java class and choose Refactor > Move .
Click Next .
Specify the new destination for the Java class.
Select a different package, or use the New button to create a new package.
Click Preview to examine the
changes before committing
Refactoring Functions (1 of 4) Function Description Shortcut Undo Reverses the last refactoring operation Alt+Shift+Z Redo Performs a refactoring operation that was previously reversed Alt+Shift+Y Rename Changes the name of a Java element, and updates all references to that element Alt+Shift+R Move Moves a Java element from between classes, interfaces, packages, or projects Alt+Shift+V Change Method Signature Changes the name or parameters of a method, and updates all references to the method Alt+Shift+C Convert Anonymous Class to Nested Provides a name for an anonymous class, thus changing the class into a nested class
Refactoring Functions (2 of 4) Function Description Move Member Type into New File Extracts a nested class and saves it as a separate class Push Down Moves a set of methods and fields from a class to its subclasses Pull Up Moves a set of methods and fields from a class to its superclass Extract Interface Creates a new interface based on a class. Optionally, you can make the source class implement the new interface Generalize Type Replaces a type in a variable, parameter, or field or on a method return type with one of its supertypes Use Supertype Where Possible Replaces all occurrences of a type with one of its supertypes
Refactoring Functions (3 of 4) Function Description Shortcut Inline Replace a method invocation with the implementation of the method itself. For static final fields, replace a reference to the field with the actual value Alt+Shift+I Extract Method Takes a section of code within a method and places it in a new method Alt+Shift+M Extract Local Variable Creates a local variable from an expression. Replaces an expression with a reference to the local variable Alt+Shift+L Extract Constant Creates a static final field from an expression. Replaces the expression with a reference to the static final field Introduce Parameter Within a method, extracts an expression and replaces it with a new method parameter
Refactoring Functions (4 of 4) Function Description Shortcut Introduce Factory Replaces a constructor with a factory method that invokes the constructor Convert Local Variable to Field Replaces a local variable with a field. If the local variable is initialized when it is created, this operation moves the initialization code to the method’s constructor. Alt+Shift+F Encapsulate Field Replaces all references to a field with getter and setter methods
Source Functions (1 of 4) Function Description Shortcut Toggle Comment Adds single line comments ( // ) to each line in the selection Ctrl+/ Add Block Comment Adds block comment tags ( /* */ ) around the selection Ctrl+Shift+/ Remove Block Comment Removes block comment tags ( /* */ ) around the selection Ctrl+Shift+ Shift Right Adds a tab character to the start of each line in the selection Tab Shift Left Removes a tab character from the start of each line in the selection Shift+Tab Format Changes the indentation, line spacing, and braces in the entire Java class according to the code formatter settings Ctrl+Shift+F
Source Functions (2 of 4) Function Description Shortcut Format Element Apply code formatting only to the first Java element in the selection Correct Indentation Adjust the indentation to every line in the current selection Ctrl+I Sort Members Arrange the member order according to the Member Sort Order in Java preferences Organize Imports Adds any missing import statements, and removes any unused import statements Ctrl+Shift+O Add Imports Adds an import statement for the currently selected type. Removes the package name for a qualified type, if possible. Ctrl+Shift+M Override/ Implement Methods Creates one or more methods defined in a superclass or interface
Source Functions (3 of 4) Function Description Shortcut Generate Getters and Setters Creates a get Field and set Field method for one or more fields in the current class Generate Delegate Methods For a field in the current class, creates a wrapper around methods from the field’s class Generate Constructor using Fields Creates a new constructor that initializes one or more fields in the class Add Constructor from Superclass Overrides one or more constructors defined in a superclass Add Javadoc Comment Adds a Javadoc comment and appropriate Javadoc tags for the selection Alt+Shift+J
Source Functions (4 of 4) Function Description Shortcut Surround with try/catch Block Adds a try/catch block around the selection to catch exceptions Externalize Strings Takes all static string declarations and saves them into a separate properties file. Also creates a method to retrieve strings in the properties file. Find Strings to Externalize Given a project, source folder, or package, searches for any strings that have not been externalized Convert Line Delimiters To
Changes the end-of-line indicator in the current document to one of the three formats:
The Type Hierarchy view allows you to view the relationship between a type and its super and subtypes. The UML visualization tools can also diagram the relationship between types.
The Refactor Move command verifies every reference to the resource within the workspace and updates all references. Moving the file outside of the workbench will not update these references.
In the Java editor, the left indicator bar displays the tasks and errors in the same scale as the lines within the editor. The right indicator bar displays the tasks and errors as well, but in scale with the entire file.
The Organize Imports command scans the current Java class and suggests an import statement to fix any classes. The Quick Fix feature also suggests an import statement for a class that the compiler cannot resolve.
Error (red circle, white cross), warning (yellow triangle, exclamation mark), Information (blue exclamation mark)