Difference between revisions of "Teams Winter 2011/team1/RCP/Define and use JFace"

From CDOT Wiki
Jump to: navigation, search
Line 11: Line 11:
 
  </pre>
 
  </pre>
 
1.3 Run the application you should see the following:<br/>
 
1.3 Run the application you should see the following:<br/>
[[Image: StatusLine.png | 500px]]
+
[[Image: StatusLine.png | 400px]]<br/>
 +
1.4 Change the status line from <code>StudentsView.java</code>. Add the following method to this class:<br/>
 +
<pre>
 +
  private void setStatusLine(String message) {
 +
        // Get the status line and set the text
 +
        IActionBars bars = getViewSite().getActionBars();
 +
        bars.getStatusLineManager().setMessage(message);
 +
    }
 +
</pre>
 +
Use this method to change text in status line. In the <code>createColumn()</code> method insert the following line at the end of column's <code>update()</code> method:</br>
 +
<code>setStatusLine("Student search has been updated");</code>

Revision as of 11:55, 4 March 2011

1. Adding status line

1.1 Open ApplicationWorkbenchWindowAdvisor.java file in your project and add the following line at the end of preWindowOpen() method:

configurer.setShowStatusLine(true); 

1.2 Add a new method to this class to set text in status line from different parts of application:

  
   @Override
   public void postWindowOpen() {
      IStatusLineManager statusline = getWindowConfigurer().getActionBarConfigurer().getStatusLineManager();
      statusline.setMessage(null, "Status line is ready");
   }
 

1.3 Run the application you should see the following:
StatusLine.png
1.4 Change the status line from StudentsView.java. Add the following method to this class:

   private void setStatusLine(String message) {
        // Get the status line and set the text
        IActionBars bars = getViewSite().getActionBars();
        bars.getStatusLineManager().setMessage(message);
    }
 

Use this method to change text in status line. In the createColumn() method insert the following line at the end of column's update() method:</br>

setStatusLine("Student search has been updated");