Skip to content

Commit b8b5ce8

Browse files
committed
Fix context menu update for kotlin
1 parent bbe4925 commit b8b5ce8

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

src/ServiceStackIDEA/src/main/java/net/servicestack/idea/UpdateServiceStackReference.java

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package net.servicestack.idea;
22

3-
import com.intellij.facet.Facet;
4-
import com.intellij.facet.FacetManager;
53
import com.intellij.openapi.actionSystem.AnAction;
64
import com.intellij.openapi.actionSystem.AnActionEvent;
75
import com.intellij.openapi.actionSystem.DataKeys;
@@ -14,9 +12,6 @@
1412
import com.intellij.openapi.vfs.VirtualFile;
1513
import com.intellij.psi.PsiDocumentManager;
1614
import com.intellij.psi.PsiFile;
17-
import com.intellij.psi.PsiJavaFile;
18-
import org.jetbrains.annotations.NotNull;
19-
import org.jetbrains.annotations.Nullable;
2015

2116
/**
2217
* Created by Layoric on 9/04/2015.
@@ -39,9 +34,8 @@ public void run() {
3934

4035
@Override
4136
public void update(AnActionEvent e) {
42-
Module module = getModule(e);
4337
PsiFile psiFile = getPsiFile(e);
44-
if (psiFile == null || !isAndroidProject(module)) {
38+
if (psiFile == null) {
4539
e.getPresentation().setVisible(false);
4640
return;
4741
}
@@ -56,6 +50,7 @@ public void update(AnActionEvent e) {
5650
e.getPresentation().setVisible(false);
5751
return;
5852
}
53+
5954
e.getPresentation().setVisible(true);
6055
super.update(e);
6156
}
@@ -70,16 +65,6 @@ static Module getModule(Project project) {
7065
return null;
7166
}
7267

73-
private static boolean isAndroidProject(@NotNull Module module) {
74-
Facet[] facetsByType = FacetManager.getInstance(module).getAllFacets();
75-
for (Facet facet :facetsByType) {
76-
if(facet.getTypeId().toString().equals("android")) {
77-
return true;
78-
}
79-
}
80-
return false;
81-
}
82-
8368
private static PsiFile getPsiFile(AnActionEvent e) {
8469

8570
Module module = getModule(e);

src/ServiceStackIDEA/src/main/resources/META-INF/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<add-to-group group-id="NewGroup" anchor="after" relative-to-action="NewAction"/>
4242
<keyboard-shortcut keymap="$default" first-keystroke="shift ctrl alt R"/>
4343
</action>
44-
<action id="UpdateServiceStackReference" class="net.servicestack.idea.UpdateServiceStackReference" text="Update ServiceStack Reference" icon="/icons/logo-16.png"
44+
<action id="UpdateServiceStackReference" class="net.servicestack.idea.UpdateServiceStackReference" text="Update ServiceStack Reference" icon="/logo-16.png"
4545
description="Updates the selected ServiceStack reference.">
4646
<add-to-group group-id="ProjectViewPopupMenu" anchor="last"/>
4747
</action>

0 commit comments

Comments
 (0)