本文整理汇总了Java中org.eclipse.swt.browser.Browser类的典型用法代码示例。如果您正苦于以下问题:Java Browser类的具体用法?Java Browser怎么用?Java Browser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Browser类属于org.eclipse.swt.browser包,在下文中一共展示了Browser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.eclipse.swt.browser.Browser; //导入依赖的package包/类
@Override
public void start(final IApplicationLifecycle lifecycle) {
//create the root frame
final IFrame frame = Toolkit.createRootFrame(BPF.frame("JoToSwt Snipped"), lifecycle);
frame.setSize(1024, 768);
frame.setLayout(FillLayout.get());
//create a regular jo composite
final IComposite joComposite = frame.add(BPF.composite());
//get the native ui reference which must be a swt composite
//because swt SPI impl is used
final Composite swtComposite = (Composite) joComposite.getUiReference();
swtComposite.setLayout(new org.eclipse.swt.layout.FillLayout());
//create a swt browser
final Browser browser = new Browser(swtComposite, SWT.NONE);
browser.setUrl("http://www.jowidgets.org/");
//set the root frame visible
frame.setVisible(true);
}
示例2: createHandler
import org.eclipse.swt.browser.Browser; //导入依赖的package包/类
/**
* Creates and returns a new IGazeHandler object from the specified object
* and partRef, or returns null if no handler object is defined for that object.
*/
public static IGazeHandler createHandler(Object target,
IWorkbenchPartReference partRef) {
// create gaze handler for a StyledText widget within an EditorPart
if (target instanceof StyledText &&
partRef instanceof IEditorReference) {
return new StyledTextGazeHandler(target); //can go back to using partRef
} else if (target instanceof Browser) {
//create gaze handler for a Browser Stack overflow and Bug Report widget
//cannot get associated partRef
return new BrowserGazeHandler(target);
} else if (target instanceof Tree &&
partRef instanceof IViewReference &&
partRef.getTitle().equals("Project Explorer")) {
//create gaze handler for a Project Explorer Tree
return new ProjectExplorerGazeHandler(target, partRef);
}
return null;
}
示例3: bind
import org.eclipse.swt.browser.Browser; //导入依赖的package包/类
/**
* Recursive helper function to find and bind Browser controls
* @param control
*/
private static void bind(Control control) {
if (control instanceof Browser) {
bindControl(null, control, false);
}
//If composite, look through children.
if (control instanceof Composite) {
Composite composite = (Composite) control;
Control[] children = composite.getChildren();
if (children.length > 0 && children[0] != null) {
for (Control curControl : children)
bind(curControl);
}
}
}
示例4: unbind
import org.eclipse.swt.browser.Browser; //导入依赖的package包/类
/**
* Recursive helper function to find and unbind Browser controls
* @param control
*/
private static void unbind(Control control) {
if (control instanceof Browser) {
bindControl(null, control, true);
}
//If composite, look through children
if (control instanceof Composite) {
Composite composite = (Composite) control;
Control[] children = composite.getChildren();
if (children.length > 0 && children[0] != null) {
for (Control curControl : children)
unbind(curControl);
}
}
}
示例5: setupBrowsers
import org.eclipse.swt.browser.Browser; //导入依赖的package包/类
/**
* Recursive helper function to find and set up Browser control managers
* @param control
*/
private void setupBrowsers(Control control) {
if (control instanceof Browser) {
setupControls(null, control);
}
//If composite, look through children.
if (control instanceof Composite) {
Composite composite = (Composite) control;
Control[] children = composite.getChildren();
if (children.length > 0 && children[0] != null) {
for (Control curControl : children)
setupBrowsers(curControl);
}
}
}
示例6: setupControls
import org.eclipse.swt.browser.Browser; //导入依赖的package包/类
/**
* Recursive function for setting up children controls for a control if it is
* a composite and setting up the main control's manager.
* @param part
* @param control
*/
private void setupControls(IWorkbenchPart part, Control control) {
//If composite, setup children controls.
if (control instanceof Composite) {
Composite composite = (Composite) control;
Control[] children = composite.getChildren();
if (children.length > 0 && children[0] != null) {
for (Control curControl : children)
setupControls(part, curControl);
}
}
if (control instanceof StyledText) {
//set up styled text manager if there is one
setupStyledText((IEditorPart) part, (StyledText) control);
} else if (control instanceof Browser) {
//set up browser manager if there is one
setupBrowser((Browser) control);
}
//TODO: no control set up for a ProjectExplorer, since there isn't an need for
//a Manager right now, might be needed in the future
}
示例7: isAvailable
import org.eclipse.swt.browser.Browser; //导入依赖的package包/类
/**
* <p>
* Tells whether the SWT Browser widget and hence this information control is
* available.
* </p>
*
* @param parent the parent component used for checking or <code>null</code> if
* none
*
* @return <code>true</code> if this control is available
*/
public static boolean isAvailable(Composite parent) {
if (!fgAvailabilityChecked) {
try {
Browser browser= new Browser(parent, SWT.NONE);
browser.dispose();
fgIsAvailable= true;
Slider sliderV= new Slider(parent, SWT.VERTICAL);
Slider sliderH= new Slider(parent, SWT.HORIZONTAL);
int width= sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
int height= sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
fgScrollBarSize= new Point(width, height);
sliderV.dispose();
sliderH.dispose();
} catch (SWTError er) {
fgIsAvailable= false;
} finally {
fgAvailabilityChecked= true;
}
}
return fgIsAvailable;
}
示例8: createDialogArea
import org.eclipse.swt.browser.Browser; //导入依赖的package包/类
protected Control createDialogArea( Composite parent){
Composite composite = (Composite) super.createDialogArea(parent);
Browser browser = new Browser(composite, SWT.NONE);
browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
try {
String html = new String(ResourceUtils.getBundleResourceBytes(CoreConstants.PLUGIN_UI, "resources/about.html"));
html = html.replaceAll("currentYear", ""+Calendar.getInstance().get(Calendar.YEAR));
browser.setText(html);
} catch (Exception e) {
setErrorMessage(e.getLocalizedMessage());
}
return composite;
}
示例9: createDialogArea
import org.eclipse.swt.browser.Browser; //导入依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout(1, false);
composite.setLayout(layout);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
composite.setLayoutData(data);
Browser browser = new Browser(composite, SWT.NONE);
browser.setText(browserString);
browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
if (Util.isMac())
browser.refresh();
composite.pack();
return composite;
}
示例10: createPartControl
import org.eclipse.swt.browser.Browser; //导入依赖的package包/类
@Override
public void createPartControl(Composite parent) {
browser = new Browser(parent, SWT.None);
URL url;
try {
url = new URL("platform:/plugin/reFactor/resources/technical_debt.html");
InputStream inputStream = url.openConnection().getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
String inputLine = "";
String html = "";
while ((inputLine = in.readLine()) != null) {
html += inputLine;
}
browser.setText(html);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
// try {
// url = new URL("platform:/plugin/reFactor/resources/technical_debt.html");
// } catch (IOException e) {
// e.printStackTrace();
// }
}
示例11: StandardWidgetToolkit
import org.eclipse.swt.browser.Browser; //导入依赖的package包/类
public StandardWidgetToolkit(String... commandLineArgs) {
this.swtRunnableFactory = RUNNABLE_FACTORY_OVERRIDE != null ? RUNNABLE_FACTORY_OVERRIDE : this;
this.commandLineArgs = commandLineArgs;
display = new Display();
shell = new Shell(display);
shell.setText("OAuth 2.0 Authorization Request");
shell.setLayout(new FillLayout());
Monitor monitor = display.getPrimaryMonitor();
Rectangle bounds = monitor.getBounds();
Dimension size = new Dimension((int) (bounds.width * 0.25), (int) (bounds.height * 0.55));
shell.setSize(size.width, size.height);
shell.setLocation((bounds.width - size.width) / 2, (bounds.height - size.height) / 2);
Browser browser = new org.eclipse.swt.browser.Browser(shell, SWT.ON_TOP);
swtInterceptingBrowser = new SwtInterceptingBrowser(browser, display, shell);
}
示例12: createPartControl
import org.eclipse.swt.browser.Browser; //导入依赖的package包/类
public void createPartControl(final Composite parent) {
shell = parent.getShell();
Composite composite = new Composite(parent, SWT.NONE);
GridLayout gLayout = new GridLayout(1, true);
gLayout.horizontalSpacing = 0;
gLayout.marginHeight = 0;
gLayout.marginWidth = 0;
composite.setLayout(gLayout);
Composite textComposite = new Composite(composite, SWT.NONE);
textComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
textComposite.setLayout(new FillLayout());
browser = new Browser(textComposite, SWT.BORDER);
}
示例13: viewThreadStack
import org.eclipse.swt.browser.Browser; //导入依赖的package包/类
public void viewThreadStack( String filter ) {
if ( filter == null )
return;
StackFileInfo stackFileInfo = getSelectedStackFileInfo();
if ( stackFileInfo == null )
return;
String filename = StackParser.getWorkingThreadFilename(stackFileInfo.getFilename());
int stackStartLine = stackFileInfo.getParserConfig().getStackStartLine();
if ( filename != null && filter != null ) {
Browser broswer = getBrowser();
if ( m_isExcludeStack )
broswer.setText(HtmlUtils.filterThreadStack(filename, filter, stackFileInfo.getParserConfig().getExcludeStack(), stackStartLine));
else
broswer.setText(HtmlUtils.filterThreadStack(filename, filter, null, stackStartLine));
}
}
示例14: createFieldEditors
import org.eclipse.swt.browser.Browser; //导入依赖的package包/类
/**
*
*/
public void createFieldEditors() {
NStringFieldEditor tf = new NStringFieldEditor(CsvExporterConfiguration.PROPERTY_RECORD_DELIMITER,
Messages.CSVExporterPreferencePage_3, 4, getFieldEditorParent());
tf.setEmptyStringAllowed(false);
tf.setTextLimit(10);
addField(tf);
HelpSystem.setHelp(tf.getTextControl(getFieldEditorParent()),
StudioPreferencePage.REFERENCE_PREFIX + tf.getPreferenceName());
tf = new NStringFieldEditor(CsvExporterConfiguration.PROPERTY_FIELD_DELIMITER,
Messages.CSVExporterPreferencePage_4, 4, getFieldEditorParent());
tf.setEmptyStringAllowed(false);
tf.setTextLimit(10);
addField(tf);
HelpSystem.setHelp(tf.getTextControl(getFieldEditorParent()),
StudioPreferencePage.REFERENCE_PREFIX + tf.getPreferenceName());
Browser lbl = BrowserUtils.getSWTBrowserWidget(getFieldEditorParent(), SWT.MULTI);
lbl.setText(Messages.CSVExporterPreferencePage_5);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
lbl.setLayoutData(gd);
}
示例15: createPartControl
import org.eclipse.swt.browser.Browser; //导入依赖的package包/类
@Override
public void createPartControl(final Composite parent) {
final Composite compo = GamaToolbarFactory.createToolbars(this, parent);
browser = new Browser(compo, SWT.NONE);
browser.addProgressListener(new ProgressListener() {
@Override
public void changed(final ProgressEvent arg0) {}
@Override
public void completed(final ProgressEvent event) {
checkButtons();
}
});
parent.layout();
openInput();
}