Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request #13 from SchibstedSpain/issue-8-corrected-generati…
Browse files Browse the repository at this point in the history
…on-path

[Issue 8] Corrected generation of files with the correct active project path (PART2)
  • Loading branch information
ferranpons authored Oct 15, 2018
2 parents 33b48b0 + 3689697 commit 6612887
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
Now shows the modules from the current project active
When using a kotlin reserved name on a model it changes its name to "Model"+"class name"
"Body" parameter now use the correct class reference
Corrected generation of files with the correct active project path
8 changes: 4 additions & 4 deletions src/main/java/protein/common/StorageUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ public static ListModel getFoldersList() {
}

public static void generateFiles(@Nullable String moduleName, @Nullable String packageName, @NotNull com.squareup.kotlinpoet.TypeSpec classTypeSpec) {
FileSpec kotlinFile = FileSpec.builder(packageName, classTypeSpec.getName()).addType(classTypeSpec).build();

try {
FileSpec kotlinFile = FileSpec.builder(packageName, classTypeSpec.getName()).addType(classTypeSpec).build();
Project currentProject = (Project)DataManager.getInstance().getDataContext().getData(DataConstants.PROJECT);
String projectPath;
if (moduleName != null && !"".equals(moduleName)) {
projectPath = FileEditorManager.getInstance(ProjectManager.getInstance().getOpenProjects()[0]).getProject().getBasePath() + "/" + moduleName + "/src/main/java/";
projectPath = FileEditorManager.getInstance(currentProject).getProject().getBasePath() + "/" + moduleName + "/src/main/java/";
} else {
projectPath = FileEditorManager.getInstance(ProjectManager.getInstance().getOpenProjects()[0]).getProject().getBasePath() + "/src/main/java/";
projectPath = FileEditorManager.getInstance(currentProject).getProject().getBasePath() + "/src/main/java/";
}
Path path = FileSystems.getDefault().getPath(projectPath);
if (!Files.exists(path)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class ProteinUpdateComponent(project: Project) : AbstractProjectComponent(projec
If you find my plugin helpful,
<b><a href="https://plugins.jetbrains.com/plugin/10206-protein--kotlin-code-generator-for-retrofit2-and-rxjava2-based-on-swagger">
Please give me a star on JetBrains Plugin Store</a></b><br/>
If you find any issue, <b><a href="https://github.com/SchibstedSpain">Feel free to raise a issue</a></b><br/>
See <b><a href="https://plugins.jetbrains.com/plugin/10206-protein--kotlin-code-generator-for-retrofit2-and-rxjava2-based-on-swagger">Changelog</a></b>
If you find any issue, <b><a href="https://github.com/SchibstedSpain/Protein/issues/new/choose">Feel free to raise a issue</a></b><br/>
See <b><a href="https://github.com/SchibstedSpain/Protein/blob/master/CHANGELOG.md">Changelog</a></b>
for more details.
"""

Expand Down
4 changes: 1 addition & 3 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@
]]></description>

<change-notes><![CDATA[
Now shows the modules from the current project active
When using a kotlin reserved name on a model it changes its name to "Model"+"class name"
"Body" parameter now use the correct class reference
Corrected generation of files with the correct active project path
]]>
</change-notes>

Expand Down
2 changes: 1 addition & 1 deletion version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MAJOR=1
MINOR=0
PATCH=1
PATCH=2

0 comments on commit 6612887

Please sign in to comment.