Difference between revisions of "Team1/Moving and copying Java elements"

From CDOT Wiki
Jump to: navigation, search
 
Line 1: Line 1:
=== 6. Moving and copying Java elements ===
+
=== 7. Moving and copying Java elements ===
  
6.1. To '''Move''' a class to another package: <br/>
+
7.1. To '''Move''' a class to another package: <br/>
 
Click on ''Refactor -> Move'' <br/>
 
Click on ''Refactor -> Move'' <br/>
 
[[Image:move1.jpg |600px]]
 
[[Image:move1.jpg |600px]]
  
<br/>6.2. IIn the ''Move'' window,chose the new package (destination), e.g."cs.ecl.basics.lab_1" and check the ''Update references to the moved element(s)'' then click on OK. .<br />
+
<br/>7.2. IIn the ''Move'' window,chose the new package (destination), e.g."cs.ecl.basics.lab_1" and check the ''Update references to the moved element(s)'' then click on OK. .<br />
 
[[Image:move2.jpg |500px ]]
 
[[Image:move2.jpg |500px ]]
  
<br/>6.3. The following code will be the content of the ''VehicleRegistration'' class. Note the package name. <br />
+
<br/>7.3. The following code will be the content of the ''VehicleRegistration'' class. Note the package name. <br />
 
[[Image:move3.jpg |600px ]]
 
[[Image:move3.jpg |600px ]]
  
<br/>6.4. To '''Copy''' a class to another package:<br/>
+
<br/>7.4. To '''Copy''' a class to another package:<br/>
 
Right Click on the class name in the ''Package Explorer'', then select ''Copy'', <br/>
 
Right Click on the class name in the ''Package Explorer'', then select ''Copy'', <br/>
 
[[Image:copy1.jpg |600px]]
 
[[Image:copy1.jpg |600px]]
  
<br/>6.5. Then right click on the destination package and select ''Paste''. The package name in the copied class would be the same as the destination package name. <br />
+
<br/>7.5. Then right click on the destination package and select ''Paste''. The package name in the copied class would be the same as the destination package name. <br />
 
[[Image:copy2.jpg |500px ]]
 
[[Image:copy2.jpg |500px ]]
  
<br/>6.6. The following code will be the content of the copied ''VehicleRegistration'' class. Note the package name.<br />
+
<br/>7.6. The following code will be the content of the copied ''VehicleRegistration'' class. Note the package name.<br />
 
[[Image:copy3.jpg |600px ]]
 
[[Image:copy3.jpg |600px ]]

Latest revision as of 13:34, 30 January 2011

7. Moving and copying Java elements

7.1. To Move a class to another package:
Click on Refactor -> Move
Move1.jpg


7.2. IIn the Move window,chose the new package (destination), e.g."cs.ecl.basics.lab_1" and check the Update references to the moved element(s) then click on OK. .
Move2.jpg


7.3. The following code will be the content of the VehicleRegistration class. Note the package name.
Move3.jpg


7.4. To Copy a class to another package:
Right Click on the class name in the Package Explorer, then select Copy,
Copy1.jpg


7.5. Then right click on the destination package and select Paste. The package name in the copied class would be the same as the destination package name.
Copy2.jpg


7.6. The following code will be the content of the copied VehicleRegistration class. Note the package name.
Copy3.jpg