當前位置: 首頁>>代碼示例>>Java>>正文


Java IWebBrowser.openURL方法代碼示例

本文整理匯總了Java中org.eclipse.ui.browser.IWebBrowser.openURL方法的典型用法代碼示例。如果您正苦於以下問題:Java IWebBrowser.openURL方法的具體用法?Java IWebBrowser.openURL怎麽用?Java IWebBrowser.openURL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.ui.browser.IWebBrowser的用法示例。


在下文中一共展示了IWebBrowser.openURL方法的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);
	}
}
 
開發者ID:de-jcup,項目名稱:egradle,代碼行數:17,代碼來源:OpenInExternalBrowserAction.java

示例2: 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;
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:26,代碼來源:WorkbenchBrowserUtil.java

示例3: 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");
    }
}
 
開發者ID:OpenNTF,項目名稱:FindBug-for-Domino-Designer,代碼行數:18,代碼來源:BugInfoView.java

示例4: 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);
    }
}
 
開發者ID:d-case,項目名稱:d-case_editor,代碼行數:27,代碼來源:OpenUrlHandler.java

示例5: 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;
}
 
開發者ID:angelozerr,項目名稱:angular-eclipse,代碼行數:13,代碼來源:NgServeJob.java

示例6: 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);
	}

}
 
開發者ID:cchabanois,項目名稱:mesfavoris,代碼行數:14,代碼來源:ViewInGDriveOperation.java

示例7: 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();
			}
		}
	};
}
 
開發者ID:mondo-project,項目名稱:mondo-integration,代碼行數:28,代碼來源:MONDOServerView.java

示例8: 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));
}
 
開發者ID:kasemir,項目名稱:org.csstudio.display.builder,代碼行數:9,代碼來源:RCP_JFXRepresentation.java

示例9: 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;
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:15,代碼來源:BrowserUtilities.java

示例10: 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);
  }      
}
 
開發者ID:ninneko,項目名稱:velocity-edit,代碼行數:14,代碼來源:VelocityEditor.java

示例11: 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);
	}

}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:16,代碼來源:BrowserUtils.java

示例12: 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);
	}
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:14,代碼來源:ShowBrowserEditorAction.java

示例13: display

import org.eclipse.ui.browser.IWebBrowser; //導入方法依賴的package包/類
/**
 * Opens visualize.html in the default browser
 * 
 * @throws PartInitException
 * @throws MalformedURLException
 */
private void display() throws PartInitException, MalformedURLException {
	// set to use external browser due to internal browser bug
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=501978
	final IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser();
	browser.openURL(Paths.get(target, FILE_TO_OPEN_IN_BROWSER).toUri().toURL());
}
 
開發者ID:ELTE-Soft,項目名稱:txtUML,代碼行數:13,代碼來源:Exporter.java

示例14: editOnActivate

import org.eclipse.ui.browser.IWebBrowser; //導入方法依賴的package包/類
@Override
public boolean editOnActivate(ParameterFacet<T> facet, IUndoContext undoContext, TreeItem item, int index) {
	EStructuralFeature feature = facet.getFeature();
	EClassifier type = feature.getEType();
	if (isCheckboxType(type)) {
		Boolean value = (Boolean) facet.getValue();
		boolean newValue = (value == null ? true : !value);
		modify(facet, newValue, undoContext);
		return true;
	}
	if (type == CommonPackage.Literals.EURL) {
		URL url = (URL)facet.getValue();
		if ((url == null) || "".equals(url.toString())) {
			MessageDialog.openInformation(new Shell(), "No URL", "No URL is set");
		} else {
			IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
			try {
				IWebBrowser browser = browserSupport.createBrowser("");
				browser.openURL(url);
			} catch (PartInitException e1) {
				LogUtil.error("Failed to INIT part for opening WebBrowser in URLEditor", e1);
			}
		}
		return false;
	}
	return false;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:28,代碼來源:ParameterColumn.java

示例15: displayURL

import org.eclipse.ui.browser.IWebBrowser; //導入方法依賴的package包/類
public void displayURL(String url) throws Exception {
	try {
		IWebBrowser browser = getExternalBrowser();
		if (browser != null) {
			browser.openURL(new URL(url));
		}
	} catch (PartInitException pie) {
		ErrorUtil.displayErrorDialog(pie.getLocalizedMessage());
	}
}
 
開發者ID:heartsome,項目名稱:translationstudio8,代碼行數:11,代碼來源:AbstractSelfHelpUI.java


注:本文中的org.eclipse.ui.browser.IWebBrowser.openURL方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。