From 562e17935a52ec8ebb1dd3f2d2e92604a051ea1c Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Sat, 11 Jun 2022 17:53:16 -0600 Subject: [PATCH 1/3] Revised installer configuration to enable desktop icon and file associations. The major change is it turns out you need to do the file installation before trying to create the integrations. --- install4j/22.xx/openrocket-22.xx.install4j | 112 +++++++-------------- 1 file changed, 37 insertions(+), 75 deletions(-) diff --git a/install4j/22.xx/openrocket-22.xx.install4j b/install4j/22.xx/openrocket-22.xx.install4j index 3a15e2134..d19b835af 100644 --- a/install4j/22.xx/openrocket-22.xx.install4j +++ b/install4j/22.xx/openrocket-22.xx.install4j @@ -1,6 +1,6 @@ - + @@ -175,16 +175,6 @@ return console.askOkCancel(message, true); !context.getBooleanVariable("sys.confirmedUpdateInstallation") - - - - - sys.installationDir - - - context.getVariable("sys.responseFile") == null - - @@ -211,30 +201,40 @@ return console.askOkCancel(message, true); - + - + - ${i18n:SelectComponentsLabel2} + ${i18n:SelectAssociationsLabel} - !context.isConsole() - + - selectionChangedScript + showSelectionButtons + selectionButtonPosition - + + + + + + + ${form:confirmationMessage} + + !context.isConsole() + + ${i18n:CreateDesktopIcon} createDesktopLinkAction - + ${i18n:AddToDock} @@ -244,21 +244,17 @@ return console.askOkCancel(message, true); - + - + + - - - OpenRocket - - + ${i18n:UninstallerMenuEntry(${compiler:sys.fullName})} - context.getBooleanVariable("addToDockAction") + !context.getBooleanVariable("sys.programGroupDisabled") - + - Education;Science OpenRocket @@ -278,7 +274,17 @@ return console.askOkCancel(message, true); !context.getBooleanVariable("sys.programGroupDisabled") - + + + + + OpenRocket + + + + context.getBooleanVariable("addToDockAction") + + OpenRocket Model Rocket Simulator @@ -286,7 +292,6 @@ return console.askOkCancel(message, true); OpenRocket - ${compiler:sys.fullName} @@ -301,7 +306,7 @@ return console.askOkCancel(message, true); context.getBooleanVariable("createDesktopLinkAction") - + OpenRocket Design ork @@ -326,49 +331,6 @@ return console.askOkCancel(message, true); - - - - - ${i18n:SelectAssociationsLabel} - - - - - - - - - selectionButtonPosition - showSelectionButtons - - - - - ${i18n:CreateDesktopIcon} - - createDesktopLinkAction - - - - - ${i18n:AddToDock} - - addToDockAction - - Util.isMacOS() - - - - - - - - - ${i18n:UninstallerMenuEntry(${compiler:sys.fullName})} - - !context.getBooleanVariable("sys.programGroupDisabled") - ${compiler:sys.fullName} ${compiler:sys.version} From 79f2fad994c4c6e567a0ba34c6342b832732229c Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Tue, 14 Jun 2022 10:07:26 -0600 Subject: [PATCH 2/3] Add file association handler for MacOS --- swing/src/net/sf/openrocket/startup/OSXSetup.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/swing/src/net/sf/openrocket/startup/OSXSetup.java b/swing/src/net/sf/openrocket/startup/OSXSetup.java index 614d50c8a..24a158e16 100644 --- a/swing/src/net/sf/openrocket/startup/OSXSetup.java +++ b/swing/src/net/sf/openrocket/startup/OSXSetup.java @@ -2,6 +2,8 @@ package net.sf.openrocket.startup; import java.awt.*; import java.awt.desktop.AboutHandler; +import java.awt.desktop.OpenFilesEvent; +import java.awt.desktop.OpenFilesHandler; import java.awt.desktop.PreferencesHandler; import java.awt.desktop.QuitHandler; @@ -13,6 +15,7 @@ import net.sf.openrocket.arch.SystemInfo.Platform; import net.sf.openrocket.gui.dialogs.AboutDialog; import net.sf.openrocket.gui.dialogs.preferences.PreferencesDialog; import net.sf.openrocket.gui.main.BasicFrame; +import net.sf.openrocket.gui.main.MRUDesignFile; import javax.swing.*; @@ -31,6 +34,15 @@ final class OSXSetup { // The image resource to use for the Dock Icon private static final String ICON_RSRC = "/pix/icon/icon-256.png"; + + /** + * The handler for file associations + */ + public static final OpenFilesHandler OPEN_FILE_HANDLER = (e) -> { + System.out.println("Received open files event "+e.toString()); + MRUDesignFile opts = MRUDesignFile.getInstance(); + opts.addFile(e.getFiles().get(0).getAbsolutePath()); + }; /** * The handler for the Quit item in the OSX app menu @@ -81,6 +93,7 @@ final class OSXSetup { // Set handlers osxDesktop.setAboutHandler(ABOUT_HANDLER); + osxDesktop.setOpenFileHandler(OPEN_FILE_HANDLER); osxDesktop.setPreferencesHandler(PREFERENCES_HANDLER); osxDesktop.setQuitHandler(QUIT_HANDLER); From 8604377748938c063fe656d78e03cb0fc97e749f Mon Sep 17 00:00:00 2001 From: SiboVG Date: Tue, 14 Jun 2022 20:14:51 +0200 Subject: [PATCH 3/3] Fix file association for macOS --- swing/src/net/sf/openrocket/startup/OSXSetup.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/swing/src/net/sf/openrocket/startup/OSXSetup.java b/swing/src/net/sf/openrocket/startup/OSXSetup.java index 24a158e16..8e4a0a038 100644 --- a/swing/src/net/sf/openrocket/startup/OSXSetup.java +++ b/swing/src/net/sf/openrocket/startup/OSXSetup.java @@ -39,9 +39,8 @@ final class OSXSetup { * The handler for file associations */ public static final OpenFilesHandler OPEN_FILE_HANDLER = (e) -> { - System.out.println("Received open files event "+e.toString()); - MRUDesignFile opts = MRUDesignFile.getInstance(); - opts.addFile(e.getFiles().get(0).getAbsolutePath()); + log.info("Opening file from association: " + e.getFiles().get(0)); + BasicFrame.open(e.getFiles().get(0), null); }; /**