use of org.eclipse.swt.browser.Browser in project eclipse.platform.swt by eclipse.
the class TextEditor method handleMouseUp.
void handleMouseUp(Event event) {
if (link != null) {
int offset = styledText.getCaretOffset();
StyleRange range = offset > 0 ? styledText.getStyleRangeAtOffset(offset - 1) : null;
if (range != null) {
if (link == range.data) {
Shell dialog = new Shell(shell);
dialog.setLayout(new FillLayout());
// $NON-NLS-1$
dialog.setText(getResourceString("Browser"));
Browser browser = new Browser(dialog, SWT.NONE);
browser.setUrl(link);
dialog.open();
}
}
}
}
use of org.eclipse.swt.browser.Browser in project eclipse.platform.swt by eclipse.
the class BrowserTab method createTabFolderPage.
/**
* Creates the tab folder page.
*
* @param tabFolder org.eclipse.swt.widgets.TabFolder
* @return the new page for the tab folder
*/
@Override
Composite createTabFolderPage(final TabFolder tabFolder) {
super.createTabFolderPage(tabFolder);
/*
* Add a resize listener to the tabFolderPage so that
* if the user types into the example widget to change
* its preferred size, and then resizes the shell, we
* recalculate the preferred size correctly.
*/
tabFolderPage.addControlListener(ControlListener.controlResizedAdapter(e -> setExampleWidgetSize()));
/*
* Add a selection listener to the tabFolder to bring up a
* dialog if this platform does not support the Browser.
*/
tabFolder.addSelectionListener(widgetSelectedAdapter(e -> {
if (errorMessage != null && tabFolder.getSelection()[0].getText().equals(getTabText())) {
MessageBox dialog = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
dialog.setMessage(ControlExample.getResourceString("BrowserNotFound", errorMessage));
dialog.open();
}
}));
return tabFolderPage;
}
use of org.eclipse.swt.browser.Browser in project eclipse.platform.swt by eclipse.
the class BrowserDemoView method createPartControl.
@Override
public void createPartControl(Composite parent) {
this.parent = parent;
parent.setLayout(new FillLayout());
try {
Browser browser = new Browser(parent, SWT.NONE);
browser.dispose();
} catch (SWTError e) {
Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY);
text.setText("Browser widget cannot be instantiated. The exact error is:\r\n" + e);
text.requestLayout();
return;
}
TabFolder folder = new TabFolder(parent, SWT.NONE);
TabItem item = new TabItem(folder, SWT.NONE);
new PawnTab(item);
item = new TabItem(folder, SWT.NONE);
new EditorTab(item);
}
use of org.eclipse.swt.browser.Browser in project cubrid-manager by CUBRID.
the class CubridNewInfoEditorPart method createPartControl.
/**
* Create the editor content
*
* @param parent the parent composite
*/
public void createPartControl(Composite parent) {
String url = Platform.getNL().equals("ko_KR") ? CHECK_NEW_INFO_URL_KO : CHECK_NEW_INFO_URL_EN;
try {
Browser browser = new Browser(parent, SWT.NONE);
browser.setUrl(url);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
Label label = new Label(parent, SWT.NONE);
IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
try {
IWebBrowser browser = support.getExternalBrowser();
browser.openURL(new URL(CommonUITool.urlEncodeForSpaces(url.toCharArray())));
} catch (Exception browserEx) {
LOGGER.warn(browserEx.getMessage(), browserEx);
label.setText(Messages.errCannotOpenExternalBrowser);
return;
}
label.setText(Messages.errCannotOpenInternalBrowser);
}
}
use of org.eclipse.swt.browser.Browser in project cubrid-manager by CUBRID.
the class NewFeatureEditorPart method createPartControl.
public void createPartControl(Composite parent) {
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.marginBottom = 0;
layout.marginTop = 0;
layout.marginLeft = 0;
layout.marginRight = 0;
parent.setLayout(layout);
browser = new Browser(parent, SWT.None);
browser.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
}
Aggregations