javamanager/javainstaller/installerui/javasrc/com/nokia/mj/impl/installer/ui/eswt2/InstallerUiEswt.java
equal
deleted
inserted
replaced
60 /** |
60 /** |
61 * JavaInstaller eSWT UI. |
61 * JavaInstaller eSWT UI. |
62 */ |
62 */ |
63 public class InstallerUiEswt extends InstallerUi |
63 public class InstallerUiEswt extends InstallerUi |
64 { |
64 { |
|
65 /** Disable UI temporarily. */ |
|
66 private static final boolean DISABLE_UI = true; |
65 /** Default shell style. */ |
67 /** Default shell style. */ |
66 private static final int SHELL_STYLE = |
68 private static final int SHELL_STYLE = |
67 SWT.BORDER | SWT.APPLICATION_MODAL | SWT.ON_TOP; |
69 SWT.BORDER | SWT.APPLICATION_MODAL | SWT.ON_TOP; |
68 |
70 |
69 private Shell iParent = null; |
71 private Shell iParent = null; |
133 StartUpTrace.doTrace("InstallerUiEswt init"); |
135 StartUpTrace.doTrace("InstallerUiEswt init"); |
134 InstallerRuntimeUi.init(this); |
136 InstallerRuntimeUi.init(this); |
135 // Create a hashtable for icons. |
137 // Create a hashtable for icons. |
136 iImageTable = new Hashtable(); |
138 iImageTable = new Hashtable(); |
137 // Create a new thread to be the UI main thread. |
139 // Create a new thread to be the UI main thread. |
138 iUiThreadExists = true; |
|
139 UIThreadSupport.startInUIThread(new Runnable() |
140 UIThreadSupport.startInUIThread(new Runnable() |
140 { |
141 { |
141 public void run() |
142 public void run() |
142 { |
143 { |
143 uiMain(); |
144 uiMain(); |
152 * This method is executed in UI main thread. |
153 * This method is executed in UI main thread. |
153 */ |
154 */ |
154 private void uiMain() |
155 private void uiMain() |
155 { |
156 { |
156 log("uiMain: thread started"); |
157 log("uiMain: thread started"); |
|
158 iUiThreadExists = true; |
157 try |
159 try |
158 { |
160 { |
159 // Create the necessary views. |
161 // Create the necessary views. |
160 DisplayExtension display = new DisplayExtension(); |
162 DisplayExtension display = new DisplayExtension(); |
161 StartUpTrace.doTrace("InstallerUiEswt display created"); |
163 StartUpTrace.doTrace("InstallerUiEswt display created"); |
461 * @param aProgress progress value between 0 and 100 |
463 * @param aProgress progress value between 0 and 100 |
462 */ |
464 */ |
463 public void updateProgress(int aProgress) |
465 public void updateProgress(int aProgress) |
464 { |
466 { |
465 super.updateProgress(aProgress); |
467 super.updateProgress(aProgress); |
466 if (true) return; // Disable UI temporarily. |
468 if (DISABLE_UI) return; // Disable UI temporarily. |
467 if (!isUiReady()) |
469 if (!isUiReady()) |
468 { |
470 { |
469 return; |
471 return; |
470 } |
472 } |
471 // UI is created asynchronously, so it might be that |
473 // UI is created asynchronously, so it might be that |
508 * This method must return quickly. |
510 * This method must return quickly. |
509 */ |
511 */ |
510 public void ended() |
512 public void ended() |
511 { |
513 { |
512 super.ended(); |
514 super.ended(); |
513 if (true) return; // Disable UI temporarily. |
515 if (DISABLE_UI) return; // Disable UI temporarily. |
514 if (!isUiReady()) |
516 if (!isUiReady()) |
515 { |
517 { |
516 return; |
518 return; |
517 } |
519 } |
518 Display display = iParent.getDisplay(); |
520 Display display = iParent.getDisplay(); |
553 * @param aDownloadInfo information about download |
555 * @param aDownloadInfo information about download |
554 */ |
556 */ |
555 public void started(DownloadInfo aDownloadInfo) |
557 public void started(DownloadInfo aDownloadInfo) |
556 { |
558 { |
557 super.started(aDownloadInfo); |
559 super.started(aDownloadInfo); |
558 if (true) return; // Disable UI temporarily. |
560 if (DISABLE_UI) return; // Disable UI temporarily. |
559 if (!isUiReady()) |
561 if (!isUiReady()) |
560 { |
562 { |
561 return; |
563 return; |
562 } |
564 } |
563 // Ensure that download progress bar is displayed and |
565 // Ensure that download progress bar is displayed and |
580 * @param aDownloadInfo information about download |
582 * @param aDownloadInfo information about download |
581 */ |
583 */ |
582 public void updateProgress(DownloadInfo aDownloadInfo) |
584 public void updateProgress(DownloadInfo aDownloadInfo) |
583 { |
585 { |
584 super.updateProgress(aDownloadInfo); |
586 super.updateProgress(aDownloadInfo); |
585 if (true) return; // Disable UI temporarily. |
587 if (DISABLE_UI) return; // Disable UI temporarily. |
586 if (!isUiReady()) |
588 if (!isUiReady()) |
587 { |
589 { |
588 return; |
590 return; |
589 } |
591 } |
590 |
592 |
630 * @param aDownloadInfo information about download |
632 * @param aDownloadInfo information about download |
631 */ |
633 */ |
632 public void ended(DownloadInfo aDownloadInfo) |
634 public void ended(DownloadInfo aDownloadInfo) |
633 { |
635 { |
634 super.ended(aDownloadInfo); |
636 super.ended(aDownloadInfo); |
635 if (true) return; // Disable UI temporarily. |
637 if (DISABLE_UI) return; // Disable UI temporarily. |
636 if (!isUiReady()) |
638 if (!isUiReady()) |
637 { |
639 { |
638 return; |
640 return; |
639 } |
641 } |
640 if (iDlProgressView != null && !iDlProgressView.isDisposed()) |
642 if (iDlProgressView != null && !iDlProgressView.isDisposed()) |
657 * @param aOn true when OCSP is started, false when OCSP is stopped |
659 * @param aOn true when OCSP is started, false when OCSP is stopped |
658 */ |
660 */ |
659 public void setOcspIndicator(boolean aOn) |
661 public void setOcspIndicator(boolean aOn) |
660 { |
662 { |
661 super.setOcspIndicator(aOn); |
663 super.setOcspIndicator(aOn); |
662 if (true) return; // Disable UI temporarily. |
664 if (DISABLE_UI) return; // Disable UI temporarily. |
663 waitForUi(); |
665 waitForUi(); |
664 if (!isUiReady()) |
666 if (!isUiReady()) |
665 { |
667 { |
666 log("UI not ready, could not set OCSP indicator to " + aOn); |
668 log("UI not ready, could not set OCSP indicator to " + aOn); |
667 return; |
669 return; |
758 * @param aInstallerException exception indicating the error reason |
760 * @param aInstallerException exception indicating the error reason |
759 */ |
761 */ |
760 public void error(InstallerExceptionBase aInstallerException) |
762 public void error(InstallerExceptionBase aInstallerException) |
761 { |
763 { |
762 super.error(aInstallerException); |
764 super.error(aInstallerException); |
763 if (true) return; // Disable UI temporarily. |
765 if (DISABLE_UI) return; // Disable UI temporarily. |
764 |
766 |
765 waitForUi(); |
767 waitForUi(); |
766 if (!isUiReady()) { |
768 if (!isUiReady()) { |
767 return; |
769 return; |
768 } |
770 } |
855 * @return true if the user has answered, false if the user has |
857 * @return true if the user has answered, false if the user has |
856 * canceled the confirmation |
858 * canceled the confirmation |
857 */ |
859 */ |
858 public boolean confirm(String aAppName, ConfirmData aConfirmData) |
860 public boolean confirm(String aAppName, ConfirmData aConfirmData) |
859 { |
861 { |
860 if (true) return true; // Disable UI temporarily. |
862 if (DISABLE_UI) return true; // Disable UI temporarily. |
861 waitForUi(); |
863 waitForUi(); |
862 if (!isUiReady()) { |
864 if (!isUiReady()) { |
863 return true; |
865 return true; |
864 } |
866 } |
865 |
867 |
894 * and second being password. If username and password |
896 * and second being password. If username and password |
895 * cannot be obtained, this method returns null. |
897 * cannot be obtained, this method returns null. |
896 */ |
898 */ |
897 public String[] getUsernamePassword(String aUrl) |
899 public String[] getUsernamePassword(String aUrl) |
898 { |
900 { |
899 if (true) return new String[] { "", "" }; // Disable UI temporarily. |
901 if (DISABLE_UI) return new String[] { "", "" }; // Disable UI temporarily. |
900 waitForUi(); |
902 waitForUi(); |
901 if (!isUiReady()) |
903 if (!isUiReady()) |
902 { |
904 { |
903 return null; |
905 return null; |
904 } |
906 } |
950 * @return true if the user has chosen to launch the application, |
952 * @return true if the user has chosen to launch the application, |
951 * false if the user has canceled the query |
953 * false if the user has canceled the query |
952 */ |
954 */ |
953 public boolean launchAppQuery(LaunchAppInfo aLaunchAppInfo) |
955 public boolean launchAppQuery(LaunchAppInfo aLaunchAppInfo) |
954 { |
956 { |
955 if (true) return false; // Disable UI temporarily. |
957 if (DISABLE_UI) return false; // Disable UI temporarily. |
956 waitForUi(); |
958 waitForUi(); |
957 if (!isUiReady() || iConfirmationsCanceled || getInstallInfo() == null) |
959 if (!isUiReady() || iConfirmationsCanceled || getInstallInfo() == null) |
958 { |
960 { |
959 // Either UI is not yet ready, or user has cancelled |
961 // Either UI is not yet ready, or user has cancelled |
960 // installation, in both cases do nothing. |
962 // installation, in both cases do nothing. |
972 iLaunchAppQueryView = new LaunchAppQueryView(self, iDialog); |
974 iLaunchAppQueryView = new LaunchAppQueryView(self, iDialog); |
973 } |
975 } |
974 }); |
976 }); |
975 } |
977 } |
976 boolean result = iLaunchAppQueryView.launchAppQuery(aLaunchAppInfo); |
978 boolean result = iLaunchAppQueryView.launchAppQuery(aLaunchAppInfo); |
977 iParent.getDisplay().syncExec(new Runnable() |
979 iLaunchAppQueryView.dispose(); |
978 { |
|
979 public void run() |
|
980 { |
|
981 iParent.dispose(); |
|
982 } |
|
983 }); |
|
984 iLaunchAppQueryView = null; |
980 iLaunchAppQueryView = null; |
|
981 if (!result) |
|
982 { |
|
983 iParent.getDisplay().syncExec(new Runnable() |
|
984 { |
|
985 public void run() |
|
986 { |
|
987 iParent.dispose(); |
|
988 } |
|
989 }); |
|
990 } |
985 log("LaunchAppQuery returns " + result + " for " + aLaunchAppInfo); |
991 log("LaunchAppQuery returns " + result + " for " + aLaunchAppInfo); |
986 return result; |
992 return result; |
|
993 } |
|
994 |
|
995 /** |
|
996 * Executes given Runnable synchronously in the UI thread. |
|
997 */ |
|
998 public void syncExec(Runnable aRunnable) |
|
999 { |
|
1000 iParent.getDisplay().syncExec(aRunnable); |
987 } |
1001 } |
988 |
1002 |
989 /** |
1003 /** |
990 * Hides or unhides InstallerUi. |
1004 * Hides or unhides InstallerUi. |
991 */ |
1005 */ |