Search in sources :

Example 1 with ProgressEvent

use of org.eclipse.swt.browser.ProgressEvent in project cubrid-manager by CUBRID.

the class BrowserEditorPart method initBrowser.

private void initBrowser(Composite parent) {
    browser = new Browser(parent, SWT.None);
    browser.setLayoutData(createGridData(FILL_BOTH, 3, 1, -1, -1));
    // Add location change listener
    browser.addLocationListener(new LocationListener() {

        public void changing(LocationEvent e) {
            location.setText(e.location);
        }

        public void changed(LocationEvent e) {
            noOp();
        }
    });
    // Add loading listener
    browser.addProgressListener(new ProgressListener() {

        // Set stopItem and progress bar status
        public void changed(ProgressEvent e) {
            if (!stopItem.isEnabled() && e.total != e.current) {
                stopItem.setEnabled(true);
            }
        }

        // Set stopItem,backItem,forwardItem and progress bar status
        public void completed(ProgressEvent e) {
            stopItem.setEnabled(false);
            backItem.setEnabled(browser.isBackEnabled());
            forwardItem.setEnabled(browser.isForwardEnabled());
        }
    });
}
Also used : ProgressListener(org.eclipse.swt.browser.ProgressListener) LocationListener(org.eclipse.swt.browser.LocationListener) ProgressEvent(org.eclipse.swt.browser.ProgressEvent) LocationEvent(org.eclipse.swt.browser.LocationEvent) Browser(org.eclipse.swt.browser.Browser)

Aggregations

Browser (org.eclipse.swt.browser.Browser)1 LocationEvent (org.eclipse.swt.browser.LocationEvent)1 LocationListener (org.eclipse.swt.browser.LocationListener)1 ProgressEvent (org.eclipse.swt.browser.ProgressEvent)1 ProgressListener (org.eclipse.swt.browser.ProgressListener)1