Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to open a new tab in the same browser RAP is running in?
How to open a new tab in the same browser RAP is running in? [message #123887] Fri, 06 March 2009 19:14 Go to next message
Andreas Maier is currently offline Andreas Maier
Messages: 32
Registered: July 2009
Member
Hello,

my RAP application has some external links, which are opened each in a new
external browser window. Is it possible to open them in a separate tab of
the same browser instance where the RAP application is running in, instead?
(Of course the browser must support tabbed-browsing.) Here is my code:
int style = IWorkbenchBrowserSupport.AS_EXTERNAL |
IWorkbenchBrowserSupport.LOCATION_BAR |
IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.STATUS;

String browserId = String.valueOf(new Random().nextInt(10000));

PlatformUI.getWorkbench().getBrowserSupport()..createBrowser (style,
browserId , "", "").openURL(new URL("http://..."));

Generating a new browserId is required, as applying a constant browserId
just opens one new browser instance and each loaded URLlink gets replaced
there by the next one. But I want all URLs left open.
In HTML <a href="..." target="_blank"> does the job.


Thanks in advance,
Andreas
Re: How to open a new tab in the same browser RAP is running in? [message #123901 is a reply to message #123887] Mon, 09 March 2009 08:15 Go to previous messageGo to next message
Eclipse User
Originally posted by: bjoern.bjoernfischer.de

Hi Andreas,
I don't know for sure, but IMHO it is a browser option if a new web page
with target _blank is opened in a new window or in a new tab (Firefox at
least has this option). Could be that you can not force the browser to
choose the one or the other way of opening.

Regards,
Björn

Andreas Maier schrieb:
> Hello,
>
> my RAP application has some external links, which are opened each in a new
> external browser window. Is it possible to open them in a separate tab of
> the same browser instance where the RAP application is running in, instead?
> (Of course the browser must support tabbed-browsing.) Here is my code:
> int style = IWorkbenchBrowserSupport.AS_EXTERNAL |
> IWorkbenchBrowserSupport.LOCATION_BAR |
> IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.STATUS;
>
> String browserId = String.valueOf(new Random().nextInt(10000));
>
> PlatformUI.getWorkbench().getBrowserSupport()..createBrowser (style,
> browserId , "", "").openURL(new URL("http://..."));
>
> Generating a new browserId is required, as applying a constant browserId
> just opens one new browser instance and each loaded URLlink gets replaced
> there by the next one. But I want all URLs left open.
> In HTML <a href="..." target="_blank"> does the job.
>
>
> Thanks in advance,
> Andreas
>
>
Re: How to open a new tab in the same browser RAP is running in? [message #123913 is a reply to message #123887] Mon, 09 March 2009 08:25 Go to previous messageGo to next message
Stefan   is currently offline Stefan
Messages: 316
Registered: July 2009
Senior Member
Hi Andreas,

the RWT-specific class org.eclipse.rwt.widgets.ExternalBrowser does this
job.

Regards,
Stefan.

Andreas Maier schrieb:
> Hello,
>
> my RAP application has some external links, which are opened each in a new
> external browser window. Is it possible to open them in a separate tab of
> the same browser instance where the RAP application is running in, instead?
> (Of course the browser must support tabbed-browsing.) Here is my code:
> int style = IWorkbenchBrowserSupport.AS_EXTERNAL |
> IWorkbenchBrowserSupport.LOCATION_BAR |
> IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.STATUS;
>
> String browserId = String.valueOf(new Random().nextInt(10000));
>
> PlatformUI.getWorkbench().getBrowserSupport()..createBrowser (style,
> browserId , "", "").openURL(new URL("http://..."));
>
> Generating a new browserId is required, as applying a constant browserId
> just opens one new browser instance and each loaded URLlink gets replaced
> there by the next one. But I want all URLs left open.
> In HTML <a href="..." target="_blank"> does the job.
>
>
> Thanks in advance,
> Andreas
>
>
Re: How to open a new tab in the same browser RAP is running in? [message #123940 is a reply to message #123913] Mon, 09 March 2009 08:54 Go to previous messageGo to next message
rollo is currently offline rollo
Messages: 117
Registered: July 2009
Senior Member
And how I can open a new tab instead of a new window?

ExternalBrowser.open( "test", "http://www.eclipse.org",
ExternalBrowser.LOCATION_BAR | ExternalBrowser.NAVIGATION_BAR |
ExternalBrowser.STATUS );

This opens a new window.

Roland

Stefan Roeck schrieb:
> Hi Andreas,
>
> the RWT-specific class org.eclipse.rwt.widgets.ExternalBrowser does this
> job.
>
> Regards,
> Stefan.
Re: How to open a new tab in the same browser RAP is running in? [message #123966 is a reply to message #123940] Mon, 09 March 2009 09:33 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf Sternberg
Messages: 1290
Registered: July 2009
Senior Member

Hi Roland,

this problem is not RAP specific. The ExternalBrowser#open parameters
are passed to the Javascript function window.open. Instead of "test",
you could experiment with the id's "_blank", "_parent", etc. But it's
still up to the browser to decide whether to open up a new tab or a new
window. There are a many forum threads out there discussing this problem
- maybe you can find anything there.

Best regards,
Ralf


Roland Siebert wrote:
> And how I can open a new tab instead of a new window?
>
> ExternalBrowser.open( "test", "http://www.eclipse.org",
> ExternalBrowser.LOCATION_BAR | ExternalBrowser.NAVIGATION_BAR |
> ExternalBrowser.STATUS );
>
> This opens a new window.
>
> Roland
>
> Stefan Roeck schrieb:
>> Hi Andreas,
>>
>> the RWT-specific class org.eclipse.rwt.widgets.ExternalBrowser does
>> this job.
>>
>> Regards,
>> Stefan.
>
Re: How to open a new tab in the same browser RAP is running in? [message #123991 is a reply to message #123966] Mon, 09 March 2009 14:23 Go to previous messageGo to next message
rollo is currently offline rollo
Messages: 117
Registered: July 2009
Senior Member
Hi,

I found out that I need this code to open in a new tab:
org.eclipse.rwt.widgets.ExternalBrowser.open( "_blank",
"http://www.eclipse.org", "" );

But ExternalBrowser.open( "_blank", "http://www.eclipse.org", 0 );
generates this code:
org.eclipse.rwt.widgets.ExternalBrowser.open( "_0blank",
"http://www.eclipse.org",
" dependent=1,scrollbars=1,resizable=1,status=1,location=1,too lbar=1,menubar=1 "
);

The method static String escapeId( final String id ) does not accept
"_blank" and replace it with "_0blank".

And the method private static String getFeatures( final int style ) is
setting by default some features.

Can this be fixed?
Roland

Ralf Sternberg schrieb:
> Hi Roland,
>
> this problem is not RAP specific. The ExternalBrowser#open parameters
> are passed to the Javascript function window.open. Instead of "test",
> you could experiment with the id's "_blank", "_parent", etc. But it's
> still up to the browser to decide whether to open up a new tab or a new
> window. There are a many forum threads out there discussing this problem
> - maybe you can find anything there.
>
> Best regards,
> Ralf
>
>
> Roland Siebert wrote:
>> And how I can open a new tab instead of a new window?
>>
>> ExternalBrowser.open( "test", "http://www.eclipse.org",
>> ExternalBrowser.LOCATION_BAR | ExternalBrowser.NAVIGATION_BAR |
>> ExternalBrowser.STATUS );
>>
>> This opens a new window.
>>
>> Roland
>>
>> Stefan Roeck schrieb:
>>> Hi Andreas,
>>>
>>> the RWT-specific class org.eclipse.rwt.widgets.ExternalBrowser does
>>> this job.
>>>
>>> Regards,
>>> Stefan.
Re: How to open a new tab in the same browser RAP is running in? [message #124081 is a reply to message #123991] Mon, 09 March 2009 18:15 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf Sternberg
Messages: 1290
Registered: July 2009
Senior Member

Hi Roland,

thanks for pointing this out. Indeed, this escaping of periods seems to
be a problem with _xxx ids. Could you file a bug report for this issue?

Thank you,
Ralf

Roland Siebert wrote:
> Hi,
>
> I found out that I need this code to open in a new tab:
> org.eclipse.rwt.widgets.ExternalBrowser.open( "_blank",
> "http://www.eclipse.org", "" );
>
> But ExternalBrowser.open( "_blank", "http://www.eclipse.org", 0 );
> generates this code:
> org.eclipse.rwt.widgets.ExternalBrowser.open( "_0blank",
> "http://www.eclipse.org",
> " dependent=1,scrollbars=1,resizable=1,status=1,location=1,too lbar=1,menubar=1 "
> );
>
> The method static String escapeId( final String id ) does not accept
> "_blank" and replace it with "_0blank".
>
> And the method private static String getFeatures( final int style ) is
> setting by default some features.
>
> Can this be fixed?
> Roland
>
> Ralf Sternberg schrieb:
>> Hi Roland,
>>
>> this problem is not RAP specific. The ExternalBrowser#open parameters
>> are passed to the Javascript function window.open. Instead of "test",
>> you could experiment with the id's "_blank", "_parent", etc. But it's
>> still up to the browser to decide whether to open up a new tab or a new
>> window. There are a many forum threads out there discussing this problem
>> - maybe you can find anything there.
>>
>> Best regards,
>> Ralf
>>
>>
>> Roland Siebert wrote:
>>> And how I can open a new tab instead of a new window?
>>>
>>> ExternalBrowser.open( "test", "http://www.eclipse.org",
>>> ExternalBrowser.LOCATION_BAR | ExternalBrowser.NAVIGATION_BAR |
>>> ExternalBrowser.STATUS );
>>>
>>> This opens a new window.
>>>
>>> Roland
>>>
>>> Stefan Roeck schrieb:
>>>> Hi Andreas,
>>>>
>>>> the RWT-specific class org.eclipse.rwt.widgets.ExternalBrowser does
>>>> this job.
>>>>
>>>> Regards,
>>>> Stefan.
Re: How to open a new tab in the same browser RAP is running in? [message #124208 is a reply to message #124081] Tue, 10 March 2009 12:02 Go to previous messageGo to next message
rollo is currently offline rollo
Messages: 117
Registered: July 2009
Senior Member
Hi,
I filed a bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=267831

In the meantime I wrote my own ExternalBrowser.
Because of the different behavior of the browsers I want to find out
which browser is used. Can I do this with the RAP-API?

Roland
Re: How to open a new tab in the same browser RAP is running in? [message #124222 is a reply to message #124208] Tue, 10 March 2009 12:53 Go to previous messageGo to next message
rollo is currently offline rollo
Messages: 117
Registered: July 2009
Senior Member
I found it.
ContextProvider.getBrowser();

Roland

Roland Siebert schrieb:
> Hi,
> I filed a bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=267831
>
> In the meantime I wrote my own ExternalBrowser.
> Because of the different behavior of the browsers I want to find out
> which browser is used. Can I do this with the RAP-API?
>
> Roland
Re: How to open a new tab in the same browser RAP is running in? [message #999310 is a reply to message #124222] Fri, 11 January 2013 19:43 Go to previous message
Sergei Vasilyev is currently offline Sergei Vasilyev
Messages: 3
Registered: January 2013
Junior Member
Hi,

Posting to this outdated thread in a hope someone would still need a solution like me today...

ExternalBrowser (of RWT 1.5) does open a URL in a new window. But the code below opens it in a new tab (on my remote Firefox 18.0/Win32 XP at least):

JSExecutor.executeJS("window.open(\"" + url + "\");");

Regards,
Sergei
Previous Topic:e4 and RAP
Next Topic:Custom Theme Override
Goto Forum:
  


Current Time: Tue Sep 16 15:32:48 GMT 2014

Powered by FUDForum. Page generated in 0.06083 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software