Project

General

Profile

IntelliJ Idea Configuration

FWD since bzr branch 3821c revision 12128 contains preconfigured IntelliJ Idea module. It can be found in tools/ide/idea. Use it directly in your own Idea project or indirectly through Hotel GUI Demo Application, which since bzr revision 228 contains a complete Idea project. The following lines document this project. Use it to your own development needs.

Quick start

1. Checkout or download Hotel GUI Demo Application revision 228+.
2. Build the sample project by following the wiki page at least up to the point Hotel GUI Demo Application: Build Your Application.
3. Fetch the IDE dependencies (this is needed only once or after the dependencies change):

cd <hotel_gui_root>/p2j
./gradlew fetchDependencies

4. Run Idea.
5. Configure Java 8 in Idea, FWD requires this particular version.
6. From Idea open the project file <hotel_gui_root>/tools/ide/idea/hotel.ipr.

Project layout

The Hotel GUI Idea project contains two Idea modules. One for the core FWD itself and second for the Hotel GUI generated code and related resources. The modules point to the needed set of Java dependencies located in <project_root>/p2j/.lib/ and resolved by fetchDependencies Gradle target. The project is configured to write build outputs in <project_root>/tools/ide/idea/out.

The project has two run/debug configurations. FWD Server and FWD Client Swing GUI. As the names imply, the former is used to start FWD server, where all the converted business logic runs and the latter is the client Java process for presenting the program outputs and for handling user input.

FWD utilizes AspectJ framework. When built with Gradle the code is compiled with AspectJ compiler and all aspect-related code magic (weaving) is performed during compile time. Idea has only limited support for AspectJ and so the project is setup to perform the weaving on runtime, when the Hotel GUI application starts. For this reason both run/debug configurations supply -javaagent JVM arguments with the AspectJ weaver jar file and reference aop.xml in <project_root>/p2j/tools/ide/res/META-INF with all the needed AspectJ configurations.

The class path dependencies for both modules are declared in a particular order so that the expected class or resource is correctly resolved. For instance the class path for the Hotel GUI module must contain hotel.jar (to satisfy some of the FWD requirements on resource jars), which already contains the compiled converted legacy Java classes. For this reason the jar must appear on the class path after the project sources so that any edited Java classes are resolved first.

The classpath dependencies of both modules are defined as follows:

FWD

1. Java 1.8 classes
2. Module sources
3. FWD jar file dependencies

Hotel GUI

1. Java 1.8 classes
2. Module sources
3. hotel.jar
4. FWD module

Running/Debugging FWD

To run (or debug) the Hotel GUI project from Idea:

1. Start FWD Server run configuration.
2. Wait for the server to finish its initialization. Make sure there are no exceptions or error messages in the run/debug output window and wait for the output message "Server ready".
3. Start FWD Client Swing GUI run configuration.
4. The Hotel GUI login window will come up.

To automate the launch process feel free to install Multirun Idea plugin or similar.

Editing the code

Any Java source code changes in Idea will be correctly compiled by the IDE, no need to run Gradle. However certain changes do require hotel.jar to be rebuilt with Gradle (with the ant jar command). These changes include changes in the bitmap files used in the GUI, certain XML files, and so on. If your change doesn't show up in the launched application instance, rebuild with Gradle.

Obviously any changes to the ABL code must be reconverted following the CLI conversion process. This can't be currently handled by the IDE. Also make sure you backup any manual changes to the converted classes before reconversion.

Code Style

The file GCD_code_style.xml contains code style definitions for IntelliJ Idea exported from version 2022.2.3. To import press Ctrl+Alt+S to open the IDE settings and select Editor | Code Style.

Issues

TT:
For me the idea configuration could not run. After analyzing the server.sh script, I figured out that I had to change the VM options to

-Xmx4768m -server -Djava.ext.dirs=/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext:/usr/java/packages/lib/ext:../lib/spi -Djava.system.class.loader=com.goldencode.p2j.classloader.MultiClassLoader 

and the CLI arguments to

server.xml net:server:insecure_port=3333 net:connection:secure=true net:server:secure_port=3334

© 2004-2021 Golden Code Development Corporation. ALL RIGHTS RESERVED.

GCD_code_style.xml Magnifier (11.5 KB) Hynek Cihlar, 11/11/2022 08:04 AM