[591] | 1 | package net.oni2.aeinstaller.gui;
|
---|
| 2 |
|
---|
[627] | 3 | import java.awt.BorderLayout;
|
---|
[608] | 4 | import java.awt.Desktop;
|
---|
[632] | 5 | import java.awt.GridLayout;
|
---|
[608] | 6 | import java.awt.event.ActionEvent;
|
---|
[627] | 7 | import java.awt.event.ItemEvent;
|
---|
| 8 | import java.awt.event.ItemListener;
|
---|
[660] | 9 | import java.awt.event.KeyAdapter;
|
---|
| 10 | import java.awt.event.KeyEvent;
|
---|
[604] | 11 | import java.io.File;
|
---|
[623] | 12 | import java.net.URL;
|
---|
[634] | 13 | import java.util.Date;
|
---|
[605] | 14 | import java.util.HashMap;
|
---|
| 15 | import java.util.HashSet;
|
---|
[591] | 16 | import java.util.ResourceBundle;
|
---|
| 17 | import java.util.TreeMap;
|
---|
[600] | 18 | import java.util.TreeSet;
|
---|
[605] | 19 | import java.util.Vector;
|
---|
[591] | 20 |
|
---|
[623] | 21 | import javax.swing.AbstractAction;
|
---|
| 22 | import javax.swing.ImageIcon;
|
---|
[600] | 23 | import javax.swing.JButton;
|
---|
[627] | 24 | import javax.swing.JCheckBox;
|
---|
[591] | 25 | import javax.swing.JComboBox;
|
---|
[604] | 26 | import javax.swing.JFileChooser;
|
---|
[591] | 27 | import javax.swing.JFrame;
|
---|
[592] | 28 | import javax.swing.JLabel;
|
---|
[593] | 29 | import javax.swing.JMenu;
|
---|
[608] | 30 | import javax.swing.JMenuItem;
|
---|
[593] | 31 | import javax.swing.JOptionPane;
|
---|
[627] | 32 | import javax.swing.JPanel;
|
---|
[630] | 33 | import javax.swing.JRadioButton;
|
---|
[658] | 34 | import javax.swing.JScrollPane;
|
---|
[592] | 35 | import javax.swing.JSplitPane;
|
---|
[660] | 36 | import javax.swing.JTextField;
|
---|
[591] | 37 | import javax.swing.SwingUtilities;
|
---|
[631] | 38 | import javax.swing.ToolTipManager;
|
---|
[604] | 39 | import javax.swing.filechooser.FileFilter;
|
---|
[591] | 40 |
|
---|
[623] | 41 | import net.oni2.aeinstaller.AEInstaller2;
|
---|
| 42 | import net.oni2.aeinstaller.backend.AppExecution;
|
---|
[671] | 43 | import net.oni2.aeinstaller.backend.ImageResizer;
|
---|
[604] | 44 | import net.oni2.aeinstaller.backend.Paths;
|
---|
[591] | 45 | import net.oni2.aeinstaller.backend.Settings;
|
---|
[672] | 46 | import net.oni2.aeinstaller.backend.ToolLauncher;
|
---|
[593] | 47 | import net.oni2.aeinstaller.backend.Settings.Platform;
|
---|
[600] | 48 | import net.oni2.aeinstaller.backend.SizeFormatter;
|
---|
[591] | 49 | import net.oni2.aeinstaller.backend.depot.DepotManager;
|
---|
[658] | 50 | import net.oni2.aeinstaller.backend.oni.InstallProgressListener;
|
---|
| 51 | import net.oni2.aeinstaller.backend.oni.Installer;
|
---|
| 52 | import net.oni2.aeinstaller.backend.oni.OniSplit;
|
---|
[648] | 53 | import net.oni2.aeinstaller.backend.packages.Package;
|
---|
| 54 | import net.oni2.aeinstaller.backend.packages.PackageManager;
|
---|
| 55 | import net.oni2.aeinstaller.backend.packages.Type;
|
---|
| 56 | import net.oni2.aeinstaller.backend.packages.download.ModDownloader;
|
---|
[658] | 57 | import net.oni2.aeinstaller.backend.packages.download.ModDownloader.State;
|
---|
[648] | 58 | import net.oni2.aeinstaller.backend.packages.download.ModDownloaderListener;
|
---|
[593] | 59 | import net.oni2.aeinstaller.gui.about.AboutDialog;
|
---|
[648] | 60 | import net.oni2.aeinstaller.gui.corepackages.CorePackagesDialog;
|
---|
[605] | 61 | import net.oni2.aeinstaller.gui.downloadwindow.Downloader;
|
---|
[600] | 62 | import net.oni2.aeinstaller.gui.modtable.DownloadSizeListener;
|
---|
[660] | 63 | import net.oni2.aeinstaller.gui.modtable.EApplyFilterTo;
|
---|
[631] | 64 | import net.oni2.aeinstaller.gui.modtable.ModSelectionListener;
|
---|
| 65 | import net.oni2.aeinstaller.gui.modtable.ModTable;
|
---|
[658] | 66 | import net.oni2.aeinstaller.gui.modtable.ModTable.ETableContentType;
|
---|
| 67 | import net.oni2.aeinstaller.gui.packageinfobox.PackageInfoBox;
|
---|
[591] | 68 | import net.oni2.aeinstaller.gui.settings.SettingsDialog;
|
---|
[625] | 69 | import net.oni2.aeinstaller.gui.toolmanager.ToolManager;
|
---|
[591] | 70 |
|
---|
| 71 | import org.javabuilders.BuildResult;
|
---|
| 72 | import org.javabuilders.annotations.DoInBackground;
|
---|
| 73 | import org.javabuilders.event.BackgroundEvent;
|
---|
| 74 | import org.javabuilders.swing.SwingJavaBuilder;
|
---|
[593] | 75 | import org.simplericity.macify.eawt.ApplicationEvent;
|
---|
| 76 | import org.simplericity.macify.eawt.ApplicationListener;
|
---|
[591] | 77 |
|
---|
| 78 | /**
|
---|
| 79 | * @author Christian Illy
|
---|
| 80 | */
|
---|
[600] | 81 | public class MainWin extends JFrame implements ApplicationListener,
|
---|
[631] | 82 | DownloadSizeListener, ModSelectionListener {
|
---|
[591] | 83 | private static final long serialVersionUID = -4027395051382659650L;
|
---|
| 84 |
|
---|
[629] | 85 | private ResourceBundle bundle = ResourceBundle
|
---|
| 86 | .getBundle("net.oni2.aeinstaller.localization."
|
---|
| 87 | + getClass().getSimpleName());
|
---|
[591] | 88 | @SuppressWarnings("unused")
|
---|
| 89 | private BuildResult result = SwingJavaBuilder.build(this, bundle);
|
---|
| 90 |
|
---|
[593] | 91 | private JMenu mainMenu;
|
---|
[623] | 92 | private JMenu toolsMenu;
|
---|
[641] | 93 | private Vector<JMenuItem> toolsMenuItems = new Vector<JMenuItem>();
|
---|
[593] | 94 |
|
---|
[592] | 95 | private JSplitPane contents;
|
---|
| 96 |
|
---|
[591] | 97 | private JComboBox cmbModTypes;
|
---|
[630] | 98 | private JRadioButton radAll;
|
---|
| 99 | private JRadioButton radOnline;
|
---|
| 100 | private JRadioButton radLocal;
|
---|
[660] | 101 | private JTextField txtShowFilter;
|
---|
| 102 | private JComboBox cmbShowFilterTo;
|
---|
[658] | 103 | private JScrollPane scrollMods;
|
---|
[631] | 104 | private ModTable tblMods;
|
---|
[600] | 105 | private JLabel lblDownloadSizeVal;
|
---|
[591] | 106 |
|
---|
[658] | 107 | private PackageInfoBox pkgInfo;
|
---|
[660] | 108 |
|
---|
[600] | 109 | private JButton btnInstall;
|
---|
| 110 |
|
---|
[648] | 111 | private TreeSet<Package> execCoreUpdates = new TreeSet<Package>();
|
---|
| 112 | private TreeSet<Package> execUpdates = null;
|
---|
[621] | 113 |
|
---|
[641] | 114 | private enum EInstallState {
|
---|
[621] | 115 | DONE,
|
---|
[641] | 116 | READY,
|
---|
| 117 | ABORTED,
|
---|
[621] | 118 | OFFLINE,
|
---|
[641] | 119 | INCOMPATIBLE,
|
---|
| 120 | CHECKING
|
---|
[621] | 121 | };
|
---|
| 122 |
|
---|
[641] | 123 | private EInstallState installState = EInstallState.DONE;
|
---|
[648] | 124 | private TreeSet<Package> installMods = null;
|
---|
| 125 | private TreeSet<Package> installDeps = null;
|
---|
[621] | 126 |
|
---|
[591] | 127 | /**
|
---|
| 128 | * Constructor of main window.
|
---|
| 129 | */
|
---|
| 130 | public MainWin() {
|
---|
[593] | 131 | this.setTitle(SwingJavaBuilder.getConfig().getResource("appname")
|
---|
| 132 | + " - v"
|
---|
| 133 | + SwingJavaBuilder.getConfig().getResource("appversion"));
|
---|
[591] | 134 |
|
---|
[658] | 135 | tblMods = new ModTable(ETableContentType.MODS);
|
---|
| 136 | tblMods.setVisible(false);
|
---|
| 137 | scrollMods.setViewportView(tblMods);
|
---|
| 138 |
|
---|
[651] | 139 | contents.setDividerLocation(550);
|
---|
[631] | 140 | contents.setResizeWeight(0.4);
|
---|
[593] | 141 |
|
---|
| 142 | if (Settings.getPlatform() == Platform.MACOS) {
|
---|
| 143 | mainMenu.setVisible(false);
|
---|
| 144 | }
|
---|
[600] | 145 |
|
---|
[631] | 146 | ToolTipManager.sharedInstance().setInitialDelay(250);
|
---|
| 147 |
|
---|
[600] | 148 | getRootPane().setDefaultButton(btnInstall);
|
---|
[605] | 149 | lblDownloadSizeVal.setText(SizeFormatter.format(0, 2));
|
---|
[630] | 150 | radAll.setSelected(true);
|
---|
[631] | 151 |
|
---|
[660] | 152 | for (EApplyFilterTo f : EApplyFilterTo.values()) {
|
---|
| 153 | cmbShowFilterTo.addItem(f);
|
---|
| 154 | }
|
---|
| 155 | txtShowFilter.addKeyListener(new KeyAdapter() {
|
---|
| 156 | @Override
|
---|
| 157 | public void keyReleased(KeyEvent e) {
|
---|
| 158 | super.keyReleased(e);
|
---|
| 159 | updateTableFilter();
|
---|
| 160 | }
|
---|
| 161 | });
|
---|
| 162 |
|
---|
[631] | 163 | tblMods.addModSelectionListener(this);
|
---|
| 164 | tblMods.addDownloadSizeListener(this);
|
---|
[591] | 165 | }
|
---|
| 166 |
|
---|
| 167 | private void initModTypeBox() {
|
---|
[592] | 168 | cmbModTypes.removeAllItems();
|
---|
| 169 |
|
---|
[600] | 170 | TreeMap<String, Type> types = new TreeMap<String, Type>();
|
---|
[648] | 171 | for (Type t : PackageManager.getInstance().getTypesWithContent()) {
|
---|
[600] | 172 | types.put(t.getName(), t);
|
---|
[591] | 173 | }
|
---|
[630] | 174 | cmbModTypes.addItem("-All-");
|
---|
[600] | 175 | for (Type t : types.values()) {
|
---|
[591] | 176 | cmbModTypes.addItem(t);
|
---|
| 177 | }
|
---|
| 178 | cmbModTypes.setSelectedIndex(0);
|
---|
| 179 | }
|
---|
| 180 |
|
---|
| 181 | private void exit() {
|
---|
| 182 | dispose();
|
---|
[608] | 183 | System.exit(0);
|
---|
[591] | 184 | }
|
---|
| 185 |
|
---|
| 186 | private void saveLocalData() {
|
---|
| 187 | Settings.getInstance().serializeToFile();
|
---|
| 188 | }
|
---|
| 189 |
|
---|
| 190 | @DoInBackground(progressMessage = "updateDepot.title", cancelable = false, indeterminateProgress = false)
|
---|
| 191 | private void execDepotUpdate(final BackgroundEvent evt) {
|
---|
[657] | 192 | if (!Settings.getInstance().isOfflineMode()
|
---|
| 193 | && !Settings.getInstance().isNoCacheUpdateMode()) {
|
---|
[634] | 194 | long start = new Date().getTime();
|
---|
| 195 |
|
---|
[621] | 196 | try {
|
---|
[662] | 197 | DepotManager.getInstance().updateInformation();
|
---|
[621] | 198 | } catch (Exception e) {
|
---|
| 199 | e.printStackTrace();
|
---|
| 200 | }
|
---|
[634] | 201 |
|
---|
| 202 | System.out.println("Took: " + (new Date().getTime() - start)
|
---|
| 203 | + " msec");
|
---|
[621] | 204 | }
|
---|
[633] | 205 |
|
---|
[648] | 206 | PackageManager.getInstance().init();
|
---|
[631] | 207 | tblMods.reloadData();
|
---|
[621] | 208 | initModTypeBox();
|
---|
[600] | 209 |
|
---|
[621] | 210 | tblMods.setVisible(true);
|
---|
| 211 | }
|
---|
| 212 |
|
---|
| 213 | @SuppressWarnings("unused")
|
---|
| 214 | private void checkUpdates(Object evtSource) {
|
---|
| 215 | if ((evtSource != this)
|
---|
| 216 | || Settings.getInstance().get("notifyupdates", true)) {
|
---|
| 217 | if (Settings.getInstance().isOfflineMode()) {
|
---|
| 218 | if (evtSource != this) {
|
---|
[657] | 219 | JOptionPane.showMessageDialog(
|
---|
| 220 | this,
|
---|
| 221 | SwingJavaBuilder.getConfig().getResource(
|
---|
| 222 | "offlineMode.text"),
|
---|
| 223 | SwingJavaBuilder.getConfig().getResource(
|
---|
| 224 | "offlineMode.title"),
|
---|
[621] | 225 | JOptionPane.WARNING_MESSAGE);
|
---|
| 226 | }
|
---|
| 227 | } else {
|
---|
[657] | 228 | TreeSet<Package> mods = PackageManager.getInstance()
|
---|
| 229 | .getUpdatableMods();
|
---|
[648] | 230 | TreeSet<Package> tools = PackageManager.getInstance()
|
---|
[621] | 231 | .getUpdatableTools();
|
---|
[632] | 232 | JPanel panPackages = new JPanel(new GridLayout(0, 1));
|
---|
[648] | 233 | execUpdates = new TreeSet<Package>();
|
---|
[632] | 234 | execUpdates.addAll(mods);
|
---|
| 235 | execUpdates.addAll(tools);
|
---|
[672] | 236 | final JLabel lblSize = new JLabel("<html>"
|
---|
| 237 | + String.format(
|
---|
| 238 | bundle.getString("updatesAvailableSize.text"),
|
---|
| 239 | SizeFormatter.format(0, 3)) + "</html>");
|
---|
| 240 | int size = 0;
|
---|
[648] | 241 | for (final Package m : mods) {
|
---|
[621] | 242 | size += m.getZipSize();
|
---|
[672] | 243 | JCheckBox check = new JCheckBox("Mod: " + m.getName()
|
---|
| 244 | + " (" + SizeFormatter.format(size, 1) + ")");
|
---|
[632] | 245 | check.setSelected(true);
|
---|
| 246 | check.addItemListener(new ItemListener() {
|
---|
| 247 | @Override
|
---|
| 248 | public void itemStateChanged(ItemEvent e) {
|
---|
| 249 | if (e.getStateChange() == ItemEvent.SELECTED)
|
---|
| 250 | execUpdates.add(m);
|
---|
| 251 | else
|
---|
| 252 | execUpdates.remove(m);
|
---|
[672] | 253 | int s = 0;
|
---|
| 254 | for (Package p : execUpdates)
|
---|
| 255 | s += p.getZipSize();
|
---|
| 256 | lblSize.setText("<html>"
|
---|
| 257 | + String.format(
|
---|
| 258 | bundle.getString("updatesAvailableSize.text"),
|
---|
| 259 | SizeFormatter.format(s, 3))
|
---|
| 260 | + "</html>");
|
---|
[632] | 261 | }
|
---|
| 262 | });
|
---|
| 263 | panPackages.add(check);
|
---|
[621] | 264 | }
|
---|
[648] | 265 | for (final Package m : tools) {
|
---|
[621] | 266 | size += m.getZipSize();
|
---|
[672] | 267 | JCheckBox check = new JCheckBox("Tool: " + m.getName()
|
---|
| 268 | + " (" + SizeFormatter.format(size, 1) + ")");
|
---|
[632] | 269 | check.setSelected(true);
|
---|
[672] | 270 | check.addItemListener(new ItemListener() {
|
---|
| 271 | @Override
|
---|
| 272 | public void itemStateChanged(ItemEvent e) {
|
---|
| 273 | if (e.getStateChange() == ItemEvent.SELECTED)
|
---|
| 274 | execUpdates.add(m);
|
---|
| 275 | else
|
---|
| 276 | execUpdates.remove(m);
|
---|
| 277 | int s = 0;
|
---|
| 278 | for (Package p : execUpdates)
|
---|
| 279 | s += p.getZipSize();
|
---|
| 280 | lblSize.setText("<html>"
|
---|
| 281 | + String.format(
|
---|
| 282 | bundle.getString("updatesAvailableSize.text"),
|
---|
| 283 | SizeFormatter.format(s, 3))
|
---|
| 284 | + "</html>");
|
---|
| 285 | }
|
---|
| 286 | });
|
---|
[632] | 287 | panPackages.add(check);
|
---|
[621] | 288 | }
|
---|
[672] | 289 | lblSize.setText("<html>"
|
---|
| 290 | + String.format(
|
---|
| 291 | bundle.getString("updatesAvailableSize.text"),
|
---|
| 292 | SizeFormatter.format(size, 3)) + "</html>");
|
---|
[622] | 293 | if (size > 0) {
|
---|
[627] | 294 | // Build info dialog content
|
---|
[632] | 295 | JPanel packages = new JPanel(new BorderLayout(0, 7));
|
---|
| 296 | JLabel lblIntro = new JLabel("<html>"
|
---|
| 297 | + bundle.getString("updatesAvailable.text")
|
---|
| 298 | + "</html>");
|
---|
| 299 | packages.add(lblIntro, BorderLayout.NORTH);
|
---|
| 300 | packages.add(panPackages, BorderLayout.CENTER);
|
---|
| 301 | packages.add(lblSize, BorderLayout.SOUTH);
|
---|
[627] | 302 |
|
---|
[632] | 303 | JPanel pan = new JPanel(new BorderLayout(0, 25));
|
---|
| 304 | pan.add(packages, BorderLayout.CENTER);
|
---|
[627] | 305 | JCheckBox checkFutureUpdates = new JCheckBox(
|
---|
| 306 | bundle.getString("checkOnStartup.text"));
|
---|
| 307 | checkFutureUpdates.setSelected(Settings.getInstance().get(
|
---|
| 308 | "notifyupdates", true));
|
---|
| 309 | checkFutureUpdates.addItemListener(new ItemListener() {
|
---|
| 310 | @Override
|
---|
| 311 | public void itemStateChanged(ItemEvent evt) {
|
---|
| 312 | Settings.getInstance().put("notifyupdates",
|
---|
| 313 | evt.getStateChange() == ItemEvent.SELECTED);
|
---|
| 314 | }
|
---|
| 315 | });
|
---|
| 316 | pan.add(checkFutureUpdates, BorderLayout.SOUTH);
|
---|
| 317 |
|
---|
| 318 | // Show dialog
|
---|
| 319 | int res = JOptionPane.showConfirmDialog(this, pan,
|
---|
[622] | 320 | bundle.getString("updatesAvailable.title"),
|
---|
| 321 | JOptionPane.YES_NO_OPTION,
|
---|
| 322 | JOptionPane.QUESTION_MESSAGE);
|
---|
[632] | 323 | if (res == JOptionPane.NO_OPTION) {
|
---|
| 324 | execUpdates = null;
|
---|
[622] | 325 | }
|
---|
[656] | 326 | } else {
|
---|
| 327 | if (evtSource != this) {
|
---|
| 328 | JOptionPane.showMessageDialog(this,
|
---|
| 329 | bundle.getString("updatesNotAvailable.text"),
|
---|
| 330 | bundle.getString("updatesNotAvailable.title"),
|
---|
| 331 | JOptionPane.INFORMATION_MESSAGE);
|
---|
| 332 | }
|
---|
[621] | 333 | }
|
---|
| 334 | }
|
---|
[591] | 335 | }
|
---|
| 336 | }
|
---|
| 337 |
|
---|
[624] | 338 | @SuppressWarnings("unused")
|
---|
| 339 | private void doUpdate() {
|
---|
[632] | 340 | if (execUpdates != null && execUpdates.size() > 0) {
|
---|
[646] | 341 | Downloader dl = new Downloader(execUpdates, null);
|
---|
[624] | 342 | try {
|
---|
| 343 | dl.setVisible(true);
|
---|
| 344 | if (dl.isFinished()) {
|
---|
| 345 | TreeSet<Integer> installed = Installer.getInstalledTools();
|
---|
[648] | 346 | TreeSet<Package> tools = new TreeSet<Package>();
|
---|
| 347 | for (Package m : execUpdates)
|
---|
[624] | 348 | if (m.isTool()
|
---|
| 349 | && installed.contains(m.getPackageNumber()))
|
---|
| 350 | tools.add(m);
|
---|
| 351 | if (tools.size() > 0) {
|
---|
| 352 | Installer.installTools(tools);
|
---|
| 353 | }
|
---|
| 354 | }
|
---|
| 355 | } finally {
|
---|
| 356 | dl.dispose();
|
---|
| 357 | }
|
---|
[591] | 358 | }
|
---|
[621] | 359 | execUpdates = null;
|
---|
[591] | 360 | }
|
---|
| 361 |
|
---|
| 362 | @SuppressWarnings("unused")
|
---|
| 363 | private void focus() {
|
---|
| 364 | SwingUtilities.invokeLater(new Runnable() {
|
---|
| 365 |
|
---|
| 366 | @Override
|
---|
| 367 | public void run() {
|
---|
| 368 | toFront();
|
---|
| 369 | repaint();
|
---|
| 370 | }
|
---|
| 371 | });
|
---|
| 372 |
|
---|
| 373 | }
|
---|
[646] | 374 |
|
---|
[645] | 375 | @SuppressWarnings("unused")
|
---|
[648] | 376 | private void showCorePackagesDialog() {
|
---|
| 377 | new CorePackagesDialog().setVisible(true);
|
---|
[645] | 378 | }
|
---|
[591] | 379 |
|
---|
| 380 | private void showSettings() {
|
---|
[593] | 381 | new SettingsDialog().setVisible(true);
|
---|
[591] | 382 | }
|
---|
| 383 |
|
---|
[593] | 384 | private void showAbout() {
|
---|
| 385 | new AboutDialog().setVisible(true);
|
---|
| 386 | }
|
---|
| 387 |
|
---|
[604] | 388 | private JFileChooser getConfigOpenSaveDialog(boolean save) {
|
---|
| 389 | JFileChooser fc = new JFileChooser();
|
---|
| 390 | fc.setCurrentDirectory(Paths.getEditionBasePath());
|
---|
| 391 | if (save)
|
---|
| 392 | fc.setDialogType(JFileChooser.SAVE_DIALOG);
|
---|
| 393 | else
|
---|
| 394 | fc.setDialogType(JFileChooser.OPEN_DIALOG);
|
---|
| 395 | fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
---|
| 396 | fc.setFileFilter(new FileFilter() {
|
---|
| 397 | @Override
|
---|
| 398 | public String getDescription() {
|
---|
| 399 | return "XML files";
|
---|
| 400 | }
|
---|
| 401 |
|
---|
| 402 | @Override
|
---|
| 403 | public boolean accept(File arg0) {
|
---|
| 404 | return (arg0.isDirectory())
|
---|
| 405 | || (arg0.getName().toLowerCase().endsWith(".xml"));
|
---|
| 406 | }
|
---|
| 407 | });
|
---|
| 408 | fc.setMultiSelectionEnabled(false);
|
---|
| 409 | return fc;
|
---|
| 410 | }
|
---|
| 411 |
|
---|
[593] | 412 | @SuppressWarnings("unused")
|
---|
| 413 | private void loadConfig() {
|
---|
[604] | 414 | JFileChooser fc = getConfigOpenSaveDialog(false);
|
---|
| 415 | int res = fc.showOpenDialog(this);
|
---|
| 416 | if (res == JFileChooser.APPROVE_OPTION) {
|
---|
| 417 | if (fc.getSelectedFile().exists())
|
---|
[631] | 418 | tblMods.reloadSelection(fc.getSelectedFile());
|
---|
[604] | 419 | }
|
---|
[593] | 420 | }
|
---|
| 421 |
|
---|
| 422 | @SuppressWarnings("unused")
|
---|
| 423 | private void saveConfig() {
|
---|
[604] | 424 | JFileChooser fc = getConfigOpenSaveDialog(true);
|
---|
| 425 | int res = fc.showSaveDialog(this);
|
---|
| 426 | if (res == JFileChooser.APPROVE_OPTION) {
|
---|
| 427 | File f = fc.getSelectedFile();
|
---|
| 428 | if (!f.getName().endsWith(".xml"))
|
---|
| 429 | f = new File(f.getParentFile(), f.getName() + ".xml");
|
---|
[648] | 430 | PackageManager.getInstance().saveModSelection(f,
|
---|
[631] | 431 | tblMods.getSelectedMods());
|
---|
[604] | 432 | }
|
---|
[593] | 433 | }
|
---|
| 434 |
|
---|
[661] | 435 | @SuppressWarnings("unused")
|
---|
| 436 | private boolean reglobalizeVerify() {
|
---|
| 437 | int res = JOptionPane.showConfirmDialog(this,
|
---|
| 438 | bundle.getString("rebuildCore.text"),
|
---|
| 439 | bundle.getString("rebuildCore.title"),
|
---|
| 440 | JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
|
---|
| 441 | return res == JOptionPane.YES_OPTION;
|
---|
| 442 | }
|
---|
| 443 |
|
---|
[600] | 444 | @DoInBackground(progressMessage = "initializingEdition.title", cancelable = false, indeterminateProgress = false)
|
---|
| 445 | private void reglobalize(final BackgroundEvent evt) {
|
---|
| 446 | Installer.initializeEdition(new InstallProgressListener() {
|
---|
| 447 | @Override
|
---|
| 448 | public void installProgressUpdate(int done, int total, String step) {
|
---|
| 449 | evt.setProgressEnd(total);
|
---|
| 450 | evt.setProgressValue(done);
|
---|
| 451 | evt.setProgressMessage(step);
|
---|
| 452 | }
|
---|
| 453 | });
|
---|
| 454 | }
|
---|
| 455 |
|
---|
[593] | 456 | @SuppressWarnings("unused")
|
---|
[600] | 457 | private void tools() {
|
---|
[625] | 458 | new ToolManager().setVisible(true);
|
---|
[593] | 459 | }
|
---|
[596] | 460 |
|
---|
[593] | 461 | @SuppressWarnings("unused")
|
---|
[623] | 462 | private void refreshToolsMenu() {
|
---|
| 463 | for (JMenuItem i : toolsMenuItems) {
|
---|
| 464 | toolsMenu.remove(i);
|
---|
| 465 | }
|
---|
| 466 | toolsMenuItems.clear();
|
---|
[672] | 467 | for (final Package m : PackageManager.getInstance().getInstalledTools()) {
|
---|
[640] | 468 | File exe = m.getExeFile();
|
---|
| 469 | if (exe != null && exe.exists()) {
|
---|
[623] | 470 | JMenuItem item = new JMenuItem();
|
---|
[671] | 471 | ImageIcon ico = null;
|
---|
[623] | 472 | if (m.getIconFile() != null && m.getIconFile().exists()) {
|
---|
| 473 | ico = new ImageIcon(m.getIconFile().getPath());
|
---|
| 474 | } else {
|
---|
[624] | 475 | URL icon = AEInstaller2.class
|
---|
| 476 | .getResource("images/transparent.png");
|
---|
[623] | 477 | ico = new ImageIcon(icon);
|
---|
| 478 | }
|
---|
[671] | 479 | ico = ImageResizer.resizeImage(ico, 32, 32);
|
---|
[623] | 480 | item.setAction(new AbstractAction(m.getName(), ico) {
|
---|
| 481 | private static final long serialVersionUID = 1L;
|
---|
| 482 |
|
---|
| 483 | @Override
|
---|
[672] | 484 | public void actionPerformed(ActionEvent evt) {
|
---|
| 485 | try {
|
---|
| 486 | ToolLauncher.launch(m);
|
---|
| 487 | } catch (Exception ex) {
|
---|
| 488 | if (ex.getMessage().contains("JRE"))
|
---|
| 489 | JOptionPane.showMessageDialog(null,
|
---|
| 490 | bundle.getString("jreNotFound.text"),
|
---|
| 491 | bundle.getString("jreNotFound.title"),
|
---|
| 492 | JOptionPane.ERROR_MESSAGE);
|
---|
| 493 | if (ex.getMessage().contains(".NET"))
|
---|
| 494 | JOptionPane.showMessageDialog(null,
|
---|
| 495 | bundle.getString("dotNetNotFound.text"),
|
---|
| 496 | bundle.getString("dotNetNotFound.title"),
|
---|
| 497 | JOptionPane.ERROR_MESSAGE);
|
---|
| 498 | }
|
---|
[623] | 499 | }
|
---|
| 500 | });
|
---|
| 501 | toolsMenuItems.add(item);
|
---|
| 502 | toolsMenu.add(item);
|
---|
| 503 | }
|
---|
| 504 | }
|
---|
| 505 | }
|
---|
| 506 |
|
---|
[593] | 507 | private void revertSelection() {
|
---|
[631] | 508 | tblMods.revertSelection();
|
---|
[593] | 509 | }
|
---|
[658] | 510 |
|
---|
[657] | 511 | @SuppressWarnings("unused")
|
---|
| 512 | private void unSelectAll() {
|
---|
| 513 | tblMods.unSelectAll();
|
---|
| 514 | }
|
---|
[593] | 515 |
|
---|
[648] | 516 | @DoInBackground(progressMessage = "checkCorePackages.title", cancelable = false, indeterminateProgress = false)
|
---|
| 517 | private void checkCorePackages(final BackgroundEvent evt) {
|
---|
[621] | 518 | if (!Settings.getInstance().isOfflineMode()) {
|
---|
[648] | 519 | for (Package m : PackageManager.getInstance().getCoreTools()) {
|
---|
[621] | 520 | if (m.isNewerAvailable()) {
|
---|
[648] | 521 | execCoreUpdates.add(m);
|
---|
[621] | 522 | }
|
---|
[604] | 523 | }
|
---|
[648] | 524 | for (Package m : PackageManager.getInstance().getCoreMods()) {
|
---|
[621] | 525 | if (m.isNewerAvailable()) {
|
---|
[648] | 526 | execCoreUpdates.add(m);
|
---|
[621] | 527 | }
|
---|
[604] | 528 | }
|
---|
[648] | 529 | if (execCoreUpdates.size() > 0) {
|
---|
| 530 | ModDownloader m = new ModDownloader(execCoreUpdates,
|
---|
[621] | 531 | new ModDownloaderListener() {
|
---|
| 532 | @Override
|
---|
| 533 | public void updateStatus(ModDownloader source,
|
---|
[648] | 534 | Package currentDownload, State state,
|
---|
[646] | 535 | int filesDown, int filesTotal,
|
---|
[621] | 536 | int bytesDown, int bytesTotal,
|
---|
| 537 | int duration, int remaining, int speed) {
|
---|
| 538 | evt.setProgressEnd(filesTotal);
|
---|
| 539 | evt.setProgressValue(filesDown);
|
---|
| 540 | }
|
---|
| 541 | });
|
---|
| 542 | while (!m.isFinished()) {
|
---|
| 543 | try {
|
---|
| 544 | Thread.sleep(10);
|
---|
| 545 | } catch (InterruptedException e) {
|
---|
| 546 | e.printStackTrace();
|
---|
| 547 | }
|
---|
[604] | 548 | }
|
---|
| 549 | }
|
---|
[657] | 550 | evt.setProgressMessage(bundle.getString("coreToolsInstall.title"));
|
---|
| 551 | Installer.installTools(PackageManager.getInstance().getCoreTools());
|
---|
[604] | 552 | }
|
---|
[602] | 553 | }
|
---|
| 554 |
|
---|
[641] | 555 | @SuppressWarnings("unused")
|
---|
[648] | 556 | private void infoCorePackages() {
|
---|
| 557 | if (execCoreUpdates.size() > 0) {
|
---|
[645] | 558 | String packages = "";
|
---|
[648] | 559 | for (Package m : execCoreUpdates) {
|
---|
[645] | 560 | packages += String.format("\n - %s (%s)", m.getName(),
|
---|
| 561 | m.getVersion());
|
---|
| 562 | }
|
---|
| 563 | JOptionPane.showMessageDialog(this, String.format(
|
---|
[648] | 564 | bundle.getString("corePackagesUpdated.text"), packages),
|
---|
| 565 | bundle.getString("corePackagesUpdated.title"),
|
---|
[645] | 566 | JOptionPane.INFORMATION_MESSAGE);
|
---|
| 567 | }
|
---|
| 568 | }
|
---|
| 569 |
|
---|
| 570 | @SuppressWarnings("unused")
|
---|
[641] | 571 | private void install() {
|
---|
[648] | 572 | TreeSet<Package> mods = new TreeSet<Package>();
|
---|
| 573 | mods.addAll(PackageManager.getInstance().getCoreMods());
|
---|
[631] | 574 | mods.addAll(tblMods.getSelectedMods());
|
---|
[600] | 575 |
|
---|
[648] | 576 | installDeps = new TreeSet<Package>();
|
---|
[646] | 577 |
|
---|
[641] | 578 | installState = EInstallState.CHECKING;
|
---|
[605] | 579 |
|
---|
[641] | 580 | while (installState == EInstallState.CHECKING) {
|
---|
[648] | 581 | TreeSet<Package> toDownload = new TreeSet<Package>();
|
---|
| 582 | for (Package m : mods) {
|
---|
[605] | 583 | if (!m.isLocalAvailable())
|
---|
| 584 | toDownload.add(m);
|
---|
| 585 | }
|
---|
[669] | 586 |
|
---|
[657] | 587 | if (toDownload.size() > 0 && Settings.getInstance().isOfflineMode()) {
|
---|
[641] | 588 | installState = EInstallState.OFFLINE;
|
---|
[621] | 589 | break;
|
---|
| 590 | }
|
---|
[669] | 591 |
|
---|
[605] | 592 | if (toDownload.size() > 0) {
|
---|
[646] | 593 | Downloader dl = new Downloader(toDownload, installDeps);
|
---|
[617] | 594 | try {
|
---|
| 595 | dl.setVisible(true);
|
---|
[641] | 596 | if (!dl.isFinished()) {
|
---|
| 597 | installState = EInstallState.ABORTED;
|
---|
[617] | 598 | break;
|
---|
[641] | 599 | }
|
---|
[617] | 600 | } finally {
|
---|
| 601 | dl.dispose();
|
---|
| 602 | }
|
---|
[605] | 603 | }
|
---|
[669] | 604 |
|
---|
[657] | 605 | HashMap<Package, HashSet<Package>> dependencies = PackageManager
|
---|
| 606 | .getInstance().checkDependencies(mods);
|
---|
[605] | 607 | if (dependencies.size() > 0) {
|
---|
[648] | 608 | for (HashSet<Package> hm : dependencies.values()) {
|
---|
[646] | 609 | installDeps.addAll(hm);
|
---|
| 610 | }
|
---|
[647] | 611 |
|
---|
[669] | 612 | int size = 0;
|
---|
| 613 | String depsLocalString = "";
|
---|
| 614 | String depsDownloadString = "";
|
---|
| 615 | for (Package m : dependencies.keySet()) {
|
---|
| 616 | for (Package mDep : dependencies.get(m)) {
|
---|
| 617 | if (!mods.contains(mDep)) {
|
---|
| 618 | mods.add(mDep);
|
---|
| 619 | if (!mDep.isLocalAvailable()) {
|
---|
| 620 | size += mDep.getZipSize();
|
---|
| 621 | if (depsDownloadString.length() > 0)
|
---|
| 622 | depsDownloadString += "\n";
|
---|
| 623 | depsDownloadString += " - " + mDep.getName();
|
---|
| 624 | } else {
|
---|
| 625 | if (depsLocalString.length() > 0)
|
---|
| 626 | depsLocalString += "\n";
|
---|
| 627 | depsLocalString += " - " + mDep.getName();
|
---|
[641] | 628 | }
|
---|
| 629 | }
|
---|
| 630 | }
|
---|
[669] | 631 | }
|
---|
[641] | 632 |
|
---|
[669] | 633 | if (depsLocalString.length() == 0)
|
---|
| 634 | depsLocalString = bundle
|
---|
| 635 | .getString("installDependencies.none");
|
---|
| 636 | if (depsDownloadString.length() == 0)
|
---|
| 637 | depsDownloadString = bundle
|
---|
| 638 | .getString("installDependencies.none");
|
---|
| 639 |
|
---|
| 640 | if (!Settings.getInstance()
|
---|
| 641 | .get("notifyDepsAfterInstall", false)) {
|
---|
[646] | 642 | int res = JOptionPane.showConfirmDialog(this, String
|
---|
| 643 | .format(bundle
|
---|
| 644 | .getString("installDependencies.text"),
|
---|
| 645 | depsLocalString, depsDownloadString,
|
---|
| 646 | SizeFormatter.format(size, 3)), bundle
|
---|
| 647 | .getString("installDependencies.title"),
|
---|
| 648 | JOptionPane.YES_NO_OPTION,
|
---|
| 649 | JOptionPane.INFORMATION_MESSAGE);
|
---|
[669] | 650 |
|
---|
[646] | 651 | if (res == JOptionPane.NO_OPTION) {
|
---|
| 652 | installState = EInstallState.ABORTED;
|
---|
| 653 | break;
|
---|
| 654 | }
|
---|
[641] | 655 | }
|
---|
[605] | 656 | } else {
|
---|
[648] | 657 | HashMap<Package, HashSet<Package>> incompatibilities = PackageManager
|
---|
[645] | 658 | .getInstance().checkIncompabitilites(mods);
|
---|
[643] | 659 | if (incompatibilities.size() > 0) {
|
---|
[641] | 660 | installState = EInstallState.INCOMPATIBLE;
|
---|
[643] | 661 |
|
---|
| 662 | String incompatString = "";
|
---|
[648] | 663 | for (Package m : incompatibilities.keySet()) {
|
---|
[643] | 664 | if (incompatString.length() > 0)
|
---|
| 665 | incompatString += "\n";
|
---|
| 666 | incompatString += m.getName() + ": ";
|
---|
| 667 | String confMods = "";
|
---|
[648] | 668 | for (Package mConf : incompatibilities.get(m)) {
|
---|
[643] | 669 | if (confMods.length() > 0)
|
---|
| 670 | confMods += ", ";
|
---|
| 671 | confMods += mConf.getName();
|
---|
| 672 | }
|
---|
| 673 | incompatString += confMods;
|
---|
| 674 | }
|
---|
| 675 |
|
---|
| 676 | JOptionPane.showMessageDialog(this, String.format(
|
---|
| 677 | bundle.getString("installIncompatibilities.text"),
|
---|
| 678 | incompatString), bundle
|
---|
| 679 | .getString("installIncompatibilities.title"),
|
---|
| 680 | JOptionPane.ERROR_MESSAGE);
|
---|
[605] | 681 | break;
|
---|
| 682 | } else {
|
---|
[641] | 683 | installState = EInstallState.READY;
|
---|
[605] | 684 | }
|
---|
| 685 | }
|
---|
[600] | 686 | }
|
---|
[618] | 687 |
|
---|
[641] | 688 | if (installState == EInstallState.READY) {
|
---|
[648] | 689 | installMods = new TreeSet<Package>();
|
---|
| 690 | TreeSet<Package> actuallyTools = new TreeSet<Package>();
|
---|
[623] | 691 |
|
---|
[648] | 692 | for (Package m : mods) {
|
---|
[623] | 693 | if (m.isTool())
|
---|
| 694 | actuallyTools.add(m);
|
---|
| 695 | else
|
---|
[641] | 696 | installMods.add(m);
|
---|
[623] | 697 | }
|
---|
| 698 |
|
---|
| 699 | if (actuallyTools.size() > 0) {
|
---|
| 700 | Installer.installTools(actuallyTools);
|
---|
| 701 | }
|
---|
[641] | 702 | }
|
---|
| 703 | }
|
---|
| 704 |
|
---|
| 705 | @DoInBackground(progressMessage = "installing.title", cancelable = false, indeterminateProgress = false)
|
---|
| 706 | private void installExec(final BackgroundEvent evt) {
|
---|
| 707 | if (installState == EInstallState.READY) {
|
---|
| 708 | Installer.install(installMods, new InstallProgressListener() {
|
---|
[605] | 709 | @Override
|
---|
| 710 | public void installProgressUpdate(int done, int total,
|
---|
| 711 | String step) {
|
---|
| 712 | evt.setProgressEnd(total);
|
---|
| 713 | evt.setProgressValue(done);
|
---|
| 714 | evt.setProgressMessage(step);
|
---|
| 715 | }
|
---|
| 716 | });
|
---|
[641] | 717 | installState = EInstallState.DONE;
|
---|
[605] | 718 | }
|
---|
[641] | 719 | installMods = null;
|
---|
[600] | 720 | }
|
---|
[618] | 721 |
|
---|
[617] | 722 | @SuppressWarnings("unused")
|
---|
| 723 | private void installDone() {
|
---|
[648] | 724 | PackageManager.getInstance().updateInstalledMods();
|
---|
[641] | 725 | switch (installState) {
|
---|
[621] | 726 | case DONE:
|
---|
[641] | 727 | revertSelection();
|
---|
[646] | 728 | if (installDeps.size() > 0
|
---|
| 729 | && Settings.getInstance().get("notifyDepsAfterInstall",
|
---|
| 730 | false)) {
|
---|
| 731 | String installedDeps = "";
|
---|
[648] | 732 | for (Package m : installDeps) {
|
---|
[646] | 733 | if (installedDeps.length() > 0)
|
---|
| 734 | installedDeps += "\n";
|
---|
| 735 | installedDeps += " - " + m.getName();
|
---|
| 736 | }
|
---|
| 737 | JOptionPane.showMessageDialog(this, String.format(
|
---|
| 738 | bundle.getString("installDoneDeps.text"),
|
---|
| 739 | installedDeps), bundle
|
---|
| 740 | .getString("installDone.title"),
|
---|
| 741 | JOptionPane.INFORMATION_MESSAGE);
|
---|
| 742 | } else {
|
---|
| 743 | JOptionPane.showMessageDialog(this,
|
---|
| 744 | bundle.getString("installDone.text"),
|
---|
| 745 | bundle.getString("installDone.title"),
|
---|
| 746 | JOptionPane.INFORMATION_MESSAGE);
|
---|
| 747 | }
|
---|
[621] | 748 | break;
|
---|
| 749 | case OFFLINE:
|
---|
[657] | 750 | JOptionPane.showMessageDialog(
|
---|
| 751 | this,
|
---|
| 752 | SwingJavaBuilder.getConfig().getResource(
|
---|
| 753 | "offlineMode.text"),
|
---|
| 754 | SwingJavaBuilder.getConfig().getResource(
|
---|
| 755 | "offlineMode.title"),
|
---|
[621] | 756 | JOptionPane.WARNING_MESSAGE);
|
---|
| 757 | break;
|
---|
[641] | 758 | default:
|
---|
[621] | 759 | break;
|
---|
| 760 | }
|
---|
[646] | 761 | installDeps = null;
|
---|
[617] | 762 | }
|
---|
[600] | 763 |
|
---|
[631] | 764 | @Override
|
---|
[648] | 765 | public void modSelectionChanged(ModTable source, Package m) {
|
---|
[658] | 766 | pkgInfo.updateInfo(m);
|
---|
[591] | 767 | }
|
---|
| 768 |
|
---|
[630] | 769 | private void updateTableFilter() {
|
---|
| 770 | Object o = cmbModTypes.getSelectedItem();
|
---|
| 771 | Type t = null;
|
---|
| 772 | if (o instanceof Type)
|
---|
| 773 | t = (Type) o;
|
---|
| 774 | int downloadState = 0;
|
---|
| 775 | if (radOnline.isSelected())
|
---|
| 776 | downloadState = 1;
|
---|
| 777 | if (radLocal.isSelected())
|
---|
| 778 | downloadState = 2;
|
---|
[660] | 779 | tblMods.setFilter(t, downloadState, txtShowFilter.getText(),
|
---|
| 780 | (EApplyFilterTo) cmbShowFilterTo.getSelectedItem());
|
---|
[630] | 781 | }
|
---|
| 782 |
|
---|
[593] | 783 | @Override
|
---|
[600] | 784 | public void downloadSizeChanged(int newSize) {
|
---|
| 785 | lblDownloadSizeVal.setText(SizeFormatter.format(newSize, 2));
|
---|
| 786 | }
|
---|
| 787 |
|
---|
[616] | 788 | @SuppressWarnings("unused")
|
---|
| 789 | private void checkInitialize() {
|
---|
[600] | 790 | if (!Installer.isEditionInitialized()) {
|
---|
[621] | 791 | if (!OniSplit.isOniSplitInstalled()) {
|
---|
| 792 | JOptionPane.showMessageDialog(this,
|
---|
| 793 | bundle.getString("noOniSplit.text"),
|
---|
| 794 | bundle.getString("noOniSplit.title"),
|
---|
| 795 | JOptionPane.ERROR_MESSAGE);
|
---|
[600] | 796 | exit();
|
---|
[621] | 797 | } else {
|
---|
| 798 | int res = JOptionPane
|
---|
| 799 | .showConfirmDialog(this,
|
---|
| 800 | bundle.getString("askInitialize.text"),
|
---|
| 801 | bundle.getString("askInitialize.title"),
|
---|
| 802 | JOptionPane.YES_NO_OPTION,
|
---|
| 803 | JOptionPane.QUESTION_MESSAGE);
|
---|
| 804 | if (res == JOptionPane.NO_OPTION) {
|
---|
| 805 | saveLocalData();
|
---|
| 806 | exit();
|
---|
| 807 | }
|
---|
[600] | 808 | }
|
---|
| 809 | }
|
---|
| 810 | }
|
---|
[606] | 811 |
|
---|
[616] | 812 | @DoInBackground(progressMessage = "initializingEdition.title", cancelable = false, indeterminateProgress = false)
|
---|
| 813 | private void initialize(final BackgroundEvent evt) {
|
---|
| 814 | if (!Installer.isEditionInitialized()) {
|
---|
| 815 | Installer.initializeEdition(new InstallProgressListener() {
|
---|
| 816 | @Override
|
---|
| 817 | public void installProgressUpdate(int done, int total,
|
---|
| 818 | String step) {
|
---|
| 819 | evt.setProgressEnd(total);
|
---|
| 820 | evt.setProgressValue(done);
|
---|
| 821 | evt.setProgressMessage(step);
|
---|
| 822 | }
|
---|
| 823 | });
|
---|
| 824 | }
|
---|
| 825 | }
|
---|
| 826 |
|
---|
[605] | 827 | private Vector<String> getBasicOniLaunchParams() {
|
---|
| 828 | Vector<String> params = new Vector<String>();
|
---|
[618] | 829 | File exe = null;
|
---|
[605] | 830 | switch (Settings.getPlatform()) {
|
---|
| 831 | case WIN:
|
---|
[618] | 832 | exe = new File(Paths.getEditionBasePath(), "Oni.exe");
|
---|
| 833 | if (exe.exists())
|
---|
| 834 | params.add(exe.getPath());
|
---|
[605] | 835 | break;
|
---|
| 836 | case MACOS:
|
---|
[618] | 837 | exe = new File(Paths.getEditionBasePath(),
|
---|
| 838 | "Oni.app/Contents/MacOS/Oni");
|
---|
| 839 | if (exe.exists())
|
---|
| 840 | params.add(exe.getPath());
|
---|
[605] | 841 | break;
|
---|
| 842 | case LINUX:
|
---|
| 843 | String wine = Settings.getWinePath();
|
---|
[618] | 844 | exe = new File(Paths.getEditionBasePath(), "Oni.exe");
|
---|
| 845 | if (exe.exists()) {
|
---|
| 846 | if (wine != null) {
|
---|
| 847 | params.add(wine);
|
---|
| 848 | params.add(exe.getPath());
|
---|
| 849 | }
|
---|
[605] | 850 | }
|
---|
| 851 | break;
|
---|
| 852 | default:
|
---|
| 853 | }
|
---|
| 854 | if (params.size() > 0) {
|
---|
| 855 | params.add("-debugfiles");
|
---|
| 856 | }
|
---|
| 857 | return params;
|
---|
| 858 | }
|
---|
[600] | 859 |
|
---|
[605] | 860 | @SuppressWarnings("unused")
|
---|
| 861 | private void oniFull() {
|
---|
| 862 | Vector<String> params = getBasicOniLaunchParams();
|
---|
| 863 | if (params.size() > 0) {
|
---|
[623] | 864 | AppExecution.execute(params, Paths.getEditionBasePath());
|
---|
[605] | 865 | }
|
---|
| 866 | }
|
---|
| 867 |
|
---|
| 868 | @SuppressWarnings("unused")
|
---|
| 869 | private void oniWin() {
|
---|
| 870 | Vector<String> params = getBasicOniLaunchParams();
|
---|
| 871 | if (params.size() > 0) {
|
---|
| 872 | params.add("-noswitch");
|
---|
[623] | 873 | AppExecution.execute(params, Paths.getEditionBasePath());
|
---|
[605] | 874 | }
|
---|
| 875 | }
|
---|
| 876 |
|
---|
[608] | 877 | @SuppressWarnings("unused")
|
---|
| 878 | private void openEditionFolder() {
|
---|
| 879 | try {
|
---|
| 880 | Desktop.getDesktop().open(Paths.getEditionBasePath());
|
---|
[639] | 881 | } catch (Exception e) {
|
---|
[608] | 882 | e.printStackTrace();
|
---|
| 883 | }
|
---|
| 884 | }
|
---|
| 885 |
|
---|
[600] | 886 | @Override
|
---|
[593] | 887 | public void handleAbout(ApplicationEvent event) {
|
---|
| 888 | event.setHandled(true);
|
---|
| 889 | showAbout();
|
---|
| 890 | }
|
---|
| 891 |
|
---|
| 892 | @Override
|
---|
| 893 | public void handleOpenApplication(ApplicationEvent event) {
|
---|
| 894 | }
|
---|
| 895 |
|
---|
| 896 | @Override
|
---|
| 897 | public void handleOpenFile(ApplicationEvent event) {
|
---|
| 898 | }
|
---|
| 899 |
|
---|
| 900 | @Override
|
---|
| 901 | public void handlePreferences(ApplicationEvent event) {
|
---|
| 902 | showSettings();
|
---|
| 903 | }
|
---|
| 904 |
|
---|
| 905 | @Override
|
---|
| 906 | public void handlePrintFile(ApplicationEvent event) {
|
---|
| 907 | }
|
---|
| 908 |
|
---|
| 909 | @Override
|
---|
| 910 | public void handleQuit(ApplicationEvent event) {
|
---|
[605] | 911 | event.setHandled(true);
|
---|
| 912 | saveLocalData();
|
---|
| 913 | exit();
|
---|
[593] | 914 | }
|
---|
| 915 |
|
---|
| 916 | @Override
|
---|
| 917 | public void handleReOpenApplication(ApplicationEvent event) {
|
---|
| 918 | }
|
---|
[600] | 919 |
|
---|
[592] | 920 | }
|
---|