Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Add the Browse Button in BIRT CSV Data Source screen
pJune
I have created a custom oda data source driver and oda ui driver. I need to add a browse button to choose a file in the New Data Source Profile. I saw that for the implementation of xml data source they use org.eclipse.datatools.enablement.oda.xml.ui.wizards.XMLSelectionWizardPage as the page class for the newDataSourceWizard, and that is how we see the browse buttons.
I appreciate any help
Thanks in advanced
Find more posts tagged with
Comments
JasonW
The XML Data Source uses and SWT FileDialog box. Here is the code below:
private void setupXMLFolderLocation( Composite composite )
{
GridData data = new GridData( GridData.FILL_HORIZONTAL );
m_folderLocation = new Text( composite, SWT.BORDER );
m_folderLocation.setLayoutData( data );
browseFolderButton = new Button( composite, SWT.NONE );
browseFolderButton.setText( Messages.getString( "file.choose" ) ); //$NON-NLS-1$
browseFolderButton.addSelectionListener( new SelectionAdapter( ) {
/*
* (non-Javadoc)
*
*
@see
org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
public void widgetSelected( SelectionEvent e )
{
FileDialog dialog = new FileDialog( PlatformUI.getWorkbench( )
.getDisplay( ).getActiveShell( ), SWT.OPEN );
dialog.setFilterExtensions( new String[]{
"*.xml", "*.*"
} );
if ( m_folderLocation.getText( ) != null
&& m_folderLocation.getText( ).trim( ).length( ) > 0 )
{
dialog.setFilterPath( m_folderLocation.getText( ) );
}
String selectedLocation = dialog.open( );
if ( selectedLocation != null )
{
m_folderLocation.setText( selectedLocation );
}
}
} );
}
Jason
pJune
Thank you! Everything is working perfect.