Changeset 623 for AE/installer2/src/net/oni2/aeinstaller/gui
- Timestamp:
- Jan 16, 2013, 11:25:00 AM (12 years ago)
- Location:
- AE/installer2/src/net/oni2/aeinstaller/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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.