if ( fmtStr == null || fmtStr == "" ) { fmtStr = Messages.getString( "FormatStringPreferencePage.previewLabel.invalidFormatCode" ); } cPreviewLabel.setText( fmtStr ); setPatternStr( pattern );
cPreviewLabel.setText( validatedFmtStr( fmtStr ) ); setPattern( pattern );
	private void updatePreview( )	{		String pattern = ""; //$NON-NLS-1$		String fmtStr = ""; //$NON-NLS-1$		Locale locale = Locale.getDefault( );		String gText = getPreviewText( ) == null ? DEFAULT_PREVIEW_TEXT				: getPreviewText( );		String displayName = typeChoicer.getText( );		String category = getCategoryForDisplayName( displayName );		setCategory( category );		if ( DesignChoiceConstants.STRING_FORMAT_TYPE_UNFORMATTED.equals( category ) )		{			pattern = getPatternForCategory( category );			generalPreviewLabel.setText( gText );			setPatternStr( pattern );			return;		}		else if ( DesignChoiceConstants.STRING_FORMAT_TYPE_UPPERCASE.equals( category ) )		{			pattern = getPatternForCategory( category );			fmtStr = new StringFormatter( pattern, locale ).format( gText );			generalPreviewLabel.setText( fmtStr );			setPatternStr( pattern );			return;		}		else if ( DesignChoiceConstants.STRING_FORMAT_TYPE_LOWERCASE.equals( category ) )		{			pattern = getPatternForCategory( category );			fmtStr = new StringFormatter( pattern, locale ).format( gText );			generalPreviewLabel.setText( fmtStr );			setPatternStr( pattern );			return;		}		else if ( DesignChoiceConstants.STRING_FORMAT_TYPE_ZIP_CODE.equals( category ) )		{			pattern = getPatternForCategory( category );			gText = Messages.getString( "FormatStringPreferencePage.zipCode.previewText" ); //$NON-NLS-1$			fmtStr = new StringFormatter( pattern, locale ).format( gText );			generalPreviewLabel.setText( fmtStr );			setPatternStr( pattern );			return;		}		else if ( DesignChoiceConstants.STRING_FORMAT_TYPE_ZIP_CODE_4.equals( category ) )		{			pattern = getPatternForCategory( category );			gText = Messages.getString( "FormatStringPreferencePage.zipCode+4.previewText" ); //$NON-NLS-1$			fmtStr = new StringFormatter( pattern, locale ).format( gText );			generalPreviewLabel.setText( fmtStr );			setPatternStr( pattern );			return;		}		else if ( DesignChoiceConstants.STRING_FORMAT_TYPE_PHONE_NUMBER.equals( category ) )		{			pattern = getPatternForCategory( category );			gText = Messages.getString( "FormatStringPreferencePage.phoneNumber.previewText" ); //$NON-NLS-1$			fmtStr = new StringFormatter( pattern, locale ).format( gText );			generalPreviewLabel.setText( fmtStr );			setPatternStr( pattern );			return;		}		else if ( DesignChoiceConstants.STRING_FORMAT_TYPE_SOCIAL_SECURITY_NUMBER.equals( category ) )		{			pattern = getPatternForCategory( category );			gText = Messages.getString( "FormatStringPreferencePage.socialSecurityNum.previewText" ); //$NON-NLS-1$			fmtStr = new StringFormatter( pattern, locale ).format( gText );			generalPreviewLabel.setText( fmtStr );			setPatternStr( pattern );			return;		}		else if ( DesignChoiceConstants.STRING_FORMAT_TYPE_CUSTOM.equals( category ) )		{			pattern = formatCode.getText( );			if ( StringUtil.isBlank( previewTextBox.getText( ) ) )			{				fmtStr = new StringFormatter( pattern, locale ).format( gText );			}			else			{				fmtStr = new StringFormatter( pattern, locale ).format( previewTextBox.getText( ) );			}			if ( fmtStr == null || fmtStr == "" ) //$NON-NLS-1$			{				fmtStr = Messages.getString( "FormatStringPreferencePage.previewLabel.invalidFormatCode" ); //$NON-NLS-1$			}			cPreviewLabel.setText( fmtStr );			setPatternStr( pattern );			return;		}	}