本文整理匯總了Java中org.eclipse.swt.browser.Browser.addOpenWindowListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Browser.addOpenWindowListener方法的具體用法?Java Browser.addOpenWindowListener怎麽用?Java Browser.addOpenWindowListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.browser.Browser
的用法示例。
在下文中一共展示了Browser.addOpenWindowListener方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: internalCreatePartControl
import org.eclipse.swt.browser.Browser; //導入方法依賴的package包/類
@Override
protected void internalCreatePartControl(Composite parent) {
try {
fBrowser= new Browser(parent, SWT.NONE);
fBrowser.setJavascriptEnabled(false);
fIsUsingBrowserWidget= true;
addLinkListener(fBrowser);
fBrowser.addOpenWindowListener(new OpenWindowListener() {
public void open(WindowEvent event) {
event.required= true; // Cancel opening of new windows
}
});
} catch (SWTError er) {
/* The Browser widget throws an SWTError if it fails to
* instantiate properly. Application code should catch
* this SWTError and disable any feature requiring the
* Browser widget.
* Platform requirements for the SWT Browser widget are available
* from the SWT FAQ web site.
*/
IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
boolean doNotWarn= store.getBoolean(DO_NOT_WARN_PREFERENCE_KEY);
if (WARNING_DIALOG_ENABLED) {
if (!doNotWarn) {
String title= InfoViewMessages.JavadocView_error_noBrowser_title;
String message= InfoViewMessages.JavadocView_error_noBrowser_message;
String toggleMessage= InfoViewMessages.JavadocView_error_noBrowser_doNotWarn;
MessageDialogWithToggle dialog= MessageDialogWithToggle.openError(parent.getShell(), title, message, toggleMessage, false, null, null);
if (dialog.getReturnCode() == Window.OK)
store.setValue(DO_NOT_WARN_PREFERENCE_KEY, dialog.getToggleState());
}
}
fIsUsingBrowserWidget= false;
}
if (!fIsUsingBrowserWidget) {
fText= new StyledText(parent, SWT.V_SCROLL | SWT.H_SCROLL);
fText.setEditable(false);
fPresenter= new HTMLTextPresenter(false);
fText.addControlListener(new ControlAdapter() {
/*
* @see org.eclipse.swt.events.ControlAdapter#controlResized(org.eclipse.swt.events.ControlEvent)
*/
@Override
public void controlResized(ControlEvent e) {
doSetInput(fOriginalInput);
}
});
}
initStyleSheet();
listenForFontChanges();
getViewSite().setSelectionProvider(new SelectionProvider(getControl()));
}