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 1 of 2)
  • Bernd Sahre

    Bernd Sahre - 2016-09-05

    The .iml files of the sender/reciever seem fine and are equivalent on both sides.

     
    • Franz Zieris

      Franz Zieris - 2016-09-05

      Are you aware of the .idea/modules.xml (github.com)?

       
  • Bernd Sahre

    Bernd Sahre - 2016-09-06

    @Franz:
    I did a div between the two preojects of the Host/Client, the result is following:

    all empty folders are only host-sided
    there are differences between
    misc.xml
    workspace.xml
    modules.xml
    in the .idea folder (META Data of project)

    the transmitted files are missed in modules.xml client-sided, and the Host has some components as "EntryPointManager", "FileEditorManager" and "EditorHistoryManager" which doesnt appear client-side. There are also some minor differences which i think are referable to the different PCs i tested this.

     
    • Franz Zieris

      Franz Zieris - 2016-09-06

      This should be part of the bug description, not the discussion on it.

       
  • Franz Zieris

    Franz Zieris - 2016-09-06
    • summary: Saros/I Modules are not shared correctly --> IntelliJ Modules are not shared correctly
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,7 +1,7 @@
     Scenario:
    -Host A has a Module contains a Testfolder, sources folder and a modulename.iml file. In the src folder are two classes (file1.java, file2.java).
    -If the Host shares this Module in Intellij with Client B, B get all the files(.java and .iml), but the folders contains the files are only showed as "Directories", independent of their current host-sided status (e.g. Modules, src-Folders, Test-Folders, Testsources etc.). 
    +Host A has a Module which contains a Testfolder, sources folder and a modulename.iml file. In the src folder are two classes (file1.java, file2.java).
    +If the Host shares this Module in Intellij with Client B, B get all the files (.java and .iml), but the folders containing the files are only shown as "Directories", independent of their current host-sided status (e.g. Modules, src-Folders, Test-Folders, Testsources etc.). 
    
    -As a result, the Reciever cannot create classes (as its only possible in java-Module-src-folders, not in Directories) and the .java files are marked as error-prone.
    +As a result, the Reciever cannot create classes (as it's only possible in java-Module-src-folders, not in Directories) and the .java files are marked as error-prone.
    
    -Furthermore, empty folders (e.g. empty src folders or directories) are not sended.
    +Furthermore, empty folders (e.g. empty src folders or directories) are not sent.
    
     
  • Franz Zieris

    Franz Zieris - 2016-09-06

    What does "marked as error-prone" mean?

     
    • Bernd Sahre

      Bernd Sahre - 2016-09-06

      If a .java file exists in a folder where it doesnt belong, Intellij mark this file with a red J (maybe error-prone is the wrong word for it. Not maybe, certainly).

       
      • Franz Zieris

        Franz Zieris - 2016-09-06

        Well, then please change the bug description to something that makes sense.

         
  • Bernd Sahre

    Bernd Sahre - 2016-09-06
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -5,3 +5,11 @@
     As a result, the Reciever cannot create classes (as it's only possible in java-Module-src-folders, not in Directories) and the .java files are marked as error-prone.
    
     Furthermore, empty folders (e.g. empty src folders or directories) are not sent.
    +
    +I did a div between the two preojects of the Host/Client, the result is following:
    +there are differences between
    +misc.xml
    +workspace.xml
    +modules.xml
    +in the .idea folder (META Data of project)
    +the transmitted files are missed in modules.xml client-sided, and the Host has some components as "EntryPointManager", "FileEditorManager" and "EditorHistoryManager" which doesnt appear client-side. There are also some minor differences which i think are referable to the different PCs i tested this.
    
     
    • Franz Zieris

      Franz Zieris - 2016-09-06

      Would you please make sure your spelling is correct ("preojects", "div", ...) and use some markup (or markdown, to be precise) to structure the bug description? Click on the little question mark in the top right corner of the text field to learn more about the syntax.

       
  • Stefan Rossbach

    Stefan Rossbach - 2016-09-06

    I think you should ensure that all files are transmitted.

    Eclipse has the same "issue" but that does not matter. We just create an empty non language specific project and when the .project file is being created or overwritten, Eclipse will correctly update the project.

     
  • Bernd Sahre

    Bernd Sahre - 2016-09-06
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,15 +1,25 @@
    -Scenario:
    -Host A has a Module which contains a Testfolder, sources folder and a modulename.iml file. In the src folder are two classes (file1.java, file2.java).
    +**Intellij Modules are shared as Directories**
    +
    +-----
    +
    +Description:
    +_Host A has a Module which contains a Testfolder, sources folder and a modulename.iml file. In the src folder are two classes.
     If the Host shares this Module in Intellij with Client B, B get all the files (.java and .iml), but the folders containing the files are only shown as "Directories", independent of their current host-sided status (e.g. Modules, src-Folders, Test-Folders, Testsources etc.). 
    +As a result, the Reciever cannot create classes (as it's only possible in java-Module-src-folders, not in Directories). The files(.java, .iml) are transmitted correctly but empty folders are not sent, only if they contain files or other folders._
    
    -As a result, the Reciever cannot create classes (as it's only possible in java-Module-src-folders, not in Directories) and the .java files are marked as error-prone.
    +**Problem-Analysis**
    
    -Furthermore, empty folders (e.g. empty src folders or directories) are not sent.
    +I compared the two projects of the Host/Client, the result is following:
    
    -I did a div between the two preojects of the Host/Client, the result is following:
     there are differences between
    -misc.xml
    -workspace.xml
    -modules.xml
    -in the .idea folder (META Data of project)
    -the transmitted files are missed in modules.xml client-sided, and the Host has some components as "EntryPointManager", "FileEditorManager" and "EditorHistoryManager" which doesnt appear client-side. There are also some minor differences which i think are referable to the different PCs i tested this.
    +* _misc.xml_
    +* _workspace.xml_
    +* _modules.xml_
    +in the .idea folder (META Data of project). 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 doesnt appear there. After copying the _module.xml_ file from the Host to the client the corresponding module is shown correctly.
    +
    +**Approach to solution**
    +
    +Intellij provide a _ModuleManager.class_ in the openapi Library, which hast a method "loadModules" which load a Module from an .iml file and adds it to the project, i think also to the _modules.xml_ file.
    +The problem is where to create the instance of the ModuleManager (abstract class) because Saros recieves and saves the incoming Data in the _IncomingProjectNegotiation.java_, which is located in de.fu_berlin.inf.core and not in the Intellij Plugin.
    
     
  • Franz Zieris

    Franz Zieris - 2016-09-06
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,23 +1,21 @@
    -**Intellij Modules are shared as Directories**
    +**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.
    
    ------
    +**Problem-Analysis**:
    +Comparing the two projects of Alice and Bob, the result is following:
    
    -Description:
    -_Host A has a Module which contains a Testfolder, sources folder and a modulename.iml file. In the src folder are two classes.
    -If the Host shares this Module in Intellij with Client B, B get all the files (.java and .iml), but the folders containing the files are only shown as "Directories", independent of their current host-sided status (e.g. Modules, src-Folders, Test-Folders, Testsources etc.). 
    -As a result, the Reciever cannot create classes (as it's only possible in java-Module-src-folders, not in Directories). The files(.java, .iml) are transmitted correctly but empty folders are not sent, only if they contain files or other folders._
    +In the _.idea_ folder (which contains the project meta data), there are differences in
    
    -**Problem-Analysis**
    -
    -I compared the two projects of the Host/Client, the result is following:
    -
    -there are differences between
    
     * _misc.xml_
     * _workspace.xml_
     * _modules.xml_
    -in the .idea folder (META Data of project). 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 doesnt appear there. After copying the _module.xml_ file from the Host to the client the corresponding module is shown correctly.
    +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.
    
     **Approach to solution**
    
     
  • Franz Zieris

    Franz Zieris - 2016-09-06

    I reformatted the description and cleaned up the sentences.

     
  • Franz Zieris

    Franz Zieris - 2016-09-23
    • Labels: IntelliJ --> IntelliJ, Intellij
     
  • Franz Zieris

    Franz Zieris - 2016-09-23
    • labels: IntelliJ, Intellij --> Intellij
     
  • Bernd Sahre

    Bernd Sahre - 2016-09-26
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -19,5 +19,13 @@
    
     **Approach to solution**
    
    -Intellij provide a _ModuleManager.class_ in the openapi Library, which hast a method "loadModules" which load a Module from an .iml file and adds it to the project, i think also to the _modules.xml_ file.
    -The problem is where to create the instance of the ModuleManager (abstract class) because Saros recieves and saves the incoming Data in the _IncomingProjectNegotiation.java_, which is located in de.fu_berlin.inf.core and not in the Intellij Plugin.
    +Intellij provide a _ModuleManager.class_ in the openapi Library, which hast a method "loadModules" which load a Module from an .iml file and adds 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 imbed this method with
    
    +   ApplicationManager.getApplication().invokeLater(new Runnable() {
    +                @Override
    +                public void run() {
    +                    ApplicationManager.getApplication().runWriteAction(new Runnable() {
    +                    loadModule(filepath);
    +                    ....
    +to secure threadsafety.
    
     
  • Bernd Sahre

    Bernd Sahre - 2016-09-26
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -17,6 +17,8 @@
    
     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 provide a _ModuleManager.class_ in the openapi Library, which hast a method "loadModules" which load a Module from an .iml file and adds it to the project. This solves the problem.
    
     
  • Franz Zieris

    Franz Zieris - 2016-10-17
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -21,13 +21,17 @@
    
     **Approach to solution**
    
    -Intellij provide a _ModuleManager.class_ in the openapi Library, which hast a method "loadModules" which load a Module from an .iml file and adds it to the project. This solves the problem.
    +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 imbed this method with
    
    -   ApplicationManager.getApplication().invokeLater(new Runnable() {
    -                @Override
    -                public void run() {
    -                    ApplicationManager.getApplication().runWriteAction(new Runnable() {
    -                    loadModule(filepath);
    -                    ....
    -to secure threadsafety.
    +It is also appropiate to embed this method with
    +
    +~~~java
    +ApplicationManager.getApplication().invokeLater(new Runnable() {
    +    @Override
    +    public void run() {
    +        ApplicationManager.getApplication().runWriteAction(new Runnable() {
    +            loadModule(filepath);
    +            ....
    +~~~
    +
    +to secure thread safety.
    
    • assigned_to: Bernd Sahre --> nobody
     
  • Stefan Rossbach

    Stefan Rossbach - 2017-02-21
    • status: open --> open-fixed
    • assigned_to: Bernd Sahre
     
  • Stefan Rossbach

    Stefan Rossbach - 2017-02-21

    It would be nice if the author of the patches would update the bug tracker and not someone else of the current staff.
    3cb588ed45f708163a6a9d853308c52616910776

     

    Last edit: tobous 2017-03-16
  • Stefan Rossbach

    Stefan Rossbach - 2017-02-21
    • Group: OTHER --> IntelliJ 0.1
     
  • tobous

    tobous - 2017-03-16
    • status: open-fixed --> pending-fixed
    • assigned_to: Bernd Sahre --> tobous
     
  • tobous

    tobous - 2018-03-22
    • Labels: Intellij --> Intellij, IntelliJ
     
1 2 > >> (Page 1 of 2)

Log in to post a comment.

MongoDB Logo MongoDB