private void loadWorkspace() {
    if (!workspace.isLoaded()) {
      final String defaultWorkspace =
          BinDiffConfig.getInstance().getMainSettings().getDefaultWorkspace();

      boolean noOption = false;
      if (new File(defaultWorkspace).exists()) {
        final int answer =
            MessageBox.showYesNoCancelQuestion(
                getParent(),
                "A workspace has to be loaded to save a function diff view. Load the default "
                    + "workspace?");

        if (answer == JOptionPane.YES_OPTION) {
          final File workspaceFile = new File(defaultWorkspace);

          final WorkspaceLoader loader = new WorkspaceLoader(workspaceFile, workspace);
          try {
            ProgressDialog.show(
                (Window) getParent(),
                String.format("Loading Workspace '%s'", workspaceFile.getName()),
                loader);
          } catch (final Exception e) {
            logger.atSevere().withCause(e).log(
                "Load default workspace failed: '%s'", workspaceFile.getPath());
            MessageBox.showError(
                getParent(),
                String.format(
                    "Failed to load the current default workspace.\n'%s'",
                    workspaceFile.getPath()));
          }
        } else if (answer == JOptionPane.NO_OPTION) {
          noOption = true;
        }
      }

      if (noOption || !new File(defaultWorkspace).exists()) {
        if (!new File(defaultWorkspace).exists()) {
          final int answer =
              MessageBox.showYesNoQuestion(
                  window,
                  "A workspace has to be loaded to save a function diff view. Load workspace?");
          if (answer == JOptionPane.NO_OPTION) {
            return;
          }
        }

        try {
          final TabPanelManager tabPanelManager = window.getController().getTabPanelManager();
          final WorkspaceTabPanel workspaceTabPanel = tabPanelManager.getWorkspaceTabPanel();
          workspaceTabPanel.getController().loadWorkspace();
        } catch (final Exception e) {
          logger.atSevere().withCause(e).log("Load workspace failed");
          MessageBox.showError(window, "Load workspace failed.");
        }
      }
    }
  }
Save dialog for function diff views.
java/ui/src/main/java/com/google/security/zynamics/bindiff/gui/dialogs/SaveFunctionDiffViewDialog.java