34 import com.nokia.mj.impl.utils.StartUpTrace; |
34 import com.nokia.mj.impl.utils.StartUpTrace; |
35 import com.nokia.mj.impl.utils.exception.InstallerExceptionBase; |
35 import com.nokia.mj.impl.utils.exception.InstallerExceptionBase; |
36 |
36 |
37 import java.io.InputStream; |
37 import java.io.InputStream; |
38 import java.io.IOException; |
38 import java.io.IOException; |
|
39 import java.util.Enumeration; |
39 import java.util.Hashtable; |
40 import java.util.Hashtable; |
40 |
41 |
41 import org.eclipse.ercp.swt.midp.UIThreadSupport; |
42 import org.eclipse.ercp.swt.midp.UIThreadSupport; |
42 import org.eclipse.swt.SWT; |
43 import org.eclipse.swt.SWT; |
43 import org.eclipse.swt.events.ControlEvent; |
44 import org.eclipse.swt.events.ControlEvent; |
672 final InstallerUiEswt self = this; |
670 final InstallerUiEswt self = this; |
673 iParent.getDisplay().syncExec(new Runnable() |
671 iParent.getDisplay().syncExec(new Runnable() |
674 { |
672 { |
675 public void run() |
673 public void run() |
676 { |
674 { |
677 iOcspProgressView = new ProgressView(self, iDialog, |
675 iOcspProgressView = new ProgressView( |
678 InstallerUiTexts.get(InstallerUiTexts.OCSP_CHECK_PROGRESS), |
676 self, iDialog, |
679 true); |
677 InstallerUiTexts.get(InstallerUiTexts.OCSP_CHECK_PROGRESS), |
|
678 true); |
680 } |
679 } |
681 }); |
680 }); |
682 iOcspProgressView.addCancelCommand(); |
681 iOcspProgressView.addCancelCommand(); |
683 } |
682 } |
684 if (iOcspProgressView != null) |
683 if (iOcspProgressView != null) |
801 result = iErrorDetailsView.error(aInstallerException); |
800 result = iErrorDetailsView.error(aInstallerException); |
802 iErrorDetailsView.dispose(); |
801 iErrorDetailsView.dispose(); |
803 iErrorDetailsView = null; |
802 iErrorDetailsView = null; |
804 } |
803 } |
805 } |
804 } |
806 |
|
807 /** |
|
808 * Notify user that an error has occurred using RuntimeUI. |
|
809 * |
|
810 * @param aInstallerException exception indicating the error reason |
|
811 */ |
|
812 /* |
|
813 private void showRuntimeUiError(InstallerExceptionBase aInstallerException) |
|
814 { |
|
815 boolean identified = false; |
|
816 if (iInstallInfo != null) |
|
817 { |
|
818 if (iInstallInfo.getCertificates() != null) |
|
819 { |
|
820 identified = true; |
|
821 } |
|
822 } |
|
823 else if (iUninstallInfo != null) |
|
824 { |
|
825 if (iUninstallInfo.getCertificates() != null) |
|
826 { |
|
827 identified = true; |
|
828 } |
|
829 } |
|
830 String tmpTitle = InstallerUiTexts.get(InstallerUiTexts.INSTALL_FAILED); |
|
831 |
|
832 // Ensure that no confirmations are being displayed. |
|
833 cancelConfirmations(); |
|
834 // Hide progress view before displaying error message. |
|
835 if (iProgressView != null) |
|
836 { |
|
837 iProgressView.setVisible(false); |
|
838 } |
|
839 // Use RuntimeUi to display uninstallation error message. |
|
840 RuntimeUi runtimeUi = RuntimeUiFactory.getRuntimeUi(identified); |
|
841 runtimeUi.error(tmpTitle, aInstallerException); |
|
842 runtimeUi.destroy(); |
|
843 } |
|
844 */ |
|
845 |
805 |
846 /** |
806 /** |
847 * Seeks confirmation from the user. |
807 * Seeks confirmation from the user. |
848 * |
808 * |
849 * @param aAppName the name of the application on behalf of which the |
809 * @param aAppName the name of the application on behalf of which the |
1030 /** |
990 /** |
1031 * Returns string title basing on mode of this InstallerUi. |
991 * Returns string title basing on mode of this InstallerUi. |
1032 */ |
992 */ |
1033 protected String getTitle() |
993 protected String getTitle() |
1034 { |
994 { |
1035 String result = null; |
995 String result = super.getTitle(); |
1036 if (iMode == MODE_INSTALL) |
996 if (isUiReady()) |
1037 { |
997 { |
1038 result = InstallerUiTexts.get(InstallerUiTexts.INSTALLING); |
998 if (iMode == MODE_INSTALL) |
1039 } |
999 { |
1040 else if (iMode == MODE_UNINSTALL) |
1000 result = InstallerUiTexts.get(InstallerUiTexts.INSTALLING); |
1041 { |
1001 } |
1042 result = InstallerUiTexts.get("Uninstalling"); |
1002 else if (iMode == MODE_UNINSTALL) |
1043 } |
1003 { |
1044 else if (iMode == MODE_APP_CONVERSION) |
1004 result = InstallerUiTexts.get("Uninstalling"); |
1045 { |
1005 } |
1046 result = InstallerUiTexts.get( |
1006 else if (iMode == MODE_APP_CONVERSION) |
1047 "Converting data for application " + |
1007 { |
1048 iAppConversionCurrent + "/" + iAppConversionTotal); |
1008 result = InstallerUiTexts.get( |
|
1009 "Converting data for application " + |
|
1010 iAppConversionCurrent + "/" + iAppConversionTotal); |
|
1011 } |
1049 } |
1012 } |
1050 return result; |
1013 return result; |
1051 } |
1014 } |
1052 |
1015 |
1053 /** |
1016 /** |
1068 String iconFilename = "java_3_untrusted.png"; |
1031 String iconFilename = "java_3_untrusted.png"; |
1069 if (aIdentified) |
1032 if (aIdentified) |
1070 { |
1033 { |
1071 iconFilename = "java_3_trusted.png"; |
1034 iconFilename = "java_3_trusted.png"; |
1072 } |
1035 } |
1073 String resourceDir = ResourceUtil.getResourceDir(0); |
1036 try |
1074 for (int i = 1; iSecurityIcon == null && resourceDir != null; i++) |
1037 { |
1075 { |
1038 String resourceDir = ResourceUtil.getResourceDir(0); |
1076 iSecurityIcon = loadImage(aDisplay, resourceDir + iconFilename, false); |
1039 for (int i = 1; iSecurityIcon == null && resourceDir != null; i++) |
1077 resourceDir = ResourceUtil.getResourceDir(i); |
1040 { |
|
1041 iSecurityIcon = loadImage( |
|
1042 aDisplay, resourceDir + iconFilename, false); |
|
1043 resourceDir = ResourceUtil.getResourceDir(i); |
|
1044 } |
|
1045 } |
|
1046 catch (Throwable t) |
|
1047 { |
|
1048 log("Can not load security icon: " + t); |
1078 } |
1049 } |
1079 return iSecurityIcon; |
1050 return iSecurityIcon; |
1080 } |
1051 } |
1081 |
1052 |
1082 /** |
1053 /** |
1361 catch (Throwable t) |
1332 catch (Throwable t) |
1362 { |
1333 { |
1363 logError("Loading CSS from " + cssPath + " failed", t); |
1334 logError("Loading CSS from " + cssPath + " failed", t); |
1364 } |
1335 } |
1365 } |
1336 } |
|
1337 |
|
1338 private void disposeResources() { |
|
1339 if (iBoldFont != null && !iBoldFont.isDisposed()) |
|
1340 { |
|
1341 iBoldFont.dispose(); |
|
1342 } |
|
1343 if (iSecurityIcon != null && !iSecurityIcon.isDisposed()) |
|
1344 { |
|
1345 iSecurityIcon.dispose(); |
|
1346 } |
|
1347 Enumeration e = iImageTable.elements(); |
|
1348 while (e.hasMoreElements()) |
|
1349 { |
|
1350 Image img = (Image)e.nextElement(); |
|
1351 if (img != null && !img.isDisposed()) |
|
1352 { |
|
1353 img.dispose(); |
|
1354 } |
|
1355 } |
|
1356 } |
1366 } |
1357 } |