/* Copyright (c) Oracle Corporation 1994.  All Rights Reserved */

/*****************************************************************************
  NAME
    fjava60.dei - V3 deinstall script for Windows Java Class Web Support Files 1.0

  DESCRIPTION
    This script deinstalls Win32 Java Class Web Support Files 1.0


  MODIFIED    DD-MM-YY  Reason
     pyuen    06/23/97  Created.
*****************************************************************************/

{
  /************************************************
  Set necessary variables for deinstallation
  *************************************************/
  EXECUTE_SCRIPT = "SET_DEINSTALL_VARIABLES";
  execute("%installer_home%\d2kr2dei.usr");
  /************************************************/

  deinstall_prompt01 = nls("deinstall_prompt01", "Other products are dependent on %%registry_label%% (or one of its components). Removing it may cause other products to work improperly. Are you sure you want to deinstall it?");
  deinstall_help01   = nls("deinstall_help01", "Other products are dependent on %%registry_label%% (or one of its components). Removing it will remove all its underlying components also, which may cause other products to work improperly. It is therefore recommended that you do not remove %%registry_label%%. Choose 'No' to leave %%registry_label%% intact. Choose 'Yes' if you are sure you want to remove it.");

  {doit = execute("%installer_home%%dir_separator%%operating_system%.dei");}
  [
        'UNBOUND_VARIABLE: signal('failure,instantiate(nls("instver_too_early2",
        "The version of the Installer currently running is %%installer_version%%. The product(s) you have chosen to deinstall were installed with a later version of the Installer. Please use a later version of the Installer to deinstall these Product(s).")));
  ]

  if (doit)
  {
    /************************************************
    Create a label with the product name, and version
    *************************************************/
    EXECUTE_SCRIPT = "CREATE_LABEL";
    execute("%installer_home%%dir_separator%d2kr2dei.usr");
    /************************************************/

    /************************
    Setup the nls() stuff for
    deinstall scripts
    *************************/
    deinstall_components    = nls("deinstall_components", "Deinstalling %%registry_label%% Components...");
    deinstall_unregister    = nls("deinstall_unregister","Unregistering %%registry_label%%...");
    unreference_dependencies= nls("unreference_dependencies","Unreferencing %%registry_label%% Dependencies...");

    deinstall_exe           = nls("deinstall_exe", "Deinstalling %%product_label%% Files...");

    deinstall_which         = nls("deinstall_which","Remove which %%registry_label%%?");
    deinstall_location      = nls("deinstall_location", "%%registry_label%% is not found in this directory.  Do you wish to attempt to deinstall at this location anyway?");
    /************************/

    permit_retry_operations  = TRUE;
    permit_ignore_operations = TRUE;
    permit_process_operations= TRUE;

    /****************************/
    PARENT_PRODUCT         = registry_parent(current_registry);
    PARENT_REGISTRY_NAME   = registry_name(PARENT_PRODUCT);
    RUNTIME_PRODUCT_STRING = "w32fjava60";
    /****************************/

    /***************************
    Validate deinstallation path
    ****************************/
    deinstall_variable  = "FORMS60";
    section_heading     = registry_filename(PARENT_PRODUCT);
    EXECUTE_SCRIPT      = "GET_DEINSTALLATION_PATH";
    FORMS60             = execute("%installer_home%%dir_separator%d2kr2dei.usr");

    /***************************/

    permit_retry_operations  = TRUE;
    permit_ignore_operations = TRUE;
    permit_process_operations= TRUE;

    /********************************
    Unreference Designer Dependencies
    *********************************/
    ui_product(instantiate(display_registry_label));
    ui_action(instantiate(unreference_dependencies));

    {unreference(registration(RUNTIME_PRODUCT_STRING), current_registry);}   /* Unreference Java */
    ['UNREGISTERED_PRODUCT: continue();]

    {unreference(registration(PARENT_REGISTRY_NAME), current_registry);}   /* Unreference Parent */
    ['UNREGISTERED_PRODUCT: continue();]
    /********************************/

    /*********************
    Unregister the product
    **********************/
    ui_product(instantiate(display_registry_label));
    ui_action(instantiate(deinstall_unregister));
    unregister(current_registry);
    /*********************/

    /************************************************
    Deinstall parent if no other child product exists
    *************************************************/
    EXECUTE_SCRIPT = "DEINSTALL_PARENT";
    execute("%installer_home%%dir_separator%d2kr2dei.usr");
    /************************************************/


    temp_var=current_directory();
    change_directory("%INSTALLER_HOME%");
    {win32_asynchronous_spawn("%INSTALLER_HOME%\fjava60.bat");}
    ['NO_RESPONSE, 'FILE_NOT_FOUND, 'MEMORY_ERROR: continue();]
    change_directory("%temp_var%");

    /********************
    Deinstall the product
    *********************/
    ui_action(instantiate(deinstall_exe));
    remove(ewt);

    ui_action(instantiate(deinstall_exe));
    remove(deinst); 
    /********************/
    permit_retry_operations = FALSE;
  }
}
