LAB-62 get rid of static *Bundle usages: more fields with better names

GitOrigin-RevId: a45cdabe30739e10f6ae9c979819b6ee9d5afdd0
This commit is contained in:
Dmitry.Krasilschikov
2020-01-01 18:14:10 +02:00
committed by intellij-monorepo-bot
parent bb8b4b8c66
commit 89c610e27f
21 changed files with 44 additions and 44 deletions

View File

@@ -202,8 +202,8 @@ public class DebuggerTreeRenderer extends ColoredTreeCellRenderer {
nodeName = descriptor.getName();
}
if(text.equals(XDebuggerUIConstants.getCOLLECTING_DATA_MESSAGE())) {
descriptorText.append(XDebuggerUIConstants.getCOLLECTING_DATA_MESSAGE(), XDebuggerUIConstants.COLLECTING_DATA_HIGHLIGHT_ATTRIBUTES);
if(text.equals(XDebuggerUIConstants.getCollectingDataMessage())) {
descriptorText.append(XDebuggerUIConstants.getCollectingDataMessage(), XDebuggerUIConstants.COLLECTING_DATA_HIGHLIGHT_ATTRIBUTES);
return descriptorText;
}
@@ -283,8 +283,8 @@ public class DebuggerTreeRenderer extends ColoredTreeCellRenderer {
descriptorText.append(errorMessage, XDebuggerUIConstants.EXCEPTION_ATTRIBUTES);
}
else {
if(valueLabel.equals(XDebuggerUIConstants.getCOLLECTING_DATA_MESSAGE())) {
descriptorText.append(XDebuggerUIConstants.getCOLLECTING_DATA_MESSAGE(), XDebuggerUIConstants.COLLECTING_DATA_HIGHLIGHT_ATTRIBUTES);
if(valueLabel.equals(XDebuggerUIConstants.getCollectingDataMessage())) {
descriptorText.append(XDebuggerUIConstants.getCollectingDataMessage(), XDebuggerUIConstants.COLLECTING_DATA_HIGHLIGHT_ATTRIBUTES);
}
else {
appendValueTextWithEscapesRendering(descriptorText, valueLabel, valueLabelAttribs, colorScheme);

View File

@@ -37,7 +37,7 @@ public class MessageDescriptor extends NodeDescriptorImpl {
public static final MessageDescriptor ARRAY_IS_EMPTY = new MessageDescriptor(DebuggerBundle.message("message.node.empty.array"));
public static final MessageDescriptor CLASS_HAS_NO_FIELDS = new MessageDescriptor(DebuggerBundle.message("message.node.class.has.no.fields"));
public static final MessageDescriptor OBJECT_COLLECTED = new MessageDescriptor(DebuggerBundle.message("message.node.object.collected"));
public static final MessageDescriptor EVALUATING = new MessageDescriptor(XDebuggerUIConstants.getCOLLECTING_DATA_MESSAGE());
public static final MessageDescriptor EVALUATING = new MessageDescriptor(XDebuggerUIConstants.getCollectingDataMessage());
public static final MessageDescriptor THREAD_IS_RUNNING = new MessageDescriptor(DebuggerBundle.message("message.node.thread.running"));
public static final MessageDescriptor THREAD_IS_EMPTY = new MessageDescriptor(DebuggerBundle.message("message.node.thread.has.no.frames"));
public static final MessageDescriptor EVALUATION_NOT_POSSIBLE = new MessageDescriptor(DebuggerBundle.message("message.node.evaluation.not.possible", WARNING));

View File

@@ -89,7 +89,7 @@ public class ToStringRenderer extends NodeRendererImpl implements OnDemandRender
labelListener.labelChanged();
}
});
return XDebuggerUIConstants.getCOLLECTING_DATA_MESSAGE();
return XDebuggerUIConstants.getCollectingDataMessage();
}
@NotNull

View File

@@ -236,7 +236,7 @@ public class CanBeFinalInspection extends GlobalJavaBatchInspectionTool {
@Override
@NotNull
public String getFamilyName() {
return getQUICK_FIX_NAME();
return getQuickFixName();
}
@Override
@@ -265,7 +265,7 @@ public class CanBeFinalInspection extends GlobalJavaBatchInspectionTool {
}
}
private static String getQUICK_FIX_NAME() {
private static String getQuickFixName() {
return InspectionsBundle.message("inspection.can.be.final.accept.quickfix");
}
}

View File

@@ -19,7 +19,7 @@ public class PackagesPaneSelectInTarget extends ProjectViewSelectInTarget {
}
public String toString() {
return SelectInManager.getPACKAGES();
return SelectInManager.getPackages();
}
@Override

View File

@@ -41,7 +41,7 @@ public interface HighlightInfoType {
HighlightInfoType DUPLICATE_FROM_SERVER = new HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, CodeInsightColors.DUPLICATE_FROM_SERVER);
HighlightInfoType UNUSED_SYMBOL = new HighlightInfoTypeSeverityByKey(
HighlightDisplayKey.findOrRegister(UNUSED_SYMBOL_SHORT_NAME, getUNUSED_SYMBOL_DISPLAY_NAME(), UNUSED_SYMBOL_SHORT_NAME),
HighlightDisplayKey.findOrRegister(UNUSED_SYMBOL_SHORT_NAME, getUnusedSymbolDisplayName(), UNUSED_SYMBOL_SHORT_NAME),
CodeInsightColors.NOT_USED_ELEMENT_ATTRIBUTES);
HighlightInfoType DEPRECATED = new HighlightInfoTypeSeverityByKey(
@@ -235,7 +235,7 @@ public interface HighlightInfoType {
boolean needsUpdateOnTyping();
}
static String getUNUSED_SYMBOL_DISPLAY_NAME() {
static String getUnusedSymbolDisplayName() {
return InspectionsBundle.message("inspection.dead.code.display.name");
}
}

View File

@@ -280,7 +280,7 @@ public abstract class InspectionRVContentProvider {
model,
currentParent,
showStructure
|| HighlightInfoType.getUNUSED_SYMBOL_DISPLAY_NAME().equals(toolWrapper.getDisplayName())
|| HighlightInfoType.getUnusedSymbolDisplayName().equals(toolWrapper.getDisplayName())
|| presentation.isDummy());
appendDescriptor(context, toolWrapper, container, node);
}

View File

@@ -33,12 +33,12 @@ final class FavoritesViewSelectInTarget extends SelectInTargetPsiWrapper {
}
public String toString() {
return SelectInManager.getFAVORITES();
return SelectInManager.getFavorites();
}
@Override
public String getToolWindowId() {
return SelectInManager.getFAVORITES();
return SelectInManager.getFavorites();
}
@Override

View File

@@ -79,6 +79,6 @@ final class SelectInNavBarTarget extends SelectInTargetPsiWrapper implements Dum
}
public String toString() {
return SelectInManager.getNAV_BAR();
return SelectInManager.getNavBar();
}
}

View File

@@ -28,7 +28,7 @@ public class ScopePaneSelectInTarget extends ProjectViewSelectInTarget {
}
public String toString() {
return SelectInManager.getSCOPE();
return SelectInManager.getScope();
}
@Override

View File

@@ -83,23 +83,23 @@ public final class SelectInManager {
return IdeBundle.message("select.in.project");
}
public static String getPACKAGES() {
public static String getPackages() {
return IdeBundle.message("select.in.packages");
}
public static String getCOMMANDER() {
public static String getCommander() {
return IdeBundle.message("select.in.commander");
}
public static String getFAVORITES() {
public static String getFavorites() {
return IdeBundle.message("select.in.favorites");
}
public static String getNAV_BAR() {
public static String getNavBar() {
return IdeBundle.message("select.in.nav.bar");
}
public static String getSCOPE() {
public static String getScope() {
return IdeBundle.message("select.in.scope");
}
}

View File

@@ -28,7 +28,7 @@ import java.util.List;
public abstract class DefaultRollbackEnvironment implements RollbackEnvironment {
@Override
public String getRollbackOperationName() {
return getROLLBACK_OPERATION_NAME();
return getRollbackOperationText();
}
@Override
@@ -41,7 +41,7 @@ public abstract class DefaultRollbackEnvironment implements RollbackEnvironment
public void rollbackIfUnchanged(final VirtualFile file) {
}
public static String getROLLBACK_OPERATION_NAME() {
public static String getRollbackOperationText() {
return VcsBundle.message("changes.action.rollback.text");
}
}

View File

@@ -39,7 +39,7 @@ public class RollbackWorker {
private final List<VcsException> myExceptions;
public RollbackWorker(final Project project) {
this(project, DefaultRollbackEnvironment.getROLLBACK_OPERATION_NAME(), false);
this(project, DefaultRollbackEnvironment.getRollbackOperationText(), false);
}
public RollbackWorker(final Project project, final String operationName, boolean invokedFromModalContext) {

View File

@@ -39,7 +39,7 @@ public class RollbackUtil {
* Finds the most appropriate name for the "Rollback" operation for the given VCSs.
* That is: iterates through the all {@link RollbackEnvironment#getRollbackOperationName() RollbackEnvironments} and picks
* the operation name if it is equal to all given VCSs.
* Otherwise picks the {@link DefaultRollbackEnvironment#getROLLBACK_OPERATION_NAME() default name}.
* Otherwise picks the {@link DefaultRollbackEnvironment#getRollbackOperationText() default name}.
* @param vcses affected VCSs.
* @return name for the "rollback" operation to be used in the UI.
*/
@@ -54,11 +54,11 @@ public class RollbackUtil {
}
else if (!operationName.equals(rollbackEnvironment.getRollbackOperationName())) {
// if there are different names, use default
return DefaultRollbackEnvironment.getROLLBACK_OPERATION_NAME();
return DefaultRollbackEnvironment.getRollbackOperationText();
}
}
}
return operationName != null ? operationName : DefaultRollbackEnvironment.getROLLBACK_OPERATION_NAME();
return operationName != null ? operationName : DefaultRollbackEnvironment.getRollbackOperationText();
}
/**

View File

@@ -167,7 +167,7 @@ public class XValueHint extends AbstractValueHint {
EdtExecutorService.getScheduledExecutorInstance().schedule(() -> {
if (myCurrentHint == null && showEvaluating.get()) {
SimpleColoredComponent component = HintUtil.createInformationComponent();
component.append(XDebuggerUIConstants.getEVALUATING_EXPRESSION_MESSAGE());
component.append(XDebuggerUIConstants.getEvaluatingExpressionMessage());
showHint(component);
}
}, 200, TimeUnit.MILLISECONDS);

View File

@@ -137,7 +137,7 @@ public class DebuggerUIUtil {
}
public static void showValuePopup(@NotNull XFullValueEvaluator evaluator, @NotNull MouseEvent event, @NotNull Project project, @Nullable Editor editor) {
EditorTextField textArea = new TextViewer(XDebuggerUIConstants.getEVALUATING_EXPRESSION_MESSAGE(), project);
EditorTextField textArea = new TextViewer(XDebuggerUIConstants.getEvaluatingExpressionMessage(), project);
textArea.setBackground(HintUtil.getInformationColor());
final FullValueEvaluationCallbackImpl callback = new FullValueEvaluationCallbackImpl(textArea);

View File

@@ -16,7 +16,7 @@ import java.awt.*;
*/
public class XDebuggerUIConstants {
/**
* Use {code {@link #getCOLLECTING_DATA_MESSAGE()}} instead
* Use {code {@link #getCollectingDataMessage()}} instead
*/
@Deprecated
public static final String COLLECTING_DATA_MESSAGE = "Collecting data…";
@@ -50,15 +50,15 @@ public class XDebuggerUIConstants {
private XDebuggerUIConstants() {
}
public static String getCOLLECTING_DATA_MESSAGE() {
public static String getCollectingDataMessage() {
return XDebuggerBundle.message("xdebugger.building.tree.node.message");
}
public static String getEVALUATING_EXPRESSION_MESSAGE() {
public static String getEvaluatingExpressionMessage() {
return XDebuggerBundle.message("xdebugger.evaluating.expression.node.message");
}
public static String getMODIFYING_VALUE_MESSAGE() {
public static String getModifyingValueMessage() {
return XDebuggerBundle.message("xdebugger.modifiyng.value.node.message");
}
}

View File

@@ -105,12 +105,12 @@ public class MessageTreeNode extends XDebuggerTreeNode {
}
public static MessageTreeNode createLoadingMessage(XDebuggerTree tree, final XDebuggerTreeNode parent) {
return new MessageTreeNode(tree, parent, XDebuggerUIConstants.getCOLLECTING_DATA_MESSAGE(),
return new MessageTreeNode(tree, parent, XDebuggerUIConstants.getCollectingDataMessage(),
XDebuggerUIConstants.COLLECTING_DATA_HIGHLIGHT_ATTRIBUTES, null);
}
public static MessageTreeNode createEvaluatingMessage(XDebuggerTree tree, @Nullable XDebuggerTreeNode parent) {
return new MessageTreeNode(tree, parent, XDebuggerUIConstants.getEVALUATING_EXPRESSION_MESSAGE(),
return new MessageTreeNode(tree, parent, XDebuggerUIConstants.getEvaluatingExpressionMessage(),
XDebuggerUIConstants.EVALUATING_EXPRESSION_HIGHLIGHT_ATTRIBUTES, null);
}

View File

@@ -66,7 +66,7 @@ public class XValueNodeImpl extends XValueContainerNode<XValue> implements XValu
myText.append(myName, XDebuggerUIConstants.VALUE_NAME_ATTRIBUTES);
myText.append(XDebuggerUIConstants.EQ_TEXT, SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
myText.append(XDebuggerUIConstants.getCOLLECTING_DATA_MESSAGE(), XDebuggerUIConstants.COLLECTING_DATA_HIGHLIGHT_ATTRIBUTES);
myText.append(XDebuggerUIConstants.getCollectingDataMessage(), XDebuggerUIConstants.COLLECTING_DATA_HIGHLIGHT_ATTRIBUTES);
}
}
@@ -293,7 +293,7 @@ public class XValueNodeImpl extends XValueContainerNode<XValue> implements XValu
myText.clear();
appendName();
XValuePresentationUtil.appendSeparator(myText, myValuePresentation.getSeparator());
myText.append(XDebuggerUIConstants.getMODIFYING_VALUE_MESSAGE(), XDebuggerUIConstants.MODIFYING_VALUE_HIGHLIGHT_ATTRIBUTES);
myText.append(XDebuggerUIConstants.getModifyingValueMessage(), XDebuggerUIConstants.MODIFYING_VALUE_HIGHLIGHT_ATTRIBUTES);
setLeaf(true);
fireNodeStructureChanged();
}

View File

@@ -17,7 +17,7 @@ public final class CommanderSelectInTarget extends SelectInTargetPsiWrapper {
}
public String toString() {
return SelectInManager.getCOMMANDER();
return SelectInManager.getCommander();
}
@Override

View File

@@ -65,10 +65,10 @@ public class InlinePropertyHandler extends JavaInlineActionHandler {
);
if (!result) {
CommonRefactoringUtil.showErrorHint(project, editor, "Property has non-method usages", getREFACTORING_NAME(), null);
CommonRefactoringUtil.showErrorHint(project, editor, "Property has non-method usages", getRefactoringName(), null);
}
if (occurrences.isEmpty()) {
CommonRefactoringUtil.showErrorHint(project, editor, "Property has no usages", getREFACTORING_NAME(), null);
CommonRefactoringUtil.showErrorHint(project, editor, "Property has no usages", getRefactoringName(), null);
return;
}
@@ -76,7 +76,7 @@ public class InlinePropertyHandler extends JavaInlineActionHandler {
String occurrencesString = RefactoringBundle.message("occurrences.string", occurrences.size());
String question =
PropertiesBundle.message("inline.property.confirmation", property.getName(), propertyValue) + " " + occurrencesString;
RefactoringMessageDialog dialog = new RefactoringMessageDialog(getREFACTORING_NAME(), question, HelpID.INLINE_VARIABLE,
RefactoringMessageDialog dialog = new RefactoringMessageDialog(getRefactoringName(), question, HelpID.INLINE_VARIABLE,
"OptionPane.questionIcon", true, project);
if (!dialog.showAndGet()) {
return;
@@ -86,7 +86,7 @@ public class InlinePropertyHandler extends JavaInlineActionHandler {
final RefactoringEventData data = new RefactoringEventData();
data.addElement(psiElement.copy());
WriteCommandAction.writeCommandAction(project, containingFiles.toArray(PsiFile.EMPTY_ARRAY)).withName(getREFACTORING_NAME()).run(() -> {
WriteCommandAction.writeCommandAction(project, containingFiles.toArray(PsiFile.EMPTY_ARRAY)).withName(getRefactoringName()).run(() -> {
project.getMessageBus().syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringStarted(REFACTORING_ID, data);
PsiLiteral stringLiteral = (PsiLiteral)JavaPsiFacade.getInstance(project).getElementFactory().
createExpressionFromText("\"" + StringUtil.escapeStringCharacters(propertyValue) + "\"", null);
@@ -100,10 +100,10 @@ public class InlinePropertyHandler extends JavaInlineActionHandler {
@Nullable
@Override
public String getActionName(PsiElement element) {
return getREFACTORING_NAME();
return getRefactoringName();
}
public static String getREFACTORING_NAME() {
public static String getRefactoringName() {
return PropertiesBundle.message("inline.property.refactoring");
}
}