本文整理汇总了Java中com.intellij.codeInsight.hint.ShowParameterInfoHandler类的典型用法代码示例。如果您正苦于以下问题:Java ShowParameterInfoHandler类的具体用法?Java ShowParameterInfoHandler怎么用?Java ShowParameterInfoHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ShowParameterInfoHandler类属于com.intellij.codeInsight.hint包,在下文中一共展示了ShowParameterInfoHandler类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: autoPopupParameterInfo
import com.intellij.codeInsight.hint.ShowParameterInfoHandler; //导入依赖的package包/类
public void autoPopupParameterInfo(@NotNull final Editor editor, @Nullable final PsiElement highlightedMethod){
if (ApplicationManager.getApplication().isUnitTestMode()) return;
if (DumbService.isDumb(myProject)) return;
if (PowerSaveMode.isEnabled()) return;
ApplicationManager.getApplication().assertIsDispatchThread();
final CodeInsightSettings settings = CodeInsightSettings.getInstance();
if (settings.AUTO_POPUP_PARAMETER_INFO) {
final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject);
PsiFile file = documentManager.getPsiFile(editor.getDocument());
if (file == null) return;
if (!documentManager.isUncommited(editor.getDocument())) {
file = documentManager.getPsiFile(InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit(editor, file).getDocument());
if (file == null) return;
}
final PsiFile file1 = file;
final Runnable request = new Runnable(){
@Override
public void run(){
if (myProject.isDisposed() || DumbService.isDumb(myProject)) return;
documentManager.commitAllDocuments();
if (editor.isDisposed() || !editor.getComponent().isShowing()) return;
int lbraceOffset = editor.getCaretModel().getOffset() - 1;
try {
ShowParameterInfoHandler.invoke(myProject, editor, file1, lbraceOffset, highlightedMethod);
}
catch (IndexNotReadyException ignored) { //anything can happen on alarm
}
}
};
addRequest(request, settings.PARAMETER_INFO_DELAY);
}
}
示例2: autoPopupParameterInfo
import com.intellij.codeInsight.hint.ShowParameterInfoHandler; //导入依赖的package包/类
public void autoPopupParameterInfo(final Editor editor, @Nullable final PsiElement highlightedMethod){
if (ApplicationManager.getApplication().isUnitTestMode()) return;
if (DumbService.isDumb(myProject)) return;
ApplicationManager.getApplication().assertIsDispatchThread();
final CodeInsightSettings settings = CodeInsightSettings.getInstance();
if (settings.AUTO_POPUP_PARAMETER_INFO) {
final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject);
PsiFile file = documentManager.getPsiFile(editor.getDocument());
if (file == null) return;
if (!documentManager.isUncommited(editor.getDocument())) {
file = documentManager.getPsiFile(InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit(editor, file).getDocument());
if (file == null) return;
}
final PsiFile file1 = file;
final Runnable request = new Runnable(){
@Override
public void run(){
if (myProject.isDisposed() || DumbService.isDumb(myProject) || editor.isDisposed()) return;
documentManager.commitAllDocuments();
int lbraceOffset = editor.getCaretModel().getOffset() - 1;
try {
ShowParameterInfoHandler.invoke(myProject, editor, file1, lbraceOffset, highlightedMethod);
}
catch (IndexNotReadyException ignored) { //anything can happen on alarm
}
}
};
addRequest(request, settings.PARAMETER_INFO_DELAY);
}
}
示例3: autoPopupParameterInfo
import com.intellij.codeInsight.hint.ShowParameterInfoHandler; //导入依赖的package包/类
@RequiredDispatchThread
public void autoPopupParameterInfo(@Nonnull final Editor editor, @Nullable final Object highlightedMethod) {
if (DumbService.isDumb(myProject)) return;
if (PowerSaveMode.isEnabled()) return;
ApplicationManager.getApplication().assertIsDispatchThread();
final CodeInsightSettings settings = CodeInsightSettings.getInstance();
if (settings.AUTO_POPUP_PARAMETER_INFO) {
final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject);
PsiFile file = documentManager.getPsiFile(editor.getDocument());
if (file == null) return;
if (!documentManager.isUncommited(editor.getDocument())) {
file = documentManager.getPsiFile(InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit(editor, file).getDocument());
if (file == null) return;
}
Runnable request = () -> {
if (!myProject.isDisposed() && !DumbService.isDumb(myProject) && !editor.isDisposed() && (ApplicationManager.getApplication().isUnitTestMode() || editor.getComponent().isShowing())) {
int lbraceOffset = editor.getCaretModel().getOffset() - 1;
try {
PsiFile file1 = PsiDocumentManager.getInstance(myProject).getPsiFile(editor.getDocument());
ShowParameterInfoHandler.invoke(myProject, editor, file1, lbraceOffset, highlightedMethod, false, true);
}
catch (IndexNotReadyException ignored) { //anything can happen on alarm
}
}
};
addRequest(() -> documentManager.performLaterWhenAllCommitted(request), settings.PARAMETER_INFO_DELAY);
}
}
示例4: getHandler
import com.intellij.codeInsight.hint.ShowParameterInfoHandler; //导入依赖的package包/类
@NotNull
@Override
protected CodeInsightActionHandler getHandler() {
return new ShowParameterInfoHandler();
}
示例5: isValidForFile
import com.intellij.codeInsight.hint.ShowParameterInfoHandler; //导入依赖的package包/类
@Override
protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull final PsiFile file) {
final Language language = PsiUtilCore.getLanguageAtOffset(file, editor.getCaretModel().getOffset());
return ShowParameterInfoHandler.getHandlers(project, language, file.getViewProvider().getBaseLanguage()) != null;
}
示例6: handleEmptyLookup
import com.intellij.codeInsight.hint.ShowParameterInfoHandler; //导入依赖的package包/类
@Override
public String handleEmptyLookup(@NotNull final CompletionParameters parameters, final Editor editor) {
if (!(parameters.getOriginalFile() instanceof PsiJavaFile)) return null;
final String ad = advertise(parameters);
final String suffix = ad == null ? "" : "; " + StringUtil.decapitalize(ad);
if (parameters.getCompletionType() == CompletionType.SMART) {
if (!ApplicationManager.getApplication().isUnitTestMode()) {
final Project project = parameters.getPosition().getProject();
final PsiFile file = parameters.getOriginalFile();
PsiExpression expression = PsiTreeUtil.getContextOfType(parameters.getPosition(), PsiExpression.class, true);
if (expression != null && expression.getParent() instanceof PsiExpressionList) {
int lbraceOffset = expression.getParent().getTextRange().getStartOffset();
ShowParameterInfoHandler.invoke(project, editor, file, lbraceOffset, null);
}
if (expression instanceof PsiLiteralExpression) {
return LangBundle.message("completion.no.suggestions") + suffix;
}
if (expression instanceof PsiInstanceOfExpression) {
final PsiInstanceOfExpression instanceOfExpression = (PsiInstanceOfExpression)expression;
if (PsiTreeUtil.isAncestor(instanceOfExpression.getCheckType(), parameters.getPosition(), false)) {
return LangBundle.message("completion.no.suggestions") + suffix;
}
}
}
final Set<PsiType> expectedTypes = JavaCompletionUtil.getExpectedTypes(parameters);
if (expectedTypes != null) {
PsiType type = expectedTypes.size() == 1 ? expectedTypes.iterator().next() : null;
if (type != null) {
final PsiType deepComponentType = type.getDeepComponentType();
if (deepComponentType instanceof PsiClassType) {
if (((PsiClassType)deepComponentType).resolve() != null) {
return CompletionBundle.message("completion.no.suggestions.of.type", type.getPresentableText()) + suffix;
}
return CompletionBundle.message("completion.unknown.type", type.getPresentableText()) + suffix;
}
if (!PsiType.NULL.equals(type)) {
return CompletionBundle.message("completion.no.suggestions.of.type", type.getPresentableText()) + suffix;
}
}
}
}
return LangBundle.message("completion.no.suggestions") + suffix;
}
示例7: isValidForFile
import com.intellij.codeInsight.hint.ShowParameterInfoHandler; //导入依赖的package包/类
@Override
protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull final PsiFile file) {
final Language language = PsiUtilBase.getLanguageAtOffset(file, editor.getCaretModel().getOffset());
return ShowParameterInfoHandler.getHandlers(project, language, file.getViewProvider().getBaseLanguage()) != null;
}
示例8: getHandler
import com.intellij.codeInsight.hint.ShowParameterInfoHandler; //导入依赖的package包/类
@Nonnull
@Override
protected CodeInsightActionHandler getHandler() {
return new ShowParameterInfoHandler();
}
示例9: isValidForFile
import com.intellij.codeInsight.hint.ShowParameterInfoHandler; //导入依赖的package包/类
@Override
protected boolean isValidForFile(@Nonnull Project project, @Nonnull Editor editor, @Nonnull final PsiFile file) {
final Language language = PsiUtilCore.getLanguageAtOffset(file, editor.getCaretModel().getOffset());
return ShowParameterInfoHandler.getHandlers(project, language, file.getViewProvider().getBaseLanguage()) != null;
}