Hidden "Delete" action and renamed "Edit" to "View" when external annotation is read-only.
This commit is contained in:
@@ -38,6 +38,9 @@ public class DeleteSignatureAction extends AnAction {
|
|||||||
public DeleteSignatureAction(@NotNull PsiMethod elementInEditor) {
|
public DeleteSignatureAction(@NotNull PsiMethod elementInEditor) {
|
||||||
super("Delete");
|
super("Delete");
|
||||||
this.annotationOwner = getAnnotationOwner(elementInEditor);
|
this.annotationOwner = getAnnotationOwner(elementInEditor);
|
||||||
|
boolean editable = ExternalAnnotationsManager.getInstance(annotationOwner.getProject())
|
||||||
|
.isExternalAnnotationWritable(annotationOwner, KOTLIN_SIGNATURE_ANNOTATION);
|
||||||
|
getTemplatePresentation().setVisible(editable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -41,8 +41,10 @@ public class EditSignatureAction extends AnAction {
|
|||||||
private final PsiMethod elementInEditor;
|
private final PsiMethod elementInEditor;
|
||||||
|
|
||||||
public EditSignatureAction(@NotNull PsiMethod elementInEditor) {
|
public EditSignatureAction(@NotNull PsiMethod elementInEditor) {
|
||||||
super("Edit");
|
|
||||||
this.elementInEditor = elementInEditor;
|
this.elementInEditor = elementInEditor;
|
||||||
|
boolean editable = ExternalAnnotationsManager.getInstance(elementInEditor.getProject())
|
||||||
|
.isExternalAnnotationWritable(getAnnotationOwner(elementInEditor), KOTLIN_SIGNATURE_ANNOTATION);
|
||||||
|
getTemplatePresentation().setText(editable ? "Edit" : "View");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user