jramosd / javachromiumembedded

Automatically exported from code.google.com/p/javachromiumembedded
0 stars 0 forks source link

Is it possible to embed JCEF into SWT/Eclipse applications #39

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The sample (MainFrame.java) is based on SWING/AWT. I want to use jcef in 
SWT/eclipse.
I got it working by patching org.jcef.*.java files to make it work in 
eclipse/swt app.

I don't want to take that path though. It is un-maintainable.

Hence, request your comments on any other approach to the solution.

Using SWT-AWT bridge is showing blank white screen.

Regards,

Original issue reported on code.google.com by kscr...@gmail.com on 17 Feb 2014 at 12:35

GoogleCodeExporter commented 9 years ago
There is work in-progress to improve the JCEF API but we are not targeting 
eclipse specifically. What are the requirements for embedding in SWT/eclipse? 
What changes did you make to the Java files?

Original comment by magreenb...@gmail.com on 20 Feb 2014 at 4:57

GoogleCodeExporter commented 9 years ago
Thank you.

Here are the very crude details..

1) Async timer loop for the message loop
2) converting swt-events to awt events
3) using GLCanvas of swt and a different way of initializing GLCanvas/GL2
4) "window_handle" that is available on swt library of windows,linux (no mac)

The above combo is working on linux and windows. But not on mac. It just 
crashes.

I will check with my employer, whether I can publish the code.
Approached as to make JCEF frame as Eclipse-Part. 

I tried to use "SWT-AWT bridge" but couldn't. A blank screen appears all the 
time.

Original comment by kscr...@gmail.com on 21 Feb 2014 at 4:58

GoogleCodeExporter commented 9 years ago
I made the javacef project about 2 years ago to embed cef into a SWT widget. 
I've been porting the project to use cef3 in all platforms since last month. 
Switching cef1 to cef3 in windows is not hard and already stable.

In mac there is a "view" property in SWT which is a NSView object, and you can 
get the id property of the NSView object, which is a pointer to NSView*. Then 
the NSView* can be used to create a browser. Due to the cocoa limitations, swt 
and awt can't be mixed together, so I'm not sure whether you can make jcef to 
work in swt. I've already made javacef to load as a SWT widget in mac.

The javacef project uses a different approach. It uses native controls instead 
of off screen rendering and opengl. There won't be many differences between the 
two methods (such as context menu and resize speed) when aura is used in the 
future. In windows it can run the blocking message loop on a separate thread. 
In mac and linux it's running async message loop now, and there're always 
crashes on exit.

I will publish the work when it's getting stable on mac and linux.

Original comment by wjy...@gmail.com on 6 Apr 2014 at 9:17

GoogleCodeExporter commented 9 years ago
I have solved this issue just by adding .jar files externally. If number of 
.jar files are causing problem you can always combine/merge them into single 
one. Many tools are available to so.

Original comment by aniketro...@gmail.com on 11 Sep 2014 at 5:16

GoogleCodeExporter commented 9 years ago
Hello 

I try to do the same thing. With jcef 1916_1804

I have an eclipse RCP application, and want to display a browser into an swt 
canvas.

I would like to have the minimum modifications to do to the jcef functional code

I saw that I can use JOGL in SWT using the SWT-AWT bridge.

CEF3 is initialized in a separate thread (I could have more than one browser) 
but I don't use an async message loop

I use the SefBrowserOSr class

Display display=new Dispaly();
Shell shell=new Shell(display);
shell.setLayout(new FillLayout();
shell.setSize(1024, 768);

I call a class constructor which inherits from swt.Canvas (the constructor 
calls super(shell,SWT.EMBEDDED);

I then usr Frame (java.awt.Frame) 
Frame frame= SWT_AWT.new_Frame(compoiste) (composite is my swt Canvas).
fram.add(glCanvas)

here is the code

private void createGLCanvas(Composite composite) {
GLProfile glprofile = GLProfile.getMaxFixedFunc(true);
GLCapabilities glcapabilities = new GLCapabilities(glprofile);

canvas_ = new GLCanvas(glcapabilities) {
@Override
public void paint(Graphics g) {
if (parent_ != null) {
createDevTools(parent_, clientHandler_, getWindowHandle(), isTransparent_, 
null);
} else {
createBrowser(clientHandler_, getWindowHandle(), url_, isTransparent_, null, 
context_);
}
super.paint(g);
}
};

Frame frame = SWT_AWT.new_Frame(composite);
frame.add(canvas_); 

canvas_.addGLEventListener(new GLEventListener() {

..............

I get an error when I execute frame.add(canvas_); 

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d999829, pid=280, tid=6260
#
# JRE version: 7.0_21-b11
# Java VM: Java HotSpot(TM) Client VM (23.21-b01 mixed mode, sharing 
windows-x86 )
# Problematic frame:
# V  [jvm.dll+0xa9829]
#
# Failed to write core dump. Minidumps are not enabled by default on client 
versions of Windows
#
# An error report file with more information is saved as:
# C:\jcef_1916_1804\src\out\win32\Debug\hs_err_pid280.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#
[1211/093859:ERROR:stack_trace_win.cc(142)] SymInitialize failed: 87

[error occurred during error reporting , id 0x80000003]

[1211/093859:FATAL:context.cc(309)] Check failed: OnInitThread(). 
Error initializing symbols (87).  Dumping unresolved backtrace:
    3A5F4061
    3A54383F

Could you give me or explain the code regarding what you did to make it working.

I will try the very crude details given by you give.. But if you can help me.

thank's a lot for your response

philippe

Original comment by caussi...@yahoo.fr on 11 Dec 2014 at 8:46

Attachments:

GoogleCodeExporter commented 9 years ago
JCEF is transitioning from Google Code to Bitbucket project hosting. If you 
would like to continue receiving notifications on this issue please add 
yourself as a Watcher at the new location: 
https://bitbucket.org/chromiumembedded/java-cef/issue/39

Original comment by magreenb...@gmail.com on 18 Mar 2015 at 5:59