Changeset 720 for AE/installer2/src/net/oni2/aeinstaller/gui
- Timestamp:
- Mar 21, 2013, 12:33:53 PM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller/gui
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r708 r720 10 10 import java.awt.event.KeyEvent; 11 11 import java.io.File; 12 import java.io.FileNotFoundException; 12 13 import java.net.URL; 13 14 import java.util.Date; … … 39 40 import javax.swing.filechooser.FileFilter; 40 41 42 import net.oni2.SettingsManager; 41 43 import net.oni2.aeinstaller.AEInstaller2; 42 44 import net.oni2.aeinstaller.backend.ImageResizer; 43 45 import net.oni2.aeinstaller.backend.Paths; 44 import net.oni2.aeinstaller.backend.ToolLauncher;45 46 import net.oni2.aeinstaller.backend.SizeFormatter; 46 47 import net.oni2.aeinstaller.backend.depot.DepotManager; 47 48 import net.oni2.aeinstaller.backend.oni.InstallProgressListener; 48 49 import net.oni2.aeinstaller.backend.oni.Installer; 50 import net.oni2.aeinstaller.backend.oni.OniLauncher; 49 51 import net.oni2.aeinstaller.backend.oni.OniSplit; 50 52 import net.oni2.aeinstaller.backend.packages.Package; … … 57 59 import net.oni2.aeinstaller.gui.corepackages.CorePackagesDialog; 58 60 import net.oni2.aeinstaller.gui.downloadwindow.Downloader; 61 import net.oni2.aeinstaller.gui.modtable.EApplyFilterTo; 59 62 import net.oni2.aeinstaller.gui.modtable.ModInstallSelectionListener; 60 import net.oni2.aeinstaller.gui.modtable.EApplyFilterTo;61 63 import net.oni2.aeinstaller.gui.modtable.ModSelectionListener; 62 64 import net.oni2.aeinstaller.gui.modtable.ModTable; … … 65 67 import net.oni2.aeinstaller.gui.settings.SettingsDialog; 66 68 import net.oni2.aeinstaller.gui.toolmanager.ToolManager; 67 import net.oni2.applicationinvoker.AppExecution; 68 import net.oni2.settingsmanager.Settings; 69 import net.oni2.settingsmanager.Settings.Platform; 69 import net.oni2.platformtools.PlatformInformation; 70 import net.oni2.platformtools.PlatformInformation.Platform; 71 import net.oni2.platformtools.applicationinvoker.ApplicationInvoker; 72 import net.oni2.platformtools.applicationinvoker.ERuntimeNotInstalledException; 70 73 71 74 import org.javabuilders.BuildResult; … … 138 141 scrollMods.setViewportView(tblMods); 139 142 140 contents.setDividerLocation(Settings.getInstance().get("win_main_divloc", 550)); 143 contents.setDividerLocation(SettingsManager.getInstance().get( 144 "win_main_divloc", 550)); 141 145 contents.setResizeWeight(0.4); 142 146 143 if ( Settings.getPlatform() == Platform.MACOS) {147 if (PlatformInformation.getPlatform() == Platform.MACOS) { 144 148 mainMenu.setVisible(false); 145 149 } … … 165 169 tblMods.addModSelectionListener(this); 166 170 tblMods.addDownloadSizeListener(this); 167 168 setSize(Settings.getInstance().get("win_main_width", 950), Settings.getInstance().get("win_main_height", 600)); 171 172 setSize(SettingsManager.getInstance().get("win_main_width", 950), 173 SettingsManager.getInstance().get("win_main_height", 600)); 169 174 setLocationRelativeTo(null); 170 175 } … … 190 195 191 196 private void saveLocalData() { 192 Settings.getInstance().put("win_main_divloc", contents.getDividerLocation()); 193 Settings.getInstance().put("win_main_width", getWidth()); 194 Settings.getInstance().put("win_main_height", getHeight()); 195 Settings.getInstance().serializeToFile(Paths.getSettingsFilename()); 197 SettingsManager.getInstance().put("win_main_divloc", 198 contents.getDividerLocation()); 199 SettingsManager.getInstance().put("win_main_width", getWidth()); 200 SettingsManager.getInstance().put("win_main_height", getHeight()); 201 SettingsManager.getInstance().serializeToFile( 202 Paths.getSettingsFilename()); 196 203 } 197 204 198 205 @DoInBackground(progressMessage = "updateDepot.title", cancelable = false, indeterminateProgress = false) 199 206 private void execDepotUpdate(final BackgroundEvent evt) { 200 if (!Settings .getInstance().isOfflineMode()201 && !Settings .getInstance().isNoCacheUpdateMode()) {207 if (!SettingsManager.getInstance().isOfflineMode() 208 && !SettingsManager.getInstance().isNoCacheUpdateMode()) { 202 209 long start = new Date().getTime(); 203 210 … … 222 229 private void checkUpdates(Object evtSource) { 223 230 if ((evtSource != this) 224 || Settings .getInstance().get("notifyupdates", true)) {225 if (Settings .getInstance().isOfflineMode()) {231 || SettingsManager.getInstance().get("notifyupdates", true)) { 232 if (SettingsManager.getInstance().isOfflineMode()) { 226 233 if (evtSource != this) { 227 234 JOptionPane.showMessageDialog( … … 250 257 size += m.getZipSize(); 251 258 JCheckBox check = new JCheckBox("Mod: " + m.getName() 252 + " (" + SizeFormatter.format(m.getZipSize(), 1) + ")"); 259 + " (" + SizeFormatter.format(m.getZipSize(), 1) 260 + ")"); 253 261 check.setSelected(true); 254 262 check.addItemListener(new ItemListener() { … … 274 282 size += m.getZipSize(); 275 283 JCheckBox check = new JCheckBox("Tool: " + m.getName() 276 + " (" + SizeFormatter.format(m.getZipSize(), 1) + ")"); 284 + " (" + SizeFormatter.format(m.getZipSize(), 1) 285 + ")"); 277 286 check.setSelected(true); 278 287 check.addItemListener(new ItemListener() { … … 313 322 JCheckBox checkFutureUpdates = new JCheckBox( 314 323 bundle.getString("checkOnStartup.text")); 315 checkFutureUpdates.setSelected(Settings .getInstance().get(316 "notifyupdates", true));324 checkFutureUpdates.setSelected(SettingsManager 325 .getInstance().get("notifyupdates", true)); 317 326 checkFutureUpdates.addItemListener(new ItemListener() { 318 327 @Override 319 328 public void itemStateChanged(ItemEvent evt) { 320 Settings .getInstance().put("notifyupdates",329 SettingsManager.getInstance().put("notifyupdates", 321 330 evt.getStateChange() == ItemEvent.SELECTED); 322 331 } … … 492 501 public void actionPerformed(ActionEvent evt) { 493 502 try { 494 ToolLauncher.launch(m); 495 } catch (Exception ex) { 496 if (ex.getMessage().contains("JRE")) 503 ApplicationInvoker.execute(m.getExeType(), 504 m.getWorkingDir(), m.getExeFile(), null); 505 } catch (ERuntimeNotInstalledException e) { 506 JOptionPane.showMessageDialog(null, 507 bundle.getString("exeNotFound.text"), 508 bundle.getString("exeNotFound.title"), 509 JOptionPane.ERROR_MESSAGE); 510 e.printStackTrace(); 511 } catch (FileNotFoundException e) { 512 if (e.getMessage().contains("JRE")) 497 513 JOptionPane.showMessageDialog(null, 498 514 bundle.getString("jreNotFound.text"), 499 515 bundle.getString("jreNotFound.title"), 500 516 JOptionPane.ERROR_MESSAGE); 501 if (e x.getMessage().contains(".NET"))517 if (e.getMessage().contains(".NET")) 502 518 JOptionPane.showMessageDialog( 503 519 null, … … 505 521 bundle.getString("dotNetNotFound.title"), 506 522 JOptionPane.ERROR_MESSAGE); 523 if (e.getMessage().contains("Wine")) 524 JOptionPane.showMessageDialog(null, 525 bundle.getString("wineNotFound.text"), 526 bundle.getString("wineNotFound.title"), 527 JOptionPane.ERROR_MESSAGE); 528 e.printStackTrace(); 507 529 } 508 530 } … … 525 547 @DoInBackground(progressMessage = "checkCorePackages.title", cancelable = false, indeterminateProgress = false) 526 548 private void checkCorePackages(final BackgroundEvent evt) { 527 if (!Settings .getInstance().isOfflineMode()) {549 if (!SettingsManager.getInstance().isOfflineMode()) { 528 550 for (Package m : PackageManager.getInstance().getCoreTools()) { 529 551 if (m.isNewerAvailable()) { … … 558 580 } 559 581 evt.setProgressMessage(bundle.getString("coreToolsInstall.title")); 560 Installer.installTools(PackageManager.getInstance().getCoreTools(), false); 582 Installer.installTools(PackageManager.getInstance().getCoreTools(), 583 false); 561 584 } 562 585 } … … 594 617 } 595 618 596 if (toDownload.size() > 0 && Settings.getInstance().isOfflineMode()) { 619 if (toDownload.size() > 0 620 && SettingsManager.getInstance().isOfflineMode()) { 597 621 installState = EInstallState.OFFLINE; 598 622 break; … … 647 671 .getString("installDependencies.none"); 648 672 649 if (!Settings .getInstance()650 .get("notifyDepsAfterInstall", false)) {673 if (!SettingsManager.getInstance().get( 674 "notifyDepsAfterInstall", false)) { 651 675 int res = JOptionPane.showConfirmDialog(this, String 652 676 .format(bundle … … 736 760 revertSelection(); 737 761 if (installDeps.size() > 0 738 && Settings .getInstance().get("notifyDepsAfterInstall",739 false)) {762 && SettingsManager.getInstance().get( 763 "notifyDepsAfterInstall", false)) { 740 764 String installedDeps = ""; 741 765 for (Package m : installDeps) { … … 835 859 } 836 860 837 private Vector<String> getBasicOniLaunchParams() { 838 Vector<String> params = new Vector<String>(); 839 File exe = null; 840 switch (Settings.getPlatform()) { 841 case WIN: 842 exe = new File(Paths.getEditionBasePath(), "Oni.exe"); 843 if (exe.exists()) 844 params.add(exe.getPath()); 845 break; 846 case MACOS: 847 exe = new File(Paths.getEditionBasePath(), 848 "Oni.app/Contents/MacOS/Oni"); 849 if (exe.exists()) 850 params.add(exe.getPath()); 851 break; 852 case LINUX: 853 String wine = Settings.getWinePath(); 854 exe = new File(Paths.getEditionBasePath(), "Oni.exe"); 855 if (exe.exists()) { 856 if (wine != null) { 857 params.add(wine); 858 params.add(exe.getPath()); 859 } 860 } 861 break; 862 default: 863 } 864 if (params.size() > 0) { 865 params.add("-debugfiles"); 866 } 867 return params; 861 private void oni(boolean windowed) { 862 try { 863 OniLauncher.launch(windowed); 864 } catch (FileNotFoundException e) { 865 JOptionPane.showMessageDialog(this, 866 bundle.getString("oniExeNotFound.text"), 867 bundle.getString("oniExeNotFound.title"), 868 JOptionPane.ERROR_MESSAGE); 869 e.printStackTrace(); 870 } catch (ERuntimeNotInstalledException e) { 871 JOptionPane.showMessageDialog(this, 872 bundle.getString("wineNotFound.text"), 873 bundle.getString("wineNotFound.title"), 874 JOptionPane.ERROR_MESSAGE); 875 e.printStackTrace(); 876 } 868 877 } 869 878 870 879 @SuppressWarnings("unused") 871 880 private void oniFull() { 872 Vector<String> params = getBasicOniLaunchParams(); 873 if (params.size() > 0) { 874 AppExecution.execute(params, Paths.getEditionBasePath()); 875 } 881 oni(false); 876 882 } 877 883 878 884 @SuppressWarnings("unused") 879 885 private void oniWin() { 880 Vector<String> params = getBasicOniLaunchParams(); 881 if (params.size() > 0) { 882 params.add("-noswitch"); 883 AppExecution.execute(params, Paths.getEditionBasePath()); 884 } 886 oni(true); 885 887 } 886 888 -
AE/installer2/src/net/oni2/aeinstaller/gui/corepackages/CorePackagesDialog.java
r708 r720 12 12 import javax.swing.KeyStroke; 13 13 14 import net.oni2.SettingsManager; 14 15 import net.oni2.aeinstaller.backend.packages.Package; 15 16 import net.oni2.aeinstaller.gui.modtable.ModSelectionListener; … … 17 18 import net.oni2.aeinstaller.gui.modtable.ModTable.ETableContentType; 18 19 import net.oni2.aeinstaller.gui.packageinfobox.PackageInfoBox; 19 import net.oni2.settingsmanager.Settings;20 20 21 21 import org.javabuilders.BuildResult; … … 60 60 getRootPane().getActionMap().put("close", closeAction); 61 61 62 contents.setDividerLocation(Settings .getInstance().get("win_core_divloc", 550));62 contents.setDividerLocation(SettingsManager.getInstance().get("win_core_divloc", 550)); 63 63 contents.setResizeWeight(0.4); 64 64 … … 69 69 tblTools.addModSelectionListener(this); 70 70 71 setSize(Settings .getInstance().get("win_core_width", 950), Settings.getInstance().get("win_core_height", 600));71 setSize(SettingsManager.getInstance().get("win_core_width", 950), SettingsManager.getInstance().get("win_core_height", 600)); 72 72 setLocationRelativeTo(null); 73 73 } … … 80 80 @SuppressWarnings("unused") 81 81 private void closing() { 82 Settings .getInstance().put("win_core_divloc", contents.getDividerLocation());83 Settings .getInstance().put("win_core_width", getWidth());84 Settings .getInstance().put("win_core_height", getHeight());82 SettingsManager.getInstance().put("win_core_divloc", contents.getDividerLocation()); 83 SettingsManager.getInstance().put("win_core_width", getWidth()); 84 SettingsManager.getInstance().put("win_core_height", getHeight()); 85 85 } 86 86 } -
AE/installer2/src/net/oni2/aeinstaller/gui/modtable/ModTable.java
r708 r720 35 35 import javax.swing.table.TableRowSorter; 36 36 37 import net.oni2.SettingsManager; 37 38 import net.oni2.aeinstaller.backend.packages.Package; 38 39 import net.oni2.aeinstaller.backend.packages.Type; 39 40 import net.oni2.aeinstaller.gui.downloadwindow.Downloader; 40 import net.oni2.settingsmanager.Settings;41 41 42 42 /** … … 103 103 List<RowSorter.SortKey> sortKeys = new ArrayList<RowSorter.SortKey>(); 104 104 105 int sortCol = Settings .getInstance().get("modSortColumn", 1);106 SortOrder sortOrder = SortOrder.valueOf(Settings .getInstance().get(105 int sortCol = SettingsManager.getInstance().get("modSortColumn", 1); 106 SortOrder sortOrder = SortOrder.valueOf(SettingsManager.getInstance().get( 107 107 "modSortOrder", "ASCENDING")); 108 108 … … 244 244 int col = keys.get(0).getColumn(); 245 245 SortOrder so = keys.get(0).getSortOrder(); 246 Settings .getInstance().put("modSortColumn", col);247 Settings .getInstance().put("modSortOrder", so.toString());246 SettingsManager.getInstance().put("modSortColumn", col); 247 SettingsManager.getInstance().put("modSortOrder", so.toString()); 248 248 } 249 249 } … … 459 459 for (int i = 1; i < columns.size(); i++) { 460 460 TableColumn tc = columns.get(i); 461 if (!Settings .getInstance().get(461 if (!SettingsManager.getInstance().get( 462 462 String.format("modShowColumn%02d", tc.getModelIndex()), 463 463 true)) … … 506 506 tcm.removeColumn(col); 507 507 } 508 Settings .getInstance().put(508 SettingsManager.getInstance().put( 509 509 String.format("modShowColumn%02d", 510 510 col.getModelIndex()), itm.isSelected()); -
AE/installer2/src/net/oni2/aeinstaller/gui/settings/LaFComboModel.java
r708 r720 9 9 import javax.swing.event.ListDataListener; 10 10 11 import net.oni2. settingsmanager.Settings;11 import net.oni2.SettingsManager; 12 12 13 13 /** … … 32 32 33 33 34 String laf = Settings .getInstance().get("lookandfeel",34 String laf = SettingsManager.getInstance().get("lookandfeel", 35 35 UIManager.getLookAndFeel().getClass().getName()); 36 36 -
AE/installer2/src/net/oni2/aeinstaller/gui/settings/SettingsDialog.java
r708 r720 14 14 import javax.swing.UIManager; 15 15 16 import net.oni2. settingsmanager.Settings;16 import net.oni2.SettingsManager; 17 17 18 18 import org.javabuilders.BuildResult; … … 66 66 67 67 private void initValues() { 68 Settings set = Settings.getInstance();68 SettingsManager set = SettingsManager.getInstance(); 69 69 70 70 laFModel = new LaFComboModel(); … … 79 79 @SuppressWarnings("unused") 80 80 private boolean save() { 81 Settings set = Settings.getInstance();81 SettingsManager set = SettingsManager.getInstance(); 82 82 83 83 set.put("notifyupdates", chkNotifyOnStart.isSelected()); -
AE/installer2/src/net/oni2/aeinstaller/gui/toolmanager/ToolManager.java
r708 r720 17 17 import javax.swing.KeyStroke; 18 18 19 import net.oni2.SettingsManager; 19 20 import net.oni2.aeinstaller.backend.oni.Installer; 20 21 import net.oni2.aeinstaller.backend.packages.Package; … … 24 25 import net.oni2.aeinstaller.gui.modtable.ModTable.ETableContentType; 25 26 import net.oni2.aeinstaller.gui.packageinfobox.PackageInfoBox; 26 import net.oni2.settingsmanager.Settings;27 27 28 28 import org.javabuilders.BuildResult; … … 73 73 getRootPane().getActionMap().put("close", closeAction); 74 74 75 contents.setDividerLocation(Settings .getInstance().get("win_tools_divloc", 550));75 contents.setDividerLocation(SettingsManager.getInstance().get("win_tools_divloc", 550)); 76 76 contents.setResizeWeight(0.4); 77 77 … … 87 87 SwingJavaBuilder.getConfig().getResource("img.uninstall"))); 88 88 89 setSize(Settings .getInstance().get("win_tools_width", 950), Settings.getInstance().get("win_tools_height", 600));89 setSize(SettingsManager.getInstance().get("win_tools_width", 950), SettingsManager.getInstance().get("win_tools_height", 600)); 90 90 setLocationRelativeTo(null); 91 91 } … … 100 100 } else { 101 101 if (!selectedPackage.isLocalAvailable()) { 102 if (Settings .getInstance().isOfflineMode()) {102 if (SettingsManager.getInstance().isOfflineMode()) { 103 103 JOptionPane.showMessageDialog(this, 104 104 bundle.getString("offlineMode.text"), … … 152 152 @SuppressWarnings("unused") 153 153 private void closing() { 154 Settings .getInstance().put("win_tools_divloc", contents.getDividerLocation());155 Settings .getInstance().put("win_tools_width", getWidth());156 Settings .getInstance().put("win_tools_height", getHeight());154 SettingsManager.getInstance().put("win_tools_divloc", contents.getDividerLocation()); 155 SettingsManager.getInstance().put("win_tools_width", getWidth()); 156 SettingsManager.getInstance().put("win_tools_height", getHeight()); 157 157 } 158 158 }
Note:
See TracChangeset
for help on using the changeset viewer.