Changeset 623 for AE/installer2/src/net/oni2/aeinstaller
- Timestamp:
- Jan 16, 2013, 11:25:00 AM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller
- Files:
-
- 2 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/installer2/src/net/oni2/aeinstaller/AEInstaller.properties
r622 r623 1 1 appname=AE Installer 2 2 appversion=0.8 22 appversion=0.83 3 3 4 4 invalidPath.title=Wrong directory -
AE/installer2/src/net/oni2/aeinstaller/Images.properties
r621 r623 32 32 img.ae=/net/oni2/aeinstaller/images/AElogo.png 33 33 img.oni=/net/oni2/aeinstaller/images/oni.png 34 img.transparent=/net/oni2/aeinstaller/images/transparent.png -
AE/installer2/src/net/oni2/aeinstaller/backend/Settings.java
r621 r623 80 80 Vector<String> res = null; 81 81 try { 82 res = QuickAppExecution.execute(cmd);82 res = AppExecution.executeAndWait(cmd); 83 83 } catch (IOException e) { 84 84 e.printStackTrace(); … … 134 134 Vector<String> res = null; 135 135 try { 136 res = QuickAppExecution.execute(cmd);136 res = AppExecution.executeAndWait(cmd); 137 137 } catch (IOException e) { 138 138 e.printStackTrace(); -
AE/installer2/src/net/oni2/aeinstaller/backend/mods/Mod.java
r622 r623 26 26 27 27 private HashSet<Type> types = new HashSet<Type>(); 28 private boolean tool = false; 28 29 private ECompatiblePlatform platform = null; 29 30 private String version = ""; … … 36 37 private net.oni2.aeinstaller.backend.depot.model.File file = null; 37 38 39 private File exeFile = null; 40 private File iconFile = null; 41 private String workingDir = "Base"; 42 38 43 private HashSet<Integer> incompatibilities = new HashSet<Integer>(); 39 44 private HashSet<Integer> dependencies = new HashSet<Integer>(); 45 private HashSet<Integer> unlockLevel = new HashSet<Integer>(); 40 46 41 47 private long localTimestamp = 0; … … 52 58 packageNumber = nm.getPackageNumber(); 53 59 platform = nm.getPlatform(); 60 tool = nm.isTool(); 54 61 for (TaxonomyTerm tt : nm.getTypes()) { 55 62 Type t = ModManager.getInstance().getTypeByName(tt.getName()); 56 63 types.add(t); 57 if (! nm.isTool()&& !isMandatoryMod() && isValidOnPlatform())64 if (!tool && !isMandatoryMod() && isValidOnPlatform()) 58 65 t.addEntry(this); 59 66 } … … 76 83 File config = new File(getLocalPath(), "Mod_Info.cfg"); 77 84 File aeicfg = new File(getLocalPath(), "aei.cfg"); 85 File plain = new File(getLocalPath(), "plain"); 78 86 if (config.exists()) { 79 87 try { … … 131 139 } 132 140 } 141 } else if (sName.equalsIgnoreCase("UnlockLevel")) { 142 String[] levelsS = sVal.split(","); 143 for (String s : levelsS) { 144 try { 145 int level = Integer.parseInt(s); 146 unlockLevel.add(level); 147 } catch (NumberFormatException e) { 148 System.err 149 .format("Mod %05d does contain a non-number UnlockLevel value: '%s'\n", 150 packageNumber, s); 151 } 152 } 153 } else if (sName.equalsIgnoreCase("ExeName")) { 154 exeFile = new File(Paths.getEditionBasePath(), sVal); 155 } else if (sName.equalsIgnoreCase("WorkingDir")) { 156 workingDir = sVal; 157 } else if (sName.equalsIgnoreCase("IconName")) { 158 iconFile = new File(Paths.getEditionBasePath(), sVal); 133 159 } 134 160 } … … 166 192 } 167 193 } 194 if (node == null) 195 tool = plain.exists(); 168 196 } 169 197 … … 254 282 255 283 /** 284 * @return Is this mod actually a tool? 285 */ 286 public boolean isTool() { 287 return tool; 288 } 289 290 /** 256 291 * @return Compatible platforms 257 292 */ … … 326 361 public HashSet<Integer> getDependencies() { 327 362 return dependencies; 363 } 364 365 /** 366 * @return the levels this mod will unlock 367 */ 368 public HashSet<Integer> getUnlockLevels() { 369 return unlockLevel; 370 } 371 372 /** 373 * @return Executable name of this tool 374 */ 375 public File getExeFile() { 376 return exeFile; 377 } 378 /** 379 * @return Icon file of this tool 380 */ 381 public File getIconFile() { 382 return iconFile; 383 } 384 385 /** 386 * @return Working directory of this tool 387 */ 388 public File getWorkingDir() { 389 if (workingDir.equalsIgnoreCase("Exe")) { 390 if (exeFile != null) 391 return exeFile.getParentFile(); 392 else 393 return Paths.getEditionGDF(); 394 } else if (workingDir.equalsIgnoreCase("GDF")) 395 return Paths.getEditionGDF(); 396 else 397 return Paths.getEditionBasePath(); 328 398 } 329 399 -
AE/installer2/src/net/oni2/aeinstaller/backend/mods/ModManager.java
r621 r623 253 253 254 254 /** 255 * Get a mod by its package number 255 * @return Currently installed tools 256 */ 257 public TreeSet<Mod> getInstalledTools() { 258 TreeSet<Mod> res = new TreeSet<Mod>(); 259 for (int n : Installer.getInstalledTools()) { 260 res.add(getModByNumber(n)); 261 } 262 return res; 263 } 264 265 /** 266 * Get a mod/tool by its package number 256 267 * 257 268 * @param number 258 269 * Package number 259 * @return Mod or null270 * @return Mod/tool or null 260 271 */ 261 272 public Mod getModByNumber(int number) { 262 for (Mod m : mods.values()) {263 if (m.getPackageNumber() == number)264 return m;265 }273 if (mods.containsKey(number)) 274 return mods.get(number); 275 if (tools.containsKey(number)) 276 return tools.get(number); 266 277 return null; 267 278 } -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
r622 r623 8 8 import java.io.File; 9 9 import java.io.IOException; 10 import java.net.URL; 10 11 import java.util.ArrayList; 11 12 import java.util.HashMap; … … 17 18 import java.util.Vector; 18 19 20 import javax.swing.AbstractAction; 21 import javax.swing.Icon; 22 import javax.swing.ImageIcon; 19 23 import javax.swing.JButton; 20 24 import javax.swing.JComboBox; … … 38 42 import javax.swing.table.TableRowSorter; 39 43 44 import net.oni2.aeinstaller.AEInstaller2; 45 import net.oni2.aeinstaller.backend.AppExecution; 40 46 import net.oni2.aeinstaller.backend.Paths; 41 47 import net.oni2.aeinstaller.backend.Settings; … … 80 86 81 87 private JMenu mainMenu; 88 private JMenu toolsMenu; 89 private TreeSet<JMenuItem> toolsMenuItems = new TreeSet<JMenuItem>(); 82 90 83 91 private JSplitPane contents; … … 412 420 413 421 @SuppressWarnings("unused") 422 private void refreshToolsMenu() { 423 for (JMenuItem i : toolsMenuItems) { 424 toolsMenu.remove(i); 425 } 426 toolsMenuItems.clear(); 427 for (Mod m : ModManager.getInstance().getInstalledTools()) { 428 if (m.getExeFile() != null && m.getExeFile().exists()) { 429 JMenuItem item = new JMenuItem(); 430 final Vector<String> params = new Vector<String>(); 431 params.add(m.getExeFile().getPath()); 432 final File wd = m.getWorkingDir(); 433 Icon ico = null; 434 if (m.getIconFile() != null && m.getIconFile().exists()) { 435 ico = new ImageIcon(m.getIconFile().getPath()); 436 } else { 437 URL icon = AEInstaller2.class.getResource("images/transparent.png"); 438 ico = new ImageIcon(icon); 439 } 440 item.setAction(new AbstractAction(m.getName(), ico) { 441 private static final long serialVersionUID = 1L; 442 443 @Override 444 public void actionPerformed(ActionEvent e) { 445 AppExecution.execute(params, wd); 446 } 447 }); 448 toolsMenuItems.add(item); 449 toolsMenu.add(item); 450 } 451 } 452 } 453 454 @SuppressWarnings("unused") 414 455 private void revertSelection() { 415 456 model.revertSelection(); … … 510 551 511 552 if (instReady) { 512 Installer.install(mods, new InstallProgressListener() { 553 TreeSet<Mod> actuallyMods = new TreeSet<Mod>(); 554 TreeSet<Mod> actuallyTools = new TreeSet<Mod>(); 555 556 for (Mod m : mods) { 557 if (m.isTool()) 558 actuallyTools.add(m); 559 else 560 actuallyMods.add(m); 561 } 562 563 if (actuallyTools.size() > 0) { 564 Installer.installTools(actuallyTools); 565 } 566 567 Installer.install(actuallyMods, new InstallProgressListener() { 513 568 @Override 514 569 public void installProgressUpdate(int done, int total, … … 657 712 Vector<String> params = getBasicOniLaunchParams(); 658 713 if (params.size() > 0) { 659 try { 660 ProcessBuilder pb = new ProcessBuilder(params); 661 pb.directory(Paths.getEditionBasePath()); 662 pb.start(); 663 } catch (IOException e) { 664 e.printStackTrace(); 665 } 714 AppExecution.execute(params, Paths.getEditionBasePath()); 666 715 } 667 716 } … … 672 721 if (params.size() > 0) { 673 722 params.add("-noswitch"); 674 try { 675 ProcessBuilder pb = new ProcessBuilder(params); 676 pb.directory(Paths.getEditionBasePath()); 677 pb.start(); 678 } catch (IOException e) { 679 e.printStackTrace(); 680 } 723 AppExecution.execute(params, Paths.getEditionBasePath()); 681 724 } 682 725 } -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.properties
r621 r623 24 24 menu.reglobalize=&Rebuild Core Data 25 25 menu.reglobalizeTooltip=Rebuild Core Data 26 menu.tools=&Manage Tools27 menu.toolsTooltip=Install/Remove Tools28 26 menu.update=&Check for updates 29 27 menu.updateTooltip=Check for updates to already downloaded packages on the Depot 28 29 menu.tools=&Tools 30 menu.manageTools=&Manage Tools 31 menu.manageToolsTooltip=Install/Remove Tools 30 32 31 33 btnRevertSelection.text=Revert selection -
AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.yml
r621 r623 6 6 locationRelativeTo: null 7 7 defaultCloseOperation: doNothingOnClose 8 onWindowOpened: [execDepotUpdate,checkMandatoryFiles,checkInitialize,initialize,checkUpdates,doUpdate ]8 onWindowOpened: [execDepotUpdate,checkMandatoryFiles,checkInitialize,initialize,checkUpdates,doUpdate,refreshToolsMenu,focus] 9 9 onWindowClosing: [saveLocalData,exit] 10 10 iconImage: img.ae … … 19 19 - Action(name=saveConfig, text=menu.saveConfig, toolTipText=menu.saveConfigTooltip, icon=img.saveFile, onAction=[saveConfig]) 20 20 - Action(name=reglobalize, text=menu.reglobalize, toolTipText=menu.reglobalizeTooltip, icon=img.refresh, onAction=[reglobalize]) 21 - Action(name=tools, text=menu. tools, toolTipText=menu.toolsTooltip, icon=img.tools, onAction=[tools])21 - Action(name=tools, text=menu.manageTools, toolTipText=menu.manageToolsTooltip, icon=img.tools, onAction=[tools,refreshToolsMenu]) 22 22 - Action(name=update, text=menu.update, toolTipText=menu.updateTooltip, icon=img.update, onAction=[checkUpdates,doUpdate]) 23 23 - JMenuBar: … … 37 37 - JMenuItem(action=reglobalize) 38 38 - JSeparator() 39 - JMenuItem(action=tools) 39 - JMenuItem(action=update) 40 - JMenu(name=toolsMenu, text=menu.tools): 41 - JMenuItem(name=manageToolsItem, action=tools) 40 42 - JSeparator() 41 - JMenuItem(action=update)42 43 - JToolBar(name=toolbar, floatable=false, orientation=0): 43 44 - JButton(action=exitAction, hideActionText=true)
Note:
See TracChangeset
for help on using the changeset viewer.