use of org.eclipse.ui.browser.IWebBrowser 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.IWebBrowser 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.IWebBrowser in project cubrid-manager by CUBRID.
the class ProductInfoDialog method openLink.
/**
* Open a link
*
* @param href the href string
*/
protected void openLink(String href) {
// format the href for an html file (file:///<filename.html>
// required for Mac only.
String hrefUrl = href;
if (href.startsWith("file:")) {
//$NON-NLS-1$
hrefUrl = href.substring(5);
while (hrefUrl.startsWith("/")) {
//$NON-NLS-1$
hrefUrl = hrefUrl.substring(1);
}
//$NON-NLS-1$
hrefUrl = "file:///" + hrefUrl;
}
IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
try {
IWebBrowser browser = support.getExternalBrowser();
browser.openURL(new URL(urlEncodeForSpaces(hrefUrl.toCharArray())));
} catch (MalformedURLException e) {
LOGGER.info(e.getMessage(), e);
} catch (PartInitException e) {
LOGGER.info(e.getMessage(), e);
}
}
use of org.eclipse.ui.browser.IWebBrowser in project cubrid-manager by CUBRID.
the class CubridOnlineForumAction method run.
public void run() {
String url = CommonUITool.urlEncodeForSpaces(Messages.msgCubridOnlineForumUrl);
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.IWebBrowser in project cubrid-manager by CUBRID.
the class HelpDocumentAction method run.
public void run() {
String url = CommonUITool.urlEncodeForSpaces(Messages.msgCubridHelpSiteUrl);
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);
}
}
Aggregations