Warnings fixed

GitOrigin-RevId: feabd51d4f4c25bfc769b22d3847294e202f2462
This commit is contained in:
Tagir Valeev
2020-04-29 07:50:12 +00:00
committed by intellij-monorepo-bot
parent b49093fdec
commit a1ca90c8a6
5 changed files with 7 additions and 8 deletions
@@ -78,7 +78,7 @@ public class TreeViewUtil {
}
name.insert(0, ".");
if (packageName.length() > 2 && shouldAbbreviateName(parentPackage)) {
name.insert(0, packageName.substring(0, 1));
name.insert(0, packageName.charAt(0));
}
else {
name.insert(0, packageName);
@@ -367,7 +367,7 @@ public class SwingHelper {
}
}
public static void setLongestAsPrototype(@NotNull JComboBox comboBox, @NotNull List<String> variants) {
private static void setLongestAsPrototype(@NotNull JComboBox comboBox, @NotNull List<String> variants) {
Object prototypeDisplayValue = comboBox.getPrototypeDisplayValue();
String prototypeDisplayValueStr = null;
if (prototypeDisplayValue instanceof String) {
@@ -724,15 +724,14 @@ public class SwingHelper {
final String currentSubstring = text.substring(0, currentLen);
int realWidth = fm.stringWidth(currentSubstring);
int delta = 0;
if (realWidth >= availableWidth) {
int delta = 0;
for (int i = currentLen - 1; i >= 0; i--) {
if ((realWidth - delta) < availableWidth) return text.substring(0, i) + ELLIPSIS;
delta += fm.charWidth(currentSubstring.charAt(i));
}
return text.substring(0, 1) + ELLIPSIS;
return text.charAt(0) + ELLIPSIS;
} else {
int delta = 0;
for (int i = currentLen; i < text.length(); i++) {
if ((realWidth + delta) >= availableWidth) return text.substring(0, i) + ELLIPSIS;
delta += fm.charWidth(text.charAt(i));
@@ -75,7 +75,7 @@ public class GitRebaseEditorMain implements GitExternalApp {
params.add(handlerId);
if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).startsWith("windows") && file.startsWith(CYGDRIVE_PREFIX)) {
int p = CYGDRIVE_PREFIX.length();
file = file.substring(p, p + 1) + ":" + file.substring(p + 1);
file = file.charAt(p) + ":" + file.substring(p + 1);
}
params.add(new File(file).getAbsolutePath());
Integer exitCode = (Integer)client.execute(HANDLER_NAME + ".editCommits", params);
@@ -85,7 +85,7 @@ class GitInteractiveRebaseFile {
private static String adjustFilePath(@NotNull String file) {
if (SystemInfo.isWindows && file.startsWith(CYGDRIVE_PREFIX)) {
final int prefixSize = CYGDRIVE_PREFIX.length();
return file.substring(prefixSize, prefixSize + 1) + ":" + file.substring(prefixSize + 1);
return file.charAt(prefixSize) + ":" + file.substring(prefixSize + 1);
}
return file;
}
@@ -173,7 +173,7 @@ public class GrUnusedIncDecInspection extends BaseInspection {
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
GrUnaryExpression expr = findUnaryExpression(descriptor);
GrExpression newExpr = GroovyPsiElementFactory.getInstance(project)
.createExpressionFromText(expr.getOperand().getText() + expr.getOperationToken().getText().substring(0, 1) + "1");
.createExpressionFromText(expr.getOperand().getText() + expr.getOperationToken().getText().charAt(0) + "1");
expr.replaceWithExpression(newExpr, true);
}
}