| 7 |
|
import java.awt.event.MouseEvent; |
| 8 |
|
import java.io.File; |
| 9 |
|
import java.io.IOException; |
| 10 |
+ |
import java.net.URL; |
| 11 |
|
import java.util.ArrayList; |
| 12 |
|
import java.util.HashMap; |
| 13 |
|
import java.util.HashSet; |
| 17 |
|
import java.util.TreeSet; |
| 18 |
|
import java.util.Vector; |
| 19 |
|
|
| 20 |
+ |
import javax.swing.AbstractAction; |
| 21 |
+ |
import javax.swing.Icon; |
| 22 |
+ |
import javax.swing.ImageIcon; |
| 23 |
|
import javax.swing.JButton; |
| 24 |
|
import javax.swing.JComboBox; |
| 25 |
|
import javax.swing.JComponent; |
| 41 |
|
import javax.swing.filechooser.FileFilter; |
| 42 |
|
import javax.swing.table.TableRowSorter; |
| 43 |
|
|
| 44 |
+ |
import net.oni2.aeinstaller.AEInstaller2; |
| 45 |
+ |
import net.oni2.aeinstaller.backend.AppExecution; |
| 46 |
|
import net.oni2.aeinstaller.backend.Paths; |
| 47 |
|
import net.oni2.aeinstaller.backend.Settings; |
| 48 |
|
import net.oni2.aeinstaller.backend.Settings.Platform; |
| 85 |
|
private BuildResult result = SwingJavaBuilder.build(this, bundle); |
| 86 |
|
|
| 87 |
|
private JMenu mainMenu; |
| 88 |
+ |
private JMenu toolsMenu; |
| 89 |
+ |
private TreeSet<JMenuItem> toolsMenuItems = new TreeSet<JMenuItem>(); |
| 90 |
|
|
| 91 |
|
private JSplitPane contents; |
| 92 |
|
|
| 419 |
|
} |
| 420 |
|
|
| 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") |
| 455 |
|
private void revertSelection() { |
| 456 |
|
model.revertSelection(); |
| 457 |
|
} |
| 550 |
|
} |
| 551 |
|
|
| 552 |
|
if (instReady) { |
| 553 |
< |
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() { |
| 568 |
|
@Override |
| 569 |
|
public void installProgressUpdate(int done, int total, |
| 570 |
|
String step) { |
| 711 |
|
private void oniFull() { |
| 712 |
|
Vector<String> params = getBasicOniLaunchParams(); |
| 713 |
|
if (params.size() > 0) { |
| 714 |
< |
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()); |
| 715 |
|
} |
| 716 |
|
} |
| 717 |
|
|
| 720 |
|
Vector<String> params = getBasicOniLaunchParams(); |
| 721 |
|
if (params.size() > 0) { |
| 722 |
|
params.add("-noswitch"); |
| 723 |
< |
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()); |
| 724 |
|
} |
| 725 |
|
} |
| 726 |
|
|