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 04:16 Go to next message
Ralf Buschermoehle is currently offline Ralf Buschermoehle
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 09:34 Go to previous messageGo to next message
Ralf Buschermoehle is currently offline Ralf Buschermoehle
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 14:59 Go to previous message
Danny T. is currently offline Danny T.
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: Wed, 22 December 2010 20:06]

Report message to a moderator

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


Current Time: Fri Jul 25 12:12:42 EDT 2014

Powered by FUDForum. Page generated in 0.01543 seconds