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;
|
package org.jetbrains.jet.lang.resolve;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|||||||
+3
-5
@@ -26,9 +26,7 @@ import com.intellij.psi.PsiAnnotation;
|
|||||||
import com.intellij.psi.PsiMethod;
|
import com.intellij.psi.PsiMethod;
|
||||||
import org.jetbrains.annotations.NotNull;
|
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.*;
|
||||||
import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUtil.findKotlinSignatureAnnotation;
|
|
||||||
import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUtil.refreshMarkers;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Evgeny Gerashchenko
|
* @author Evgeny Gerashchenko
|
||||||
@@ -37,9 +35,9 @@ import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUt
|
|||||||
public class DeleteSignatureAction extends AnAction {
|
public class DeleteSignatureAction extends AnAction {
|
||||||
private final PsiMethod annotationOwner;
|
private final PsiMethod annotationOwner;
|
||||||
|
|
||||||
public DeleteSignatureAction(@NotNull PsiMethod annotationOwner) {
|
public DeleteSignatureAction(@NotNull PsiMethod elementInEditor) {
|
||||||
super("Delete");
|
super("Delete");
|
||||||
this.annotationOwner = annotationOwner;
|
this.annotationOwner = getAnnotationOwner(elementInEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+10
-10
@@ -38,11 +38,11 @@ import static org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureUt
|
|||||||
* @since 5 Sep 12
|
* @since 5 Sep 12
|
||||||
*/
|
*/
|
||||||
public class EditSignatureAction extends AnAction {
|
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");
|
super("Edit");
|
||||||
this.annotationOwner = annotationOwner;
|
this.elementInEditor = elementInEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -53,13 +53,13 @@ public class EditSignatureAction extends AnAction {
|
|||||||
public void actionPerformed(@NotNull DataContext dataContext, @Nullable Point point) {
|
public void actionPerformed(@NotNull DataContext dataContext, @Nullable Point point) {
|
||||||
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
|
Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
|
||||||
assert editor != null;
|
assert editor != null;
|
||||||
invokeEditSignature(annotationOwner, editor, point);
|
invokeEditSignature(elementInEditor, editor, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void invokeEditSignature(@NotNull PsiMethod element, @NotNull Editor editor, @Nullable Point point) {
|
static void invokeEditSignature(@NotNull PsiMethod elementInEditor, @NotNull Editor editor, @Nullable Point point) {
|
||||||
PsiAnnotation annotation = findKotlinSignatureAnnotation(element);
|
PsiAnnotation annotation = findKotlinSignatureAnnotation(elementInEditor);
|
||||||
assert annotation != null;
|
assert annotation != null;
|
||||||
if (annotation.getContainingFile() == element.getContainingFile()) {
|
if (annotation.getContainingFile() == elementInEditor.getContainingFile()) {
|
||||||
// not external, go to
|
// not external, go to
|
||||||
for (PsiNameValuePair pair : annotation.getParameterList().getAttributes()) {
|
for (PsiNameValuePair pair : annotation.getParameterList().getAttributes()) {
|
||||||
if (pair.getName() == null || "value".equals(pair.getName())) {
|
if (pair.getName() == null || "value".equals(pair.getName())) {
|
||||||
@@ -80,10 +80,10 @@ public class EditSignatureAction extends AnAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PsiMethod annotationOwner = getAnnotationOwner(element);
|
PsiMethod annotationOwner = getAnnotationOwner(elementInEditor);
|
||||||
boolean editable = ExternalAnnotationsManager.getInstance(element.getProject())
|
boolean editable = ExternalAnnotationsManager.getInstance(elementInEditor.getProject())
|
||||||
.isExternalAnnotationWritable(annotationOwner, KOTLIN_SIGNATURE_ANNOTATION);
|
.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
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public ActionGroup getPopupMenuActions() {
|
public ActionGroup getPopupMenuActions() {
|
||||||
DefaultActionGroup actionGroup = new DefaultActionGroup();
|
|
||||||
|
|
||||||
PsiMethod element = getElement();
|
PsiMethod element = getElement();
|
||||||
assert element != null;
|
assert element != null;
|
||||||
PsiMethod annotationOwner = getAnnotationOwner(element);
|
|
||||||
|
|
||||||
actionGroup.add(new EditSignatureAction(annotationOwner));
|
return new DefaultActionGroup(new EditSignatureAction(element), new DeleteSignatureAction(element));
|
||||||
actionGroup.add(new DeleteSignatureAction(annotationOwner));
|
|
||||||
|
|
||||||
return actionGroup;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user