org.eclipse.swt.browser.Browser.getUrl()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中org.eclipse.swt.browser.Browser.getUrl()方法的一些代码示例,展示了Browser.getUrl()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Browser.getUrl()方法的具体详情如下:
包路径:org.eclipse.swt.browser.Browser
类名称:Browser
方法名:getUrl

Browser.getUrl介绍

[英]Returns the current URL.
[中]返回当前URL。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

private void print() {
 String printURL = wBrowser.getUrl();
 if ( printURL.startsWith( PREFIX ) ) {
  printURL = printURL.replace( PREFIX, PRINT_PREFIX );
  fromPrint = true;
  wBrowser.setUrl( printURL );
 } else {
  wBrowser.execute( PRINT_SCRIPT );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void changed( LocationEvent event ) {
 Browser browser = (Browser) event.widget;
 if ( back != null ) {
  back.setDisabled( !browser.isBackEnabled() );
  forward.setDisabled( !browser.isForwardEnabled() );
  location.setValue( browser.getUrl() );
 }
}

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
public String
getUrl()
{
  return( browser.getUrl());
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.intro

/**
 * Override parent behavior to handle the case when we have a static page.
 * This can happen in both the static intro case, or in the dynamic when the
 * last visited page is the dynamic browser is an http: page, and not an
 * intro page.
 */
@Override
protected void saveCurrentPage(IMemento memento) {
  if (memento == null)
    return;
  // Handle the case where we are on a static page.
  // browser.getURL() returns the empty string if there is no current URL
  // and returns "about:blank" if we are on a dynamic page
  if (browser != null && browser.getUrl() != null
      && browser.getUrl().length() > 0
      && !(browser.getUrl().equals("about:blank")) //$NON-NLS-1$
      && !(browser.getUrl().equals("file:///"))) { //$NON-NLS-1$
    String currentURL = browser.getUrl();
    if (currentURL != null) {
      memento.putString(IIntroConstants.MEMENTO_CURRENT_PAGE_ATT,
        currentURL);
    }
  } else {
    super.saveCurrentPage(memento);
  }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07

static String getUrl( final Browser browser ) throws IOException {
 String text = getText( browser );
 String url = browser.getUrl();
 String result;
 if( !"".equals( text.trim() ) ) {
  result = registerHtml( text );
 } else if( !"".equals( url.trim() ) ) {
  result = url;
 } else {
  result = registerHtml( BLANK_HTML );
 }
 return result;
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

static String getUrl( Browser browser ) throws IOException {
 String text = getText( browser );
 String url = browser.getUrl();
 String result;
 if( !"".equals( text.trim() ) ) {
  result = registerHtml( text );
 } else if( !"".equals( url.trim() ) ) {
  result = url;
 } else {
  result = registerHtml( BLANK_HTML );
 }
 return result;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

/**
 * Disposes the "Example" widgets.
 */
@Override
void disposeExampleWidgets () {
  /* store the state of the Browser if applicable */
  if (browser != null) {
    String url = browser.getUrl();
    if (url.length() > 0 && !url.equals("about:blank")) { //$NON-NLS-1$
      lastUrl = url;
    } else {
      String text = browser.getText();
      if (text.length() > 0) {
        lastText = text;
      }
    }
  }
  super.disposeExampleWidgets();
}

代码示例来源:origin: openaudible/openaudible

private HtmlPage getHtmlPage() {
  try {
    
    String html = this.browser.browser.getText();
    final List<NameValuePair> responseHeaders = new ArrayList<>();
    String u = browser.browser.getUrl();
    URL url = new URL(u);
    WebRequest request = new WebRequest(url);
    WebResponseData webResponseData = new WebResponseData(html.getBytes(), 200, "OK", responseHeaders);
    WebResponse webResponse = new WebResponse(webResponseData, request, 0);
    WebWindow w = this.getCurrentWindow();
    HtmlPage p = HTMLParser.parseHtml(webResponse, w);
    p.initialize();
    // String title = p.getTitleText();
    if (u.toLowerCase().contains("audible"))
      lastPage = p;
    // logger.info("xml=" + p.asXml());
    return p;
  } catch (Throwable th) {
    th.printStackTrace();
  }
  return null;
}

代码示例来源:origin: BiglySoftware/BiglyBT

debug("browser.changing " + event.location + " from " + (browser == null ? "null" : browser.getUrl())
    + ";" + event.top);
String curURL = browser.getUrl().toLowerCase();

相关文章