javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/StartProgressNotifications.java
branchRCL_3
changeset 19 04becd199f91
child 23 98ccebc37403
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 package com.nokia.mj.impl.installer.midp2.uninstall.steps;
       
    20 
       
    21 import com.nokia.mj.impl.installer.applicationregistrator.SifNotifier;
       
    22 import com.nokia.mj.impl.installer.exetable.ExeBall;
       
    23 import com.nokia.mj.impl.installer.exetable.ExeStep;
       
    24 import com.nokia.mj.impl.installer.storagehandler.ApplicationInfo;
       
    25 import com.nokia.mj.impl.installer.utils.InstallerException;
       
    26 import com.nokia.mj.impl.installer.utils.Log;
       
    27 
       
    28 import java.util.Vector;
       
    29 
       
    30 public class StartProgressNotifications extends ExeStep
       
    31 {
       
    32     public void execute(ExeBall aBall)
       
    33     {
       
    34         UninstallBall ball = (UninstallBall)aBall;
       
    35         Log.log("Starting progress notifications...");
       
    36 
       
    37         if (!SifNotifier.enabled())
       
    38         {
       
    39             Log.log("SifNotifier disabled.");
       
    40             return;
       
    41         }
       
    42 
       
    43         try
       
    44         {
       
    45             ball.iSifNotifier = new SifNotifier();
       
    46         }
       
    47         catch (Throwable t)
       
    48         {
       
    49             Log.logError("StartProgressNotifications: creating SifNotifier failed", t);
       
    50             // Could not create SifNotifer, let's proceed without it.
       
    51             return;
       
    52         }
       
    53 
       
    54         // Init application names array.
       
    55         Vector appNamesVector = ball.iSuite.getApplications();
       
    56         String[] appNames = new String[appNamesVector.size()];
       
    57         for (int i = 0; i < appNamesVector.size(); i++)
       
    58         {
       
    59             appNames[i] =
       
    60                 ((ApplicationInfo)appNamesVector.elementAt(i)).getName();
       
    61         }
       
    62 
       
    63         // Use default icon for now.
       
    64         String componentIconPath =
       
    65             ball.iApplicationRegistrator.getDefaultIconPath();
       
    66 
       
    67         try
       
    68         {
       
    69             ball.iSifNotifier.notifyStart(
       
    70                 ball.iSifNotifier.OP_UNINSTALL,
       
    71                 ball.iSuite.getGlobalId(), ball.iSuite.getName(),
       
    72                 appNames, ball.iSuite.calculateInitialSize(),
       
    73                 componentIconPath);
       
    74         }
       
    75         catch (Throwable t)
       
    76         {
       
    77             Log.logError("StartProgressNotifications: SifNotifier.notifyStart failed", t);
       
    78         }
       
    79 
       
    80         // Set SifNotifier for the listeners that should use it.
       
    81         ball.iInstallationNotifier.setSifNotifier(ball.iSifNotifier);
       
    82     }
       
    83 
       
    84     public void cancel(ExeBall aBall)
       
    85     {
       
    86         // nop
       
    87     }
       
    88 }