small refactorings

This commit is contained in:
2014-12-07 12:41:55 +01:00
parent 1e9da7fd40
commit cdae56d128
36 changed files with 154 additions and 108 deletions
+10 -9
View File
@@ -27,20 +27,21 @@ public class BlockFileHeader {
protected static final int kBlockHeaderSize = 8192; // Two pages: almost 64k entries
private static final int kMaxBlocks = (kBlockHeaderSize - 80) * 8;
private long magic; // c3 ca 04 c1
private long version; // 00 00 02 00
private int this_file;
private int next_file;
private int entry_size;
private int num_entries;
private int max_entries;
private final long magic; // c3 ca 04 c1
private final long version; // 00 00 02 00
private final int this_file;
private final int next_file;
private final int entry_size;
private final int num_entries;
private final int max_entries;
private int empty[] = new int[4];
private int hints[] = new int[4];
private int updating;
private final int updating;
private int user[] = new int[5];
private long allocation_map[] = new long[kMaxBlocks / 32];
private final long allocation_map[];
public BlockFileHeader(InputStream is) throws IOException {
this.allocation_map = new long[kMaxBlocks / 32];
IndexInputStream iis = new IndexInputStream(is);
magic = iis.readUInt32();
version = iis.readUInt32();
@@ -299,7 +299,7 @@ public class FolderPreviewPanel extends JPanel {
if (imgSrc != null) {
return imgSrc;
}
scale = 1;
}
@@ -66,9 +66,9 @@ public class LoadFromCacheFrame extends AppFrame implements ActionListener {
private List<CacheImplementation> caches;
private List<CacheEntry> entries;
private final JProgressBar progressBar;
private JButton saveButton;
private JButton refreshButton;
private JButton openButton;
private final JButton saveButton;
private final JButton refreshButton;
private final JButton openButton;
public LoadFromCacheFrame() {
setSize(900, 600);
@@ -1726,12 +1726,12 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
// "configuration items" for the current replace only
private final ConfigurationItem<Boolean> showAgainIgnoreMissingCharacters = new ConfigurationItem<>("showAgainIgnoreMissingCharacters", true, true);
private boolean ignoreMissingCharacters = false;
@Override
public boolean getIgnoreMissingCharacters() {
return ignoreMissingCharacters;
}
@Override
public boolean handle(TextTag textTag, FontTag font, char character) {
String fontName = font.getSwf().sourceFontNamesMap.get(font.getFontId());
@@ -1742,9 +1742,9 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
if (f == null || !f.canDisplay(character)) {
String msg = translate("error.font.nocharacter").replace("%char%", "" + character);
logger.log(Level.SEVERE, msg + " FontId: " + font.getCharacterId() + " TextId: " + textTag.getCharacterId());
ignoreMissingCharacters = View.showConfirmDialog(null, msg, translate("error"),
JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE,
showAgainIgnoreMissingCharacters,
ignoreMissingCharacters = View.showConfirmDialog(null, msg, translate("error"),
JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE,
showAgainIgnoreMissingCharacters,
ignoreMissingCharacters ? JOptionPane.OK_OPTION : JOptionPane.CANCEL_OPTION) == JOptionPane.OK_OPTION;
return false;
}
@@ -37,7 +37,7 @@ import jsyntaxpane.SyntaxDocument;
public class UndoFixedEditorPane extends JEditorPane {
private static final Object setTextLock = new Object();
@Override
public void setText(String t) {
setText(t, getContentType());
@@ -31,10 +31,10 @@ public class Debugger {
private static class DebugHandler extends Thread {
private Socket s;
private int serverPort;
private final Socket s;
private final int serverPort;
private static int maxid = 0;
private int id;
private final int id;
public boolean finished = false;
public DebugHandler(int serverPort, Socket s) {
@@ -167,7 +167,7 @@ public class TagTreeModel implements TreeModel {
frames.add(timeline.getFrames().get(i));
}
for (int i = sounds.size() - 1; i >=0 ; i--) {
for (int i = sounds.size() - 1; i >= 0; i--) {
TreeItem sound = sounds.get(i);
if (sound instanceof SoundStreamHeadTypeTag) {
List<SoundStreamBlockTag> blocks = ((SoundStreamHeadTypeTag) sound).getBlocks();