Java Code Examples for org.eclipse.swt.browser.Browser#setUrl()

The following examples show how to use org.eclipse.swt.browser.Browser#setUrl() . 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: ODDBView.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void createPartControl(Composite parent){
	browser = new Browser(parent, SWT.NONE);
	browser.addLocationListener(new LocationAdapter() {
		
		@Override
		public void changed(LocationEvent arg0){
			String text = getText(arg0.location);
			System.out.println(text);
		}
		
	});
	// browser.setUrl("http://ch.oddb.org");
	browser.setUrl("http://santesuisse.oddb.org/");
	
}
 
Example 2
Source File: HtmlBrowserEditor.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
	GridLayoutFactory.fillDefaults().numColumns(1).applyTo(parent);
	parent.setLayoutData(new GridData(GridData.FILL_BOTH));
	cmp = new Composite(parent, SWT.BORDER);
	GridLayoutFactory.fillDefaults().numColumns(1).applyTo(cmp);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(cmp);
	
	browser = new Browser(cmp, SWT.NONE);
	browser.setLayoutData(new GridData(GridData.FILL_BOTH));
	browser.setUrl(htmlUrl);

	browser.addMouseListener(new MouseAdapter() {
		@Override
		public void mouseDown(MouseEvent e) {
			getSite().getPart().setFocus();
			super.mouseDown(e);
		}
	});
}
 
Example 3
Source File: WebViewer.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Displays the specified url using eclipse SWT browser.
 * 
 * @param report
 *            report report
 * @param format
 *            report format
 * @param browser
 *            SWT browser instance
 * @param servletName
 *            servlet name to viewer report
 * @deprecated
 */
public static void display( String report, String format, Browser browser,
		String servletName )
{
	checkAdapter( );

	startWebApp( DEFAULT_WEBAPP.getName( ), report );
	browser.setUrl( createURL( DEFAULT_WEBAPP.getName( ),
			servletName,
			report,
			format,
			null,
			null,
			null,
			null ) + "&" + random.nextInt( ) ); //$NON-NLS-1$
}
 
Example 4
Source File: ElexisEnvironmentLoginDialog.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Create contents of the dialog.
 * 
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent){
	browser = new Browser(parent, SWT.NONE);
	browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	browser.setUrl(oauthService.getAuthorizationUrl());
	browser.addLocationListener(new LocationAdapter() {
		@Override
		public void changing(LocationEvent event){
			if (event.location.contains("localhost:11223/elexis-rcp-callback")) {
				// catch the callback, we're not using a local http server for this
				browser.setText("<HTML>Logging in ...</HTML>");
				parseCallback(event.location);
				event.doit = false;
			}
			super.changing(event);
		}
		
	});
	
	return parent;
}
 
Example 5
Source File: WebViewer.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public static void display( String webappName, String report,
		Browser browser, Map params )
{
	startWebApp( webappName, report );
	browser.setUrl( createURL( webappName, report, params )
			+ "&" + random.nextInt( ) ); //$NON-NLS-1$
}
 
Example 6
Source File: HtmlDialog.java    From MergeProcessor with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Control createDialogArea(Composite parent) {
	final Composite parent2 = (Composite) super.createDialogArea(parent);
	parent2.setLayout(new FillLayout());
	final Browser browser = new Browser(parent2, SWT.NONE);
	browser.setUrl(url);
	return parent2;
}
 
Example 7
Source File: KompendiumView.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createPartControl(Composite parent){
	browser = new Browser(parent, SWT.NONE);
	browser.addLocationListener(new LocationAdapter() {
		
		@Override
		public void changed(LocationEvent arg0){
			String text = browser.getText();
			// System.out.println(text);
		}
		
	});
	browser.setUrl("http://www.compendium.ch/search/de"); //$NON-NLS-1$
	
}
 
Example 8
Source File: BookstackPart.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create contents of the view part.
 */
@PostConstruct
public void createControls(Composite parent){
	browser = new Browser(parent, SWT.NONE);
	if (elexisEnvironmentService == null) {
		browser.setText("Elexis-Environment nicht konfiguriert");
	} else {
		//		browser.setCookie(value, url)
		// login cookies?!
		browser.setUrl(elexisEnvironmentService.getBookstackBaseUrl());
	}
}
 
Example 9
Source File: BrowserInputDialog.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent){
	Composite ret = (Composite) super.createDialogArea(parent);
	Browser browser = new Browser(ret, SWT.NONE);
	browser.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
	browser.setUrl(url);
	Label lbtext = new Label(ret, SWT.NONE);
	lbtext.setText(text);
	input = new Text(ret, SWT.BORDER);
	input.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	return ret;
}
 
Example 10
Source File: CreateXMPPAccountWizardPage.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void performHelp() {
  Shell shell = new Shell(getShell());
  shell.setText("Saros XMPP Accounts");
  shell.setLayout(new GridLayout());
  shell.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

  Browser browser = new Browser(shell, SWT.NONE);
  browser.setUrl("https://www.saros-project.org/documentation/setup-xmpp.html");
  browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

  shell.open();
}
 
Example 11
Source File: LogFileEditor.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = mform.getForm();
	FormToolkit toolkit = mform.getToolkit();
	UI.formHeader(mform, M.OpenLCALog);
	Composite body = UI.formBody(form, toolkit);
	Browser browser = new Browser(body, SWT.NONE);
	UI.gridData(browser, true, true);
	try {
		browser.setUrl(file.toURI().toURL().toString());
	} catch (IOException e) {
		log.error("Error loading log files", e);
	}
}
 
Example 12
Source File: Regression_145144_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public static void main( String args[] )
{
	display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setLocation( display.getClientArea( ).width / 2 - 110, display
			.getClientArea( ).height / 2 - 40 );
	shell.setSize( 620, 450 );
	shell.setLayout( new GridLayout( ) );

	Regression_117865_svg siv = new Regression_117865_svg( shell, SWT.NONE );
	GridData gd = new GridData( GridData.BEGINNING );
	gd.widthHint = 1;
	gd.heightHint = 1;
	siv.setLayoutData( gd );

	try
	{
		RunTimeContext rtc = new RunTimeContext( );
		rtc.setULocale( ULocale.getDefault( ) );

		IDeviceRenderer idr = null;
		Chart cm = highlight_BarChart( );

		idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
		Generator gr = Generator.instance( );
		GeneratedChartState gcs = null;
		Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
		gcs = gr.build( idr.getDisplayServer( ), cm, bo, null, rtc, null );

		idr.setProperty( IDeviceRenderer.FILE_IDENTIFIER, "c:/test.svg" ); //$NON-NLS-1$
		idr.setProperty(
				IDeviceRenderer.UPDATE_NOTIFIER,
				new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

		gr.render( idr, gcs );
	}

	catch ( ChartException ce )
	{
		ce.printStackTrace( );
	}

	Browser br = new Browser( shell, SWT.NONE );
	br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
	br.setVisible( true );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 13
Source File: Regression_117865_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public static void main( String args[] )
{
	display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setLocation( display.getClientArea( ).width / 2 - 110, display
			.getClientArea( ).height / 2 - 40 );
	shell.setSize( 620, 450 );
	shell.setLayout( new GridLayout( ) );

	Regression_117865_svg siv = new Regression_117865_svg( shell, SWT.NONE );
	GridData gd = new GridData( GridData.BEGINNING );
	gd.widthHint = 1;
	gd.heightHint = 1;
	siv.setLayoutData( gd );

	try
	{
		RunTimeContext rtc = new RunTimeContext( );
		rtc.setULocale( ULocale.getDefault( ) );

		IDeviceRenderer idr = null;
		Chart cm = toggleVisibility_PieChart( );

		idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
		Generator gr = Generator.instance( );
		GeneratedChartState gcs = null;
		Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
		gcs = gr.build( idr.getDisplayServer( ), cm, bo, null, rtc, null );

		idr.setProperty( IDeviceRenderer.FILE_IDENTIFIER, "c:/test.svg" ); //$NON-NLS-1$
		idr.setProperty(
				IDeviceRenderer.UPDATE_NOTIFIER,
				new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

		gr.render( idr, gcs );
	}

	catch ( ChartException ce )
	{
		ce.printStackTrace( );
	}

	Browser br = new Browser( shell, SWT.NONE );
	br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
	br.setVisible( true );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 14
Source File: Regression_131260_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void widgetSelected( SelectionEvent e )
{
	if ( e.widget == btn )
	{
		int i = cbType.getSelectionIndex( );
		switch ( i )
		{
			case 0 :
				cm = showTooltip_BarChart( );
				break;
		}

		try
		{

			RunTimeContext rtc = new RunTimeContext( );
			rtc.setULocale( ULocale.getDefault( ) );

			idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
			Generator gr = Generator.instance( );
			GeneratedChartState gcs = null;
			Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
			gcs = gr.build(
					idr.getDisplayServer( ),
					cm,
					bo,
					null,
					rtc,
					null );

			idr
					.setProperty(
							IDeviceRenderer.FILE_IDENTIFIER,
							"c:/test.svg" ); //$NON-NLS-1$
			idr.setProperty(
					IDeviceRenderer.UPDATE_NOTIFIER,
					new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

			gr.render( idr, gcs );
		}
		catch ( ChartException ce )
		{
			ce.printStackTrace( );
		}

		Shell shell = new Shell( display );
		shell.setSize( 620, 450 );
		shell.setLayout( new GridLayout( ) );

		Browser br = new Browser( shell, SWT.NONE );
		br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
		br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
		br.setVisible( true );

		shell.open( );
	}
}
 
Example 15
Source File: Regression_132620_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public static void main( String args[] )
{
	display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setLocation( display.getClientArea( ).width / 2 - 110, display
			.getClientArea( ).height / 2 - 40 );
	shell.setSize( 620, 450 );
	shell.setLayout( new GridLayout( ) );

	Regression_132620_svg siv = new Regression_132620_svg( shell, SWT.NONE );
	GridData gd = new GridData( GridData.BEGINNING );
	gd.widthHint = 1;
	gd.heightHint = 1;
	siv.setLayoutData( gd );

	try
	{
		RunTimeContext rtc = new RunTimeContext( );
		rtc.setULocale( ULocale.getDefault( ) );

		IDeviceRenderer idr = null;
		Chart cm = toggleVisibility_BarChart( );

		idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
		Generator gr = Generator.instance( );
		GeneratedChartState gcs = null;
		Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
		gcs = gr.build( idr.getDisplayServer( ), cm, bo, null, rtc, null );

		idr.setProperty( IDeviceRenderer.FILE_IDENTIFIER, "c:/test.svg" ); //$NON-NLS-1$
		idr.setProperty(
				IDeviceRenderer.UPDATE_NOTIFIER,
				new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

		gr.render( idr, gcs );
	}

	catch ( ChartException ce )
	{
		ce.printStackTrace( );
	}

	Browser br = new Browser( shell, SWT.NONE );
	br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
	br.setVisible( true );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 16
Source File: Regression_136069_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void widgetSelected( SelectionEvent e )
{
	if ( e.widget == btn )
	{
		int i = cbType.getSelectionIndex( );
		switch ( i )
		{
			case 0 :
				cm = BarChart( );
				break;
		}

		try
		{

			RunTimeContext rtc = new RunTimeContext( );
			rtc.setULocale( ULocale.getDefault( ) );

			idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
			Generator gr = Generator.instance( );
			GeneratedChartState gcs = null;
			Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
			gcs = gr.build(
					idr.getDisplayServer( ),
					cm,
					bo,
					null,
					rtc,
					null );

			idr
					.setProperty(
							IDeviceRenderer.FILE_IDENTIFIER,
							"c:/test.svg" ); //$NON-NLS-1$
			idr.setProperty(
					IDeviceRenderer.UPDATE_NOTIFIER,
					new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

			gr.render( idr, gcs );
		}
		catch ( ChartException ce )
		{
			ce.printStackTrace( );
		}

		Shell shell = new Shell( display );
		shell.setSize( 620, 450 );
		shell.setLayout( new GridLayout( ) );

		Browser br = new Browser( shell, SWT.NONE );
		br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
		br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
		br.setVisible( true );

		shell.open( );
	}
}
 
Example 17
Source File: Regression_145712_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public static void main( String args[] )
{
	display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setLocation( display.getClientArea( ).width / 2 - 110, display
			.getClientArea( ).height / 2 - 40 );
	shell.setSize( 620, 450 );
	shell.setLayout( new GridLayout( ) );

	Regression_117865_svg siv = new Regression_117865_svg( shell, SWT.NONE );
	GridData gd = new GridData( GridData.BEGINNING );
	gd.widthHint = 1;
	gd.heightHint = 1;
	siv.setLayoutData( gd );

	try
	{
		RunTimeContext rtc = new RunTimeContext( );
		rtc.setULocale( ULocale.getDefault( ) );

		IDeviceRenderer idr = null;
		Chart cm = showTooltip_AreaChart( );

		idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
		Generator gr = Generator.instance( );
		GeneratedChartState gcs = null;
		Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
		gcs = gr.build( idr.getDisplayServer( ), cm, bo, null, rtc, null );

		idr.setProperty( IDeviceRenderer.FILE_IDENTIFIER, "c:/test.svg" ); //$NON-NLS-1$
		idr.setProperty(
				IDeviceRenderer.UPDATE_NOTIFIER,
				new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

		gr.render( idr, gcs );
	}

	catch ( ChartException ce )
	{
		ce.printStackTrace( );
	}

	Browser br = new Browser( shell, SWT.NONE );
	br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
	br.setVisible( true );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 18
Source File: Regression_128590_svg.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public static void main( String args[] )
{
	display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setLocation( display.getClientArea( ).width / 2 - 110, display
			.getClientArea( ).height / 2 - 40 );
	shell.setSize( 620, 450 );
	shell.setLayout( new GridLayout( ) );

	Regression_128590_svg siv = new Regression_128590_svg( shell, SWT.NONE );
	GridData gd = new GridData( GridData.BEGINNING );
	gd.widthHint = 1;
	gd.heightHint = 1;
	siv.setLayoutData( gd );

	try
	{
		RunTimeContext rtc = new RunTimeContext( );
		rtc.setULocale( ULocale.getDefault( ) );

		IDeviceRenderer idr = null;
		Chart cm = showTooltip_BarChart( );

		idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
		Generator gr = Generator.instance( );
		GeneratedChartState gcs = null;
		Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
		gcs = gr.build( idr.getDisplayServer( ), cm, bo, null, rtc, null );

		idr.setProperty( IDeviceRenderer.FILE_IDENTIFIER, "c:/test.svg" ); //$NON-NLS-1$
		idr.setProperty(
				IDeviceRenderer.UPDATE_NOTIFIER,
				new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

		gr.render( idr, gcs );
	}
	catch ( ChartException ce )
	{
		ce.printStackTrace( );
	}

	Browser br = new Browser( shell, SWT.NONE );
	br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
	br.setVisible( true );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 19
Source File: SvgInteractivityViewer.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void widgetSelected( SelectionEvent e )
{
	if ( e.widget == btn )
	{
		int i = cbType.getSelectionIndex( );
		switch ( i )
		{
			case 0 :
				cm = InteractivityCharts.createSVGHSChart( );
				break;
			case 1 :
				cm = InteractivityCharts.createSTChart( );
				break;
			case 2 :
				cm = InteractivityCharts.createTVChart( );
				break;
			case 3 :
				cm = InteractivityCharts.createURChart( );
				break;
		}
		
		try
		{
			
			RunTimeContext rtc = new RunTimeContext( );
			rtc.setULocale( ULocale.getDefault( ) );

			idr = PluginSettings.instance( ).getDevice( "dv.SVG" ); //$NON-NLS-1$
			Generator gr = Generator.instance( );
			Bounds bo = BoundsImpl.create( 0, 0, 450, 300 );
			gcs = gr.build( idr.getDisplayServer( ),
					cm,
					bo,
					null,
					rtc,
					null );
			
			idr.setProperty( IDeviceRenderer.FILE_IDENTIFIER, "c:/test.svg" ); //$NON-NLS-1$
			idr.setProperty( IDeviceRenderer.UPDATE_NOTIFIER,
					new EmptyUpdateNotifier( cm, gcs.getChartModel( ) ) );

			gr.render( idr, gcs );
		}
		catch ( ChartException ce )
		{
			ce.printStackTrace( );
		}

		Shell shell = new Shell( display );
		shell.setSize( 620, 450 );
		shell.setLayout( new GridLayout( ) );

		Browser br = new Browser( shell, SWT.NONE );
		br.setLayoutData( new GridData( GridData.FILL_BOTH ) );
		br.setUrl( "c:/test.svg" );//$NON-NLS-1$		
		br.setVisible( true );

		shell.open( );
	}
}
 
Example 20
Source File: TestabilityReportView.java    From testability-explorer with Apache License 2.0 4 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
  browser = new Browser(parent, SWT.NONE);
  browser.setUrl(url);
}