Changes

Jump to: navigation, search

Teams Winter 2011/team1/RCP/Define and use commands

2 bytes added, 00:15, 9 March 2011
Add Other Necessary Commands to The Application
=== Add Other Necessary Commands to The Application ===
Here we will add other necessary commands to our application. We add the command Handler classes the same way we added the PrintHandler class, and then will add the commands to the menuContribution Extension point. However, in order to be able to implement the command execute method, we need to wait until we add the view and the Jface tableViewer to our application. So we add the commands then leave the implementation part and come back to it after the View and editor view creation is done. So for implementation, we assume that you have gone through those parts of the tutorial.
 
==== "Add Student" Command ====
For implementing the "AddStudent" command, we are highly depended on the use of Editor view, so after adding the command Handler class and add the command to the menuContribution extension point, we will leave this part of tutorial and will come back to it for the implementation of the execute method in the handler class. However this will not be the only code, related to the "AddStudent" command. The reason is, we are going to use the editor view to create a new student. So basically, when user clicks on the "Add Student" on the top bar, the editor view will open up and enables user to enter the information for a new student and there will be a "Save" button to save the student, Then the table viewer will show the updated data, and the editor view will close.<br/>
 
Here is what user can see by clicking on the "Add Student" button:<br/>
[[Image: RCPCommandAddRun.jpg | 700px]]<br/>
<br/>
Add the "AddStudent" command to the commands extension point the same way you added the Print command, and create its Handler class.<br/>
[[Image: RCPCommand13.jpg | 700px]]<br/>
<br/>
 
Add the command you just created to the menuContribution you have in the extension point (the same one you added Print command to). <br/>
[[Image: RCPCommand14.jpg | 700px]]<br/>
<br/>
[[Image: RCPCommand15.jpg | 700px]]<br/>
<br/>
[[Image: RCPCommand16.jpg | 700px]]<br/>
<br/>
 
 
==== "Delete Student" Command ====
</source>
 
==== "Add Student" Command ====
For implementing the "AddStudent" command, we are highly depended on the use of Editor view, so after adding the command Handler class and add the command to the menuContribution extension point, we will leave this part of tutorial and will come back to it for the implementation of the execute method in the handler class. However this will not be the only code, related to the "AddStudent" command. The reason is, we are going to use the editor view to create a new student. So basically, when user clicks on the "Add Student" on the top bar, the editor view will open up and enables user to enter the information for a new student and there will be a "Save" button to save the student, Then the table viewer will show the updated data, and the editor view will close.<br/>
 
Here is what user can see by clicking on the "Add Student" button:<br/>
[[Image: RCPCommandAddRun.jpg | 700px]]<br/>
<br/>
Add the "AddStudent" command to the commands extension point the same way you added the Print command, and create its Handler class.<br/>
[[Image: RCPCommand13.jpg | 700px]]<br/>
<br/>
 
Add the command you just created to the menuContribution you have in the extension point (the same one you added Print command to). <br/>
[[Image: RCPCommand14.jpg | 700px]]<br/>
<br/>
[[Image: RCPCommand15.jpg | 700px]]<br/>
<br/>
[[Image: RCPCommand16.jpg | 700px]]<br/>
<br/>
==== "Exit" Command ====
1
edit

Navigation menu