Menu

#868 IntelliJ Modules are not shared correctly

IntelliJ 0.1.0
closed-fixed
tobous
IntelliJ (27)
5
2019-12-02
2016-09-05
Bernd Sahre
No

Description:
Host Alice has a Module which contains a test folder, sources folder, and a <modulename>.iml file. There are two classes in the src folder.
If the Host shares this Module in Intellij with Bob, Bob gets all the files (.java and .iml) but not the whole Module.
Problem 1: The folders containing the files are only shown as directories, independent of their host-side status (e.g. Module, src folder, test folder, etc.). As a result, Bob cannot create classes (as it's only possible in Java Module src folders, not in plain directories).
Problem 2: Empty folders are not transmitted.</modulename>

Problem-Analysis:
Comparing the two projects of Alice and Bob, the result is following:

In the .idea folder (which contains the project meta data), there are differences in

  • misc.xml
  • workspace.xml
  • modules.xml

All other files are equivalent (except for own system configurations).

In the modules.xml file all Modules of the project are listed, and the transmitted Modul does not appear there. After copying the module.xml file from the Host to the client the corresponding module is shown correctly.

Another Problem (not solved with the Approach to Solution) is that nested Modules (Modules in Modules) are not transmitted correctly, because its hard to compute the path to the inner .iml file.

Approach to solution

Intellij provides a ModuleManager through the OpenAPI, which has a method "loadModule" to load a Module from an .iml file and add it to the project. This solves the problem.
To call this method, it is recommend to register a new class in the SarosLifeCycleListener and the Picocontainer so the method is called every time when Ressources are shared.
It is also appropiate to embed this method with

ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
        ApplicationManager.getApplication().runWriteAction(new Runnable() {
            loadModule(filepath);
            ....

to secure thread safety.

Discussion

<< < 1 2 (Page 2 of 2)
  • tobous

    tobous - 2018-03-22
    • labels: Intellij, IntelliJ --> IntelliJ
     
  • tobous

    tobous - 2019-12-02
    • Status: pending-fixed --> closed-fixed
     
<< < 1 2 (Page 2 of 2)

Log in to post a comment.

MongoDB Logo MongoDB