no references to class name completion from productivity tips (IDEA-86517)

This commit is contained in:
peter
2012-06-27 18:06:22 +02:00
parent 37e35440ac
commit b5ea366ab8
16 changed files with 8 additions and 103 deletions
@@ -105,11 +105,10 @@ public class ConstructorInsertHandler implements InsertHandler<LookupElementDeco
return;
}
if (mySmart) {
FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.AFTER_NEW);
}
if (isAbstract) {
if (mySmart) {
FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.AFTER_NEW_ANONYMOUS);
}
PostprocessReformattingAspect.getInstance(context.getProject()).doPostponedFormatting(context.getFile().getViewProvider());
final Editor editor = context.getEditor();
@@ -53,11 +53,6 @@ public class JavaClassNameCompletionContributor extends CompletionContributor {
@Override
public void fillCompletionVariants(CompletionParameters parameters, final CompletionResultSet _result) {
if (parameters.isExtendedCompletion()) {
if (shouldShowSecondSmartCompletionHint(parameters) &&
CompletionUtil.shouldShowFeature(parameters, CodeCompletionFeatures.SECOND_CLASS_NAME_COMPLETION)) {
CompletionService.getCompletionService().setAdvertisementText(CompletionBundle.message("completion.class.name.hint.2", getActionShortcut(IdeActions.ACTION_CODE_COMPLETION)));
}
CompletionResultSet result = _result.withPrefixMatcher(CompletionUtil.findReferenceOrAlphanumericPrefix(parameters));
addAllClasses(parameters, parameters.getInvocationCount() <= 1,
JavaCompletionSorting.addJavaSorting(parameters, result).getPrefixMatcher(), new Consumer<LookupElement>() {
@@ -488,15 +488,6 @@ public class JavaCompletionContributor extends CompletionContributor {
}
}
if (parameters.getCompletionType() != CompletionType.CLASS_NAME && shouldSuggestClassNameCompletion(parameters.getPosition())) {
if (CompletionUtil.shouldShowFeature(parameters, CodeCompletionFeatures.EDITING_COMPLETION_CLASSNAME)) {
final String shortcut = getActionShortcut(IdeActions.ACTION_CODE_COMPLETION);
if (shortcut != null) {
return CompletionBundle.message("completion.class.name.hint", shortcut);
}
}
}
if (parameters.getCompletionType() == CompletionType.SMART && parameters.getInvocationCount() == 1) {
final PsiType[] psiTypes = ExpectedTypesGetter.getExpectedTypes(parameters.getPosition(), true);
if (psiTypes.length > 0) {
@@ -27,5 +27,4 @@ public interface JavaCompletionFeatures {
@NonNls String SECOND_SMART_COMPLETION_ARRAY_MEMBER = "editing.completion.second.smarttype.array.member";
@NonNls String GLOBAL_MEMBER_NAME = "editing.completion.global.member.name";
@NonNls String AFTER_NEW = "editing.completion.smarttype.afternew";
@NonNls String AFTER_NEW_ANONYMOUS = "editing.completion.smarttype.afternew";
}
@@ -14,7 +14,6 @@
<feature id="codeassists.javadoc.external" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="tag.name.completion" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="ui.recentchanges" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="editing.completion.smarttype.anonymous" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="diagram.show" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="refactoring.introduceVariable" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="ui.tree.speedsearch" count="5" last-shown="0" last-used="1317813527648" average-frequency="2666" shown-count="0" />
@@ -57,7 +56,6 @@
<feature id="editing.completion.replace" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="editing.select.word" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="codeassists.comment.block" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="editing.completion.classname" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="editing.completion.cancelByControlArrows" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="codeassists.highlight.implements" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="codeassists.quickdefinition" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
@@ -65,7 +63,6 @@
<feature id="jar.diff" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="navigation.recent.files" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="codeassists.highlight.return" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="editing.completion.second.classname" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="editing.completion.smarttype.general" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="editing.completion.camelHumps" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
<feature id="codeassists.overrideimplement" count="0" last-shown="0" last-used="0" average-frequency="0" shown-count="0" />
@@ -22,7 +22,6 @@ import org.jetbrains.annotations.NonNls;
*/
public interface CodeCompletionFeatures {
@NonNls String EXCLAMATION_FINISH = "editing.completion.finishByExclamation";
@NonNls String SECOND_CLASS_NAME_COMPLETION = "editing.completion.second.classname";
@NonNls String SECOND_BASIC_COMPLETION = "editing.completion.second.basic";
@NonNls String EDITING_COMPLETION_SMARTTYPE_GENERAL = "editing.completion.smarttype.general";
@NonNls String EDITING_COMPLETION_BASIC = "editing.completion.basic";
@@ -151,10 +151,7 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler {
CompletionServiceImpl.assertPhase(CompletionPhase.NoCompletion.getClass(), CompletionPhase.CommittingDocuments.class);
if (time > 1) {
if (myCompletionType == CompletionType.CLASS_NAME) {
FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.SECOND_CLASS_NAME_COMPLETION);
}
else if (myCompletionType == CompletionType.BASIC) {
if (myCompletionType == CompletionType.BASIC) {
FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.SECOND_BASIC_COMPLETION);
}
}
@@ -38,12 +38,9 @@ navigation.select.in=Select In popup
navigation.goto.declaration=Go to declaration
navigation.goto.implementation=Go to implementation
editing.completion.basic=Basic code completion
editing.completion.classname=Class name completion
editing.completion.smarttype.general=Smart type completion
editing.completion.smarttype.anonymous=Smart anonymous class instantiation
editing.completion.smarttype.afternew=Smart type completion after new
editing.completion.smarttype.casting=Smart type casting
editing.completion.second.classname=Second class name completion
editing.completion.second.basic=Second basic completion
editing.completion.second.smarttype.chain=Second smart type completion: chained method calls
editing.completion.second.smarttype.toar=Second smart type completion: toArray() conversion
@@ -3,7 +3,8 @@
<link rel="stylesheet" type="text/css" href="css/tips.css">
</head>
<body>
<p>A special variant of the CodeCompletion feature invoked by <span class="shortcut">&shortcut:ClassNameCompletion;</span> allows you to
<p>
A special variant of the Code Completion feature invoked by pressing <span class="shortcut">&shortcut:CodeCompletion;</span> twice allows you to
complete
XML tag names from namespaces not declared in the current file.
If the namespace is not declared yet the declaration is generated automatically.
@@ -1,15 +0,0 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/tips.css">
</head>
<body>
<p>A special variant of the CodeCompletion feature invoked by <span class="shortcut">&shortcut:ClassNameCompletion;</span> allows you to complete the name of any
class no matter if it was imported in the current file or not. If the class is not imported yet the import statement is generated automatically.</p>
<p class="image"><img src="images/class_name_completion.gif"></p>
</body>
</html>
@@ -7,8 +7,8 @@
To quickly complete a method call of a static method located anywhere in your project, libraries or JDK, enter a prefix
and press <span class="shortcut">&shortcut:ClassNameCompletion;</span>. You'll see all the matching methods. If you want the method you chose to be imported statically,
press <span class="shortcut">&shortcut:EditorRight;</span> and see what happens:
and press <span class="shortcut">&shortcut:CodeCompletion;</span> twice. You'll see all the matching methods. If you want the method you chose to be imported statically,
press <span class="shortcut">&shortcut:ShowIntentionActions;</span> and see what happens:
<p class="image"><img src="images/completionImportStatic.png"></p>
@@ -1,14 +0,0 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/tips.css">
</head>
<body>
<p>
Pressing the same shortcut after you have invoked Class Name Completion will search for
classes in whole project and its libraries ignoring module dependencies.</p>
<p class="image">
<img src="images/first_class_name_completion.png"></p>
<p class="image">
<img src="images/second_class_name_completion.png"></p>
</body>
</html>
@@ -1,18 +0,0 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/tips.css">
</head>
<body>
<p>It's very easy to generate the whole anonymous implementation of some interface, for example, of some listener,
by using the SmartType code completion. For example, type</p>
<pre>
Component component;
component.addMouseListener(
<span class="keyword">new</span>&nbsp;<span class="caret">&lt;caret is here&gt;</span>&nbsp;);
</pre>
<p>and press <span class="shortcut">&shortcut:SmartTypeCompletion;</span> to see what happens.</p>
</body>
</html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

@@ -93,24 +93,12 @@
min-usage-count="15"
first-show="1"
successive-show="3"/>
<feature
id="editing.completion.classname"
tip-file="ClassNameCompletion.html"
min-usage-count="7"
first-show="3"
successive-show="5"/>
<feature
id="editing.completion.smarttype.general"
tip-file="SmartTypeCompletion.html"
min-usage-count="10"
first-show="2"
successive-show="3"/>
<feature
id="editing.completion.smarttype.anonymous"
tip-file="SmartTypeAnonymous.html"
min-usage-count="7"
first-show="3"
successive-show="4"/>
<feature
id="editing.completion.smarttype.afternew"
tip-file="SmartTypeAfterNew.html"
@@ -123,16 +111,6 @@
min-usage-count="5"
first-show="5"
successive-show="7"/>
<feature
id="editing.completion.second.classname"
tip-file="SecondClassNameCompletion.html"
min-usage-count="8"
first-show="10"
successive-show="3">
<dependency id="editing.completion.basic"/>
<dependency id="editing.completion.classname"/>
<dependency id="editing.completion.smarttype.general"/>
</feature>
<feature
id="editing.completion.second.basic"
tip-file="SecondBasicClassNameCompletion.html"
@@ -140,7 +118,6 @@
first-show="10"
successive-show="3">
<dependency id="editing.completion.basic"/>
<dependency id="editing.completion.classname"/>
<dependency id="editing.completion.smarttype.general"/>
</feature>
<feature