本文整理汇总了Java中org.eclipse.swt.browser.LocationEvent类的典型用法代码示例。如果您正苦于以下问题:Java LocationEvent类的具体用法?Java LocationEvent怎么用?Java LocationEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LocationEvent类属于org.eclipse.swt.browser包,在下文中一共展示了LocationEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createUI_10_SearchInternal
import org.eclipse.swt.browser.LocationEvent; //导入依赖的package包/类
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);
}
});
}
示例2: onBrowser_LocationChanging
import org.eclipse.swt.browser.LocationEvent; //导入依赖的package包/类
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;
}
}
示例3: openBrowserInEditor
import org.eclipse.swt.browser.LocationEvent; //导入依赖的package包/类
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");
}
}
示例4: createPartControl
import org.eclipse.swt.browser.LocationEvent; //导入依赖的package包/类
@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/");
}
示例5: initURI
import org.eclipse.swt.browser.LocationEvent; //导入依赖的package包/类
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;
}
示例6: SwtInterceptingBrowser
import org.eclipse.swt.browser.LocationEvent; //导入依赖的package包/类
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();
}
}
});
}
示例7: fireLocationEvent
import org.eclipse.swt.browser.LocationEvent; //导入依赖的package包/类
/**
* Fire event
*/
private void fireLocationEvent(){
LocationEvent event = new LocationEvent(root);
event.location = this.location;
for (LocationListener listener : listeners) {
listener.changed(event);
}
}
示例8: fireOnLocationChange
import org.eclipse.swt.browser.LocationEvent; //导入依赖的package包/类
/**
* 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;
}
示例9: fireLocationChanged
import org.eclipse.swt.browser.LocationEvent; //导入依赖的package包/类
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);
}
}
}
示例10: changing
import org.eclipse.swt.browser.LocationEvent; //导入依赖的package包/类
@Override
public void changing(LocationEvent event) {
EPlanElement node = getTargetNode(event);
if (node != null) {
selectTemporalNode(node);
}
event.doit = false;
}
示例11: getTargetNode
import org.eclipse.swt.browser.LocationEvent; //导入依赖的package包/类
/**
* 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;
}
示例12: createPartControl
import org.eclipse.swt.browser.LocationEvent; //导入依赖的package包/类
@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$
}
示例13: changed
import org.eclipse.swt.browser.LocationEvent; //导入依赖的package包/类
/**
* 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);
}
示例14: changed
import org.eclipse.swt.browser.LocationEvent; //导入依赖的package包/类
public void changed(LocationEvent event) {
tx_addr.setText(mozillaBrowser.getUrl());
}
示例15: changed
import org.eclipse.swt.browser.LocationEvent; //导入依赖的package包/类
@Override
public void changed(LocationEvent arg0) {
getCookies();
}