use of org.eclipse.swt.browser.Browser in project erlide_eclipse by erlang.
the class EdocView method internalCreatePartControl.
/*
* @see AbstractInfoView#internalCreatePartControl(Composite)
*/
@Override
protected void internalCreatePartControl(final Composite parent) {
try {
fBrowser = new Browser(parent, SWT.NONE);
locationListener = new HandleEdocLinksLocationListener(this);
fBrowser.addLocationListener(locationListener);
} catch (final SWTError er) {
ErlLogger.warn(er);
}
initStyleSheet();
getViewSite().setSelectionProvider(new SelectionProvider(getControl()));
}
use of org.eclipse.swt.browser.Browser in project eclipse-integration-commons by spring-projects.
the class StsBrowserEditor method createPartControl.
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
* .Composite)
*/
@Override
public void createPartControl(Composite parent) {
parent.setLayout(new FillLayout());
browserViewer = new StsBrowserViewer(parent, hasToolbar() ? StsBrowserViewer.BUTTON_BAR | StsBrowserViewer.LOCATION_BAR : SWT.NONE);
final Browser browser = browserViewer.getBrowser();
if (getEditorInput() instanceof WebBrowserEditorInput) {
homeUrl = ((WebBrowserEditorInput) getEditorInput()).getURL().toString();
browserViewer.setVisible(true);
}
if (homeUrl != null) {
browserViewer.setHomeUrl(homeUrl);
browserViewer.setURL(homeUrl);
} else {
browser.setText("<h1>URL not set</h1>" + "<p>Url should be provided via the setInitializationData method</p>");
}
if (getName() == null) {
browser.addTitleListener(new TitleListener() {
@Override
public void changed(TitleEvent event) {
String newValue = event.title;
setName(newValue);
setPartName(newValue);
}
});
}
browser.addProgressListener(new ProgressAdapter() {
@Override
public void completed(ProgressEvent event) {
StsBrowserViewer browserViewer = getBrowserViewer();
if (browserViewer != null) {
if (browserManager == null) {
browserManager = new StsBrowserManager();
}
browserManager.setClient(browserViewer.getBrowser());
if (getEditorInput() instanceof WebBrowserEditorInput) {
String url = browserViewer.getURL();
try {
setInput(new WebBrowserEditorInput(new URL(url), SWT.NONE, url));
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
}
}
});
}
use of org.eclipse.swt.browser.Browser in project webtools.servertools by eclipse.
the class BrowserViewer method init.
/**
* (non-Javadoc)
* @see ContentViewer#init(Composite)
*/
public void init(Composite parent) {
browser = new Browser(parent, SWT.NONE);
browser.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
event.doit = false;
}
});
}
use of org.eclipse.swt.browser.Browser in project epp.mpc by eclipse.
the class MarketplaceWizard method hookLocationListener.
private boolean hookLocationListener(IWebBrowser webBrowser) {
try {
// $NON-NLS-1$
Field partField = findField(webBrowser.getClass(), "part", IWorkbenchPart.class);
if (partField != null) {
partField.setAccessible(true);
IWorkbenchPart part = (IWorkbenchPart) partField.get(webBrowser);
if (part != null) {
// $NON-NLS-1$
Field browserViewerField = findField(part.getClass(), "webBrowser", null);
if (browserViewerField != null) {
browserViewerField.setAccessible(true);
Object browserViewer = browserViewerField.get(part);
if (browserViewer != null) {
// $NON-NLS-1$
Field browserField = findField(browserViewer.getClass(), "browser", Browser.class);
if (browserField != null) {
browserField.setAccessible(true);
Browser browser = (Browser) browserField.get(browserViewer);
if (browser != null) {
// only hook the listener once
if (browser.getData(MarketplaceBrowserIntegration.class.getName()) == null) {
if (browserListener == null) {
browserListener = new MarketplaceBrowserIntegration();
}
browser.setData(MarketplaceBrowserIntegration.class.getName(), browserListener);
// hook in listeners
browser.addLocationListener(browserListener);
browser.addOpenWindowListener(browserListener);
}
return true;
}
}
}
}
}
}
} catch (Throwable t) {
// ignore
}
return false;
}
use of org.eclipse.swt.browser.Browser in project epp.mpc by eclipse.
the class AbstractMarketplaceDiscoveryItem method computeBrowserAvailable.
private synchronized boolean computeBrowserAvailable(Composite composite) {
if (browserAvailable == null) {
// SWTError is thrown if not available.
try {
Browser browser = new Browser(composite, SWT.NULL);
browser.dispose();
browserAvailable = true;
} catch (SWTError e) {
browserAvailable = false;
}
}
return browserAvailable;
}
Aggregations