Skip to content

Commit

Permalink
fix #6: support 2016.3 and later versions
Browse files Browse the repository at this point in the history
  • Loading branch information
lotabout committed Jan 18, 2018
1 parent dc4d73d commit d57f73a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
6 changes: 4 additions & 2 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin>
<id>me.lotabout.codegenerator</id>
<name>Code Generator</name>
<version>1.3</version>
<version>1.3.2</version>
<vendor email="[email protected]" url="https://lotabout.me">Jinzhou Zhang</vendor>

<description><![CDATA[
Expand All @@ -20,6 +20,8 @@

<change-notes><![CDATA[
<ul>
<li>version 1.3.2 <p>support idea 2016.3 and after</p></li>
<li>version 1.3.1 <p>move Code Generator Menu to Generate menu</p></li>
<li>version 1.3 <p>support insert at caret. Fix bugs</p></li>
<li>version 1.2 <p>Able to import/export settings</p></li>
<li>version 1.1 <p>Able to define workflows for selecting members/classes</p></li>
Expand All @@ -29,7 +31,7 @@
</change-notes>

<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
<idea-version since-build="145.0"/>
<idea-version since-build="163.0"/>

<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products -->
Expand Down
11 changes: 11 additions & 0 deletions src/me/lotabout/codegenerator/ui/CodeGeneratorConfigurable.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public CodeGeneratorConfigurable() {
return "CodeGenerator";
}

@Nullable
@Override
public String getHelpTopic() {
return null;
}

@Nullable @Override public JComponent createComponent() {
if (config == null) {
config = new CodeGeneratorConfig(settings);
Expand Down Expand Up @@ -64,4 +70,9 @@ public CodeGeneratorConfigurable() {
settings.setCodeTemplates(templates);
config.refresh(templates);
}

@Override
public void reset() {

}
}
3 changes: 1 addition & 2 deletions src/me/lotabout/codegenerator/worker/JavaBodyWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.intellij.codeInsight.generation.PsiGenerationInfo;
import com.intellij.codeInsight.hint.HintManager;
import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
Expand Down Expand Up @@ -96,7 +95,7 @@ public static void execute(@NotNull CodeTemplate codeTemplate, @NotNull PsiClass
case AT_THE_END_OF_A_CLASS:
offset = parentClass.getTextRange().getEndOffset() - 1;
}
GenerateMembersUtil.insertMembersAtOffset(parentClass, offset, generationInfoList);
GenerateMembersUtil.insertMembersAtOffset(parentClass.getContainingFile(), offset, generationInfoList);
// auto import
JavaCodeStyleManager.getInstance(parentClass.getProject()).shortenClassReferences(parentClass.getContainingFile());
} catch (Exception e) {
Expand Down

0 comments on commit d57f73a

Please sign in to comment.