Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Text on label gets truncated when control placed on toolbar along with toggle button
Text on label gets truncated when control placed on toolbar along with toggle button [message #504857] Wed, 23 December 2009 06:34 Go to next message
Prasanna K is currently offline Prasanna KFriend
Messages: 78
Registered: July 2009
Member
I have placed three commands on my view's toolbar.
Style property of one of them is set to toggle.
The toggle command is the first followed by the other two commands.

Now the situation demands that I add a label to the same toolbar.
Hence I added following to the plugin.xml before the definition of toggle command :

      <menuContribution locationURI="toolbar:myorg.plugin.bottomview">
      	<control
           id="myorg.plugin.control.label"
           class="myproduct.plugin.LabelMessageContributor">
        </control>
      </menuContribution>


Have used org.eclipse.ui.services so the text of the label gets updated dynamically. It does appear on the toolbar but it is truncated.

I tried to see if text of label appears fine first by removing all other commands and then by adding other commands one by one.
The text on label appears fine in all cases except when the toggle command is added.

I searched google for any solutions but found none.
Have I run into this :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=97522

I had raised another 'toggle-command related thread in this newsgroup which is located here :
http://www.eclipse.org/forums/index.php?t=rview&goto=496 827#msg_496827

I suspect if the two topics are related.
I'd appreciate if experts point me to a solution..

Thanks in advance.
Re: Text on label gets truncated when control placed on toolbar along with toggle button [message #504858 is a reply to message #504857] Wed, 23 December 2009 06:42 Go to previous message
Prasanna K is currently offline Prasanna KFriend
Messages: 78
Registered: July 2009
Member
I wanted to post my WorkbenchWindowControlContribution class in my original topic but missed it.
Here it goes :

public class LabelMessageContributor extends
                            WorkbenchWindowControlContribution {

    /**
     * ..Whatever..
     */
    @Override
    protected Control createControl(Composite parent) {       
        Label label = new Label(parent, SWT.None);
        label.setLayoutData(new GridData(GridData.BEGINNING,
                                            GridData.CENTER, true, true));
        label.setBounds(label.getBounds().x, label.getBounds().y,
                                            150, label.getBounds().height);       
        
        return label;
    }

    @Override
    protected int computeWidth(Control control) {
        return 250;		
    }
}
Previous Topic:Hide Common Navigator Content based on active Perspective
Next Topic:code review tool for all editors?
Goto Forum:
  


Current Time: Fri Apr 19 20:32:54 GMT 2024

Powered by FUDForum. Page generated in 0.03427 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top