yet another API for advertising in completion

This commit is contained in:
peter
2012-10-16 15:00:26 +02:00
parent cd9fc2209f
commit e19ca2372a
10 changed files with 30 additions and 29 deletions
@@ -81,7 +81,7 @@ public class DefaultCodeFragmentFactory extends CodeFragmentFactory {
if (parameters.getInvocationCount() <= 1 && JavaCompletionUtil.mayHaveSideEffects(expression)) {
final CompletionService service = CompletionService.getCompletionService();
if (service.getAdvertisementText() == null && parameters.getInvocationCount() < 2) {
if (parameters.getInvocationCount() < 2) {
service.setAdvertisementText("Invoke completion once more to see runtime type variants");
}
return null;
@@ -265,13 +265,13 @@ public class JavaCompletionContributor extends CompletionContributor {
}
});
} else {
advertiseSecondCompletion(parameters.getPosition().getProject());
advertiseSecondCompletion(parameters.getPosition().getProject(), result);
}
}
public static void advertiseSecondCompletion(Project project) {
public static void advertiseSecondCompletion(Project project, CompletionResultSet result) {
if (FeatureUsageTracker.getInstance().isToBeAdvertisedInLookup(CodeCompletionFeatures.SECOND_BASIC_COMPLETION, project)) {
CompletionService.getCompletionService().setAdvertisementText("Press " + getActionShortcut(IdeActions.ACTION_CODE_COMPLETION) + " to see non-imported classes");
result.addLookupAdvertisement("Press " + getActionShortcut(IdeActions.ACTION_CODE_COMPLETION) + " to see non-imported classes");
}
}
@@ -98,7 +98,7 @@ public abstract class StaticMemberProcessor {
}
private void showHint(boolean shouldImport) {
if (!myHintShown && !shouldImport && CompletionService.getCompletionService().getAdvertisementText() == null) {
if (!myHintShown && !shouldImport) {
final String shortcut = CompletionContributor.getActionShortcut(IdeActions.ACTION_SHOW_INTENTION_ACTIONS);
if (shortcut != null) {
CompletionService.getCompletionService().setAdvertisementText("To import a method statically, press " + shortcut);