Use last BasicFrame as parent in macOS OpenFileHandler
This ensures the newly opened file replaces a (replaceable) already opened design file
This commit is contained in:
parent
9e73f6e4e2
commit
6bfaaf907b
@ -139,6 +139,8 @@ public class BasicFrame extends JFrame {
|
||||
|
||||
private SimulationPanel simulationPanel;
|
||||
|
||||
public static BasicFrame lastFrameInstance = null; // Latest BasicFrame that was created
|
||||
|
||||
|
||||
/**
|
||||
* Sole constructor. Creates a new frame based on the supplied document
|
||||
@ -152,6 +154,7 @@ public class BasicFrame extends JFrame {
|
||||
this.document = document;
|
||||
this.rocket = document.getRocket();
|
||||
this.rocket.getSelectedConfiguration().setAllStages();
|
||||
BasicFrame.lastFrameInstance = this;
|
||||
|
||||
// Create the component tree selection model that will be used
|
||||
componentSelectionModel = new DefaultTreeSelectionModel();
|
||||
|
@ -38,7 +38,7 @@ final class OSXSetup {
|
||||
*/
|
||||
public static final OpenFilesHandler OPEN_FILE_HANDLER = (e) -> {
|
||||
log.info("Opening file from association: " + e.getFiles().get(0));
|
||||
BasicFrame.open(e.getFiles().get(0), null);
|
||||
BasicFrame.open(e.getFiles().get(0), BasicFrame.lastFrameInstance);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -85,8 +85,6 @@ public class SwingStartup {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Set up the OSX file open handler here so that it can handle files that are opened when OR is not yet running.
|
||||
OSXSetup.setupOSXOpenFileHandler();
|
||||
runner.runInEDT(args);
|
||||
}
|
||||
});
|
||||
@ -217,6 +215,9 @@ public class SwingStartup {
|
||||
|
||||
Databases.fakeMethod();
|
||||
|
||||
// Set up the OSX file open handler here so that it can handle files that are opened when OR is not yet running.
|
||||
OSXSetup.setupOSXOpenFileHandler();
|
||||
|
||||
// Starting action (load files or open new document)
|
||||
log.info("Opening main application window");
|
||||
if (!handleCommandLine(args)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user