|
|
|
|
This site helps to do the first steps with the FXL Eclipse Editor.
Within the next months we will provide additional information
(guides, etc.)
and add new example projects. During this consolidation time,
the FXL Plugin has the beta status. If there are any questions,
bug reports or contribution/cooperation ideas, please feel free to send us a
email. |
|
|
| 1. Installation |
|
| In
order to install the newest FXL Eclipse Editor Plug-In, you can use the Eclipse
Update Manager (Help>Software
Updates>Find and Install...)
with the remote site http://plugins.fxl-project.com.
After a few 'next' steps, please enable the
FXL
features and finish the update process (Note: FXL requires GEF and
your Eclipse platform version should afterwards not be started with
a JRE). If you want to download all plugins manually, please visit the download
site. |
|
 |
|
| 2. Getting
Started |
|
|
Let us first open an empty workspace and create an empty java
project. |
|
 |
|
| 2.1 Enable the FXL support |
|
| Now
it is time to enable the FXL support for our new java project. Therefore,
please open the project specific properties page
(right-click on the project > Properties). Within the
appearing dialog, please choose the FXL entry on the left.
In the new frame you should enable the FXL support via the top-level check
box. Per default the indented check boxes are disabled, whereby FXL uses the default
paths for the FXL-Project (which is the project where all XML-models
and pipeline files are stored) and the FXL-Gen Project (which
defines the project where all model transformation results are
stored). Otherwise, the specified project folders are used. You
should enable the FXL-Builder check
box, so that the FXL pipeline/transformation execution is automatically handled
within the Eclipse build
cycles. Then press the Ok
button. |
|
 |
|
|
As a result, the
test.fxl and
test.fxl.generated
projects will be created. Refresh the projects, if the package
explorer shows errors. |
|
| 3. The HelloWorld
Example |
|
|
Now we can start to implement our
first
HelloWorld
example. Therefore, we create a
new HelloWorld.java
class, |
|
 |
|
|
close the default java editor and
reopen the HelloWorld.java
file with the FXL editor (right-click on the file > Open With |
FXL Editor ). Inside the FXL editor, all registered views are
displayed as a separate tab items. If the plain-text view has no
errors, you can take a look at the model view which shows the
underlying xml-based model (xApproach). Inside the pipeline view,
intra-model and inter-model transformations can be specified. You
should open the FXL Process Library (via the menu Window |
Show View | Other... | FXL | FXL Process Library ) to
get a list of pre-specified transformations.
|
|
| 3.1 Creating A Simple Pipeline |
|
|
Now we are able
to
drop the predefined 1:1 Copy library process in our active pipeline
window and connect the input and output boxes with it (Save
everything afterwards). If the FXL builder (see section 2.1) is
activated, the pipeline is executed automatically within the Eclipse build
process and the result is stored in the corresponding FXL-Gen
Project. In order to execute the pipeline manually, we can press
the start button (green arrow) in the tool bar. Then the intermediate results of
the executed
pipeline process are available (right-click on the specific process
> Show Result) until the pipeline will be stopped. |
|
 |
|
|
As a result of the pipeline
execution, a HelloWorld.java
file will appear in the
text.fxl.generated project
which is (as defined in our pipeline) a copy of the original
HelloWorld.java. To get a
feeling what happens behind the scene, let's have a quick look at
the
test.fxl
project. You usually find there three different kinds of folders:
XLang,
XLangT
and xPipe.
When a pipeline (which is stored in the
xPipe
folder) is executed, all necessary inputs are made available
as XML-files in the XLang
folder using the registered Lang2XLang converters. That's why you
can find a generated HelloWorld.xjava
file there. After the pipeline execution the result is stored in
the xLangT
folder. At the end of the build process all
xLangT
files are transformed via the corresponding
xLang2Lang
converters and stored in the FXL-Gen folder - in our case
test.fxl.generated. |
|
| 3.2 Creating A
Simple Transformation |
|
|
Now let's create our first
simple transformation. Therefore, we can either use XSLT or the
transformation language (TL) which is a FXL-registered domain specific
language (DSL). In another guide we will describe how you can
register your own views and DSLs, but let us first create a new
transformation file in the test project (right click on the project
New | File). |
|
 |
|
|
Currently, the creation of
transformations requires knowledge of the XML-based model of a
language (such as the xjava model for java). You can see the
specific XML-based model instance of a language document when you
open the model view
tab within the FXL editor. Basically, the FXL team will offer a more simplified creation of transformations in
the upcoming FXL Editor Plugin releases. But now let's do the 'low
level' way and create a transformation by hand which copies everything
(Note: Basic background knowledge in XSLT programming is expected).
|
|
 |
|
| 3.3 Creating A
Simple Logging Aspect |
|
|
Now we want to adapt our basic copy
transformation a little bit in order to provide a very simple
logging aspect which adds System.out
statements before and after the original method statements. Therefore, we add the following three templates to
the existing template in the
MyTransformation.tl file. |
|
 |
|
|
To avoid
these complex way of aspect specification via TL, existing aspect languages
(such as AspectJ, etc.) can be used/registered to provide an
appropriate level of abstraction. Internally, these aspect language
documents are transformed to TL documents. |
|
| 3.4 Modifying
the Pipeline |
|
|
In order to execute our newly
created transformation, we can modify our first pipeline which is
assigned to the HelloWorld.java
file. Therefore, we remove the old 1:1 Copy process and add a
1:1 Transform process from the library. Additionally, we drap&drop
the MyTransformation.tl
file from the package explorer and connect all inputs/outputs afterwards. |
|
 |
|
| 3.5 Creating A
Process Library Entry |
|
|
Now let us create a
process library entry for our new transformation so that other
programmers can reuse it. Make sure that the FXL Process Library is
open and right-click on a existing category or in the empty space (Create
Process). Then double-click the 'New process' entry which
will open the corresponding property view. (Note: If you want to
change the properties of an existing process in your pipeline this
view is also helpful.) Now we can give your process a new
Description,
Image
and Label.
Additionally, we change the Type
to TL
and let afterwards point the predefined tl
input to our new
MyTransformation.tl
file. |
|
 |
|
|
| 4. Next Steps |
|
|
Now you have the fundamental
knowledge to create your own pipelines and transformations. There
are a lot more things to discover. Please, study the existing
example projects first (import the projects into your workspace). If
there are any questions or if you want to contribute to the project,
please contact us. |
|
|