Optimized long string literals
This commit is contained in:
parent
6f42478850
commit
7528ec271a
2 changed files with 71 additions and 70 deletions
|
@ -267,14 +267,14 @@ public class FTLModManager {
|
||||||
if ( steamExeFile == null ) {
|
if ( steamExeFile == null ) {
|
||||||
log.debug( "Steam was not located automatically. Prompting user for location" );
|
log.debug( "Steam was not located automatically. Prompting user for location" );
|
||||||
|
|
||||||
StringBuilder steamBuf = new StringBuilder();
|
String steamPrompt = ""
|
||||||
steamBuf.append( "You will be prompted to locate Steam's executable.\n" );
|
+ "You will be prompted to locate Steam's executable.\n"
|
||||||
steamBuf.append( "- Windows: Steam.exe\n" );
|
+ "- Windows: Steam.exe\n"
|
||||||
steamBuf.append( "- Linux: steam\n" );
|
+ "- Linux: steam\n"
|
||||||
steamBuf.append( "- OSX: Steam.app\n" );
|
+ "- OSX: Steam.app\n"
|
||||||
steamBuf.append( "\n" );
|
+ "\n"
|
||||||
steamBuf.append( "If you can't find it, you can cancel and set it later." );
|
+ "If you can't find it, you can cancel and set it later.";
|
||||||
JOptionPane.showMessageDialog( null, steamBuf.toString(), "Find Steam", JOptionPane.INFORMATION_MESSAGE );
|
JOptionPane.showMessageDialog( null, steamPrompt, "Find Steam", JOptionPane.INFORMATION_MESSAGE );
|
||||||
|
|
||||||
JFileChooser steamExeChooser = new JFileChooser();
|
JFileChooser steamExeChooser = new JFileChooser();
|
||||||
steamExeChooser.setDialogTitle( "Find Steam.exe or steam or Steam.app" );
|
steamExeChooser.setDialogTitle( "Find Steam.exe or steam or Steam.app" );
|
||||||
|
@ -320,12 +320,12 @@ public class FTLModManager {
|
||||||
askAboutUpdates = true;
|
askAboutUpdates = true;
|
||||||
|
|
||||||
if ( askAboutUpdates ) {
|
if ( askAboutUpdates ) {
|
||||||
String message = "";
|
String updatePrompt = ""
|
||||||
message += "Would you like Slipstream to periodically check for updates?\n";
|
+ "Would you like Slipstream to periodically check for updates?\n"
|
||||||
message += "\n";
|
+ "\n"
|
||||||
message += "You can change this later.";
|
+ "You can change this later.";
|
||||||
|
|
||||||
int response = JOptionPane.showConfirmDialog( null, message, "Updates", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE );
|
int response = JOptionPane.showConfirmDialog( null, updatePrompt, "Updates", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE );
|
||||||
if ( response == JOptionPane.YES_OPTION ) {
|
if ( response == JOptionPane.YES_OPTION ) {
|
||||||
appConfig.setProperty( SlipstreamConfig.UPDATE_CATALOG, "7" );
|
appConfig.setProperty( SlipstreamConfig.UPDATE_CATALOG, "7" );
|
||||||
appConfig.setProperty( SlipstreamConfig.UPDATE_APP, "4" );
|
appConfig.setProperty( SlipstreamConfig.UPDATE_APP, "4" );
|
||||||
|
|
|
@ -530,13 +530,13 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
|
|
||||||
|
|
||||||
public void showAboutInfo() {
|
public void showAboutInfo() {
|
||||||
String body = "";
|
String body = ""
|
||||||
body += "- Drag to reorder mods.\n";
|
+ "- Drag to reorder mods.\n"
|
||||||
body += "- Click the checkboxes to select.\n";
|
+ "- Click the checkboxes to select.\n"
|
||||||
body += "- Click 'Patch' to apply mods ( select none for vanilla ).\n";
|
+ "- Click 'Patch' to apply mods ( select none for vanilla ).\n"
|
||||||
body += "\n";
|
+ "\n"
|
||||||
body += "Thanks for using this mod manager.\n";
|
+ "Thanks for using this mod manager.\n"
|
||||||
body += "Make sure to visit the forum for updates!";
|
+ "Make sure to visit the forum for updates!";
|
||||||
|
|
||||||
infoArea.setDescription( appName, appAuthor, appVersion.toString(), appURL, body );
|
infoArea.setDescription( appName, appAuthor, appVersion.toString(), appURL, body );
|
||||||
}
|
}
|
||||||
|
@ -610,10 +610,10 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
boolean notYetReady = isScanning();
|
boolean notYetReady = isScanning();
|
||||||
|
|
||||||
if ( notYetReady ) {
|
if ( notYetReady ) {
|
||||||
String body = "";
|
String body = ""
|
||||||
body += "No info is currently available for the selected mod.\n\n";
|
+ "No info is currently available for the selected mod.\n\n"
|
||||||
body += "But Slipstream has not yet finished scanning the mods/ folder. ";
|
+ "But Slipstream has not yet finished scanning the mods/ folder. "
|
||||||
body += "Try clicking this mod again after waiting a few seconds.";
|
+ "Try clicking this mod again after waiting a few seconds.";
|
||||||
|
|
||||||
infoArea.setDescription( modFileInfo.getName(), body );
|
infoArea.setDescription( modFileInfo.getName(), body );
|
||||||
}
|
}
|
||||||
|
@ -633,20 +633,20 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String body = "";
|
StringBuilder bodyBuf = new StringBuilder();
|
||||||
body += "No info is available for the selected mod.\n\n";
|
bodyBuf.append( "No info is available for the selected mod.\n\n" );
|
||||||
|
|
||||||
if ( modDate != null ) {
|
if ( modDate != null ) {
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
|
SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
|
||||||
body += String.format( "It was released some time after %s.\n\n", dateFormat.format( modDate ) );
|
bodyBuf.append( String.format( "It was released some time after %s.\n\n", dateFormat.format( modDate ) ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
body += "The date of its release could not be determined.\n\n";
|
bodyBuf.append( "The date of its release could not be determined.\n\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
body += "Mods can include an embedded description, but this one did not.\n";
|
bodyBuf.append( "Mods can include an embedded description, but this one did not.\n" );
|
||||||
|
|
||||||
infoArea.setDescription( modFileInfo.getName(), body );
|
infoArea.setDescription( modFileInfo.getName(), bodyBuf.toString() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -838,23 +838,23 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
exitApp();
|
exitApp();
|
||||||
}
|
}
|
||||||
else if ( source == deleteBackupsMenuItem ) {
|
else if ( source == deleteBackupsMenuItem ) {
|
||||||
StringBuilder deleteBuf = new StringBuilder();
|
String deletePrompt = ""
|
||||||
deleteBuf.append( "Slipstream uses backups to revert FTL to a state without mods.\n" );
|
+ "Slipstream uses backups to revert FTL to a state without mods.\n"
|
||||||
deleteBuf.append( "You are about to delete them.\n" );
|
+ "You are about to delete them.\n"
|
||||||
deleteBuf.append( "\n" );
|
+ "\n"
|
||||||
deleteBuf.append( "The next time you click 'patch', Slipstream will create fresh backups.\n" );
|
+ "The next time you click 'patch', Slipstream will create fresh backups.\n"
|
||||||
deleteBuf.append( "\n" );
|
+ "\n"
|
||||||
deleteBuf.append( "FTL *must be* in a working unmodded state *before* you click 'patch'.\n" );
|
+ "FTL *must be* in a working unmodded state *before* you click 'patch'.\n"
|
||||||
deleteBuf.append( "\n" );
|
+ "\n"
|
||||||
deleteBuf.append( "To get FTL into a working unmodded state, you may need to reinstall FTL\n" );
|
+ "To get FTL into a working unmodded state, you may need to reinstall FTL\n"
|
||||||
deleteBuf.append( "or use Steam's \"Verify integrity of game files\" feature.\n" );
|
+ "or use Steam's \"Verify integrity of game files\" feature.\n"
|
||||||
deleteBuf.append( "\n" );
|
+ "\n"
|
||||||
deleteBuf.append( "Whenever FTL is updated, you will need to delete stale backups or the\n" );
|
+ "Whenever FTL is updated, you will need to delete stale backups or the\n"
|
||||||
deleteBuf.append( "game will break.\n" );
|
+ "game will break.\n"
|
||||||
deleteBuf.append( "\n" );
|
+ "\n"
|
||||||
deleteBuf.append( "Are you sure you want to continue?" );
|
+ "Are you sure you want to continue?";
|
||||||
|
|
||||||
int response = JOptionPane.showConfirmDialog( ManagerFrame.this, deleteBuf.toString(), "Continue?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE );
|
int response = JOptionPane.showConfirmDialog( ManagerFrame.this, deletePrompt, "Continue?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE );
|
||||||
if ( response == JOptionPane.YES_OPTION ) {
|
if ( response == JOptionPane.YES_OPTION ) {
|
||||||
|
|
||||||
List<String> failures = new ArrayList<String>( 2 );
|
List<String> failures = new ArrayList<String>( 2 );
|
||||||
|
@ -906,22 +906,22 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder verifyBuf = new StringBuilder();
|
String verifyPrompt = ""
|
||||||
verifyBuf.append( "Slipstream is about to tell Steam to re-download FTL's resources. This will get\n" );
|
+ "Slipstream is about to tell Steam to re-download FTL's resources. This will get\n"
|
||||||
verifyBuf.append( "the game back to a working unmodded state, but it could take a while.\n" );
|
+ "the game back to a working unmodded state, but it could take a while.\n"
|
||||||
verifyBuf.append( "\n" );
|
+ "\n"
|
||||||
verifyBuf.append( "You can do it manually like this...\n" );
|
+ "You can do it manually like this...\n"
|
||||||
verifyBuf.append( "- Go to Steam's Library.\n" );
|
+ "- Go to Steam's Library.\n"
|
||||||
verifyBuf.append( "- Right-click FTL, choose \"Properties\".\n" );
|
+ "- Right-click FTL, choose \"Properties\".\n"
|
||||||
verifyBuf.append( "- Click the \"Verify integrity of game files...\" button.\n" );
|
+ "- Click the \"Verify integrity of game files...\" button.\n"
|
||||||
verifyBuf.append( "\n" );
|
+ "\n"
|
||||||
verifyBuf.append( "If you do not have Steam, you will need to reinstall FTL instead.\n" );
|
+ "If you do not have Steam, you will need to reinstall FTL instead.\n"
|
||||||
verifyBuf.append( "\n" );
|
+ "\n"
|
||||||
verifyBuf.append( "Either way, you should delete Slipstream's backups as well.\n" );
|
+ "Either way, you should delete Slipstream's backups as well.\n"
|
||||||
verifyBuf.append( "\n" );
|
+ "\n"
|
||||||
verifyBuf.append( "Are you sure you want to continue?" );
|
+ "Are you sure you want to continue?";
|
||||||
|
|
||||||
int response = JOptionPane.showConfirmDialog( ManagerFrame.this, verifyBuf.toString(), "Continue?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE );
|
int response = JOptionPane.showConfirmDialog( ManagerFrame.this, verifyPrompt, "Continue?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE );
|
||||||
if ( response == JOptionPane.YES_OPTION ) {
|
if ( response == JOptionPane.YES_OPTION ) {
|
||||||
try {
|
try {
|
||||||
FTLUtilities.verifySteamGameCache( exeFile, FTLUtilities.STEAM_APPID_FTL );
|
FTLUtilities.verifySteamGameCache( exeFile, FTLUtilities.STEAM_APPID_FTL );
|
||||||
|
@ -1070,15 +1070,16 @@ public class ManagerFrame extends JFrame implements ActionListener, ModsScanObse
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
String message = "An unexpected error has occurred.\n";
|
String message = ""
|
||||||
message += "\n";
|
+ "An unexpected error has occurred.\n"
|
||||||
message += "Thread: "+ threadString +"\n";
|
+ "\n"
|
||||||
message += "Error: "+ errString +"\n";
|
+ "Thread: "+ threadString +"\n"
|
||||||
message += "\n";
|
+ "Error: "+ errString +"\n"
|
||||||
message += "See the log for details.\n";
|
+ "\n"
|
||||||
message += "\n";
|
+ "See the log for details.\n"
|
||||||
message += "If this interrupted patching, FTL's resources were probably corrupted.\n";
|
+ "\n"
|
||||||
message += "Restart Slipstream and patch without mods to restore vanilla backups.";
|
+ "If this interrupted patching, FTL's resources were probably corrupted.\n"
|
||||||
|
+ "Restart Slipstream and patch without mods to restore vanilla backups.";
|
||||||
|
|
||||||
JOptionPane.showMessageDialog( ManagerFrame.this, message, "Error", JOptionPane.ERROR_MESSAGE );
|
JOptionPane.showMessageDialog( ManagerFrame.this, message, "Error", JOptionPane.ERROR_MESSAGE );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue