Skip to content

Commit 331425d

Browse files
committed
Normalizing action names in JavaLocalize.yaml. Removing unused action names ShowPackageCycles, SliceSliceForward, Unscramble from JavaLocalize.
1 parent 511cda6 commit 331425d

17 files changed

Lines changed: 85 additions & 87 deletions

plugin/src/main/java/com/intellij/java/impl/codeInsight/generation/actions/GenerateConstructorAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
@ActionImpl(id = "GenerateConstructor")
3131
public class GenerateConstructorAction extends BaseGenerateAction {
3232
public GenerateConstructorAction() {
33-
super(new GenerateConstructorHandler(), JavaLocalize.actionGenerateconstructorText());
33+
super(new GenerateConstructorHandler(), JavaLocalize.actionGenerateConstructorText());
3434
}
3535

3636
@Override

plugin/src/main/java/com/intellij/java/impl/codeInsight/generation/actions/GenerateCreateUIAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
@ActionImpl(id = "GenerateCreateUI")
2828
public class GenerateCreateUIAction extends BaseGenerateAction {
2929
public GenerateCreateUIAction() {
30-
super(new GenerateCreateUIHandler(), JavaLocalize.actionGeneratecreateuiText());
30+
super(new GenerateCreateUIHandler(), JavaLocalize.actionGenerateCreateUIText());
3131
}
3232

3333
@Override

plugin/src/main/java/com/intellij/java/impl/codeInsight/generation/actions/GenerateEqualsAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
@ActionImpl(id = "GenerateEquals")
3131
public class GenerateEqualsAction extends BaseGenerateAction {
3232
public GenerateEqualsAction() {
33-
super(new GenerateEqualsHandler(), JavaLocalize.actionGenerateequalsText());
33+
super(new GenerateEqualsHandler(), JavaLocalize.actionGenerateEqualsText());
3434
}
3535

3636
@Override

plugin/src/main/java/com/intellij/java/impl/codeInsight/generation/actions/GenerateGetterAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
@ActionImpl(id = "GenerateGetter")
2929
public class GenerateGetterAction extends GenerateGetterSetterBaseAction {
3030
public GenerateGetterAction() {
31-
super(new GenerateGetterHandler(), JavaLocalize.actionGenerategetterText());
31+
super(new GenerateGetterHandler(), JavaLocalize.actionGenerateGetterText());
3232
}
3333
}

plugin/src/main/java/com/intellij/java/impl/codeInsight/generation/actions/GenerateGetterAndSetterAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
@ActionImpl(id = "GenerateGetterAndSetter")
2929
public class GenerateGetterAndSetterAction extends GenerateGetterSetterBaseAction {
3030
public GenerateGetterAndSetterAction() {
31-
super(new GenerateGetterAndSetterHandler(), JavaLocalize.actionGenerategetterandsetterText());
31+
super(new GenerateGetterAndSetterHandler(), JavaLocalize.actionGenerateGetterAndSetterText());
3232
}
3333
}

plugin/src/main/java/com/intellij/java/impl/codeInspection/inferNullity/InferNullityAnnotationsAction.java

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ public class InferNullityAnnotationsAction extends BaseAnalysisAction {
8181

8282
public InferNullityAnnotationsAction() {
8383
super(
84-
JavaLocalize.actionInfernullityText(),
85-
JavaLocalize.actionInfernullityDescription(),
84+
JavaLocalize.actionInferNullityText(),
85+
JavaLocalize.actionInferNullityDescription(),
8686
LocalizeValue.localizeTODO("Infer Nullity"),
8787
INFER_NULLITY_ANNOTATIONS
8888
);
@@ -91,8 +91,8 @@ public InferNullityAnnotationsAction() {
9191
@Override
9292
@RequiredUIAccess
9393
protected void analyze(@Nonnull Project project, @Nonnull AnalysisScope scope) {
94-
boolean annotateLocaVars = myAnnotateLocalVariablesCb.getValueOrError();
95-
ApplicationPropertiesComponent.getInstance().setValue(ANNOTATE_LOCAL_VARIABLES, annotateLocaVars);
94+
boolean annotateLocalVars = myAnnotateLocalVariablesCb.getValueOrError();
95+
ApplicationPropertiesComponent.getInstance().setValue(ANNOTATE_LOCAL_VARIABLES, annotateLocalVars);
9696
myAnnotateLocalVariablesCb = null;
9797

9898
ProgressManager progressManager = ProgressManager.getInstance();
@@ -150,16 +150,16 @@ else if (javaPsiFacade.findClass(
150150
return;
151151
}
152152
PsiDocumentManager.getInstance(project).commitAllDocuments();
153-
UsageInfo[] usageInfos = findUsages(annotateLocaVars, project, scope, fileCount[0]);
153+
UsageInfo[] usageInfos = findUsages(annotateLocalVars, project, scope, fileCount[0]);
154154
if (usageInfos == null) {
155155
return;
156156
}
157157

158-
processUsages(annotateLocaVars, project, scope, usageInfos);
158+
processUsages(annotateLocalVars, project, scope, usageInfos);
159159
}
160160

161161
protected void processUsages(
162-
boolean annotateLocaVars,
162+
boolean annotateLocalVars,
163163
@Nonnull Project project,
164164
@Nonnull AnalysisScope scope,
165165
@Nonnull UsageInfo[] usageInfos
@@ -168,7 +168,7 @@ protected void processUsages(
168168
applyRunnable(project, () -> usageInfos).run();
169169
}
170170
else {
171-
showUsageView(annotateLocaVars, project, usageInfos, scope);
171+
showUsageView(annotateLocalVars, project, usageInfos, scope);
172172
}
173173
}
174174

@@ -185,7 +185,7 @@ public static boolean addAnnotationsDependency(
185185
message += StringUtil.join(modulesWithoutAnnotations, Module::getName, ", ");
186186
message += (modulesWithoutAnnotations.size() == 1 ? " doesn't" : " don't");
187187
message += " refer to the existing '" + annotationsLib.getName() + "' library" +
188-
" with Consulo nullity annotations. Would you like to add the dependenc";
188+
" with Consulo nullity annotations. Would you like to add the dependency";
189189
message += (modulesWithoutAnnotations.size() == 1 ? "y" : "ies") + " now?";
190190
if (Messages.showOkCancelDialog(project, message, title.get(), UIUtil.getErrorIcon()) == Messages.OK) {
191191
project.getApplication().runWriteAction(() ->
@@ -199,26 +199,37 @@ public static boolean addAnnotationsDependency(
199199
return false;
200200
}
201201

202-
/*if (Messages.showOkCancelDialog(project, "It is required that JetBrains annotations" + " be available in all your project sources.\n\nYou will need to add annotations.jar as a library. " +
203-
"It is possible to configure custom JAR\nin e.g. Constant Conditions & Exceptions inspection or use JetBrains annotations available in installation. " + "\nIntelliJ IDEA nullity " +
204-
"annotations are freely usable and redistributable under the Apache 2.0 license.\nWould you like to do it now?", title, Messages.getErrorIcon()) == Messages.OK)
205-
{
206-
Module firstModule = modulesWithoutAnnotations.iterator().next();
207-
JavaProjectModelModificationService.getInstance(project).addDependency(modulesWithoutAnnotations, JetBrainsAnnotationsExternalLibraryResolver.getAnnotationsLibraryDescriptor(firstModule)
208-
, DependencyScope.COMPILE);
209-
return true;
210-
} */
202+
/*
203+
if (Messages.showOkCancelDialog(
204+
project,
205+
"It is required that JetBrains annotations be available in all your project sources.\n\n" +
206+
"You will need to add annotations.jar as a library. It is possible to configure custom JAR\n" +
207+
"in e.g. Constant Conditions & Exceptions inspection or use JetBrains annotations available in installation.\n" +
208+
"IntelliJ IDEA nullity annotations are freely usable and redistributable under the Apache 2.0 license.\n" +
209+
"Would you like to do it now?",
210+
title,
211+
Messages.getErrorIcon()
212+
) == Messages.OK) {
213+
Module firstModule = modulesWithoutAnnotations.iterator().next();
214+
JavaProjectModelModificationService.getInstance(project).addDependency(
215+
modulesWithoutAnnotations,
216+
JetBrainsAnnotationsExternalLibraryResolver.getAnnotationsLibraryDescriptor(firstModule),
217+
DependencyScope.COMPILE
218+
);
219+
return true;
220+
}
221+
*/
211222
return false;
212223
}
213224

214225
@Nullable
215226
protected UsageInfo[] findUsages(
216-
boolean annotateLocaVars,
227+
boolean annotateLocalVars,
217228
@Nonnull Project project,
218229
@Nonnull AnalysisScope scope,
219230
int fileCount
220231
) {
221-
NullityInferrer inferrer = new NullityInferrer(annotateLocaVars, project);
232+
NullityInferrer inferrer = new NullityInferrer(annotateLocalVars, project);
222233
PsiManager psiManager = PsiManager.getInstance(project);
223234
Runnable searchForUsages = () -> scope.accept(new PsiElementVisitor() {
224235
int myFileCount;
@@ -235,7 +246,7 @@ public void visitFile(PsiFile file) {
235246
ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
236247
if (progressIndicator != null) {
237248
progressIndicator.setText2(ProjectUtil.calcRelativeToProjectPath(virtualFile, project));
238-
progressIndicator.setFraction(((double)myFileCount) / fileCount);
249+
progressIndicator.setFraction(((double) myFileCount) / fileCount);
239250
}
240251
if (file instanceof PsiJavaFile) {
241252
inferrer.collect(file);
@@ -309,7 +320,7 @@ protected void restartAnalysis(Project project, AnalysisScope scope) {
309320
}
310321

311322
private void showUsageView(
312-
boolean annotateLocaVars,
323+
boolean annotateLocalVars,
313324
@Nonnull Project project,
314325
UsageInfo[] usageInfos,
315326
@Nonnull AnalysisScope scope
@@ -334,19 +345,20 @@ private void showUsageView(
334345
presentation.setTabText("Infer Nullity Preview");
335346
presentation.setShowReadOnlyStatusAsRed(true);
336347
presentation.setShowCancelButton(true);
337-
presentation.setUsagesString(RefactoringLocalize.usageviewUsagestext().get());
348+
presentation.setUsagesString(RefactoringLocalize.usageviewUsagestext());
338349

339350
UsageView usageView =
340-
UsageViewManager.getInstance(project).showUsages(targets, usages, presentation, rerunFactory(annotateLocaVars, project, scope));
351+
UsageViewManager.getInstance(project).showUsages(targets, usages, presentation, rerunFactory(annotateLocalVars, project, scope));
341352

342353
Runnable refactoringRunnable = applyRunnable(project, () ->
343354
{
344355
Set<UsageInfo> infos = UsageViewUtil.getNotExcludedUsageInfos(usageView);
345356
return infos.toArray(new UsageInfo[infos.size()]);
346357
});
347358

348-
String canNotMakeString =
349-
"Cannot perform operation.\nThere were changes in code after usages have been found.\nPlease perform operation search again.";
359+
String canNotMakeString = "Cannot perform operation.\n" +
360+
"There were changes in code after usages have been found.\n" +
361+
"Please perform operation search again.";
350362

351363
usageView.addPerformOperationAction(
352364
refactoringRunnable,
@@ -359,7 +371,7 @@ private void showUsageView(
359371

360372
@Nonnull
361373
private Supplier<UsageSearcher> rerunFactory(
362-
boolean annotateLocaVars,
374+
boolean annotateLocalVars,
363375
@Nonnull Project project,
364376
@Nonnull AnalysisScope scope
365377
) {
@@ -368,7 +380,7 @@ private Supplier<UsageSearcher> rerunFactory(
368380
@Override
369381
protected UsageInfo[] findUsages() {
370382
return ObjectUtil.notNull(
371-
InferNullityAnnotationsAction.this.findUsages(annotateLocaVars, project, scope, scope.getFileCount()),
383+
InferNullityAnnotationsAction.this.findUsages(annotateLocalVars, project, scope, scope.getFileCount()),
372384
UsageInfo.EMPTY_ARRAY
373385
);
374386
}
@@ -380,8 +392,8 @@ public void generate(@Nonnull Predicate<Usage> processor) {
380392
};
381393
}
382394

383-
@RequiredUIAccess
384395
@Override
396+
@RequiredUIAccess
385397
protected void extendMainLayout(BaseAnalysisActionDialog dialog, VerticalLayout layout, Project project) {
386398
myAnnotateLocalVariablesCb =
387399
CheckBox.create(LocalizeValue.localizeTODO("Annotate local variables"));

plugin/src/main/java/com/intellij/java/impl/ide/actions/CreateClassAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
@ActionImpl(id = "JavaNewClass", parents = @ActionParentRef(value = @ActionRef(id = "NewGroup1"), anchor = ActionRefAnchor.FIRST))
5858
public class CreateClassAction extends JavaCreateTemplateInPackageAction<PsiClass> implements DumbAware {
5959
public CreateClassAction() {
60-
super(LocalizeValue.empty(), LocalizeValue.empty(), PlatformIconGroup.nodesClass(), true);
60+
super(JavaLocalize.actionNewClassText(), JavaLocalize.actionNewClassDescription(), PlatformIconGroup.nodesClass(), true);
6161
}
6262

6363
@Override
@@ -100,14 +100,14 @@ public String getErrorText(String inputString) {
100100
return null;
101101
}
102102

103-
@RequiredUIAccess
104103
@Override
104+
@RequiredUIAccess
105105
public boolean checkInput(String inputString) {
106106
return true;
107107
}
108108

109-
@RequiredUIAccess
110109
@Override
110+
@RequiredUIAccess
111111
public boolean canClose(String inputString) {
112112
return !StringUtil.isEmptyOrSpaces(inputString) && getErrorText(inputString) == null;
113113
}

plugin/src/main/java/com/intellij/java/impl/javadoc/actions/GenerateJavadocAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public final class GenerateJavadocAction extends BaseAnalysisAction {
4949

5050
public GenerateJavadocAction() {
5151
super(
52-
JavaLocalize.actionGeneratejavadocText(),
53-
JavaLocalize.actionGeneratejavadocDescription(),
52+
JavaLocalize.actionGenerateJavadocText(),
53+
JavaLocalize.actionGenerateJavadocDescription(),
5454
JavadocLocalize.javadocGenerateTitle(),
5555
JavadocLocalize.javadocGenerateTitle()
5656
);

plugin/src/main/java/com/intellij/java/impl/refactoring/actions/InvertBooleanAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
@ActionImpl(id = "InvertBoolean")
3737
public class InvertBooleanAction extends BaseRefactoringAction {
3838
public InvertBooleanAction() {
39-
super(JavaLocalize.actionInvertbooleanText(), JavaLocalize.actionInvertbooleanText());
39+
super(JavaLocalize.actionInvertBooleanText(), JavaLocalize.actionInvertBooleanDescription());
4040
}
4141

4242
@Override

plugin/src/main/java/com/intellij/java/impl/refactoring/actions/MakeStaticAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
@ActionImpl(id = "MakeStatic")
4343
public class MakeStaticAction extends BaseRefactoringAction {
4444
public MakeStaticAction() {
45-
super(JavaLocalize.actionMakestaticText(), JavaLocalize.actionMakestaticDescription());
45+
super(JavaLocalize.actionMakeStaticText(), JavaLocalize.actionMakeStaticDescription());
4646
}
4747

4848
@Override

0 commit comments

Comments
 (0)