use of org.eclipse.ui.browser.IWorkbenchBrowserSupport in project cubrid-manager by CUBRID.
the class CubridNoticeInfoEditorPart method createPartControl.
/**
* Create the editor content
*
* @param parent the parent composite
*/
public void createPartControl(Composite parent) {
Composite composite = new Composite(parent, SWT.None);
GridLayout layout = new GridLayout();
composite.setLayout(layout);
try {
Button ignoreButton = new Button(composite, SWT.CHECK);
ignoreButton.setText(Messages.cubridNoticeIgnoreButtonLbl);
ignoreButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
String ignore = PersistUtils.getPreferenceValue(CommonUIPlugin.PLUGIN_ID, CubridNoticeUtil.IGNORE_NOTICE);
if (StringUtil.isEmpty(ignore)) {
ignore = index;
} else {
ignore = ignore + "," + index;
}
PersistUtils.setPreferenceValue(CommonUIPlugin.PLUGIN_ID, CubridNoticeUtil.IGNORE_NOTICE, ignore);
getSite().getWorkbenchWindow().getActivePage().closeEditor(editor, false);
}
});
Browser browser = new Browser(composite, SWT.NONE);
browser.setUrl(noticeURL);
browser.setLayoutData(new GridData(GridData.FILL_BOTH));
} catch (Exception e) {
Label label = new Label(parent, SWT.NONE);
IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
try {
IWebBrowser browser = support.getExternalBrowser();
browser.openURL(new URL(CommonUITool.urlEncodeForSpaces(noticeURL.toCharArray())));
} catch (Exception browserEx) {
LOGGER.error(browserEx.getMessage(), browserEx);
label.setText(Messages.errCannotOpenExternalBrowser);
return;
}
label.setText(Messages.errCannotOpenInternalBrowser);
}
}
use of org.eclipse.ui.browser.IWorkbenchBrowserSupport in project cubrid-manager by CUBRID.
the class CubridProjectSiteAction method run.
public void run() {
String url = CommonUITool.urlEncodeForSpaces(Messages.msgCubridProjectSiteUrl);
try {
IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
IWebBrowser browser = support.getExternalBrowser();
browser.openURL(new URL(url));
} catch (PartInitException e) {
LOGGER.error("Can not initialize web browser on the application.", e);
} catch (MalformedURLException e) {
LOGGER.error("The url {} is invalid.", url, e);
}
}
use of org.eclipse.ui.browser.IWorkbenchBrowserSupport in project archi by archimatetool.
the class CheckForNewVersionAction method run.
@Override
public void run() {
try {
URL url = new URL(versionFile);
String newVersion = getOnlineVersion(url);
// Get this app's main version number
String thisVersion = System.getProperty(Application.APPLICATION_VERSIONID);
if (StringUtils.compareVersionNumbers(newVersion, thisVersion) > 0) {
boolean reply = MessageDialog.openQuestion(null, Messages.CheckForNewVersionAction_1, Messages.CheckForNewVersionAction_2 + " (" + newVersion + // $NON-NLS-1$ //$NON-NLS-2$
"). " + Messages.CheckForNewVersionAction_3);
if (reply) {
IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
IWebBrowser browser = support.getExternalBrowser();
if (browser != null) {
URL url2 = new URL(downloadPage);
browser.openURL(url2);
}
}
} else {
MessageDialog.openInformation(null, Messages.CheckForNewVersionAction_1, Messages.CheckForNewVersionAction_4);
}
} catch (MalformedURLException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
showErrorMessage(Messages.CheckForNewVersionAction_5);
return;
} catch (PartInitException ex) {
ex.printStackTrace();
}
}
use of org.eclipse.ui.browser.IWorkbenchBrowserSupport in project archi by archimatetool.
the class HTMLUtils method openLinkInBrowser.
/**
* Open a link in a Browser
* @param href
* @throws PartInitException
* @throws MalformedURLException
*/
public static void openLinkInBrowser(String href) throws PartInitException, MalformedURLException {
IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
IWebBrowser browser = support.getExternalBrowser();
browser.openURL(new URL(urlEncodeForSpaces(href.toCharArray())));
}
use of org.eclipse.ui.browser.IWorkbenchBrowserSupport in project eclipse.platform.text by eclipse.
the class URLHyperlink method open.
@Override
public void open() {
// Create the browser
IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
IWebBrowser browser;
try {
browser = support.createBrowser(null);
} catch (PartInitException e) {
// $NON-NLS-1$
EditorsPlugin.logErrorStatus("Could not create Web browser for URLHyperlink", e.getStatus());
super.open();
return;
}
try {
browser.openURL(new URL(getURLString()));
} catch (PartInitException e) {
super.open();
} catch (MalformedURLException e) {
super.open();
}
}
Aggregations