Trivial code cleanup
This commit is contained in:
parent
d934740377
commit
0621f680f8
12 changed files with 158 additions and 152 deletions
|
@ -87,11 +87,11 @@ public class DatExtractDialog extends ProgressDialog {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
FTLDat.AbstractPack srcP = null;
|
FTLDat.AbstractPack srcP = null;
|
||||||
FTLDat.AbstractPack dstP = null;
|
FTLDat.AbstractPack dstP = null;
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
int progress = 0;
|
int progress = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ( !extractDir.exists() ) extractDir.mkdirs();
|
if ( !extractDir.exists() ) extractDir.mkdirs();
|
||||||
|
|
||||||
|
@ -117,19 +117,19 @@ public class DatExtractDialog extends ProgressDialog {
|
||||||
}
|
}
|
||||||
setTaskOutcomeLater( true, null );
|
setTaskOutcomeLater( true, null );
|
||||||
}
|
}
|
||||||
catch ( Exception ex ) {
|
catch ( Exception e ) {
|
||||||
log.error( "Error extracting dats.", ex );
|
log.error( "Error extracting dats.", e );
|
||||||
setTaskOutcomeLater( false, ex );
|
setTaskOutcomeLater( false, e );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
try {if ( is != null ) is.close();}
|
try {if ( is != null ) is.close();}
|
||||||
catch ( IOException ex ) {}
|
catch ( IOException e ) {}
|
||||||
|
|
||||||
try {if ( srcP != null ) srcP.close();}
|
try {if ( srcP != null ) srcP.close();}
|
||||||
catch ( IOException ex ) {}
|
catch ( IOException e ) {}
|
||||||
|
|
||||||
try {if ( dstP != null ) dstP.close();}
|
try {if ( dstP != null ) dstP.close();}
|
||||||
catch ( IOException ex ) {}
|
catch ( IOException e ) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -608,7 +608,8 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
long epochTime = -1;
|
long epochTime = -1;
|
||||||
try {
|
try {
|
||||||
epochTime = ModUtilities.getModFileTime( modFileInfo.getFile() );
|
epochTime = ModUtilities.getModFileTime( modFileInfo.getFile() );
|
||||||
} catch ( IOException e ) {
|
}
|
||||||
|
catch ( IOException e ) {
|
||||||
log.error( String.format( "Error while getting modified time of mod file contents for \"%s\".", modFileInfo.getFile() ), e );
|
log.error( String.format( "Error while getting modified time of mod file contents for \"%s\".", modFileInfo.getFile() ), e );
|
||||||
}
|
}
|
||||||
if ( epochTime != -1 ) {
|
if ( epochTime != -1 ) {
|
||||||
|
@ -987,7 +988,8 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
log.info( "Running FTL..." );
|
log.info( "Running FTL..." );
|
||||||
try {
|
try {
|
||||||
FTLUtilities.launchExe( exeFile, exeArgs );
|
FTLUtilities.launchExe( exeFile, exeArgs );
|
||||||
} catch ( Exception e ) {
|
}
|
||||||
|
catch ( Exception e ) {
|
||||||
log.error( "Error launching FTL.", e );
|
log.error( "Error launching FTL.", e );
|
||||||
}
|
}
|
||||||
exitApp();
|
exitApp();
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class ModXMLSandbox extends JFrame implements ActionListener {
|
||||||
messageArea.setFont( sandboxFont );
|
messageArea.setFont( sandboxFont );
|
||||||
messageArea.setEditable( false );
|
messageArea.setEditable( false );
|
||||||
messageArea.addMouseListener( new ClipboardMenuMouseListener() );
|
messageArea.addMouseListener( new ClipboardMenuMouseListener() );
|
||||||
messageArea.setText( "This is a scratchpad to tinker with advanced mod syntax.\n1) Open XML from data.dat to fill the 'main' tab. (ctrl-o)\n2) Write some <mod:command> tags in the 'append' tab. (alt-1,2,3)\n3) Click Patch to see what would happen. (ctrl-p)\nUndo is available. (ctrl-z/ctrl-y)" );
|
messageArea.setText( "This is a sandbox to tinker with advanced mod syntax.\n1) Open XML from data.dat to fill the 'main' tab. (ctrl-o)\n2) Write some <mod:command> tags in the 'append' tab. (alt-1,2,3)\n3) Click Patch to see what would happen. (ctrl-p)\nUndo/redo is available. (ctrl-z/ctrl-y)" );
|
||||||
messageScroll = new JScrollPane( messageArea );
|
messageScroll = new JScrollPane( messageArea );
|
||||||
|
|
||||||
JPanel ctrlPanel = new JPanel();
|
JPanel ctrlPanel = new JPanel();
|
||||||
|
|
|
@ -55,11 +55,13 @@ public class ChecklistTablePanel<T> extends JPanel {
|
||||||
|
|
||||||
// Reset on first click and when no longer on that row.
|
// Reset on first click and when no longer on that row.
|
||||||
if ( e.getClickCount() == 1 ) prevRow = -1;
|
if ( e.getClickCount() == 1 ) prevRow = -1;
|
||||||
|
|
||||||
if ( thisRow != prevRow || thisRow == -1 ) {
|
if ( thisRow != prevRow || thisRow == -1 ) {
|
||||||
streak = 1;
|
streak = 1;
|
||||||
prevRow = thisRow;
|
prevRow = thisRow;
|
||||||
return;
|
return;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
streak++;
|
streak++;
|
||||||
}
|
}
|
||||||
if ( streak % 2 != 0 ) return; // Respond only to click pairs.
|
if ( streak % 2 != 0 ) return; // Respond only to click pairs.
|
||||||
|
|
|
@ -109,7 +109,9 @@ public class TreeState {
|
||||||
public boolean accept( TreeNodeState nodeState ) {
|
public boolean accept( TreeNodeState nodeState ) {
|
||||||
Object nodeObject = nodeState.getUserObject();
|
Object nodeObject = nodeState.getUserObject();
|
||||||
if ( objectClass != null && nodeObject != null ) {
|
if ( objectClass != null && nodeObject != null ) {
|
||||||
return ( objectClass.isAssignableFrom( nodeObject.getClass() ) );
|
@SuppressWarnings("unchecked")
|
||||||
|
boolean result = objectClass.isAssignableFrom( nodeObject.getClass() );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
else if ( o != null ) {
|
else if ( o != null ) {
|
||||||
return ( o.equals( nodeState.getUserObject() ) );
|
return ( o.equals( nodeState.getUserObject() ) );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue