Java Code Examples for org.eclipse.swt.widgets.Text#getShell()

The following examples show how to use org.eclipse.swt.widgets.Text#getShell() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: birt   File: RotatedTextBuilder.java    License: Eclipse Public License 1.0 6 votes vote down vote up
private void openExpression( Text textControl )
{
	String oldValue = textControl.getText( );

	ExpressionBuilder eb = new ExpressionBuilder( textControl.getShell( ),
			oldValue );
	eb.setExpressionProvier( new ExpressionProvider( textItem.getModelHandle( ) ) );

	String result = oldValue;

	if ( eb.open( ) == Window.OK )
	{
		result = eb.getResult( );
	}

	if ( !oldValue.equals( result ) )
	{
		textControl.setText( result );
	}
}
 
Example 2
protected void handleFileBrowseButtonPressed(Text text, String[] extensions, String title) {
	FileDialog dialog= new FileDialog(text.getShell());
	dialog.setText(title);
	dialog.setFilterExtensions(extensions);
	String dirName= text.getText();
	if (!dirName.equals("")) { //$NON-NLS-1$
		File path= new File(dirName);
		if (path.exists())
			dialog.setFilterPath(dirName);

	}
	String selectedDirectory= dialog.open();
	if (selectedDirectory != null)
		text.setText(selectedDirectory);
}
 
Example 3
private void openExpression( Text textControl )
{
	RotatedTextItem item = getItem( );

	if ( item != null )
	{
		String oldValue = textControl.getText( );

		ExpressionBuilder eb = new ExpressionBuilder( textControl.getShell( ),
				oldValue );
		eb.setExpressionProvier( new ExpressionProvider( item.getModelHandle( ) ) );

		String result = oldValue;

		if ( eb.open( ) == Window.OK )
		{
			result = eb.getResult( );
		}

		if ( !oldValue.equals( result ) )
		{
			textControl.setText( result );

			updateModel( RotatedTextItem.TEXT_PROP );
		}
	}
}
 
Example 4
Source Project: goclipse   File: ControlUtils.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public static void openStringVariableSelectionDialog_ForText(Text text) {
	Shell shell = text.getShell();
	try {
		String variable = openStringVariableSelectionDialog(shell);
		text.insert(variable);
	} catch(OperationCancellation e) {
		return;
	}
}
 
Example 5
public RelativeFileFieldSetter(Text fileField, IPath basePath, String[] filterExtensions) {
  this(fileField, basePath, filterExtensions, new FileDialog(fileField.getShell(), SWT.SHEET));
}
 
Example 6
public FileFieldSetter(Text fileField, String[] filterExtensions) {
  this(fileField, filterExtensions, new FileDialog(fileField.getShell(), SWT.SHEET));
}