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));
}
use of org.eclipse.swt.browser.Browser in project eclipse.platform.swt by eclipse.
the class BrowserTab method createExampleWidgets.
/**
* Creates the "Example" widgets.
*/
@Override
void createExampleWidgets() {
/* Compute the widget style */
int style = getDefaultStyle();
if (borderButton.getSelection())
style |= SWT.BORDER;
if (webKitButton.getSelection())
style |= SWT.WEBKIT;
/* Create the example widgets */
try {
browser = new Browser(browserGroup, style);
} catch (SWTError e) {
// Probably missing browser
try {
browser = new Browser(browserGroup, style & ~(SWT.WEBKIT));
} catch (SWTError e2) {
// Unsupported platform
errorMessage = e.getMessage();
return;
}
MessageBox dialog = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
String resourceString = "WebKitNotFound";
dialog.setMessage(ControlExample.getResourceString(resourceString, e.getMessage()));
dialog.open();
}
if (lastUrl != null) {
browser.setUrl(lastUrl);
} else if (lastText != null) {
browser.setText(lastText);
} else {
StringBuilder sb = new StringBuilder(300);
try (InputStream htmlStream = ControlExample.class.getResourceAsStream("browser-content.html");
BufferedReader br = new BufferedReader(new InputStreamReader(htmlStream))) {
int read = 0;
while ((read = br.read()) != -1) sb.append((char) read);
} catch (IOException e) {
log(e.getMessage());
}
String text = sb.toString();
browser.setText(text);
}
lastText = lastUrl = null;
}
use of org.eclipse.swt.browser.Browser in project eclipse.platform.swt by eclipse.
the class Bug497705_BrowserDragDetect method main.
public static void main(String[] args) {
Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
final Browser b = new Browser(shell, SWT.BORDER);
b.setText("TEXT");
final Label label2 = new Label(shell, SWT.BORDER);
// doesn't seem to have an effect.
setDrag(b);
setDrop(label2);
shell.setSize(200, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
use of org.eclipse.swt.browser.Browser in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_browser_Browser method test_LocationListener_adapter_closeShell.
@Test
public void test_LocationListener_adapter_closeShell() {
Display display = Display.getCurrent();
Shell shell = new Shell(display);
Browser browser = new Browser(shell, SWT.NONE);
LocationAdapter adapter = new LocationAdapter() {
};
// shouldn't throw
browser.addLocationListener(adapter);
shell.close();
}
Aggregations