Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » HowTo avoid minimal size of text in ControlContribution in Local Toolbar?
HowTo avoid minimal size of text in ControlContribution in Local Toolbar? [message #336941] Wed, 15 July 2009 08:16 Go to next message
Ralf Buschermoehle is currently offline Ralf BuschermoehleFriend
Messages: 81
Registered: July 2009
Member
Hello,

I would like to have a resizable textfield in a toolbar.

public class SearchAndExecuteField extends ControlContribution {

protected SearchAndExecuteField(String id) {
super(id);
}

@Override
protected Control createControl(Composite parent) {
nsURIField = new Text(parent, SWT.SINGLE | SWT.BORDER);
nsURIField.setText("<search, execute>");
GridData gridData = new GridData(GridData.FILL_HORIZONTAL,
GridData.FILL_VERTICAL, true, true);
nsURIField.setLayoutData(gridData);
return nsURIField;
}
}

Positioned with:

private void fillLocalToolBar(IToolBarManager manager) {
manager.add(new SearchAndExecuteField("<search, execute>"));

Unfortunately the textfield has the minimal possible size ... ?

Any hints how to stretch the textfield?

Greetings,

Ralf
Re: HowTo avoid minimal size of text in ControlContribution in Local Toolbar? [message #336961 is a reply to message #336941] Thu, 16 July 2009 13:34 Go to previous messageGo to next message
Ralf Buschermoehle is currently offline Ralf BuschermoehleFriend
Messages: 81
Registered: July 2009
Member
Hello,

the "problem" is that I don't create a new ToolBar / ToolBarManager but
try to use the existing one ->

IActionBars bars = getViewSite().getActionBars(); IToolBarManager
toolBarManager = bars.getToolBarManager();

Is is possible (re-)configure the ToolBar of toolBarManager?

Greetings,

Ralf

Ralf Buschermoehle wrote:
> Hello,
>
> I would like to have a resizable textfield in a toolbar.
>
> public class SearchAndExecuteField extends ControlContribution {
>
> protected SearchAndExecuteField(String id) {
> super(id);
> }
>
> @Override
> protected Control createControl(Composite parent) {
> nsURIField = new Text(parent, SWT.SINGLE | SWT.BORDER);
> nsURIField.setText("<search, execute>");
> GridData gridData = new GridData(GridData.FILL_HORIZONTAL,
> GridData.FILL_VERTICAL, true, true);
> nsURIField.setLayoutData(gridData);
> return nsURIField;
> }
> }
>
> Positioned with:
>
> private void fillLocalToolBar(IToolBarManager manager) {
> manager.add(new SearchAndExecuteField("<search, execute>"));
>
> Unfortunately the textfield has the minimal possible size ... ?
>
> Any hints how to stretch the textfield?
>
> Greetings,
>
> Ralf
Re: HowTo avoid minimal size of text in ControlContribution in Local Toolbar? [message #646070 is a reply to message #336941] Tue, 21 December 2010 19:59 Go to previous message
Danny T. is currently offline Danny T.Friend
Messages: 1
Registered: December 2010
Junior Member
Hi,

did you solved this?
Because I have the same issue...

Best regards,
Danny.

EDIT: I just found this way - but it's not dynamically filled:
public class SearchAndExecuteField extends ControlContribution {

protected SearchAndExecuteField(String id) {
super(id);
}

@Override
protected Control createControl(Composite parent) {
nsURIField = new Text(parent, SWT.SINGLE | SWT.BORDER);
nsURIField.setText("<search, execute>");
return nsURIField;
}

@Override
protected int computeWidth(Control control) {
  return 200;
}

}

[Updated on: Thu, 23 December 2010 01:06]

Report message to a moderator

Previous Topic:Video playback support?
Next Topic:PropertySheet clears when maximized
Goto Forum:
  


Current Time: Fri Apr 26 11:58:53 GMT 2024

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

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

Back to the top