Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » FXML - Java Compiler
FXML - Java Compiler [message #1239158] Mon, 03 February 2014 14:13 Go to next message
Pablo Gomez is currently offline Pablo GomezFriend
Messages: 28
Registered: October 2013
Junior Member
Hi Tom!

I was checking your sample project for FXML - Java Compiler because definitely that's something we really need. The gained speed between fxml and java on low power devices is considerable!.

However, at least on my computer. The java generated receive a wrong package name: "package \demo;" and therefore when ant tries to compile with javac, it fails:


   [javac] Compiling 2 source files to C:\Users\gomez\workspaces\eclipse\ws_kepler_laboratory\CompilerTest\build\classes
    [javac] C:\Users\gomez\workspaces\eclipse\ws_kepler_laboratory\CompilerTest\build\gen-src\demo\Login.java:1: error: illegal character: '\'
    [javac] package \demo;
    [javac]         ^
    [javac] C:\Users\gomez\workspaces\eclipse\ws_kepler_laboratory\CompilerTest\build\gen-src\demo\Login.java:1: error: class, interface, or enum expected
    [javac] package \demo;
    [javac]          ^
    [javac] C:\Users\gomez\workspaces\eclipse\ws_kepler_laboratory\CompilerTest\build\gen-src\demo\Profile.java:1: error: illegal character: '\'
    [javac] package \demo;
    [javac]         ^
    [javac] C:\Users\gomez\workspaces\eclipse\ws_kepler_laboratory\CompilerTest\build\gen-src\demo\Profile.java:1: error: class, interface, or enum expected
    [javac] package \demo;
    [javac]          ^
    [javac] 4 errors



I'm using the argument: -Dbuild.compiler=javac1.7
Because otherwise I have a compiler not found javac1.8
At the moment I'm using ant 1.8.4

And my second question.

Assuming that I have the generated java and .class: I see that are under the folder build\classes\demo\

As far as I understood from your blog post, the ExtendedFXMLLoader.java will grab from the build folder the binary class files right? So basically in my application I should run the Ant script and in the Part.java use the ExtendedFXMLLoader instead of the FXMLLoader.


Is this open sourced already? we pointed our project today to the efxclipse 0.9 release but I don¡t see there the FXML-compiler classes. Perhaps I'm missing something in the target url (http://download.eclipse.org/efxclipse/runtime-released/0.9.0/site/) because I cannot see the org.fx.eclipse.fxml bundle

Thanks!!
Re: FXML - Java Compiler [message #1239177 is a reply to message #1239158] Mon, 03 February 2014 15:06 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

a) yes everything is opensourced
- ExtendedFXMLLoader is part of "org.eclipse.fx.core" which is part
of the runtime p2 repo
- The compiler is a build / time tool so it is *not* part of the
runtime p2 repo - it is found in "org.eclipse.fx.ide.fxml.compiler"

b) you get the compiler itself not as part of an update-site but as an
extra download [1]

c) Yes you simply replace the FXMLLoader through calls to
ExtendedFXMLLoader - but it will not search an extra classpath but
simply the classpath of your project so you need to make sure that
the generated .class-Files are packaged

In my sample ant-script you'll see that this is a 2 fold process:
* compile the project source using javac
* translate the FXML => Java-Files with the "compiler"
* compile the generated FXML-Files using javac

The reason for this 2 step process is that the "fxml-compiler" needs
e.g. the control to find out if it still has to use reflection to
access fields

d) On your compilation problem - it somehow looks like there's a "\" to
less stripped when calculating the path. Can you please give the
compiler from the release a try

e) Note that there are still gaps in the compiler that have to be
closed - e.g. the possibility to deal with include-directives, ... .
So if you come across any problems please file bug reports

f) -Dbuild.compiler=javac1.7 - yes this is a problem of a too old ANT
shipped with Eclipse. It will be fixed with Luna.

Tom

[1]http://download.eclipse.org/efxclipse/compiler-released/0.9.0/org.eclipse.fx.fxml.compiler_0.9.0.jar

On 03.02.14 15:13, Pablo Gomez wrote:
> Hi Tom!
>
> I was checking your sample project for FXML - Java Compiler because
> definitely that's something we really need. The gained speed between
> fxml and java on low power devices is considerable!.
>
> However, at least on my computer. The java generated receive a wrong
> package name: "package \demo;" and therefore when ant tries to compile
> with javac, it fails:
>
>
>
> [javac] Compiling 2 source files to
> C:\Users\gomez\workspaces\eclipse\ws_kepler_laboratory\CompilerTest\build\classes
>
> [javac]
> C:\Users\gomez\workspaces\eclipse\ws_kepler_laboratory\CompilerTest\build\gen-src\demo\Login.java:1:
> error: illegal character: '\'
> [javac] package \demo;
> [javac] ^
> [javac]
> C:\Users\gomez\workspaces\eclipse\ws_kepler_laboratory\CompilerTest\build\gen-src\demo\Login.java:1:
> error: class, interface, or enum expected
> [javac] package \demo;
> [javac] ^
> [javac]
> C:\Users\gomez\workspaces\eclipse\ws_kepler_laboratory\CompilerTest\build\gen-src\demo\Profile.java:1:
> error: illegal character: '\'
> [javac] package \demo;
> [javac] ^
> [javac]
> C:\Users\gomez\workspaces\eclipse\ws_kepler_laboratory\CompilerTest\build\gen-src\demo\Profile.java:1:
> error: class, interface, or enum expected
> [javac] package \demo;
> [javac] ^
> [javac] 4 errors
>
>
>
> I'm using the argument: -Dbuild.compiler=javac1.7
> Because otherwise I have a compiler not found javac1.8
> At the moment I'm using ant 1.8.4
>
> And my second question.
>
> Assuming that I have the generated java and .class: I see that are under
> the folder build\classes\demo\
>
> As far as I understood from your blog post, the ExtendedFXMLLoader.java
> will grab from the build folder the binary class files right? So
> basically in my application I should run the Ant script and in the
> Part.java use the ExtendedFXMLLoader instead of the FXMLLoader.
>
>
> Is this open sourced already? we pointed our project today to the
> efxclipse 0.9 release but I don¡t see there the FXML-compiler classes.
> Perhaps I'm missing something in the target url
> (http://download.eclipse.org/efxclipse/runtime-released/0.9.0/site/)
> because I cannot see the org.fx.eclipse.fxml bundle
>
> Thanks!!
>
Re: FXML - Java Compiler [message #1239479 is a reply to message #1239177] Tue, 04 February 2014 09:39 Go to previous messageGo to next message
Pablo Gomez is currently offline Pablo GomezFriend
Messages: 28
Registered: October 2013
Junior Member
ok clear thanks,
I have now another question, in the class where we load the parts we are using the FXMLLoaderFactory as follows
@PostConstruct
public void init(BorderPane pane, @FXMLLoader FXMLLoaderFactory factory) 
	FXMLBuilder<Node> builder = factory.loadRequestorRelative(FXML_RESOURCE_NAME);
	pane.setCenter(builder.load());{
}


Is it the ExtendedFXMLLoader somehow in the context or should we, for each part, to create an new instance?

best
Re: FXML - Java Compiler [message #1239487 is a reply to message #1239479] Tue, 04 February 2014 09:55 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
ok - well the FXMLLoaderFactory currently does not use the
ExtendedFXMLoader. You'd have to file a feature request to get this
feature there!

Tom

On 04.02.14 10:39, Pablo Gomez wrote:
> ok clear thanks,
> I have now another question, in the class where we load the parts we are
> using the FXMLLoaderFactory as follows
>
> @PostConstruct
> public void init(BorderPane pane, @FXMLLoader FXMLLoaderFactory factory)
> FXMLBuilder<Node> builder =
> factory.loadRequestorRelative(FXML_RESOURCE_NAME);
> pane.setCenter(builder.load());{
> }
>
>
> Is it the ExtendedFXMLLoader somehow in the context or should we, for
> each part, to create an new instance?
>
> best
Re: FXML - Java Compiler [message #1239548 is a reply to message #1239487] Tue, 04 February 2014 12:43 Go to previous messageGo to next message
Pablo Gomez is currently offline Pablo GomezFriend
Messages: 28
Registered: October 2013
Junior Member
ok I'll file a feature request.

Now I'm facing some issues regarding compilation. Below our ant file:

<project default="test">
	<path id="fxcompile">
		<filelist>
			<file name="target/classes"/>
			<file name="lib/org.eclipse.fx.fxml.compiler_0.9.0.jar"/>
		</filelist>
	</path>
	 <presetdef name="javac">
	    <javac includeantruntime="false" />
	  </presetdef>
	
	<path id="buildpath">
		<filelist>
			<file name="target/classes"/>
			<file name="lib/org.eclipse.fx.fxml.compiler_0.9.0.jar"/>
		</filelist>
	</path>
	
	<target name="test">
		<delete dir="build" />
		<mkdir dir="build/classes"/>
		
		<taskdef name="fxml-compiler" classpathref="fxcompile" classname="org.eclipse.fx.ide.fxml.compiler.ant.FXMLCompilerTask" />
		
		<javac srcdir="src" destdir="target/classes" classpathref="buildpath"></javac>
		
		<fxml-compiler sourcedir="src" destdir="target/gen-src"/>
		<javac srcdir="target/gen-src" destdir="target/classes" classpathref="buildpath"></javac>
	</target>
	
</project>




At first javac was failing, firing erros like the one below:
javac] C:\Users\gomez\workspaces\subversion\demo\src\demo\part\a\header\ControllerHeaderA.java:47: error: cannot find symbol
    [javac] 	private static Logger logger = LoggerFactory.getLogger(ControllerHeaderA.class);
    [javac] 	               ^
    [javac]   symbol:   class Logger
    [javac]   location: class ControllerHeaderA


So I give a try removing the javac as well as the remove and mkdir for the target folder ant tasks. So I now I have ensure that I have compiled all clases with eclipse - what javac task is intended to do- and I have launch the ant build. However, I get the following problem:
Buildfile: C:\Users\gomez\workspaces\subversion\demo\build.xml
Trying to override old definition of task javac
test:
[fxml-compiler] Compiling C:\Users\gomez\workspaces\subversion\demo\src\demo\part\a\footer\FooterA.fxml
[fxml-compiler] log4j:WARN No appenders could be found for logger (org.eclipse.xtext.common.types.access.impl.DeclaredTypeFactory).
[fxml-compiler] log4j:WARN Please initialize the log4j system properly.

BUILD FAILED
C:\Users\gomez\workspaces\subversion\demo\build.xml:17: java.lang.NoClassDefFoundError: org/slf4j/Logger


Before I was getting a NullPointer exception. But, for some reason I don't manage to get it again and I only receive this error related to the slf4j. In our project we are using slf4j but I don't see any reference to that class in the FXML. I wanted to debug inside the compiler but I'm not sure what is the java class, the source from this one org.eclipse.fx.ide.fxml.compiler.ant.FXMLCompilerTask I don't see it.

[Updated on: Tue, 04 February 2014 15:46]

Report message to a moderator

Re: FXML - Java Compiler [message #1239550 is a reply to message #1239548] Tue, 04 February 2014 12:50 Go to previous messageGo to next message
Pablo Gomez is currently offline Pablo GomezFriend
Messages: 28
Registered: October 2013
Junior Member
Quote:
ok - well the FXMLLoaderFactory currently does not use the
ExtendedFXMLoader. You'd have to file a feature request to get this
feature there!

Tom


Feature request filled here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=427359
Re: FXML - Java Compiler [message #1239554 is a reply to message #1239548] Tue, 04 February 2014 13:00 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
On 04.02.14 13:43, Pablo Gomez wrote:
> ok I'll file a feature request.
>
> Now I'm facing some issues regarding compilation. Below our ant file:
>
>
> <project default="test">
> <path id="fxcompile">
> <filelist>
> <file name="target/classes"/>
> <file name="lib/org.eclipse.fx.fxml.compiler_0.9.0.jar"/>
> </filelist>
> </path>
> <presetdef name="javac">
> <javac includeantruntime="false" />
> </presetdef>
>
> <path id="buildpath">
> <filelist>
> <file name="target/classes"/>
> <file name="lib/org.eclipse.fx.fxml.compiler_0.9.0.jar"/>
> </filelist>
> </path>
>
> <target name="test">
> <delete dir="build" />
> <mkdir dir="build/classes"/>
>
> <taskdef name="fxml-compiler" classpathref="fxcompile"
> classname="org.eclipse.fx.ide.fxml.compiler.ant.FXMLCompilerTask" />
>
> <javac srcdir="src" destdir="target/classes"
> classpathref="buildpath"></javac>
>
> <fxml-compiler sourcedir="src" destdir="target/gen-src"/>
> <javac srcdir="target/gen-src" destdir="target/classes"
> classpathref="buildpath"></javac>
> </target>
>
> </project>
>
>
>
>
> At first javac was failing, firing erros like the one below:
>
> javac]
> C:\Users\gomez\workspaces\subversion\keplastnew\applications\Widgetsdemo\keba.widgetsdemo.app\src\keba\widgetsdemo\part\a\header\ControllerHeaderA.java:47:
> error: cannot find symbol
> [javac] private static Logger logger =
> LoggerFactory.getLogger(ControllerHeaderA.class);
> [javac] ^
> [javac] symbol: class Logger
> [javac] location: class ControllerHeaderA
>
>

Well your compilation classpath needs to hold org.eclipse.fx.core, if
you are doing this in your workspace you only need to create a 2nd
src-folder (e.g. src-gen) and use that one as the destdir in your
eclipse and omit the compilation completely!

<project default="test">
<path id="fxcompile">
<filelist>
<file name="bin"/>
<file name="lib/org.eclipse.fx.fxml.compiler_0.9.0.jar"/>
</filelist>
</path>
<target name="convertToJava">
<taskdef name="fxml-compiler" classpathref="fxcompile"
classname="org.eclipse.fx.ide.fxml.compiler.ant.FXMLCompilerTask" />
<fxml-compiler sourcedir="src" destdir="src-gen"/>
</target>
</project>

If this is an OSGi-Project don't forget to adjust the build.properties

Tom
Re: FXML - Java Compiler [message #1239618 is a reply to message #1239554] Tue, 04 February 2014 15:57 Go to previous messageGo to next message
Pablo Gomez is currently offline Pablo GomezFriend
Messages: 28
Registered: October 2013
Junior Member
The project I'm working with is OSGi, so we have multiple bundles and therefore multiple 'bin' folders. So in our case I guess I should add al dependent binaries to the ant.


What I don't see at the moment is why it requires access to non javafx classes or classes that are not referenced by the FXML at all.
Buildfile: C:\workspaces\demo\build.xml
convertToJava:
[fxml-compiler] Compiling C:\src\demo\part\a\footer\FooterA.fxml
[fxml-compiler] log4j:WARN No appenders could be found for logger (org.eclipse.xtext.common.types.access.impl.DeclaredTypeFactory).
[fxml-compiler] log4j:WARN Please initialize the log4j system properly.

BUILD FAILED
C:\workspaces\subversion\demo\build.xml:13: java.lang.NoClassDefFoundError: org/eclipse/e4/ui/model/application/ui/basic/MPart

Total time: 2 seconds



actually that FooterA.fxml is pure javafx class

this is my ant at the moment:
<project default="convertToJava">
	<path id="fxcompile">
		<filelist>
			<file name="bin"/>
			<file name="C:/workspaces/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.fx.core_0.9.0.201401250701.jar"/>
			<file name="C:/workspaces/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.slf4j.api_1.7.2.v20121108-1250.jar"/>			<file name="target/classes"/>
			<file name="lib/org.eclipse.fx.fxml.compiler_0.9.0.jar"/>
		</filelist>
	</path>
	
	<target name="convertToJava">
		<taskdef name="fxml-compiler" classpathref="fxcompile" classname="org.eclipse.fx.ide.fxml.compiler.ant.FXMLCompilerTask" />
		<fxml-compiler sourcedir="src" destdir="target/src-gen"/>
	</target>
	
</project>


I know that it is not good to grab jar from that .metadata folder, but at the moment I'd like to make simply one compilation.
Re: FXML - Java Compiler [message #1239639 is a reply to message #1239618] Tue, 04 February 2014 17:11 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
The downloaded compiler is a repackageing of many different
dependencies! You can't simply use the one found in your bundles.

Tom

On 04.02.14 16:57, Pablo Gomez wrote:
> The project I'm working with is OSGi, so we have multiple bundles and
> therefore multiple 'bin' folders. So in our case I guess I should add al
> dependent binaries to the ant.
>
>
> What I don't see at the moment is why it requires access to non javafx
> classes or classes that are not referenced by the FXML at all.
>
> Buildfile: C:\workspaces\demo\build.xml
> convertToJava:
> [fxml-compiler] Compiling C:\src\demo\part\a\footer\FooterA.fxml
> [fxml-compiler] log4j:WARN No appenders could be found for logger
> (org.eclipse.xtext.common.types.access.impl.DeclaredTypeFactory).
> [fxml-compiler] log4j:WARN Please initialize the log4j system properly.
>
> BUILD FAILED
> C:\workspaces\subversion\demo\build.xml:13:
> java.lang.NoClassDefFoundError:
> org/eclipse/e4/ui/model/application/ui/basic/MPart
>
> Total time: 2 seconds
>
>
>
> actually that FooterA.fxml is pure javafx class
>
> this is my ant at the moment:
>
> <project default="convertToJava">
> <path id="fxcompile">
> <filelist>
> <file name="bin"/>
> <file
> name="C:/workspaces/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.fx.core_0.9.0.201401250701.jar"/>
>
> <file
> name="C:/workspaces/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.slf4j.api_1.7.2.v20121108-1250.jar"/>
> <file name="target/classes"/>
> <file name="lib/org.eclipse.fx.fxml.compiler_0.9.0.jar"/>
> </filelist>
> </path>
>
> <target name="convertToJava">
> <taskdef name="fxml-compiler" classpathref="fxcompile"
> classname="org.eclipse.fx.ide.fxml.compiler.ant.FXMLCompilerTask" />
> <fxml-compiler sourcedir="src" destdir="target/src-gen"/>
> </target>
>
> </project>
>
>
> I know that it is not good to grab jar from that .metadata folder, but
> at the moment I'd like to make simply one compilation.
Re: FXML - Java Compiler [message #1239950 is a reply to message #1239639] Wed, 05 February 2014 11:23 Go to previous messageGo to next message
Pablo Gomez is currently offline Pablo GomezFriend
Messages: 28
Registered: October 2013
Junior Member
Quote:

The downloaded compiler is a repackageing of many different
dependencies! You can't simply use the one found in your bundles.

Tom



I think I have missunderstood you, do you mean the FXGraphCompiler?

Basically the compiler library downloaded from the link you have provided I have added it to the buildpath of the project as well as to the ant file:

<file name="lib/org.eclipse.fx.fxml.compiler_0.9.0.jar"/>


What I'm not sure whether is necessary that the compiler task requires as many dependencies as dependencies has the Controller of the fxml. I think this should not be necessary because to generate a java out of a fxml, processing the controller implementation I think is not useful and should not be done. For instance if in the fxml declaration we have:
fx:controller="footer.ControllerFooterA"


This will provoke the need in the compiler task to add as many dependencies as the controller needs. For instance if in the controller I have

@Inject
MPart part


The compiler task will require to add the library
<file name="org.eclipse.e4.ui.model.workbench....jar"/>

and so on.


So I have added these dependencies from my Footer.fxml and now it has been generated succesfully.

However, now I got null pointer exception generating another file. After running the ant in debug mode, I have noticed that is because the Task is not able to find a custom JavaFX control that is provided by one of our project bundles and it is used in the fxml, I added it and it worked out. In any case I assume that a ClassNotFound should be thrown instead of a NullPointer


BUILD FAILED
C:\demo\build.xml:19: java.lang.NullPointerException
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:392)
	at org.apache.tools.ant.Target.performTasks(Target.java:413)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
	at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
	at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)
Caused by: java.lang.NullPointerException
	at org.eclipse.xtext.common.types.access.impl.ClassNameUtil.normalizeClassName(ClassNameUtil.java:16)
	at org.eclipse.xtext.common.types.access.impl.ClassFinder.forName(ClassFinder.java:57)
	at org.eclipse.xtext.common.types.access.impl.ClasspathTypeProvider.findTypeByName(ClasspathTypeProvider.java:109)
	at org.eclipse.fx.ide.fxml.compiler.FXMLSaxHandler.startElement(FXMLSaxHandler.java:198)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
	at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:355)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2770)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
	at org.eclipse.fx.ide.fxml.compiler.FXGraphCompiler.compileFXML(FXGraphCompiler.java:98)
	at org.eclipse.fx.ide.fxml.compiler.FXGraphCompiler.compile(FXGraphCompiler.java:138)
	at org.eclipse.fx.ide.fxml.compiler.ant.CompilerTask$1.call(CompilerTask.java:85)
	at org.eclipse.fx.ide.fxml.compiler.ant.CompilerTask$FileFinder.visitFile(CompilerTask.java:109)
	at org.eclipse.fx.ide.fxml.compiler.ant.CompilerTask$FileFinder.visitFile(CompilerTask.java:1)
	at java.nio.file.Files.walkFileTree(Files.java:2667)
	at java.nio.file.Files.walkFileTree(Files.java:2739)
	at org.eclipse.fx.ide.fxml.compiler.ant.CompilerTask.execute(CompilerTask.java:79)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	... 10 more

Total time: 3 seconds



best
Pablo
Re: FXML - Java Compiler [message #1239953 is a reply to message #1239950] Wed, 05 February 2014 11:27 Go to previous messageGo to next message
Pablo Gomez is currently offline Pablo GomezFriend
Messages: 28
Registered: October 2013
Junior Member
is the CompilerTask source code available? So I could debug
Re: FXML - Java Compiler [message #1239958 is a reply to message #1239950] Wed, 05 February 2014 11:42 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
On 05.02.14 12:23, Pablo Gomez wrote:
> Quote:
>> The downloaded compiler is a repackageing of many different
>> dependencies! You can't simply use the one found in your bundles.
>>
>> Tom
>
>
> I think I have missunderstood you, do you mean the FXGraphCompiler?
>
> Basically the compiler library downloaded from the link you have
> provided I have added it to the buildpath of the project as well as to

the project does not need it.

> the ant file:
>
> <file name="lib/org.eclipse.fx.fxml.compiler_0.9.0.jar"/>
>

that is ok


>
> What I'm not sure whether is necessary that the compiler task requires
> as many dependencies as dependencies has the Controller of the fxml. I
> think this should not be necessary because to generate a java out of a
> fxml, processing the controller implementation I think is not useful and
> should not be done. For instance if in the fxml declaration we have:
>
> fx:controller="footer.ControllerFooterA"
>
>
> This will provoke the need in the compiler task to add as many
> dependencies as the controller needs. For instance if in the controller
> I have
>

I need to load the controller to find out how I can access the fields
and methods. If you happend to declare them as e.g. private i need to
find that out because I have to fall back to reflection. Need to think
if this could be solved differently.

Tom
Re: FXML - Java Compiler [message #1240365 is a reply to message #1239958] Thu, 06 February 2014 09:51 Go to previous messageGo to next message
Pablo Gomez is currently offline Pablo GomezFriend
Messages: 28
Registered: October 2013
Junior Member
I'm having the following issue with the following fxml (I have simplified the fxml, so is easy to read and the problem still persists):
<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.collections.*?>
<?import javafx.scene.chart.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<?import javafx.scene.shape.*?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>

<AnchorPane fx:id="rootElem" id="rootElem" maxHeight="600.0" maxWidth="800.0" minHeight="600.0" minWidth="800.0" prefHeight="600.0" prefWidth="800.0" xmlns:fx="http://javafx.com/fxml">
  <children>
            <TitledPane animated="false" layoutX="26.0" layoutY="294.0" minWidth="226.0" prefHeight="273.0" prefWidth="236.0" text="Groups">
              <content>
                <AnchorPane id="Content" minHeight="0.0" minWidth="0.0" prefHeight="223.0" prefWidth="226.0">
                  <children>           
                    <TitledPane animated="false" layoutX="10.0" layoutY="152.0" minWidth="151.0" prefHeight="90.0" prefWidth="200.0" text="Boolean Group">
                      <content>
                        <AnchorPane id="Content" minHeight="0.0" minWidth="0.0" prefHeight="73.0" prefWidth="148.0">
                          <children>
                            <CheckBox id="CheckBox1" layoutX="23.0" layoutY="8.0" mnemonicParsing="false" text="CheckBox1" />
                            <CheckBox id="CheckBox2" layoutX="23.0" layoutY="36.0" mnemonicParsing="false" text="CheckBox2" />
                          </children>
                        </AnchorPane>
                      </content>
                    </TitledPane>
                  </children>
                </AnchorPane>
              </content>
            </TitledPane>
  </children>
</AnchorPane>





Exception by the compiler task:
build.xml:32: java.lang.ClassCastException: org.eclipse.fx.ide.fxgraph.fXGraph.impl.ElementImpl cannot be cast to org.eclipse.fx.ide.fxgraph.fXGraph.Property
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:435)
	at org.apache.tools.ant.Target.performTasks(Target.java:456)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:36)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
	at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:452)
	at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:139)
Caused by: java.lang.ClassCastException: org.eclipse.fx.ide.fxgraph.fXGraph.impl.ElementImpl cannot be cast to org.eclipse.fx.ide.fxgraph.fXGraph.Property
	at org.eclipse.fx.ide.fxml.compiler.FXMLSaxHandler.startElement(FXMLSaxHandler.java:184)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
	at javax.xml.parsers.SAXParser.parse(Unknown Source)
	at org.eclipse.fx.ide.fxml.compiler.FXGraphCompiler.compileFXML(FXGraphCompiler.java:98)
	at org.eclipse.fx.ide.fxml.compiler.FXGraphCompiler.compile(FXGraphCompiler.java:138)
	at org.eclipse.fx.ide.fxml.compiler.ant.CompilerTask$1.call(CompilerTask.java:85)
	at org.eclipse.fx.ide.fxml.compiler.ant.CompilerTask$FileFinder.visitFile(CompilerTask.java:109)
	at org.eclipse.fx.ide.fxml.compiler.ant.CompilerTask$FileFinder.visitFile(CompilerTask.java:1)
	at java.nio.file.Files.walkFileTree(Unknown Source)
	at java.nio.file.Files.walkFileTree(Unknown Source)
	at org.eclipse.fx.ide.fxml.compiler.ant.CompilerTask.execute(CompilerTask.java:79)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	... 10 more



Can I help somehow? I'm very interested in this feature!

At the moment I'm using Eclipse Luna M5 with efxclipse and compiler 1.0.0

[Updated on: Thu, 06 February 2014 09:51]

Report message to a moderator

Re: FXML - Java Compiler [message #1240372 is a reply to message #1240365] Thu, 06 February 2014 10:01 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Please file a bug

Tom

On 06.02.14 10:51, Pablo Gomez wrote:
> I'm having the following issue with the following fxml (I have
> simplified the fxml, so is easy to read and the problem still persists):
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <?import java.lang.*?>
> <?import java.util.*?>
> <?import javafx.collections.*?>
> <?import javafx.scene.chart.*?>
> <?import javafx.scene.control.*?>
> <?import javafx.scene.image.*?>
> <?import javafx.scene.layout.*?>
> <?import javafx.scene.paint.*?>
> <?import javafx.scene.shape.*?>
> <?import javafx.scene.control.TextField?>
> <?import javafx.scene.control.ComboBox?>
> <?import javafx.scene.control.Label?>
>
> <AnchorPane fx:id="rootElem" id="rootElem" maxHeight="600.0"
> maxWidth="800.0" minHeight="600.0" minWidth="800.0" prefHeight="600.0"
> prefWidth="800.0" xmlns:fx="http://javafx.com/fxml">
> <children>
> <TitledPane animated="false" layoutX="26.0" layoutY="294.0"
> minWidth="226.0" prefHeight="273.0" prefWidth="236.0" text="Groups">
> <content>
> <AnchorPane id="Content" minHeight="0.0" minWidth="0.0"
> prefHeight="223.0" prefWidth="226.0">
> <children> <TitledPane
> animated="false" layoutX="10.0" layoutY="152.0" minWidth="151.0"
> prefHeight="90.0" prefWidth="200.0" text="Boolean Group">
> <content>
> <AnchorPane id="Content" minHeight="0.0"
> minWidth="0.0" prefHeight="73.0" prefWidth="148.0">
> <children>
> <CheckBox id="CheckBox1" layoutX="23.0"
> layoutY="8.0" mnemonicParsing="false" text="CheckBox1" />
> <CheckBox id="CheckBox2" layoutX="23.0"
> layoutY="36.0" mnemonicParsing="false" text="CheckBox2" />
> </children>
> </AnchorPane>
> </content>
> </TitledPane>
> </children>
> </AnchorPane>
> </content>
> </TitledPane>
> </children>
> </AnchorPane>
>
>
>
>
>
> Exception by the compiler task:
>
> build.xml:32: java.lang.ClassCastException:
> org.eclipse.fx.ide.fxgraph.fXGraph.impl.ElementImpl cannot be cast to
> org.eclipse.fx.ide.fxgraph.fXGraph.Property
> at
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:116)
> at org.apache.tools.ant.Task.perform(Task.java:348)
> at org.apache.tools.ant.Target.execute(Target.java:435)
> at org.apache.tools.ant.Target.performTasks(Target.java:456)
> at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
> at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
> at
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>
> at
> org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:36)
>
> at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
> at
> org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:452)
>
> at
> org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:139)
>
> Caused by: java.lang.ClassCastException:
> org.eclipse.fx.ide.fxgraph.fXGraph.impl.ElementImpl cannot be cast to
> org.eclipse.fx.ide.fxgraph.fXGraph.Property
> at
> org.eclipse.fx.ide.fxml.compiler.FXMLSaxHandler.startElement(FXMLSaxHandler.java:184)
>
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
> Source)
> at
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
> at javax.xml.parsers.SAXParser.parse(Unknown Source)
> at
> org.eclipse.fx.ide.fxml.compiler.FXGraphCompiler.compileFXML(FXGraphCompiler.java:98)
>
> at
> org.eclipse.fx.ide.fxml.compiler.FXGraphCompiler.compile(FXGraphCompiler.java:138)
>
> at
> org.eclipse.fx.ide.fxml.compiler.ant.CompilerTask$1.call(CompilerTask.java:85)
>
> at
> org.eclipse.fx.ide.fxml.compiler.ant.CompilerTask$FileFinder.visitFile(CompilerTask.java:109)
>
> at
> org.eclipse.fx.ide.fxml.compiler.ant.CompilerTask$FileFinder.visitFile(CompilerTask.java:1)
>
> at java.nio.file.Files.walkFileTree(Unknown Source)
> at java.nio.file.Files.walkFileTree(Unknown Source)
> at
> org.eclipse.fx.ide.fxml.compiler.ant.CompilerTask.execute(CompilerTask.java:79)
>
> at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
> ... 10 more
>
>
>
> Can I help somehow? I'm very interested in this feature!
>
> At the momento I'm using Eclipse Luna M5 with efxclipse and compiler 1.0.0
>
Re: FXML - Java Compiler [message #1240382 is a reply to message #1240372] Thu, 06 February 2014 10:22 Go to previous messageGo to next message
Pablo Gomez is currently offline Pablo GomezFriend
Messages: 28
Registered: October 2013
Junior Member
here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=427551
Re: FXML - Java Compiler [message #1249477 is a reply to message #1240382] Tue, 18 February 2014 09:37 Go to previous messageGo to next message
Pablo Gomez is currently offline Pablo GomezFriend
Messages: 28
Registered: October 2013
Junior Member
Hi Tom!

any progress in the compiler? also I'm wondering how it is planned to manage the language translations or if the compiler already does it. - eg. fxml tag: text=%key - Does the generated code have access to the ResourceBundle so that it retrieves the appropiate language value given the key in runtime? Or on the contrary multiple java files are generated so that the extended loader will load the apropiate one? e.g. one for each available language. Or another alternative?

best
Pablo
Re: FXML - Java Compiler [message #1249536 is a reply to message #1249477] Tue, 18 February 2014 10:49 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
If you look at FXMLDocument you'll see that the ResourceBundle is pushed
into it!

Tom

On 18.02.14 10:37, Pablo Gomez wrote:
> Hi Tom!
>
> any progress in the compiler? also I'm wondering how it is planned
> to manage the language translations or if the compiler already does it.
> - eg. fxml tag: text=%key - Does the generated code have access to the
> ResourceBundle so that it retrieves the appropiate language value given
> the key in runtime? Or on the contrary multiple java files are generated
> so that the extended loader will load the apropiate one? e.g. one for
> each available language. Or another alternative?
>
> best
> Pablo
>
Re: FXML - Java Compiler [message #1249647 is a reply to message #1249536] Tue, 18 February 2014 13:28 Go to previous messageGo to next message
Pablo Gomez is currently offline Pablo GomezFriend
Messages: 28
Registered: October 2013
Junior Member
I see that's great
Pablo
Re: FXML - Java Compiler [message #1284318 is a reply to message #1249647] Fri, 04 April 2014 10:35 Go to previous messageGo to next message
Pablo Gomez is currently offline Pablo GomezFriend
Messages: 28
Registered: October 2013
Junior Member
Hi Tom!

I was about to try the last nightly build of the compiler. But now I'm having this dependency issue:

C:\app\test\build.xml:32: java.lang.NoClassDefFoundError: org/eclipse/xtext/xbase/services/XbaseGrammarAccess$OpPostfixElements


Perhaps you have a newer build.xml so I'm using an old version so I might now missing something

Thx!
Re: FXML - Java Compiler [message #1286925 is a reply to message #1284318] Mon, 07 April 2014 07:44 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
In my tests I'm not running the code directly inside my eclipse as a
java program. I'll try the generated compiler later but I think to find
problems faster and maybe debug them yourself you should simply fetch
the compiler from git and launch it as a java-application.

Tom

On 04.04.14 12:35, Pablo Gomez wrote:
> Hi Tom!
>
> I was about to try the last nightly build of the compiler. But now I'm
> having this dependency issue:
>
> C:\app\test\build.xml:32: java.lang.NoClassDefFoundError:
> org/eclipse/xtext/xbase/services/XbaseGrammarAccess$OpPostfixElements
>
>
> Perhaps you have a newer build.xml so I'm using an old version so I
> might now missing something
>
> Thx!
>
Re: FXML - Java Compiler [message #1290708 is a reply to message #1286925] Thu, 10 April 2014 11:02 Go to previous message
Pablo Gomez is currently offline Pablo GomezFriend
Messages: 28
Registered: October 2013
Junior Member
launched as java application it worked

Pablo
Previous Topic:e(fx)clipse nightly are based on Luna
Next Topic:Nightly Builds of Tooling &amp; Runtime require JavaSE-8
Goto Forum:
  


Current Time: Thu Mar 28 09:48:28 GMT 2024

Powered by FUDForum. Page generated in 0.03864 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top