mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
describe the 'static import via completion' as a productivity feature
This commit is contained in:
+3
@@ -1,6 +1,7 @@
|
||||
package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.codeInsight.lookup.*;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.Icons;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
@@ -23,6 +24,8 @@ public class ImportStaticLookupActionProvider implements LookupActionProvider {
|
||||
consumer.consume(new LookupElementAction(icon, "Import statically") {
|
||||
@Override
|
||||
public Result performLookupAction() {
|
||||
FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.IMPORT_STATIC);
|
||||
|
||||
item.setShouldImport(!item.isShouldImport());
|
||||
return Result.REFRESH_ITEM;
|
||||
}
|
||||
|
||||
@@ -25,4 +25,5 @@ public interface JavaCompletionFeatures {
|
||||
@NonNls String SECOND_SMART_COMPLETION_TOAR = "editing.completion.second.smarttype.toar";
|
||||
@NonNls String SECOND_SMART_COMPLETION_ASLIST = "editing.completion.second.smarttype.aslist";
|
||||
@NonNls String SECOND_SMART_COMPLETION_ARRAY_MEMBER = "editing.completion.second.smarttype.array.member";
|
||||
@NonNls String IMPORT_STATIC = "editing.completion.import.static";
|
||||
}
|
||||
|
||||
+8
-2
@@ -2,6 +2,7 @@ package com.intellij.codeInsight.completion;
|
||||
|
||||
import com.intellij.codeInsight.completion.simple.PsiMethodInsertHandler;
|
||||
import com.intellij.codeInsight.daemon.impl.quickfix.StaticImportMethodFix;
|
||||
import com.intellij.featureStatistics.FeatureUsageTracker;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
@@ -91,8 +92,13 @@ public class JavaGlobalMemberNameCompletionContributor extends CompletionContrib
|
||||
final PsiClass containingClass = method.getContainingClass();
|
||||
if (containingClass != null) {
|
||||
if (!JavaCompletionUtil.isInExcludedPackage(containingClass) && !StaticImportMethodFix.isExcluded(method)) {
|
||||
if (!hintShown[0] && CompletionService.getCompletionService().getAdvertisementText() == null) {
|
||||
CompletionService.getCompletionService().setAdvertisementText("To import the method statically, press Left");
|
||||
if (!hintShown[0] &&
|
||||
FeatureUsageTracker.getInstance().isToBeShown(JavaCompletionFeatures.IMPORT_STATIC, project) &&
|
||||
CompletionService.getCompletionService().getAdvertisementText() == null) {
|
||||
final String shortcut = getActionShortcut("EditorRight");
|
||||
if (shortcut != null) {
|
||||
CompletionService.getCompletionService().setAdvertisementText("To import the method statically, press " + shortcut);
|
||||
}
|
||||
hintShown[0] = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ editing.completion.second.smarttype.chain=Second smart type completion: chained
|
||||
editing.completion.second.smarttype.toar=Second smart type completion: toArray() conversion
|
||||
editing.completion.second.smarttype.aslist=Second smart type completion: asList() conversion
|
||||
editing.completion.second.smarttype.array.member=Second smart type completion: array member access
|
||||
editing.completion.import.static=Static import via code completion
|
||||
editing.completion.variable.name=Variable name completion
|
||||
editing.completion.replace=Replace By when using lookup
|
||||
editing.completion.finishByDotEtc=Finish lookup by special characters
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<html>
|
||||
<body style="font-family: Verdana; font-size: 13;" LEFTMARGIN="25" TOPMARGIN="25">
|
||||
<table cellpadding="15" width="98%" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
To quickly complete a method call of a static method located anywhere in your project, libraries or JDK, enter a prefix
|
||||
and press &shortcut:ClassNameCompletion;. You'll see all the matching methods. If you want the method you chose to be imported statically,
|
||||
press &shortcut:EditorRight; and see what happens:
|
||||
<p><img hspace="20" src="images/completionImportStatic.png"></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
@@ -169,6 +169,13 @@
|
||||
successive-show="3">
|
||||
<dependency id="editing.completion.smarttype.general"/>
|
||||
</feature>
|
||||
<feature
|
||||
id="editing.completion.import.static"
|
||||
tip-file="CompletionImportStatic.html"
|
||||
min-usage-count="8"
|
||||
first-show="10"
|
||||
successive-show="3">
|
||||
</feature>
|
||||
<feature
|
||||
id="editing.completion.finishByExclamation"
|
||||
tip-file="FinishByExclamation.html"
|
||||
|
||||
Reference in New Issue
Block a user