Java 类org.eclipse.swt.browser.LocationEvent 实例源码

项目:mytourbook    文件:SearchView.java   
private void createUI_10_SearchInternal(final Composite parent) {

        try {

            _browser = new Browser(parent, SWT.NONE);
            GridDataFactory.fillDefaults().grab(true, true).applyTo(_browser);

        } catch (final SWTError e) {
            StatusUtil.showStatus("Could not instantiate Browser: " + e.getMessage(), e);//$NON-NLS-1$
            return;
        }

        _browser.addLocationListener(new LocationAdapter() {
            @Override
            public void changing(final LocationEvent event) {
                SearchMgr.onBrowserLocation(event);
            }
        });

    }
项目:mytourbook    文件:RawDataView.java   
private void onBrowser_LocationChanging(final LocationEvent event) {

        final String location = event.location;

        final String[] locationParts = location.split(HREF_TOKEN);

        if (locationParts.length > 1) {

            // finalize loading of the browser page and then start the action
            _browser.getDisplay().asyncExec(new Runnable() {
                @Override
                public void run() {
                    onBrowser_LocationChanging_Runnable(locationParts);
                }
            });
        }

        // prevent to load a new url
        if (location.equals(PAGE_ABOUT_BLANK) == false) {

            // about:blank is the initial page

            event.doit = false;
        }
    }
项目:FindBug-for-Domino-Designer    文件:BugInfoView.java   
private void openBrowserInEditor(LocationEvent event) {
    URL url;
    try {
        url = new URL(event.location);
    } catch (MalformedURLException ignored) {
        return;
    }
    IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
    try {
        IWebBrowser newBrowser = support.createBrowser(browserId);
        browserId = newBrowser.getId();
        newBrowser.openURL(url);
        return;
    } catch (PartInitException e) {
        FindbugsPlugin.getDefault().logException(e, "Can't open external browser");
    }
}
项目:elexis-3-core    文件:ODDBView.java   
@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/");

}
项目:bts    文件:XtextElementLinks.java   
protected URI initURI(LocationEvent event){
    String loc= event.location;
    if ("about:blank".equals(loc)) { //$NON-NLS-1$
        /*
         * Using the Browser.setText API triggers a location change to "about:blank".
         * remove this code once https://bugs.eclipse.org/bugs/show_bug.cgi?id=130314 is fixed
         */
        //input set with setText
        handler.handleTextSet();
        return null;
    }

    event.doit= false;

    if (loc.startsWith("about:")) { //$NON-NLS-1$
        // Relative links should be handled via head > base tag.
        // If no base is available, links just won't work.
        return null;
    }

    URI uri;
    try {
        uri= new URI(loc);
    } catch (URISyntaxException e) {
        // try it with a file (workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=237903 ):
        File file= new File(loc);
        if (! file.exists()) {
            log.warn("Could not handle location"+loc, e);
            return null;
        }
        uri= file.toURI();
    }
    return uri;

}
项目:oauth2-useragent    文件:SwtInterceptingBrowser.java   
public SwtInterceptingBrowser(final Browser browser, final Display display, final Shell shell) {
    this.browser = browser;
    this.display = display;

    this.browser.addLocationListener(new LocationAdapter() {
        @Override
        public void changing(LocationEvent locationEvent) {
            super.changing(locationEvent);
            final String newValue = locationEvent.location;

            lock.lock();
            try {
                if (redirectUriString != null && newValue != null && newValue.startsWith(redirectUriString)) {
                    // Do not load this new location, as we are only interested in the authorization code
                    locationEvent.doit = false;

                    response = UserAgentImpl.extractResponseFromRedirectUri(newValue);
                    responseReceived.signal();
                }
            }
            finally {
                lock.unlock();
            }
        }
    });

    shell.addListener(SWT.Close, new Listener() {
        @Override
        public void handleEvent(Event event) {
            lock.lock();
            try {
                response = "error=cancelled&error_description=The browser window was closed by the user.";
                responseReceived.signal();
            } finally {
                lock.unlock();
            }
        }
    });
}
项目:swtbrowser    文件:HTMLBrowser.java   
/**
 * Fire event
 */
private void fireLocationEvent(){
    LocationEvent event = new LocationEvent(root);
    event.location = this.location;
    for (LocationListener listener : listeners) {
        listener.changed(event);
    }
}
项目:jo-widgets    文件:BrowserImpl.java   
/**
 * Fires an on location change event.
 * 
 * @param swtEvent
 * @return true, if a veto occurred
 */
private boolean fireOnLocationChange(final LocationEvent swtEvent) {
    if (locationListeners.size() > 0) {
        final IBrowserLocationEvent event = new BrowserLocationEvent(swtEvent);
        final VetoHolder vetoHolder = new VetoHolder();
        for (final IBrowserLocationListener listener : new LinkedList<IBrowserLocationListener>(locationListeners)) {
            listener.onLocationChange(event, vetoHolder);
            if (vetoHolder.hasVeto()) {
                return true;
            }
        }
    }
    return false;
}
项目:jo-widgets    文件:BrowserImpl.java   
private void fireLocationChanged(final LocationEvent swtEvent) {
    if (locationListeners.size() > 0) {
        final IBrowserLocationEvent event = new BrowserLocationEvent(swtEvent);
        for (final IBrowserLocationListener listener : new LinkedList<IBrowserLocationListener>(locationListeners)) {
            listener.locationChanged(event);
        }
    }
}
项目:OpenSPIFe    文件:TemporalNodeBrowserListener.java   
@Override
public void changing(LocationEvent event) {
    EPlanElement node = getTargetNode(event);
    if (node != null) {
        selectTemporalNode(node);
    }
    event.doit = false;
}
项目:OpenSPIFe    文件:TemporalNodeBrowserListener.java   
/**
 * Utility function to look up the target for a given hyperlink event.
 * Relies on the unique id for the target being put into the href of
 * the hyperlink.  As a backup, checks the link label as a print name.
 * @param e
 * @return the temporal node targeted by the hyperlink, if any
 */
private EPlanElement getTargetNode(LocationEvent e) {
    EPlanElement node = null;
    String href = e.location;
    if (href != null) {
        String uniqueId = PlanPrinter.getUniqueIdFromHref(href);
        node = identifiableRegistry.getIdentifiable(EPlanElement.class, uniqueId);
    }
    if (node == null) {
        String printName = e.location;
        node = getNodeByPrintName(plan, printName);
    }
    return node;
}
项目:elexis-3-core    文件:KompendiumView.java   
@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$

}
项目:d-case_editor    文件:WebBrowserDialog.java   
/** 
 * Sets the location to text control when web browser changes site. 
 * Sets the browser enable when it has changed.
 * @see org.eclipse.swt.browser.LocationListener#changed(org.eclipse.swt.browser.LocationEvent)
 * @param event event.
 */
public void changed(LocationEvent event) {
    if (event.top) {
        String url = event.location;
        locationText.setText(url);
        locationText.redraw();
    } 
    getButton(IDialogConstants.OK_ID).setEnabled(true);
}
项目:convertigo-eclipse    文件:XulToolBar.java   
public void changed(LocationEvent event) {
    tx_addr.setText(mozillaBrowser.getUrl());
}
项目:BiglyBT    文件:ExternalLoginCookieListener.java   
@Override
public void changed(LocationEvent arg0) {
    getCookies();
}
项目:typescript.java    文件:HoverLocationListener.java   
@Override
public void changing(LocationEvent event) {

    String loc = event.location;
    if ("about:blank".equals(loc)) { //$NON-NLS-1$
        /*
         * Using the Browser.setText API triggers a location change to
         * "about:blank". XXX: remove this code once
         * https://bugs.eclipse.org/bugs/show_bug.cgi?id=130314 is fixed
         */
        // input set with setText
        handleTextSet();
        return;
    }

    event.doit = false;

    if (loc.startsWith(TERN_FILE_PROTOCOL)) { //$NON-NLS-1$
        handleTernFileLink(loc);
        return;
    }

    if (loc.startsWith(TERN_DEFINITION_PROTOCOL)) { //$NON-NLS-1$
        handleTernDefinitionLink(loc);
        return;
    }

    if (loc.startsWith("about:")) { //$NON-NLS-1$
        // Relative links should be handled via head > base tag.
        // If no base is available, links just won't work.
        return;
    }

    if (loc.startsWith(HTTP_PROTOCOL)) { //$NON-NLS-1$
        try {
            handleHttpLink(new URL(loc), event.display);
            return;
        } catch (MalformedURLException e) {

        }
    }

}
项目:jo-widgets    文件:BrowserLocationEvent.java   
BrowserLocationEvent(final LocationEvent locationEvent) {
    this.locationEvent = locationEvent;
    this.location = locationEvent.location;
    this.isTopFrameLocation = locationEvent.top;
}
项目:jo-widgets    文件:BrowserImpl.java   
@Override
public void changing(final LocationEvent event) {
    if (fireOnLocationChange(event)) {
        event.doit = false;
    }
}
项目:jo-widgets    文件:BrowserImpl.java   
@Override
public void changed(final LocationEvent event) {
    fireLocationChanged(event);
}
项目:OpenSPIFe    文件:TemporalNodeBrowserListener.java   
@Override
public void changed(LocationEvent event) {
    // don't care
}
项目:AcademicTorrents-Downloader    文件:ExternalLoginCookieListener.java   
public void changed(LocationEvent arg0) {
    getCookies();
}
项目:birt    文件:ReportLocationListener.java   
public void changed( LocationEvent event )
{
    // TODO Auto-generated method stub

}
项目:birt    文件:ReportLocationListener.java   
public void changing( LocationEvent event )
{
    if ( event.location.startsWith( "birt://" ) ) //$NON-NLS-1$
    {
        try
        {
            String urlstr = URLDecoder.decode( event.location, "UTF-8" ); //$NON-NLS-1$
            urlstr = urlstr.substring( urlstr.indexOf( "?" ) + 1 ); //$NON-NLS-1$
            StringTokenizer st = new StringTokenizer( urlstr, "&" ); //$NON-NLS-1$

            final Map options = new HashMap( );
            while ( st.hasMoreTokens( ) )
            {
                String option = st.nextToken( );
                int index = option.indexOf( "=" ); //$NON-NLS-1$
                if ( index > 0 )
                {
                    options.put( option.substring( 0, index ),
                            URLDecoder.decode( option.substring( index + 1,
                                    option.length( ) ), "UTF-8" ) ); //$NON-NLS-1$
                }
                else
                {
                    options.put( option, "" ); //$NON-NLS-1$
                }
            }
            event.doit = false;
            Display.getCurrent( ).asyncExec( new Runnable( ) {

                public void run( )
                {
                    viewer.setReportDesignFile( (String) options.get( "__report" ) ); //$NON-NLS-1$
                    viewer.setParamValues( options );
                    viewer.setCurrentPage( 1 );
                    viewer.render( );
                }
            } );
        }
        catch ( UnsupportedEncodingException e )
        {
        }
    }

}
项目:Sammelbox    文件:BrowserListener.java   
@Override
public void changed(LocationEvent event) {}
项目:APICloud-Studio    文件:DisplayHandler.java   
public void onAddressChange(CefBrowser browser, String url) {
    LocationEvent locevent = new LocationEvent(webkitbrowser);

    locevent.location = url;

    webkitbrowser.notifyListeners(locevent);
}
项目:mytourbook    文件:SearchMgr.java   
static void onBrowserLocation(final LocationEvent event) {

        final String location = event.location;

        if (hrefAction(location)) {

            // keep current page when an action is performed, OTHERWISE the current page will disappear or is replaced :-(
            event.doit = false;
        }
    }
项目:BiglyBT    文件:ExternalLoginCookieListener.java   
@Override
public void changing(LocationEvent arg0) {

}
项目:AcademicTorrents-Downloader    文件:ExternalLoginCookieListener.java   
public void changing(LocationEvent arg0) {

}
项目:d-case_editor    文件:WebBrowserDialog.java   
/**
 * Sets the browser disable when it is changing.
 * @see org.eclipse.swt.browser.LocationListener#changing(org.eclipse.swt.browser.LocationEvent)
 * @param event event.
 */
public void changing(LocationEvent event) {
    getButton(IDialogConstants.OK_ID).setEnabled(false);
}
项目:convertigo-eclipse    文件:XulToolBar.java   
public void changing(LocationEvent event) { }