| HowTo avoid minimal size of text in ControlContribution in Local Toolbar? [message #336941] | 
Wed, 15 July 2009 04:16   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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] by Moderator  
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.04100 seconds