Skip to content

Commit

Permalink
Adds JFace and Draw2D demo
Browse files Browse the repository at this point in the history
  • Loading branch information
spket committed Feb 7, 2021
1 parent 1ac3751 commit 6faef13
Show file tree
Hide file tree
Showing 27 changed files with 2,311 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
**/bin
*.so
**/native-image/*-*.json

# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
16 changes: 16 additions & 0 deletions draw2d/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gtk"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.gef"/>
<classpathentry combineaccessrules="false" kind="src" path="/jface.standalone"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.swt"/>
<classpathentry combineaccessrules="false" kind="src" path="/Skija"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="res"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions draw2d/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>demo.draw2d</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
17 changes: 17 additions & 0 deletions draw2d/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
build source
```
./build.sh
```
run and generate configuration for native image
```
./run.sh -trace
```
build native image
```
./build.sh -native
```
launch
```
./draw2dapp
```
Blog: [Graalvm Native Image Demo - JFace and Draw2D](https://www.spket.com/blog/graalvm-native-image-demo-jface-and-draw2d/)
26 changes: 26 additions & 0 deletions draw2d/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! /bin/sh

if [ -z "$GRAALVM_HOME" ]; then
GRAALVM_HOME=$HOME/tools/graalvm
fi

LIBS_3RD=../../third-party
SWT_HOME=$LIBS_3RD/swt
SKIJA_HOME=$LIBS_3RD/skija
RCP_HOME=$LIBS_3RD/rcp
GEF_HOME=$LIBS_3RD/gef
CP=$SWT_HOME/swt.jar:$SKIJA_HOME/skija.jar:\
$RCP_HOME/plugins/org.eclipse.jface_3.22.0.v20201106-0834.jar:\
$RCP_HOME/plugins/org.eclipse.core.commands_3.9.800.v20201021-1339.jar:\
$RCP_HOME/plugins/org.eclipse.equinox.common_3.14.0.v20201102-2053.jar:\
$RCP_HOME/plugins/org.eclipse.ui.workbench_3.122.0.v20201122-1345.jar:\
$GEF_HOME/plugins/org.eclipse.draw2d_3.10.100.201606061308.jar:\
$GEF_HOME/plugins/org.eclipse.gef_3.11.0.201606061308.jar:\
$GEF_HOME/plugins/org.eclipse.zest.core_1.5.300.201606061308.jar:\
$GEF_HOME/plugins/org.eclipse.zest.layouts_1.1.300.201606061308.jar

if [ "$1" = "-native" ]; then
$GRAALVM_HOME/bin/native-image -cp bin:res:$CP com.spket.demo.draw2d.Draw2DApp draw2dapp
else
$GRAALVM_HOME/bin/javac -cp res:$CP -d bin -sourcepath src:gtk src/com/spket/demo/draw2d/Draw2DApp.java
fi
Loading

0 comments on commit 6faef13

Please sign in to comment.