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

The following examples show how to use org.eclipse.swt.widgets.Text#getShell() . 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 check out the related API usage on the sidebar.
Example 1
Source File: RotatedTextBuilder.java    From birt with 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
Source File: JavadocWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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
Source File: RotatedTextGeneralPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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 File: ControlUtils.java    From goclipse with 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
Source File: RelativeFileFieldSetter.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
public RelativeFileFieldSetter(Text fileField, IPath basePath, String[] filterExtensions) {
  this(fileField, basePath, filterExtensions, new FileDialog(fileField.getShell(), SWT.SHEET));
}
 
Example 6
Source File: FileFieldSetter.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
public FileFieldSetter(Text fileField, String[] filterExtensions) {
  this(fileField, filterExtensions, new FileDialog(fileField.getShell(), SWT.SHEET));
}