java left logo
java middle logo
java right logo
 

Home arrow Other API Tips arrow Eclipse arrow How to add SWT Controls in StatusLine and ToolBar of Eclipse
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 4100
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
How to add SWT Controls in StatusLine and ToolBar of Eclipse E-mail
User Rating: / 30
PoorBest 

Sometimes you may need to add SWT Controls to the Statusline. SWT Controls like Text; label can be added to the StatusLine in the form of contribution item.

Following is the snapshot of the WorkBench Window with the StatusLine having SWT Controls.


Image

Structure of the StatusLine:

StatusLine of the Workbench have five parts:

  1. FastViews
  2. Icon/Message
  3. Progress
  4. Contributions
  5. Job progress

SWT Controls can be added in the Contribution part of the StatusLine.

These classes extend the org.eclipse.jface.action.ContributionItem class. It has fill(Composite parent) method, which is used for adding SWT Controls. These controls are added to parent Composite.

Example:

Following is the code of one Contribution class Item1 in which one Label, one Text and one Combo are added. This Contribution class is added to the contribution area of the StatusLine.

public class Item1 extends ContributionItem 

  public Item1(String id) {
    super(id);
  }

  public void fill(Composite parent) {

    Label label=new Label(parent,SWT.NONE);
    label.setText("LABEL");
    Text text=new Text(parent, SWT.BORDER);
    text.setText("TEXT");
    Combo combo=new Combo(parent,SWT.NONE);
    combo.setText("COMBO");
    
  }
}

This contribution item (item1) can be added to the StatusLine using the fillStatusLine() method of the ApplicationActionBarAdvisor:

protected void fillStatusLine(IStatusLineManager statusLine){

  statusLine.add(new IPDCContributionItem1("1"));
  statusLine.update(true);
  
}

 Related Tips

 
< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.