source: AE/installer2/src/net/oni2/aeinstaller/gui/MainWin.java@ 635

Last change on this file since 635 was 635, checked in by alloc, 12 years ago

AEI2:

  • Refactorings
File size: 20.9 KB
RevLine 
[591]1package net.oni2.aeinstaller.gui;
2
[627]3import java.awt.BorderLayout;
[608]4import java.awt.Desktop;
[632]5import java.awt.GridLayout;
[608]6import java.awt.event.ActionEvent;
[627]7import java.awt.event.ItemEvent;
8import java.awt.event.ItemListener;
[604]9import java.io.File;
[605]10import java.io.IOException;
[623]11import java.net.URL;
[634]12import java.util.Date;
[605]13import java.util.HashMap;
14import java.util.HashSet;
[591]15import java.util.ResourceBundle;
16import java.util.TreeMap;
[600]17import java.util.TreeSet;
[605]18import java.util.Vector;
[591]19
[623]20import javax.swing.AbstractAction;
21import javax.swing.Icon;
22import javax.swing.ImageIcon;
[600]23import javax.swing.JButton;
[627]24import javax.swing.JCheckBox;
[591]25import javax.swing.JComboBox;
[604]26import javax.swing.JFileChooser;
[591]27import javax.swing.JFrame;
[592]28import javax.swing.JLabel;
[593]29import javax.swing.JMenu;
[608]30import javax.swing.JMenuItem;
[593]31import javax.swing.JOptionPane;
[627]32import javax.swing.JPanel;
[630]33import javax.swing.JRadioButton;
[592]34import javax.swing.JSplitPane;
[591]35import javax.swing.SwingUtilities;
[631]36import javax.swing.ToolTipManager;
[604]37import javax.swing.filechooser.FileFilter;
[591]38
[623]39import net.oni2.aeinstaller.AEInstaller2;
40import net.oni2.aeinstaller.backend.AppExecution;
[604]41import net.oni2.aeinstaller.backend.Paths;
[591]42import net.oni2.aeinstaller.backend.Settings;
[593]43import net.oni2.aeinstaller.backend.Settings.Platform;
[600]44import net.oni2.aeinstaller.backend.SizeFormatter;
[591]45import net.oni2.aeinstaller.backend.depot.DepotManager;
[600]46import net.oni2.aeinstaller.backend.mods.Mod;
47import net.oni2.aeinstaller.backend.mods.ModManager;
48import net.oni2.aeinstaller.backend.mods.Type;
[604]49import net.oni2.aeinstaller.backend.mods.download.ModDownloader;
50import net.oni2.aeinstaller.backend.mods.download.ModDownloader.State;
51import net.oni2.aeinstaller.backend.mods.download.ModDownloaderListener;
[600]52import net.oni2.aeinstaller.backend.oni.InstallProgressListener;
53import net.oni2.aeinstaller.backend.oni.Installer;
[621]54import net.oni2.aeinstaller.backend.oni.OniSplit;
[593]55import net.oni2.aeinstaller.gui.about.AboutDialog;
[605]56import net.oni2.aeinstaller.gui.downloadwindow.Downloader;
[600]57import net.oni2.aeinstaller.gui.modtable.DownloadSizeListener;
[631]58import net.oni2.aeinstaller.gui.modtable.ModSelectionListener;
59import net.oni2.aeinstaller.gui.modtable.ModTable;
[591]60import net.oni2.aeinstaller.gui.settings.SettingsDialog;
[625]61import net.oni2.aeinstaller.gui.toolmanager.ToolManager;
[591]62
63import org.javabuilders.BuildResult;
64import org.javabuilders.annotations.DoInBackground;
65import org.javabuilders.event.BackgroundEvent;
66import org.javabuilders.swing.SwingJavaBuilder;
[593]67import org.simplericity.macify.eawt.ApplicationEvent;
68import org.simplericity.macify.eawt.ApplicationListener;
[591]69
70/**
71 * @author Christian Illy
72 */
[600]73public class MainWin extends JFrame implements ApplicationListener,
[631]74 DownloadSizeListener, ModSelectionListener {
[591]75 private static final long serialVersionUID = -4027395051382659650L;
76
[629]77 private ResourceBundle bundle = ResourceBundle
78 .getBundle("net.oni2.aeinstaller.localization."
79 + getClass().getSimpleName());
[591]80 @SuppressWarnings("unused")
81 private BuildResult result = SwingJavaBuilder.build(this, bundle);
82
[593]83 private JMenu mainMenu;
[623]84 private JMenu toolsMenu;
85 private TreeSet<JMenuItem> toolsMenuItems = new TreeSet<JMenuItem>();
[593]86
[592]87 private JSplitPane contents;
88
[591]89 private JComboBox cmbModTypes;
[630]90 private JRadioButton radAll;
91 private JRadioButton radOnline;
92 private JRadioButton radLocal;
[631]93 private ModTable tblMods;
[600]94 private JLabel lblDownloadSizeVal;
[591]95
[592]96 private JLabel lblSubmitterVal;
97 private JLabel lblCreatorVal;
[606]98 private JLabel lblTypesVal;
99 private JLabel lblPlatformVal;
[621]100 private JLabel lblPackageNumberVal;
[592]101 private HTMLLinkLabel lblDescriptionVal;
102
[600]103 private JButton btnInstall;
104
[621]105 private TreeSet<Mod> execUpdates = null;
106
107 private enum EInstallResult {
108 DONE,
109 OFFLINE,
110 INCOMPATIBLE
111 };
112
113 private EInstallResult installDone = EInstallResult.DONE;
114
[591]115 /**
116 * Constructor of main window.
117 */
118 public MainWin() {
[593]119 this.setTitle(SwingJavaBuilder.getConfig().getResource("appname")
120 + " - v"
121 + SwingJavaBuilder.getConfig().getResource("appversion"));
[591]122
[592]123 contents.setDividerLocation(400);
[631]124 contents.setResizeWeight(0.4);
[593]125
126 if (Settings.getPlatform() == Platform.MACOS) {
127 mainMenu.setVisible(false);
128 }
[600]129
[631]130 ToolTipManager.sharedInstance().setInitialDelay(250);
131
[600]132 getRootPane().setDefaultButton(btnInstall);
[605]133 lblDownloadSizeVal.setText(SizeFormatter.format(0, 2));
[630]134 radAll.setSelected(true);
[631]135
136 tblMods.addModSelectionListener(this);
137 tblMods.addDownloadSizeListener(this);
[591]138 }
139
140 private void initModTypeBox() {
[592]141 cmbModTypes.removeAllItems();
142
[600]143 TreeMap<String, Type> types = new TreeMap<String, Type>();
144 for (Type t : ModManager.getInstance().getTypesWithContent()) {
145 types.put(t.getName(), t);
[591]146 }
[630]147 cmbModTypes.addItem("-All-");
[600]148 for (Type t : types.values()) {
[591]149 cmbModTypes.addItem(t);
150 }
151 cmbModTypes.setSelectedIndex(0);
152 }
153
154 private void exit() {
155 dispose();
[608]156 System.exit(0);
[591]157 }
158
159 private void saveLocalData() {
160 Settings.getInstance().serializeToFile();
161 }
162
163 @DoInBackground(progressMessage = "updateDepot.title", cancelable = false, indeterminateProgress = false)
164 private void execDepotUpdate(final BackgroundEvent evt) {
[621]165 if (!Settings.getInstance().isOfflineMode()) {
[634]166 long start = new Date().getTime();
167
[621]168 try {
[634]169 DepotManager.getInstance().updateInformation(false);
[621]170 } catch (Exception e) {
171 e.printStackTrace();
172 }
[634]173
174 System.out.println("Took: " + (new Date().getTime() - start)
175 + " msec");
[621]176 }
[633]177
[621]178 ModManager.getInstance().init();
[631]179 tblMods.reloadData();
[621]180 initModTypeBox();
[600]181
[621]182 tblMods.setVisible(true);
183 }
184
185 @SuppressWarnings("unused")
186 private void checkUpdates(Object evtSource) {
187 if ((evtSource != this)
188 || Settings.getInstance().get("notifyupdates", true)) {
189 if (Settings.getInstance().isOfflineMode()) {
190 if (evtSource != this) {
191 JOptionPane.showMessageDialog(this,
192 bundle.getString("offlineMode.text"),
193 bundle.getString("offlineMode.title"),
194 JOptionPane.WARNING_MESSAGE);
195 }
196 } else {
197 TreeSet<Mod> mods = ModManager.getInstance().getUpdatableMods();
198 TreeSet<Mod> tools = ModManager.getInstance()
199 .getUpdatableTools();
200 int size = 0;
[632]201 JPanel panPackages = new JPanel(new GridLayout(0, 1));
202 execUpdates = new TreeSet<Mod>();
203 execUpdates.addAll(mods);
204 execUpdates.addAll(tools);
205 for (final Mod m : mods) {
[621]206 size += m.getZipSize();
[632]207 JCheckBox check = new JCheckBox("Mod: " + m.getName());
208 check.setSelected(true);
209 check.addItemListener(new ItemListener() {
210 @Override
211 public void itemStateChanged(ItemEvent e) {
212 if (e.getStateChange() == ItemEvent.SELECTED)
213 execUpdates.add(m);
214 else
215 execUpdates.remove(m);
216 }
217 });
218 panPackages.add(check);
[621]219 }
[632]220 for (final Mod m : tools) {
[621]221 size += m.getZipSize();
[632]222 JCheckBox check = new JCheckBox("Tool: " + m.getName());
223 check.setSelected(true);
224 panPackages.add(check);
[621]225 }
[622]226 if (size > 0) {
[627]227 // Build info dialog content
[632]228 JPanel packages = new JPanel(new BorderLayout(0, 7));
229 JLabel lblIntro = new JLabel("<html>"
230 + bundle.getString("updatesAvailable.text")
231 + "</html>");
232 JLabel lblSize = new JLabel("<html>"
233 + String.format(bundle
234 .getString("updatesAvailableSize.text"),
235 SizeFormatter.format(size, 3)) + "</html>");
236 packages.add(lblIntro, BorderLayout.NORTH);
237 packages.add(panPackages, BorderLayout.CENTER);
238 packages.add(lblSize, BorderLayout.SOUTH);
[627]239
[632]240 JPanel pan = new JPanel(new BorderLayout(0, 25));
241 pan.add(packages, BorderLayout.CENTER);
[627]242 JCheckBox checkFutureUpdates = new JCheckBox(
243 bundle.getString("checkOnStartup.text"));
244 checkFutureUpdates.setSelected(Settings.getInstance().get(
245 "notifyupdates", true));
246 checkFutureUpdates.addItemListener(new ItemListener() {
247 @Override
248 public void itemStateChanged(ItemEvent evt) {
249 Settings.getInstance().put("notifyupdates",
250 evt.getStateChange() == ItemEvent.SELECTED);
251 }
252 });
253 pan.add(checkFutureUpdates, BorderLayout.SOUTH);
254
255 // Show dialog
256 int res = JOptionPane.showConfirmDialog(this, pan,
[622]257 bundle.getString("updatesAvailable.title"),
258 JOptionPane.YES_NO_OPTION,
259 JOptionPane.QUESTION_MESSAGE);
[632]260 if (res == JOptionPane.NO_OPTION) {
261 execUpdates = null;
[622]262 }
[621]263 }
264 }
[591]265 }
266 }
267
[624]268 @SuppressWarnings("unused")
269 private void doUpdate() {
[632]270 if (execUpdates != null && execUpdates.size() > 0) {
[624]271 Downloader dl = new Downloader(execUpdates);
272 try {
273 dl.setVisible(true);
274 if (dl.isFinished()) {
275 TreeSet<Integer> installed = Installer.getInstalledTools();
276 TreeSet<Mod> tools = new TreeSet<Mod>();
277 for (Mod m : execUpdates)
278 if (m.isTool()
279 && installed.contains(m.getPackageNumber()))
280 tools.add(m);
281 if (tools.size() > 0) {
282 Installer.installTools(tools);
283 }
284 }
285 } finally {
286 dl.dispose();
287 }
[591]288 }
[621]289 execUpdates = null;
[591]290 }
291
292 @SuppressWarnings("unused")
293 private void focus() {
294 SwingUtilities.invokeLater(new Runnable() {
295
296 @Override
297 public void run() {
298 toFront();
299 repaint();
300 }
301 });
302
303 }
304
305 private void showSettings() {
[593]306 new SettingsDialog().setVisible(true);
[591]307 }
308
[593]309 private void showAbout() {
310 new AboutDialog().setVisible(true);
311 }
312
[604]313 private JFileChooser getConfigOpenSaveDialog(boolean save) {
314 JFileChooser fc = new JFileChooser();
315 fc.setCurrentDirectory(Paths.getEditionBasePath());
316 if (save)
317 fc.setDialogType(JFileChooser.SAVE_DIALOG);
318 else
319 fc.setDialogType(JFileChooser.OPEN_DIALOG);
320 fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
321 fc.setFileFilter(new FileFilter() {
322 @Override
323 public String getDescription() {
324 return "XML files";
325 }
326
327 @Override
328 public boolean accept(File arg0) {
329 return (arg0.isDirectory())
330 || (arg0.getName().toLowerCase().endsWith(".xml"));
331 }
332 });
333 fc.setMultiSelectionEnabled(false);
334 return fc;
335 }
336
[593]337 @SuppressWarnings("unused")
338 private void loadConfig() {
[604]339 JFileChooser fc = getConfigOpenSaveDialog(false);
340 int res = fc.showOpenDialog(this);
341 if (res == JFileChooser.APPROVE_OPTION) {
342 if (fc.getSelectedFile().exists())
[631]343 tblMods.reloadSelection(fc.getSelectedFile());
[604]344 }
[593]345 }
346
347 @SuppressWarnings("unused")
348 private void saveConfig() {
[604]349 JFileChooser fc = getConfigOpenSaveDialog(true);
350 int res = fc.showSaveDialog(this);
351 if (res == JFileChooser.APPROVE_OPTION) {
352 File f = fc.getSelectedFile();
353 if (!f.getName().endsWith(".xml"))
354 f = new File(f.getParentFile(), f.getName() + ".xml");
355 ModManager.getInstance().saveModSelection(f,
[631]356 tblMods.getSelectedMods());
[604]357 }
[593]358 }
359
[600]360 @DoInBackground(progressMessage = "initializingEdition.title", cancelable = false, indeterminateProgress = false)
361 private void reglobalize(final BackgroundEvent evt) {
362 Installer.initializeEdition(new InstallProgressListener() {
363 @Override
364 public void installProgressUpdate(int done, int total, String step) {
365 evt.setProgressEnd(total);
366 evt.setProgressValue(done);
367 evt.setProgressMessage(step);
368 }
369 });
370 }
371
[593]372 @SuppressWarnings("unused")
[600]373 private void tools() {
[625]374 new ToolManager().setVisible(true);
[593]375 }
[596]376
[593]377 @SuppressWarnings("unused")
[623]378 private void refreshToolsMenu() {
379 for (JMenuItem i : toolsMenuItems) {
380 toolsMenu.remove(i);
381 }
382 toolsMenuItems.clear();
383 for (Mod m : ModManager.getInstance().getInstalledTools()) {
384 if (m.getExeFile() != null && m.getExeFile().exists()) {
385 JMenuItem item = new JMenuItem();
386 final Vector<String> params = new Vector<String>();
387 params.add(m.getExeFile().getPath());
388 final File wd = m.getWorkingDir();
389 Icon ico = null;
390 if (m.getIconFile() != null && m.getIconFile().exists()) {
391 ico = new ImageIcon(m.getIconFile().getPath());
392 } else {
[624]393 URL icon = AEInstaller2.class
394 .getResource("images/transparent.png");
[623]395 ico = new ImageIcon(icon);
396 }
397 item.setAction(new AbstractAction(m.getName(), ico) {
398 private static final long serialVersionUID = 1L;
399
400 @Override
401 public void actionPerformed(ActionEvent e) {
402 AppExecution.execute(params, wd);
403 }
404 });
405 toolsMenuItems.add(item);
406 toolsMenu.add(item);
407 }
408 }
409 }
410
411 @SuppressWarnings("unused")
[593]412 private void revertSelection() {
[631]413 tblMods.revertSelection();
[593]414 }
415
[602]416 @DoInBackground(progressMessage = "mandatoryFiles.title", cancelable = false, indeterminateProgress = false)
417 private void checkMandatoryFiles(final BackgroundEvent evt) {
[621]418 if (!Settings.getInstance().isOfflineMode()) {
419 TreeSet<Mod> mand = new TreeSet<Mod>();
420 for (Mod m : ModManager.getInstance().getMandatoryTools()) {
421 if (m.isNewerAvailable()) {
422 mand.add(m);
423 }
[604]424 }
[621]425 for (Mod m : ModManager.getInstance().getMandatoryMods()) {
426 if (m.isNewerAvailable()) {
427 mand.add(m);
428 }
[604]429 }
[621]430 if (mand.size() > 0) {
431 ModDownloader m = new ModDownloader(mand,
432 new ModDownloaderListener() {
433 @Override
434 public void updateStatus(ModDownloader source,
435 State state, int filesDown, int filesTotal,
436 int bytesDown, int bytesTotal,
437 int duration, int remaining, int speed) {
438 evt.setProgressEnd(filesTotal);
439 evt.setProgressValue(filesDown);
440 }
441 });
442 while (!m.isFinished()) {
443 try {
444 Thread.sleep(10);
445 } catch (InterruptedException e) {
446 e.printStackTrace();
447 }
[604]448 }
449 }
[621]450 evt.setProgressMessage(bundle
451 .getString("mandatoryToolsInstall.title"));
452 Installer
453 .installTools(ModManager.getInstance().getMandatoryTools());
[604]454 }
[602]455 }
456
[600]457 @DoInBackground(progressMessage = "installing.title", cancelable = false, indeterminateProgress = false)
[621]458 private void install(final BackgroundEvent evt) {
[600]459 TreeSet<Mod> mods = new TreeSet<Mod>();
[602]460 mods.addAll(ModManager.getInstance().getMandatoryMods());
[631]461 mods.addAll(tblMods.getSelectedMods());
[600]462
[605]463 boolean instReady = false;
[621]464 installDone = EInstallResult.DONE;
[605]465
466 while (!instReady) {
467 TreeSet<Mod> toDownload = new TreeSet<Mod>();
468 for (Mod m : mods) {
469 if (!m.isLocalAvailable())
470 toDownload.add(m);
471 }
[621]472 if (Settings.getInstance().isOfflineMode()) {
473 installDone = EInstallResult.OFFLINE;
474 break;
475 }
[605]476 if (toDownload.size() > 0) {
477 Downloader dl = new Downloader(toDownload);
[617]478 try {
479 dl.setVisible(true);
480 if (!dl.isFinished())
481 break;
482 } finally {
483 dl.dispose();
484 }
[605]485 }
486 HashMap<Mod, HashSet<Mod>> dependencies = ModManager.getInstance()
487 .checkDependencies(mods);
488 if (dependencies.size() > 0) {
489 System.out.println("Unmet dependencies: "
490 + dependencies.toString());
491 for (Mod m : dependencies.keySet()) {
492 for (Mod mDep : dependencies.get(m))
493 mods.add(mDep);
494 }
495 } else {
496 HashMap<Mod, HashSet<Mod>> conflicts = ModManager.getInstance()
[608]497 .checkIncompabitilites(mods);
[605]498 if (conflicts.size() > 0) {
[621]499 installDone = EInstallResult.INCOMPATIBLE;
[608]500 System.err.println("Incompatible mods: "
[605]501 + conflicts.toString());
502 break;
503 } else {
504 instReady = true;
505 }
506 }
[600]507 }
[618]508
[605]509 if (instReady) {
[623]510 TreeSet<Mod> actuallyMods = new TreeSet<Mod>();
511 TreeSet<Mod> actuallyTools = new TreeSet<Mod>();
512
513 for (Mod m : mods) {
514 if (m.isTool())
515 actuallyTools.add(m);
516 else
517 actuallyMods.add(m);
518 }
519
520 if (actuallyTools.size() > 0) {
521 Installer.installTools(actuallyTools);
522 }
523
524 Installer.install(actuallyMods, new InstallProgressListener() {
[605]525 @Override
526 public void installProgressUpdate(int done, int total,
527 String step) {
528 evt.setProgressEnd(total);
529 evt.setProgressValue(done);
530 evt.setProgressMessage(step);
531 }
532 });
[621]533 installDone = EInstallResult.DONE;
[605]534 }
[600]535 }
[618]536
[617]537 @SuppressWarnings("unused")
538 private void installDone() {
[621]539 switch (installDone) {
540 case DONE:
541 JOptionPane.showMessageDialog(this,
542 bundle.getString("installDone.text"),
543 bundle.getString("installDone.title"),
544 JOptionPane.INFORMATION_MESSAGE);
545 break;
546 case OFFLINE:
547 JOptionPane.showMessageDialog(this,
548 bundle.getString("offlineMode.text"),
549 bundle.getString("offlineMode.title"),
550 JOptionPane.WARNING_MESSAGE);
551 break;
552 case INCOMPATIBLE:
553 break;
554 }
[617]555 }
[600]556
[631]557 @Override
558 public void modSelectionChanged(ModTable source, Mod m) {
[592]559 lblSubmitterVal.setText("");
560 lblCreatorVal.setText("");
561 lblDescriptionVal.setText("");
[606]562 lblTypesVal.setText("");
563 lblPlatformVal.setText("");
[621]564 lblPackageNumberVal.setText("");
[600]565 if (m != null) {
566 lblSubmitterVal.setText(m.getName());
567 lblCreatorVal.setText(m.getCreator());
568 lblDescriptionVal.setText(m.getDescription());
[606]569
570 String types = "";
571 for (Type t : m.getTypes()) {
572 if (types.length() > 0)
573 types += ", ";
574 types += t.getName();
575 }
576 lblTypesVal.setText(types);
577 lblPlatformVal.setText(m.getPlatform().toString());
[621]578 lblPackageNumberVal.setText(m.getPackageNumberString());
[591]579 }
580 }
581
[630]582 private void updateTableFilter() {
583 Object o = cmbModTypes.getSelectedItem();
584 Type t = null;
585 if (o instanceof Type)
586 t = (Type) o;
587 int downloadState = 0;
588 if (radOnline.isSelected())
589 downloadState = 1;
590 if (radLocal.isSelected())
591 downloadState = 2;
[631]592 tblMods.setFilter(t, downloadState);
[630]593 }
594
[591]595 @SuppressWarnings("unused")
[592]596 private void modTypeSelection() {
[630]597 updateTableFilter();
[591]598 }
[593]599
[630]600 @SuppressWarnings("unused")
601 private void showTypeSelection() {
602 updateTableFilter();
603 }
604
[593]605 @Override
[600]606 public void downloadSizeChanged(int newSize) {
607 lblDownloadSizeVal.setText(SizeFormatter.format(newSize, 2));
608 }
609
[616]610 @SuppressWarnings("unused")
611 private void checkInitialize() {
[600]612 if (!Installer.isEditionInitialized()) {
[621]613 if (!OniSplit.isOniSplitInstalled()) {
614 JOptionPane.showMessageDialog(this,
615 bundle.getString("noOniSplit.text"),
616 bundle.getString("noOniSplit.title"),
617 JOptionPane.ERROR_MESSAGE);
[600]618 exit();
[621]619 } else {
620 int res = JOptionPane
621 .showConfirmDialog(this,
622 bundle.getString("askInitialize.text"),
623 bundle.getString("askInitialize.title"),
624 JOptionPane.YES_NO_OPTION,
625 JOptionPane.QUESTION_MESSAGE);
626 if (res == JOptionPane.NO_OPTION) {
627 saveLocalData();
628 exit();
629 }
[600]630 }
631 }
632 }
[606]633
[616]634 @DoInBackground(progressMessage = "initializingEdition.title", cancelable = false, indeterminateProgress = false)
635 private void initialize(final BackgroundEvent evt) {
636 if (!Installer.isEditionInitialized()) {
637 Installer.initializeEdition(new InstallProgressListener() {
638 @Override
639 public void installProgressUpdate(int done, int total,
640 String step) {
641 evt.setProgressEnd(total);
642 evt.setProgressValue(done);
643 evt.setProgressMessage(step);
644 }
645 });
646 }
647 }
648
[605]649 private Vector<String> getBasicOniLaunchParams() {
650 Vector<String> params = new Vector<String>();
[618]651 File exe = null;
[605]652 switch (Settings.getPlatform()) {
653 case WIN:
[618]654 exe = new File(Paths.getEditionBasePath(), "Oni.exe");
655 if (exe.exists())
656 params.add(exe.getPath());
[605]657 break;
658 case MACOS:
[618]659 exe = new File(Paths.getEditionBasePath(),
660 "Oni.app/Contents/MacOS/Oni");
661 if (exe.exists())
662 params.add(exe.getPath());
[605]663 break;
664 case LINUX:
665 String wine = Settings.getWinePath();
[618]666 exe = new File(Paths.getEditionBasePath(), "Oni.exe");
667 if (exe.exists()) {
668 if (wine != null) {
669 params.add(wine);
670 params.add(exe.getPath());
671 }
[605]672 }
673 break;
674 default:
675 }
676 if (params.size() > 0) {
677 params.add("-debugfiles");
678 }
679 return params;
680 }
[600]681
[605]682 @SuppressWarnings("unused")
683 private void oniFull() {
684 Vector<String> params = getBasicOniLaunchParams();
685 if (params.size() > 0) {
[623]686 AppExecution.execute(params, Paths.getEditionBasePath());
[605]687 }
688 }
689
690 @SuppressWarnings("unused")
691 private void oniWin() {
692 Vector<String> params = getBasicOniLaunchParams();
693 if (params.size() > 0) {
694 params.add("-noswitch");
[623]695 AppExecution.execute(params, Paths.getEditionBasePath());
[605]696 }
697 }
698
[608]699 @SuppressWarnings("unused")
700 private void openEditionFolder() {
701 try {
702 Desktop.getDesktop().open(Paths.getEditionBasePath());
703 } catch (IOException e) {
704 e.printStackTrace();
705 }
706 }
707
[600]708 @Override
[593]709 public void handleAbout(ApplicationEvent event) {
710 event.setHandled(true);
711 showAbout();
712 }
713
714 @Override
715 public void handleOpenApplication(ApplicationEvent event) {
716 }
717
718 @Override
719 public void handleOpenFile(ApplicationEvent event) {
720 }
721
722 @Override
723 public void handlePreferences(ApplicationEvent event) {
724 showSettings();
725 }
726
727 @Override
728 public void handlePrintFile(ApplicationEvent event) {
729 }
730
731 @Override
732 public void handleQuit(ApplicationEvent event) {
[605]733 event.setHandled(true);
734 saveLocalData();
735 exit();
[593]736 }
737
738 @Override
739 public void handleReOpenApplication(ApplicationEvent event) {
740 }
[600]741
[592]742}
Note: See TracBrowser for help on using the repository browser.