Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Scout RAP external html
Scout RAP external html [message #1066292] Tue, 02 July 2013 02:30 Go to next message
Li Hao is currently offline Li HaoFriend
Messages: 28
Registered: August 2011
Junior Member
How do I add a external html link in the scout RAP app so that when user click on the link, it will open up another browser tab or windows to the external link?

I don't need to cap the external html page inside the RAP app, I just want to show up the external page without processing.
Re: Scout RAP external html [message #1066299 is a reply to message #1066292] Tue, 02 July 2013 05:12 Go to previous messageGo to next message
Stephan Leicht Vogt is currently offline Stephan Leicht VogtFriend
Messages: 104
Registered: July 2015
Senior Member
Hi

You can do this by calling the IShellService:

SERVICES.getService(IShellService.class).shellOpen("http://www.eclipse.org/");


This method opens Documents and URLs in the corresponding application or in your case, Scout RAP, it would download Files and open URLs in a new Tab/Window.

Greetings
Stephan
Re: Scout RAP external html [message #1066349 is a reply to message #1066299] Tue, 02 July 2013 09:15 Go to previous messageGo to next message
Li Hao is currently offline Li HaoFriend
Messages: 28
Registered: August 2011
Junior Member
Thanks. It works.

I notice it always open a new windows on IE/Firefox, is there any way to make it open in new tab?
Re: Scout RAP external html [message #1066354 is a reply to message #1066349] Tue, 02 July 2013 09:44 Go to previous messageGo to next message
Stephan Leicht Vogt is currently offline Stephan Leicht VogtFriend
Messages: 104
Registered: July 2015
Senior Member
That depends on the configuration of your firefox/ie. In firefox you can define to open a new Tab instead of a new window. Same in IE. See the screenshots for the options.
index.php/fa/15441/0/
index.php/fa/15442/0/
Greetings
Stephan
  • Attachment: Firefox.png
    (Size: 43.08KB, Downloaded 602 times)
  • Attachment: IE.png
    (Size: 131.26KB, Downloaded 573 times)
Re: Scout RAP external html [message #1066368 is a reply to message #1066354] Tue, 02 July 2013 11:10 Go to previous messageGo to next message
Li Hao is currently offline Li HaoFriend
Messages: 28
Registered: August 2011
Junior Member
I have both setting for IE and firefox, both still open in new window. Firefox 21 and IE 10.
Re: Scout RAP external html [message #1066371 is a reply to message #1066368] Tue, 02 July 2013 11:30 Go to previous messageGo to next message
Stephan Leicht Vogt is currently offline Stephan Leicht VogtFriend
Messages: 104
Registered: July 2015
Senior Member
You're right. I just checked the code and it opens as default a new window for http-links. But you can overwrite this in your RwtEnvironment:
public class WebStandaloneRwtEnvironment extends AbstractStandaloneRwtEnvironment {

  public WebStandaloneRwtEnvironment() {
    super(Activator.getDefault().getBundle(), ClientSession.class);
  }

  protected BrowserWindowHandler createBrowserWindowHandler() {
    return new TabbedBrowserWindowHandler();
  }
}

@SuppressWarnings("restriction")
public class TabbedBrowserWindowHandler extends BrowserWindowHandler {
  private static IScoutLogger LOG = ScoutLogManager.getLogger(TabbedBrowserWindowHandler.class);

  @Override
  public void openLink(String link) {
    if (link == null) {
      return;
    }
    if (isHttpLink(link)) {
      openLinkInNewBrowserTab(link);
    }
    else {
      super.openLink(link);
    }
  }

  public void openLinkInNewBrowserTab(String link) {
    if (!isHttpLink(link)) {
      return;
    }

    // Code from http://www.eclipse.org/forums/index.php/mv/msg/38108/999310/#msg_999310
    JSExecutor.executeJS("window.open('" + link + "');");
  }
}


Hope that helps. Smile

Greetings
Stephan
Re: Scout RAP external html [message #1066543 is a reply to message #1066371] Wed, 03 July 2013 05:51 Go to previous messageGo to next message
Li Hao is currently offline Li HaoFriend
Messages: 28
Registered: August 2011
Junior Member
The code work for firefox 21.0, but IE 10 still open in new window
Re: Scout RAP external html [message #1066612 is a reply to message #1066543] Wed, 03 July 2013 12:38 Go to previous messageGo to next message
Stephan Leicht Vogt is currently offline Stephan Leicht VogtFriend
Messages: 104
Registered: July 2015
Senior Member
As I copied the javascript code from the RAP Forum (http://www.eclipse.org/forums/index.php/mv/msg/38108/999310/#msg_999310) I would try to find or get an answer there. I'm sorry that I can't help you further.
Re: Scout RAP external html [message #1066717 is a reply to message #1066612] Thu, 04 July 2013 03:11 Go to previous message
Li Hao is currently offline Li HaoFriend
Messages: 28
Registered: August 2011
Junior Member
Thanks. I think should be ok at this moment, I will try to find out more javascript myself.
Previous Topic:Forcing a scout client to use a specific language
Next Topic:Multi Tenancy
Goto Forum:
  


Current Time: Tue Apr 16 09:41:05 GMT 2024

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

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

Back to the top