Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot open multiple instances of Scene Builder (e.g. to compare SB11 vs. SB15 or SB16) #346

Open
Oliver-Loeffler opened this issue Apr 1, 2021 · 7 comments · May be fixed by #579
Open
Labels
bug Something isn't working

Comments

@Oliver-Loeffler
Copy link
Collaborator

Oliver-Loeffler commented Apr 1, 2021

Starting multiple instances of SceneBuilder does not work.

Expected Behavior

  • running SceneBuilder.exe (from link or from CLI) shall open a new Scene Builder window
  • repeated execution of SceneBuilder.exe should open a new window backed by an independen new instance
  • Logfile shoud indicate issue
  • As JavaFX shows warnings when using different FXML versions, for some scenarios it can be useful to run multiple instances of SceneBuilder.
  • If it is intentional to only have one instance, question: Would it be possible to allow multiple instances for different Scene Builder versions?

Current Behavior

  • Opening multiple windows by creating a new view from template or opening a FXML file works.
  • Starting a single instance using SceneBuilder.exe works.
  • Starting a second instance of SceneBuilder (regardless if same version or different version) does not work
  • Logfile is empty

Steps to Reproduce

  • Open new instance of Scene Builder 16
  • Attempt to open second instance of Scene Builder 16/15/11
  • Attempt to run SceneBuilder using Maven or from within Eclipse
  • In all attempts, I was not able to obtain any useful information from Scene Builder logfile.

Running tests entirely from IDE helped me as follows:

  • Start first Scene Builder instance from within Eclipse using a Run Configuration.
  • Attempt to start second instance ... will fail with a stack trace:
Apr. 01, 2021 6:18:37 NACHM. com.oracle.javafx.scenebuilder.app.SceneBuilderApp$SceneBuilderUncaughtExceptionHandler uncaughtException
SEVERE: An exception was thrown:
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
	at java.base/java.util.Objects.checkIndex(Objects.java:372)
	at java.base/java.util.ArrayList.get(ArrayList.java:458)
	at com.oracle.javafx.scenebuilder.app.SceneBuilderApp.handleOpenFilesAction(SceneBuilderApp.java:506)
	at com.oracle.javafx.scenebuilder.app.AppPlatform$MessageBoxDelegate.lambda$0(AppPlatform.java:186)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:447)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:446)
	at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
	at java.base/java.lang.Thread.run(Thread.java:834)

Environment

  • Windows 10 Pro
  • Version 20H2
  • Build 19042.867
  • Windows Feature Experience Pack 120.2212.551.0

Screenshots

SceneBuilder2ndInstanceStackTraceAtLaunch

@Oliver-Loeffler Oliver-Loeffler added the bug Something isn't working label Apr 1, 2021
@moacirrf
Copy link

I had a look at code and apparently is intentional.
Maybe a confirmation dialog may appear when try to open a new instance, what you think?

@moacirrf
Copy link

moacirrf commented May 1, 2021

With a change on this method is possible to run two instances of scene builder if are different versions.
Appending the current version of scene builder, it will create a folder like that.
/home/my_user/.scenebuilder/16.0.0-SNAPSHOT/MB/

`public class AppPlatform {

private static String applicationDataFolder;
private static String userLibraryFolder;
private static String messageBoxFolder;
private static MessageBox<MessageBoxMessage> messageBox;

public static synchronized String getApplicationDataFolder() {

    if (applicationDataFolder == null) {
        final String version = getSceneBuilderVersion();
        final String appName = "Scene Builder"; //NOI18N
        
        if (IS_WINDOWS) {
            applicationDataFolder 
                    = System.getenv("APPDATA") + "\\" + appName+"\\"+version; //NOI18N
        } else if (IS_MAC) {
            applicationDataFolder 
                    = System.getProperty("user.home") //NOI18N
                    + "/Library/Application Support/" //NOI18N
                    + appName+"/"+version;
        } else if (IS_LINUX) {
            applicationDataFolder
                    = System.getProperty("user.home") + "/.scenebuilder/"+version; //NOI18N
        }
    }
    
    assert applicationDataFolder != null;
    return applicationDataFolder;
}

...`

This is an easy approach, at least for linux, what you think?

@Oliver-Loeffler
Copy link
Collaborator Author

Souns like a very good idea. Asking the user is alwas good. @abhinayagarwal , what do you think? Would this fit with the way Scene Builder is supposed to be used?

@abhinayagarwal
Copy link
Collaborator

abhinayagarwal commented Jul 27, 2021

In my experience, Scene Builder stores its data in various locations, including and not limited to the ApplicationDataFolder. There are a few instances where Scene Builder depends on Java preferences (#369)

If we want to pursue this further, we need to make sure that all the data for the 2 instances is stored separately to avoid any unnecessary complications.

@moacirrf
Copy link

In my experience, Scene Builder stores its data in various locations, including and not limited to the ApplicationDataFolder. There are a few instances where Scene Builder depends on Java preferences (#369)

If we want to pursue this further, we need to make sure that all the data for the 2 instances is stored separately to avoid any unnecessary complications.

Yes you are right, i believe that is more easy deal with different folders for different versions than change the code that avoid open new instances.

Maybe this cannot be deal like a bug but a new feature to be discussed.
thanks

@Oliver-Loeffler
Copy link
Collaborator Author

A similar topic raised with issue #369. Therefore I would opt-in with having separate settings and storages for individual installations of SceneBuilder. This also implies, that it should be first of all possible to have multiple versions installed. This is not possible yet but a requirement for #346 und #369.

@Oliver-Loeffler
Copy link
Collaborator Author

Related to #579.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants