Fixed balloon position for library with sources.
This commit is contained in:
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.lang.resolve;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
+3
-5
@@ -26,9 +26,7 @@ import com.intellij.psi.PsiAnnotation;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUtil.KOTLIN_SIGNATURE_ANNOTATION;
|
||||
import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUtil.findKotlinSignatureAnnotation;
|
||||
import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUtil.refreshMarkers;
|
||||
import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUtil.*;
|
||||
|
||||
/**
|
||||
* @author Evgeny Gerashchenko
|
||||
@@ -37,9 +35,9 @@ import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUt
|
||||
public class DeleteSignatureAction extends AnAction {
|
||||
private final PsiMethod annotationOwner;
|
||||
|
||||
public DeleteSignatureAction(@NotNull PsiMethod annotationOwner) {
|
||||
public DeleteSignatureAction(@NotNull PsiMethod elementInEditor) {
|
||||
super("Delete");
|
||||
this.annotationOwner = annotationOwner;
|
||||
this.annotationOwner = getAnnotationOwner(elementInEditor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+10
-10
@@ -38,11 +38,11 @@ import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUt
|
||||
* @since 5 Sep 12
|
||||
*/
|
||||
public class EditSignatureAction extends AnAction {
|
||||
private final PsiMethod annotationOwner;
|
||||
private final PsiMethod elementInEditor;
|
||||
|
||||
public EditSignatureAction(@NotNull PsiMethod annotationOwner) {
|
||||
public EditSignatureAction(@NotNull PsiMethod elementInEditor) {
|
||||
super("Edit");
|
||||
this.annotationOwner = annotationOwner;
|
||||
this.elementInEditor = elementInEditor;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,13 +53,13 @@ public class EditSignatureAction extends AnAction {
|
||||
public void actionPerformed(@NotNull DataContext dataContext, @Nullable Point point) {
|
||||
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
|
||||
assert editor != null;
|
||||
invokeEditSignature(annotationOwner, editor, point);
|
||||
invokeEditSignature(elementInEditor, editor, point);
|
||||
}
|
||||
|
||||
static void invokeEditSignature(@NotNull PsiMethod element, @NotNull Editor editor, @Nullable Point point) {
|
||||
PsiAnnotation annotation = findKotlinSignatureAnnotation(element);
|
||||
static void invokeEditSignature(@NotNull PsiMethod elementInEditor, @NotNull Editor editor, @Nullable Point point) {
|
||||
PsiAnnotation annotation = findKotlinSignatureAnnotation(elementInEditor);
|
||||
assert annotation != null;
|
||||
if (annotation.getContainingFile() == element.getContainingFile()) {
|
||||
if (annotation.getContainingFile() == elementInEditor.getContainingFile()) {
|
||||
// not external, go to
|
||||
for (PsiNameValuePair pair : annotation.getParameterList().getAttributes()) {
|
||||
if (pair.getName() == null || "value".equals(pair.getName())) {
|
||||
@@ -80,10 +80,10 @@ public class EditSignatureAction extends AnAction {
|
||||
}
|
||||
}
|
||||
else {
|
||||
PsiMethod annotationOwner = getAnnotationOwner(element);
|
||||
boolean editable = ExternalAnnotationsManager.getInstance(element.getProject())
|
||||
PsiMethod annotationOwner = getAnnotationOwner(elementInEditor);
|
||||
boolean editable = ExternalAnnotationsManager.getInstance(elementInEditor.getProject())
|
||||
.isExternalAnnotationWritable(annotationOwner, KOTLIN_SIGNATURE_ANNOTATION);
|
||||
new EditSignatureBalloon(annotationOwner, getKotlinSignature(annotation), editable).show(point, editor, element);
|
||||
new EditSignatureBalloon(annotationOwner, getKotlinSignature(annotation), editable).show(point, editor, elementInEditor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-7
@@ -106,16 +106,10 @@ public class KotlinSignatureInJavaMarkerProvider implements LineMarkerProvider {
|
||||
@Nullable
|
||||
@Override
|
||||
public ActionGroup getPopupMenuActions() {
|
||||
DefaultActionGroup actionGroup = new DefaultActionGroup();
|
||||
|
||||
PsiMethod element = getElement();
|
||||
assert element != null;
|
||||
PsiMethod annotationOwner = getAnnotationOwner(element);
|
||||
|
||||
actionGroup.add(new EditSignatureAction(annotationOwner));
|
||||
actionGroup.add(new DeleteSignatureAction(annotationOwner));
|
||||
|
||||
return actionGroup;
|
||||
return new DefaultActionGroup(new EditSignatureAction(element), new DeleteSignatureAction(element));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user