本文整理匯總了Java中org.eclipse.ui.browser.IWebBrowser類的典型用法代碼示例。如果您正苦於以下問題:Java IWebBrowser類的具體用法?Java IWebBrowser怎麽用?Java IWebBrowser使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IWebBrowser類屬於org.eclipse.ui.browser包,在下文中一共展示了IWebBrowser類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: run
import org.eclipse.ui.browser.IWebBrowser; //導入依賴的package包/類
@Override
public void run() {
if (target==null){
return;
}
try {
URL url = new URL(target);
// Open default external browser
IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
IWebBrowser externalBrowser = browserSupport.getExternalBrowser();
externalBrowser.openURL(url);
} catch (Exception ex) {
EditorUtil.INSTANCE.logError("Was not able to open url in external browser", ex);
}
}
示例2: internalOpen
import org.eclipse.ui.browser.IWebBrowser; //導入依賴的package包/類
private static void internalOpen(final URL url, final boolean useExternalBrowser) {
BusyIndicator.showWhile(null, new Runnable() {
public void run() {
URL helpSystemUrl= PlatformUI.getWorkbench().getHelpSystem().resolve(url.toExternalForm(), true);
try {
IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
IWebBrowser browser;
if (useExternalBrowser)
browser= browserSupport.getExternalBrowser();
else
browser= browserSupport.createBrowser(null);
browser.openURL(helpSystemUrl);
} catch (PartInitException ex) {
}
}
});
}
示例3: openURL
import org.eclipse.ui.browser.IWebBrowser; //導入依賴的package包/類
/**
* Opens an URL with the default settings (which will typically open in an internal browser with no toolbar/url
* bar/etc).
*
* @param url
* @return
*/
public static IWebBrowser openURL(String url)
{
try
{
IWorkbenchBrowserSupport workbenchBrowserSupport = PlatformUI.getWorkbench().getBrowserSupport();
IWebBrowser webBrowser = workbenchBrowserSupport.createBrowser(null);
if (webBrowser != null)
{
webBrowser.openURL(new URL(url));
}
return webBrowser;
}
catch (Exception e)
{
IdeLog.logError(UIPlugin.getDefault(), e);
}
return null;
}
示例4: internalOpen
import org.eclipse.ui.browser.IWebBrowser; //導入依賴的package包/類
private static void internalOpen(final URL url, final boolean useExternalBrowser) {
BusyIndicator.showWhile(null, new Runnable() {
public void run() {
URL helpSystemUrl= PlatformUI.getWorkbench().getHelpSystem().resolve(url.toExternalForm(), true);
if (helpSystemUrl == null) { // can happen if org.eclipse.help.ui is not available
return; // the resolve() method already wrote "Unable to instantiate help UI" to the log
}
try {
IWorkbenchBrowserSupport browserSupport= PlatformUI.getWorkbench().getBrowserSupport();
IWebBrowser browser;
if (useExternalBrowser)
browser= browserSupport.getExternalBrowser();
else
browser= browserSupport.createBrowser(null);
browser.openURL(helpSystemUrl);
} catch (PartInitException ex) {
// XXX: show dialog?
JavaPlugin.logErrorStatus("Opening Javadoc failed", ex.getStatus()); //$NON-NLS-1$
}
}
});
}
示例5: openBrowserInEditor
import org.eclipse.ui.browser.IWebBrowser; //導入依賴的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");
}
}
示例6: startWebBrowser
import org.eclipse.ui.browser.IWebBrowser; //導入依賴的package包/類
/**
* Starts the web browser.
*
* @param url the URL to open.
*/
private void startWebBrowser(URL url) {
IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench()
.getBrowserSupport();
if (browserSupport.isInternalWebBrowserAvailable()) {
try {
IWebBrowser browser = browserSupport.createBrowser(
IWorkbenchBrowserSupport.LOCATION_BAR
| IWorkbenchBrowserSupport.NAVIGATION_BAR
| IWorkbenchBrowserSupport.AS_EDITOR,
CONST_INTERNAL_BROWSER_ID, CONST_INTERNAL_BROWSER_NAME,
CONST_INTERNAL_BROWSER_TOOLTIP);
browser.openURL(url);
} catch (PartInitException e) {
throw new DcaseSystemException(Messages.COMMON_EXCEPTION_partInit, e,
MessageTypeImpl.OPEN_URL_CRITICAL_FAILED);
}
} else {
throw new DcaseSystemException(Messages.OpenUrlHandler_4, null,
MessageTypeImpl.OPEN_URL_CRITICAL_FAILED);
}
}
示例7: runInUIThread
import org.eclipse.ui.browser.IWebBrowser; //導入依賴的package包/類
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
try {
IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
IWebBrowser browser = browserSupport.createBrowser(
IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR, null, null, null);
browser.openURL(new URL(serverURL));
} catch (Exception e) {
return new Status(IStatus.ERROR, AngularCLIPlugin.PLUGIN_ID, AngularCLIMessages.NgServeJob_error, e);
}
return Status.OK_STATUS;
}
示例8: openInExternalBrowser
import org.eclipse.ui.browser.IWebBrowser; //導入依賴的package包/類
private void openInExternalBrowser(URL url) {
String browserId = "bookmark";
try {
IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.AS_EXTERNAL, browserId, null,
null);
browser.openURL(url);
} catch (PartInitException e) {
StatusHelper.logError("Could not open browser", e);
}
}
示例9: createOnlineCollaborationListener
import org.eclipse.ui.browser.IWebBrowser; //導入依賴的package包/類
private SelectionAdapter createOnlineCollaborationListener(final List list) {
return new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Client client = createClient(list);
String managementURL = getManagementURL(list.getSelection());
try {
String rapPath = client.getOnlineCollaborationURL(goldRepositoryText.getText());
URL u = new URL(managementURL);
System.out.println(u.getHost());
String rapURL = u.getProtocol() + "://" + u.getHost() + ":" + u.getPort() + rapPath;
final IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport().createBrowser(
IWorkbenchBrowserSupport.AS_VIEW | IWorkbenchBrowserSupport.NAVIGATION_BAR, null, null,
null);
browser.openURL(new URL(rapURL));
} catch (Exception e1) {
String message = "Could not get online collaboration URL from server " + managementURL;
logger.error(message);
MessageBox mb = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_ERROR | SWT.OK);
mb.setText("MONDO server management error");
mb.setMessage(message);
mb.open();
}
}
};
}
示例10: openWebBrowser
import org.eclipse.ui.browser.IWebBrowser; //導入依賴的package包/類
@Override
public void openWebBrowser(final String url) throws Exception
{
final IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport()
.createBrowser(IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.LOCATION_BAR,
"CSS", null, null);
browser.openURL(new URL(url));
}
示例11: launchBrowser
import org.eclipse.ui.browser.IWebBrowser; //導入依賴的package包/類
public static IWebBrowser launchBrowser(String targetUrl) throws MalformedURLException, PartInitException {
Workbench workbench = Workbench.getInstance();
if (workbench == null) {
throw new PartInitException("No workbench is available");
}
IWorkbenchBrowserSupport browserSupport = workbench.getBrowserSupport();
URL url = new URL(targetUrl);
IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.AS_EXTERNAL, null, "GWT", "GWT");
browser.openURL(url);
return browser;
}
示例12: openBrowser
import org.eclipse.ui.browser.IWebBrowser; //導入依賴的package包/類
private void openBrowser(String url)
{
try
{
IWebBrowser browser = WorkbenchBrowserSupport.getInstance()
.createBrowser(0, "MyBrowserID", "MyBrowserName", "MyBrowser Tooltip");
browser.openURL(new URL(url));
}
catch (Exception e)
{
System.out.println(e);
}
}
示例13: openLink
import org.eclipse.ui.browser.IWebBrowser; //導入依賴的package包/類
/**
* Launches the browser to open the specified url
*
* @param url
* the url to open
*/
public static void openLink(String url) {
try {
IWebBrowser browser = JasperReportsPlugin.getDefault().getWorkbench().getBrowserSupport().createBrowser(null);
browser.openURL(new URL(url));
} catch (Exception e) {
UIUtils.showError(e);
}
}
示例14: run
import org.eclipse.ui.browser.IWebBrowser; //導入依賴的package包/類
public void run(IAction action) {
try {
IWorkbenchBrowserSupport workbenchBrowserSupport = PlatformUI.getWorkbench().getBrowserSupport();
if (workbenchBrowserSupport.isInternalWebBrowserAvailable()) {
IWebBrowser webBrowser = workbenchBrowserSupport.createBrowser(IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR | IWorkbenchBrowserSupport.STATUS, null, null, null);
if (webBrowser != null) {
webBrowser.openURL(null);
}
}
} catch (PartInitException e) {
IdeLog.logError(BrowserPlugin.getDefault(), e);
}
}
示例15: launchExternalBrowser
import org.eclipse.ui.browser.IWebBrowser; //導入依賴的package包/類
public static IWebBrowser launchExternalBrowser(String url, String browserId)
{
try
{
return launchExternalBrowser(new URL(url), browserId);
}
catch (MalformedURLException e)
{
IdeLog.logError(UIPlugin.getDefault(), e);
}
return null;
}