'Switch' statements with single case converted to 'if', other warnings fixed

This commit is contained in:
Tagir Valeev
2018-10-01 15:45:13 +07:00
parent a1271710ce
commit 4580bf04d9
32 changed files with 293 additions and 399 deletions
@@ -182,9 +182,9 @@ public class ProcessorProfilePanel extends JPanel {
myProcessorPathField.setText(FileUtil.toSystemDependentName(config.getProcessorPath()));
final String productionDirName = config.getGeneratedSourcesDirectoryName(false);
myGeneratedProductionDirField.setText(productionDirName != null? productionDirName.trim() : "");
myGeneratedProductionDirField.setText(productionDirName.trim());
final String testsDirName = config.getGeneratedSourcesDirectoryName(true);
myGeneratedTestsDirField.setText(testsDirName != null? testsDirName.trim() : "");
myGeneratedTestsDirField.setText(testsDirName.trim());
if (config.isOutputRelativeToContentRoot()) {
myRbRelativeToContentRoot.setSelected(true);
}
@@ -239,11 +239,11 @@ public class ProcessorProfilePanel extends JPanel {
}
private void updateEnabledState() {
final boolean enabled = myCbEnableProcessing.isSelected();
final boolean useProcessorpath = !myRbClasspath.isSelected();
final boolean enabled = myCbEnableProcessing.isSelected();
final boolean useProcessorPath = !myRbClasspath.isSelected();
myRbClasspath.setEnabled(enabled);
myRbProcessorsPath.setEnabled(enabled);
myProcessorPathField.setEnabled(enabled && useProcessorpath);
myProcessorPathField.setEnabled(enabled && useProcessorPath);
updateTable(myProcessorPanel, myProcessorTable, enabled);
updateTable(myOptionsPanel, myOptionsTable, enabled);
myGeneratedProductionDirField.setEnabled(enabled);
@@ -370,7 +370,7 @@ public class ProcessorProfilePanel extends JPanel {
}
public Map<String, String> getOptions() {
final Map<String, String> map = new java.util.HashMap<>();
final Map<String, String> map = new HashMap<>();
for (KeyValuePair pair : myRows) {
map.put(pair.key.trim(), pair.value.trim());
}
@@ -398,8 +398,8 @@ public class ProcessorProfilePanel extends JPanel {
@Override
public String getColumnName(int column) {
switch (column) {
case 0: return "Processor FQ Name";
if (column == 0) {
return "Processor FQ Name";
}
return super.getColumnName(column);
}
@@ -426,20 +426,16 @@ public class ProcessorProfilePanel extends JPanel {
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
switch (columnIndex) {
case 0: return myRows.get(rowIndex);
if (columnIndex == 0) {
return myRows.get(rowIndex);
}
return null;
}
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
if (aValue != null) {
switch (columnIndex) {
case 0:
myRows.set(rowIndex, (String)aValue);
break;
}
if (aValue != null && columnIndex == 0) {
myRows.set(rowIndex, (String)aValue);
}
}
@@ -468,10 +464,8 @@ public class ProcessorProfilePanel extends JPanel {
public void setProcessors(Collection<String> processors) {
clear();
if (!processors.isEmpty()) {
for (String processor : processors) {
myRows.add(processor);
}
Collections.sort(myRows, (o1, o2) -> o1.compareToIgnoreCase(o2));
myRows.addAll(processors);
Collections.sort(myRows, String.CASE_INSENSITIVE_ORDER);
fireTableRowsInserted(0, processors.size()-1);
}
}