-/*\r
-* InstallManager\r
-*\r
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
-*\r
-* Contact: \r
-* Wooyoung Cho <wooyoung1.cho@samsung.com>\r
-* Shihyun Kim <shihyun.kim@samsung.com>\r
-* Taeyoung Son <taeyoung2.son@samsung.com>\r
-* Yongsung kim <yongsung1.kim@samsung.com>\r
-* \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
-* you may not use this file except in compliance with the License.\r
-* You may obtain a copy of the License at\r
-*\r
-* http://www.apache.org/licenses/LICENSE-2.0\r
-*\r
-* Unless required by applicable law or agreed to in writing, software\r
-* distributed under the License is distributed on an "AS IS" BASIS,\r
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-* See the License for the specific language governing permissions and\r
-* limitations under the License.\r
-*\r
-* Contributors:\r
-* - S-Core Co., Ltd\r
-*\r
-*/\r
-\r
-package org.tizen.installmanager.ui;\r
-\r
-import java.io.IOException;\r
-import java.util.ArrayList;\r
-import java.util.Arrays;\r
-import java.util.Enumeration;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Map.Entry;\r
-import java.util.Properties;\r
-import java.util.Set;\r
-\r
-import org.eclipse.jface.window.ApplicationWindow;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.custom.StackLayout;\r
-import org.eclipse.swt.events.PaintEvent;\r
-import org.eclipse.swt.events.PaintListener;\r
-import org.eclipse.swt.events.SelectionAdapter;\r
-import org.eclipse.swt.events.SelectionEvent;\r
-import org.eclipse.swt.graphics.Color;\r
-import org.eclipse.swt.graphics.Image;\r
-import org.eclipse.swt.graphics.Point;\r
-import org.eclipse.swt.graphics.RGB;\r
-import org.eclipse.swt.layout.RowData;\r
-import org.eclipse.swt.layout.RowLayout;\r
-import org.eclipse.swt.widgets.Button;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Control;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.eclipse.swt.widgets.Label;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.tizen.installmanager.cli.InstallManagerNoUI;\r
-import org.tizen.installmanager.core.Config;\r
-import org.tizen.installmanager.core.IMExitException;\r
-import org.tizen.installmanager.core.IMFatalException;\r
-import org.tizen.installmanager.core.InstallManager;\r
-import org.tizen.installmanager.core.Options;\r
-import org.tizen.installmanager.core.Performance;\r
-import org.tizen.installmanager.lib.ErrorController;\r
-import org.tizen.installmanager.lib.IMError;\r
-import org.tizen.installmanager.lib.Log;\r
-import org.tizen.installmanager.lib.Platform;\r
-import org.tizen.installmanager.lib.ProgramController;\r
-import org.tizen.installmanager.lib.Registry;\r
-import org.tizen.installmanager.lib.exception.IMNetworkException;\r
-import org.tizen.installmanager.lib.mac.CocoaUtil;\r
-import org.tizen.installmanager.pkg.lib.PackageManager;\r
-import org.tizen.installmanager.pkg.model.ConfigFile;\r
-import org.tizen.installmanager.pkg.model.PackageSet;\r
-import org.tizen.installmanager.ui.dialog.AddExtraRepositoryDialog;\r
-import org.tizen.installmanager.ui.dialog.IndeterminateProgressDialog;\r
-import org.tizen.installmanager.ui.dialog.MessageBoxDlg;\r
-import org.tizen.installmanager.ui.dialog.MessageBoxDlg.DialogType;\r
-import org.tizen.installmanager.ui.dialog.ProxySettingsDialog;\r
-import org.tizen.installmanager.ui.model.Item;\r
-import org.tizen.installmanager.ui.page.CompletePage;\r
-import org.tizen.installmanager.ui.page.InstallableListPage;\r
-import org.tizen.installmanager.ui.page.InstallingPage;\r
-import org.tizen.installmanager.ui.page.LicensePage;\r
-import org.tizen.installmanager.ui.page.SetInstallDirectoryPage;\r
-import org.tizen.installmanager.ui.page.UninstallableListPage;\r
-import org.tizen.installmanager.ui.page.UninstallingPage;\r
-import org.tizen.installmanager.ui.page.UpdatableListPage;\r
-import org.tizen.installmanager.ui.page.ViewController;\r
-import org.tizen.installmanager.ui.page.WelcomePage;\r
-import org.tizen.installmanager.ui.page.InstallingPage.InstallProgressMonitor;\r
-import org.tizen.installmanager.ui.page.WelcomePage.RADIO_ACTION;\r
-import org.tizen.installmanager.util.PathUtil;\r
-import org.tizen.installmanager.pkg.model.Package;\r
-\r
-\r
-/**\r
- * This class is main class for install manager.\r
- * @author Taeyoung Son <taeyoung2.son@samsung.com>\r
- */\r
-public class InstallManagerWindow extends ApplicationWindow {\r
- private static final RGB RGB_BACKGROUND = new RGB(242, 242, 242);\r
-\r
- private static final Point POINT_MAIN_WINDOW = new Point(628, 478);\r
- private static Image IMAGE_WINDOW_ICON;\r
- private static Color COLOR_BACKGROUND;\r
-\r
- private static InstallManagerWindow window;\r
-\r
- private StackLayout sl_composite = new StackLayout();\r
- private static Button btnClose;\r
- private static Button btnBack;\r
- private static Button btnNext;\r
- private Button btnSettings;\r
- private static Button addExtraButton;\r
-\r
- private AddExtraRepositoryDialog extraDialog = null;\r
- \r
- private Composite pageComposite;\r
- private WelcomePage compositeWelcomePage;\r
- private LicensePage compositeLicensePage;\r
- private InstallableListPage compositeInstallablePage;\r
- private UninstallableListPage compositeUninstallablePage;\r
- private InstallingPage compositeInstallingPage;\r
- private UninstallingPage compositeUninstallingPage;\r
- private CompletePage compositeCompletePage;\r
- private SetInstallDirectoryPage compositeSetInstallDirectoryPage;\r
- public UpdatableListPage compositeUpdatableListPage;\r
-\r
- protected static ViewController controller;\r
- private SelectionAdapter cancelBtnSelectionAdapter = null;\r
- private SelectionAdapter closeBtnSelectionAdapter = null;\r
-\r
- /**\r
- * Create the application window.\r
- */\r
- public InstallManagerWindow() {\r
- super(null);\r
- setShellStyle(SWT.SHELL_TRIM);\r
- setShellStyle(SWT.BORDER | SWT.TITLE);\r
- }\r
-\r
- /**\r
- * Get installmanager window background color.\r
- * @return background color\r
- */\r
- public static Color getBackgroundColor() {\r
- if (COLOR_BACKGROUND == null) {\r
- COLOR_BACKGROUND = new Color(null, RGB_BACKGROUND);\r
- }\r
- return COLOR_BACKGROUND;\r
- }\r
-\r
- private static Image getWindowIconImage() {\r
- if (IMAGE_WINDOW_ICON == null) {\r
- IMAGE_WINDOW_ICON = PathUtil.getImageFromResource("/res/icons/SDK_icon.png");\r
- }\r
- return IMAGE_WINDOW_ICON;\r
- }\r
-\r
- private void init() throws IMExitException{\r
- Log.log("Window init start");\r
- \r
- //make waiting dialog.\r
- final IndeterminateProgressDialog progressbar = IndeterminateProgressDialog.getInstance();\r
- \r
- final Shell shell = progressbar.getParent();\r
- shell.getDisplay().asyncExec(new Runnable(){\r
- public void run() { \r
- //initialize installmanager\r
- progressbar.updateName("Connecting to package server.\nIt may take a minute...");\r
- \r
- shell.getDisplay().asyncExec(new Runnable() {\r
- public void run() {\r
- initInstallManager();\r
- }\r
- \r
- });\r
- \r
- //init end\r
- progressbar.finish();\r
- }\r
- });\r
- \r
- if (!shell.isDisposed()) {\r
- progressbar.open();\r
- }\r
-\r
- Log.log("Window init end");\r
- }\r
- \r
- private void updateInstallManager(Shell shell) {\r
- if (controller.canInstallManagerUpdate()) {\r
- String msg = "There is a new installer on the server. \nNew install-manager will be started. \nIt may take a minute...";\r
- MessageBoxDlg.showDlg(shell, "InstallManager", msg, DialogType.NOTIFY, false);\r
- \r
- controller.updateInstallManager();\r
- }\r
- }\r
- \r
- /**\r
- * init IM's configuation and packages information.\r
- * @return\r
- */\r
- public boolean initInstallManager() {\r
- ErrorController.setInstallationSuccess(true);\r
- \r
- controller = new ViewController();\r
- \r
- if (controller.init()) {\r
- if (Config.isSupportMultiSDK()) {\r
- Log.log("Multi SDK installation.");\r
- } else {\r
- Log.log("Single SDK installation.");\r
- }\r
- return true;\r
- } else {\r
- Log.err("InstallManager init fail.");\r
- ErrorController.setInstallationSuccess(false);\r
- \r
- return false;\r
- }\r
- }\r
-\r
- /**\r
- * Create contents of the application window.\r
- * \r
- * @param parent\r
- */\r
- @Override\r
- protected Control createContents(Composite parent) {\r
-\r
- IMError.setComposite(parent);\r
- Composite container = new Composite(parent, SWT.NONE);\r
- container.setBackground(getBackgroundColor());\r
- RowLayout rl_container = new RowLayout(SWT.VERTICAL);\r
- rl_container.spacing = 0;\r
- rl_container.marginTop = 0;\r
- rl_container.marginRight = 0;\r
- rl_container.marginLeft = 0;\r
- rl_container.marginBottom = 0;\r
- container.setLayout(rl_container);\r
-\r
- pageComposite = new Composite(container, SWT.NONE);\r
- pageComposite.setLayoutData(new RowData(619, 395));\r
- pageComposite.setLayout(sl_composite);\r
- pageComposite.setBackground(InstallManagerWindow.getBackgroundColor());\r
-\r
- Composite composite_1 = new Composite(container, SWT.NONE);\r
- composite_1.setLayoutData(new RowData(619, 38));\r
- composite_1.setBackground(InstallManagerWindow.getBackgroundColor());\r
-\r
- Label label = new Label(composite_1, SWT.SEPARATOR | SWT.HORIZONTAL);\r
- label.setBounds(0, 0, 620, 2);\r
-\r
- btnClose = new Button(composite_1, SWT.NONE);\r
- btnClose.setText("Cancel");\r
- cancelBtnSelectionAdapter = new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- int result = MessageBoxDlg.NO;\r
- if (sl_composite.topControl == compositeInstallingPage) {\r
- InstallProgressMonitor mon = compositeInstallingPage.getInstallProgressMonitor();\r
- mon.setCancelRequested(true);\r
- result = MessageBoxDlg.showDlg(\r
- e.display.getActiveShell(),\r
- "Tizen SDK Install Manager",\r
- "Are you sure you want to quit Install Manager?\n\nIf you click \"Yes\", the installation is stopped.",\r
- DialogType.WARNING, false);\r
- if (result == MessageBoxDlg.YES) {\r
- mon.setCanceled(true);\r
- } else {\r
- mon.setCancelRequested(false);\r
- }\r
- return;\r
- } else if (sl_composite.topControl == compositeUninstallingPage) {\r
- result = MessageBoxDlg.showDlg(\r
- e.display.getActiveShell(),\r
- "Tizen SDK Install Manager",\r
- "Are you sure to quit Install Manager?\n\nIf you click \"Yes\", the uninstallation is stopped.",\r
- DialogType.WARNING, false);\r
- } else if (sl_composite.topControl == compositeCompletePage) {\r
- controller.showChangeLog();\r
- \r
- if (!Options.doResumeDownloading) {\r
- controller.cleanUpTargetDirectory();\r
- }\r
- \r
- result = MessageBoxDlg.YES;\r
- } else {\r
- result = MessageBoxDlg.showDlg(e.display.getActiveShell(),\r
- "Tizen SDK Install Manager",\r
- "Are you sure to quit Install Manager?",\r
- DialogType.WARNING, false);\r
- }\r
- \r
- if (result == MessageBoxDlg.YES) {\r
- e.display.close();\r
- }\r
- }\r
- };\r
- \r
- closeBtnSelectionAdapter = new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent arg0) {\r
- arg0.display.close();\r
- }\r
- };\r
- \r
- btnClose.addSelectionListener(cancelBtnSelectionAdapter);\r
- btnClose.setBounds(531, 10, 78, 29);\r
-\r
- btnNext = new Button(composite_1, SWT.NONE);\r
- btnNext.setText("Next");\r
- btnNext.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- if (sl_composite.topControl == compositeWelcomePage) {\r
- updateInstallManager(e.display.getActiveShell());\r
- addExtraButton.setVisible(false);\r
- btnSettings.setVisible(false);\r
- if (compositeWelcomePage.getSelectedRadioButton() == RADIO_ACTION.INSTALL) {\r
- if (!checkVaildPkgVersion()) {\r
- btnSettings.setVisible(true);\r
- return;\r
- }\r
- btnNext.setEnabled(compositeLicensePage.getAcceptButton().getSelection());\r
- if (Config.isSupportMultiSDK()) {\r
- showComposite(compositeLicensePage);\r
- btnBack.setVisible(true);\r
- } else {\r
- if (!controller.isNewInstallation()) {// Update case\r
- compositeUpdatableListPage.loadPage(controller);\r
- btnBack.setVisible(true);\r
- addExtraButton.setVisible(true);\r
-\r
- btnSettings.setVisible(false);\r
- showComposite(compositeUpdatableListPage);\r
- if (controller.existRemovablePackage()) {\r
- btnNext.setText("Install");\r
- }\r
- btnBack.setVisible(true);\r
- } else {\r
- showComposite(compositeLicensePage);\r
- btnBack.setVisible(true);\r
- }\r
- }\r
- } else if (compositeWelcomePage.getSelectedRadioButton() == RADIO_ACTION.UPDATE) {\r
- btnNext.setEnabled(compositeLicensePage.getAcceptButton().getSelection());\r
- PackageManager.dispose();\r
- initInstallManager();\r
- compositeUpdatableListPage.loadPage(controller);\r
- btnBack.setVisible(true);\r
- addExtraButton.setVisible(true);\r
- btnSettings.setVisible(false);\r
- showComposite(compositeUpdatableListPage);\r
- if (controller.existRemovablePackage()) {\r
- btnNext.setText("Install");\r
- }\r
- btnBack.setVisible(true);\r
- } else if (compositeWelcomePage.getSelectedRadioButton() == RADIO_ACTION.UNINSTALL) {\r
- int resultDialog = MessageBoxDlg.NO;\r
- resultDialog = MessageBoxDlg.showDlg(\r
- e.display.getActiveShell(),\r
- "Tizen SDK Install Manager",\r
- "Are you sure you want to remove the Tizen SDK?\n\nIf you click \"Yes\", the Tizen SDK is uninstalled.",\r
- DialogType.WARNING, false);\r
- if (resultDialog == MessageBoxDlg.YES) {\r
- showComposite(compositeUninstallingPage);\r
- btnBack.setVisible(false);\r
- btnNext.setVisible(false);\r
- btnClose.setEnabled(false);\r
- addExtraButton.setVisible(false);\r
- \r
- if (Config.isSupportMultiSDK()) {\r
- PackageManager.dispose();\r
- initInstallManager(); \r
- }\r
-\r
- List<Item> items = compositeUninstallablePage.getItems();\r
- boolean result = compositeUninstallingPage.loadPage(getSelectedPackageNames(items) /* compositeInstallablePage.getCheckedPackageNames()*/,\r
- controller,\r
- window);\r
- if (!result) {\r
- showComposite(compositeWelcomePage);\r
- btnBack.setVisible(true);\r
- btnNext.setVisible(true);\r
- btnClose.setEnabled(true);\r
- }\r
- } else {\r
- btnSettings.setVisible(true);\r
- return;\r
- }\r
- }\r
- } else if (sl_composite.topControl == compositeLicensePage) {\r
- boolean hasItem = compositeInstallablePage.loadPage(controller);\r
- if (hasItem) {\r
- showComposite(compositeInstallablePage);\r
- btnNext.setEnabled(hasItem);\r
- btnBack.setVisible(hasItem);\r
- addExtraButton.setVisible(true);\r
- if (controller.existRemovablePackage()) {\r
- btnNext.setText("Install");\r
- }\r
- } else {\r
- Log.err("Installable packages do not exist. This is error.");\r
- //TODO\r
- }\r
- } else if (sl_composite.topControl == compositeInstallablePage) {\r
- List<Item> items = compositeInstallablePage.getItems();\r
- if (getSelectedPackageNames(items).size() <= 0) {\r
- return;\r
- }\r
- if (Config.isSupportMultiSDK()) {\r
- showComposite(compositeSetInstallDirectoryPage);\r
- compositeSetInstallDirectoryPage.loadPage(\r
- controller, compositeInstallablePage.getCheckedPackageSize(false));\r
- btnNext.setText("Install");\r
- addExtraButton.setVisible(false);\r
- } else {\r
- if (controller.existRemovablePackage()) {\r
- btnBack.setVisible(false);\r
- btnNext.setVisible(false);\r
- showComposite(compositeInstallingPage);\r
- addExtraButton.setVisible(false);\r
- boolean result = compositeInstallingPage.loadPage(getSelectedPackageNames(items),\r
- controller,\r
- Registry.getInstalledPath(),\r
- window, true);\r
- if (!result) {\r
- showComposite(compositeInstallablePage);\r
- btnBack.setVisible(true);\r
- btnNext.setVisible(true);\r
- btnClose.setEnabled(true);\r
- addExtraButton.setVisible(true);\r
- }\r
- } else {\r
- showComposite(compositeSetInstallDirectoryPage);\r
- compositeSetInstallDirectoryPage.loadPage(\r
- controller, compositeInstallablePage.getCheckedPackageSize(false));\r
- btnNext.setText("Install");\r
- addExtraButton.setVisible(false);\r
- }\r
- }\r
- } else if (sl_composite.topControl == compositeUpdatableListPage) {\r
- List<Item> items = compositeUpdatableListPage.getItems();\r
- if (getSelectedPackageNames(items).size() <= 0) {\r
- return;\r
- }\r
- \r
- btnBack.setVisible(false);\r
- btnNext.setVisible(false);\r
- addExtraButton.setVisible(false);\r
- showComposite(compositeInstallingPage);\r
- boolean result = compositeInstallingPage.loadPage(getSelectedPackageNames(items), controller, Registry.getInstalledPath(), window, true);\r
- \r
- if (!result) {\r
- showComposite(compositeUpdatableListPage);\r
- btnBack.setVisible(true);\r
- btnNext.setVisible(true);\r
- btnClose.setEnabled(true);\r
- addExtraButton.setVisible(true);\r
- }\r
- } else if (sl_composite.topControl == compositeSetInstallDirectoryPage) {\r
- boolean installable = compositeSetInstallDirectoryPage.isInstallablePath();\r
-\r
- Config.USER_CONFIG_HOME_PATH = compositeSetInstallDirectoryPage.getSDKWorkSpacePath();\r
- Registry.sdkDataPath = controller.getSDKWorkSpacePath();\r
- Registry.targetPath = controller.getInstallPath();\r
- Registry.saveSDKInfo(Registry.targetPath);\r
- \r
- InstallManager.getInstance().initPackageList();\r
-\r
- if (!installable) {\r
- MessageBoxDlg.showDlg(\r
- Display.getCurrent().getShells()[0],\r
- "Error",\r
- "Not enough disk space for the installation. Select a different installation path.",\r
- DialogType.ERROR, false);\r
- return;\r
- }\r
- \r
- if (Config.isSupportMultiSDK()) {\r
- if (!compositeSetInstallDirectoryPage.isWorkSpaceDuplicate()) {\r
- int result = MessageBoxDlg.showDlg(\r
- Display.getCurrent().getShells()[0],\r
- "Warning",\r
- "Tizen SDK data directory is used already. Do you want to continue?",\r
- DialogType.WARNING, false);\r
- if (result == MessageBoxDlg.NO) {\r
- return;\r
- }\r
- }\r
- }\r
- btnBack.setVisible(false);\r
- btnNext.setVisible(false);\r
- addExtraButton.setVisible(false);\r
- List<Item> items = compositeInstallablePage.getItems();\r
- showComposite(compositeInstallingPage);\r
- boolean result = compositeInstallingPage.loadPage(getSelectedPackageNames(items),\r
- controller,\r
- compositeSetInstallDirectoryPage.getInstallPath(),\r
- window, false);\r
- if (!result) {\r
- showComposite(compositeInstallablePage);\r
- btnBack.setVisible(true);\r
- btnNext.setVisible(true);\r
- btnClose.setEnabled(true);\r
- }\r
- } else if (sl_composite.topControl == compositeUninstallablePage) {\r
- showComposite(compositeUninstallingPage);\r
- btnBack.setVisible(false);\r
- btnNext.setVisible(false);\r
- btnClose.setEnabled(false);\r
- addExtraButton.setVisible(false);\r
- List<Item> items = compositeUninstallablePage.getItems();\r
- boolean result = compositeUninstallingPage.loadPage(getSelectedPackageNames(items) /* compositeInstallablePage.getCheckedPackageNames()*/,\r
- controller,\r
- window);\r
- if (!result) {\r
- showComposite(compositeUninstallablePage);\r
- btnBack.setVisible(true);\r
- btnNext.setVisible(true);\r
- btnClose.setEnabled(true);\r
- }\r
- }\r
- }\r
- });\r
- btnNext.setBounds(447, 10, 78, 29);\r
-\r
- btnBack = new Button(composite_1, SWT.NONE);\r
- btnBack.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- if (sl_composite.topControl == compositeLicensePage) {\r
- btnNext.setEnabled(true);\r
- btnBack.setVisible(false);\r
- btnNext.setFocus();\r
- btnSettings.setVisible(true);\r
- addExtraButton.setVisible(false);\r
- showComposite(compositeWelcomePage);\r
- } else if (sl_composite.topControl == compositeInstallablePage || sl_composite.topControl == compositeUpdatableListPage) {\r
- compositeInstallablePage.getItems().clear();\r
- addExtraButton.setVisible(false);\r
- if (controller.existRemovablePackage()) {\r
- btnBack.setVisible(false);\r
- btnSettings.setVisible(true);\r
- showComposite(compositeWelcomePage);\r
- } else {\r
- showComposite(compositeLicensePage);\r
- }\r
- btnNext.setEnabled(true);\r
- btnNext.setText("Next");\r
- } else if (sl_composite.topControl == compositeSetInstallDirectoryPage) {\r
- showComposite(compositeInstallablePage);\r
- addExtraButton.setVisible(true);\r
- btnNext.setText("Next");\r
- btnNext.setEnabled(true);\r
- } else if (sl_composite.topControl == compositeUninstallablePage) {\r
- showComposite(compositeWelcomePage);\r
- addExtraButton.setVisible(false);\r
- btnNext.setText("Next");\r
- btnNext.setEnabled(true);\r
- btnBack.setVisible(false);\r
- }\r
- }\r
- });\r
- btnBack.setBounds(363, 10, 78, 29);\r
- btnBack.setText("Back");\r
- btnBack.setVisible(false);\r
- \r
- createBtnSettings(composite_1);\r
- setAddRepositoryButton(composite_1);\r
-\r
- compositeWelcomePage = new WelcomePage(pageComposite, SWT.NONE);\r
- compositeLicensePage = new LicensePage(pageComposite, SWT.NONE);\r
- compositeCompletePage = new CompletePage(pageComposite, SWT.NONE);\r
- compositeInstallingPage = new InstallingPage(pageComposite, SWT.NONE);\r
- compositeInstallablePage = new InstallableListPage(pageComposite, SWT.NONE);\r
- compositeUninstallingPage = new UninstallingPage(pageComposite, SWT.NONE);\r
- compositeUninstallablePage = new UninstallableListPage(pageComposite, SWT.NONE);\r
- compositeSetInstallDirectoryPage = new SetInstallDirectoryPage(pageComposite, SWT.NONE);\r
- compositeUpdatableListPage = new UpdatableListPage(pageComposite, SWT.NONE);\r
-\r
- registLicensePageListener();\r
- registCompletePageListener();\r
-\r
- initWelcomePage();\r
- \r
- return container;\r
- }\r
- \r
- private void createBtnSettings(Composite composite) {\r
- btnSettings = new Button(composite, SWT.NONE);\r
- btnSettings.setText("Proxy settings");\r
- btnSettings.setBounds(25, 10, 120, 29);\r
- \r
- btnSettings.addSelectionListener(new SelectionAdapter() {\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- ConfigFile configFile = Config.getInstance().getConfigFile();\r
- ProxySettingsDialog psDialog = new ProxySettingsDialog(getShell());\r
- \r
- psDialog.setProxySettings(configFile.getProxyType(), \r
- configFile.getProxyHost(), \r
- configFile.getProxyPort());\r
- \r
- psDialog.open();\r
- }\r
- });\r
- }\r
- \r
- /**\r
- * Set add Repository button. \r
- */\r
- private void setAddRepositoryButton(final Composite composite) {\r
- if (addExtraButton == null) {\r
- addExtraButton = new Button(composite ,SWT.NONE); \r
- }\r
-\r
- addExtraButton.setBounds(20, 10, 130, 29);\r
- addExtraButton.setText("Extra repository");\r
- addExtraButton.setVisible(false);\r
- \r
- addExtraButton.addSelectionListener(new SelectionAdapter() {\r
- public void widgetSelected(SelectionEvent e) {\r
- extraDialog = new AddExtraRepositoryDialog(composite.getShell(), controller);\r
- extraDialog.open();\r
- \r
- if (sl_composite.topControl == compositeInstallablePage) {\r
- compositeInstallablePage.loadPage(controller);\r
- } else if (sl_composite.topControl == compositeUpdatableListPage) {\r
- compositeUpdatableListPage.loadPage(controller);\r
- }\r
- }\r
- });\r
- }\r
- \r
- private void initWelcomePage() {\r
- compositeWelcomePage.setViewController(controller);\r
- \r
- if (ErrorController.checkInstallationSuccess()) {\r
- compositeWelcomePage.setTitle(WelcomePage.STRING_TITLE);\r
- compositeWelcomePage.setSubTitleBounds(20, 190, 600, 40);\r
- compositeWelcomePage.setSubTitle(WelcomePage.STRING_SUBTITLE);\r
- \r
- compositeWelcomePage.setVisibleRadioButton(true);\r
- btnNext.setEnabled(true);\r
- btnNext.setVisible(true);\r
- btnClose.setText("Cancel");\r
- \r
- btnClose.removeSelectionListener(closeBtnSelectionAdapter);\r
- btnClose.removeSelectionListener(cancelBtnSelectionAdapter);\r
- btnClose.addSelectionListener(cancelBtnSelectionAdapter);\r
- \r
- compositeWelcomePage.setButtonStatus();\r
- } else {\r
- compositeWelcomePage.setVisibleRadioButton(false);\r
- btnNext.setVisible(false);\r
- \r
- compositeWelcomePage.setTitle("Cannot start Tizen SDK Install Manager.");\r
- \r
- String errMsg = ErrorController.getErrorMessage();\r
- String repository = Config.getInstance().getConfigFile().getRepository();\r
- \r
- if (repository != null && !repository.isEmpty()) {\r
- errMsg = errMsg + "\n(" + repository + ")";\r
- }\r
- compositeWelcomePage.setSubTitleBounds(20, 190, 600, 100);\r
- compositeWelcomePage.setErrorSubTitle(errMsg);\r
-\r
- btnClose.setText("Close");\r
- \r
- btnClose.removeSelectionListener(closeBtnSelectionAdapter);\r
- btnClose.removeSelectionListener(cancelBtnSelectionAdapter);\r
- btnClose.addSelectionListener(closeBtnSelectionAdapter);\r
- }\r
- btnNext.setFocus();\r
- sl_composite.topControl = compositeWelcomePage;\r
- }\r
- \r
- /**\r
- * Refresh InstallManager. \r
- * Refresh packages and configuration information.\r
- */\r
- public void refresh() {\r
- final IndeterminateProgressDialog progressbar = IndeterminateProgressDialog.getInstance();\r
- final Shell shell = progressbar.getParent();\r
- shell.getDisplay().asyncExec(new Runnable(){\r
- public void run() {\r
- progressbar.updateName("Initializing...");\r
- \r
- shell.getDisplay().syncExec(new Runnable() {\r
- public void run() {\r
- PackageManager.dispose();\r
- initInstallManager();\r
- initWelcomePage();\r
- }\r
- });\r
- \r
- //init end\r
- progressbar.finish();\r
- }\r
- });\r
- \r
- if (!shell.isDisposed()) {\r
- progressbar.open();\r
- }\r
-\r
- Log.log("Window refresh end");\r
- }\r
-\r
- /**\r
- * Checks if there's updatable meta package.\r
- * Then print "updatable" to stdout.\r
- */\r
- private static void checkMetaPackageUpdate() {\r
- if (PackageManager.getInstance().getUpdatableMetaPackages().size() != 0) {\r
- System.out.println("updatable");\r
- }\r
- }\r
- \r
- /**\r
- * There is no UI, just download packages.\r
- * @throws IMExitException\r
- */\r
- private static void onlyDownloadPackages() throws IMExitException {\r
- ViewController controller = new ViewController();\r
- controller.init();\r
-\r
- InstallManager installManager = InstallManager.getInstance();\r
- PackageManager packageManager = installManager.getPackageManager();\r
- \r
- // Get all meta packages list by boundary.(eg. public, partner, all....) \r
- PackageSet filteredMeta = filterPackageSet();\r
- PackageSet downloadablePkgs = packageManager.getDependsPackagesFromRepository(filteredMeta);\r
- \r
- // Download all meta packages. \r
- boolean bRet = false;\r
- try {\r
- bRet = installManager.downloadPackages(\r
- downloadablePkgs, null);\r
- } catch (IMNetworkException e) {\r
- Log.ExceptionLog(e);\r
- return;\r
- }\r
- \r
- if (bRet) {\r
- Log.log("Success to download packages from repository");\r
- } else {\r
- Log.err("Fail to download packages from repository");\r
- return;\r
- }\r
- }\r
- \r
- private static PackageSet filterPackageSet() {\r
- PackageManager pm = PackageManager.getInstance();\r
- \r
- PackageSet downloadPackageList = pm.getLeafMetaPackages();\r
- \r
- String boundary = Options.boundary;\r
- if (boundary.equalsIgnoreCase("public")) {\r
- PackageSet partnerMetaPackages = pm.getPartnerMetaPackages();\r
- \r
- if (!partnerMetaPackages.isEmpty()) {\r
- downloadPackageList.removeAll(partnerMetaPackages);\r
- }\r
- } else if (boundary.equalsIgnoreCase("partner")) {\r
- PackageSet publicMetaPackages = pm.getPublicMetaPackages();\r
- \r
- if (!publicMetaPackages.isEmpty()) {\r
- downloadPackageList.removeAll(publicMetaPackages);\r
- }\r
- }\r
- \r
- return downloadPackageList;\r
- }\r
- \r
- private static void showInstallManagerVersion() {\r
- System.out.println("InstallManager Version : " + \r
- Config.getInstance().getInstallManagerVersion().toString());\r
- }\r
- \r
- /**\r
- * Logging all system information.\r
- */\r
- private static void loggingProperty() {\r
- Log.log("=========== System properties ===========");\r
- Properties sysprops = System.getProperties();\r
- for (Enumeration e = sysprops.propertyNames(); e.hasMoreElements();) {\r
- String key = (String) e.nextElement();\r
- String value = sysprops.getProperty(key);\r
- Log.log(key + " = " + value);\r
- }\r
- \r
- Log.log("=========== Environment variables ===========");\r
-\r
- Map<String, String> env = System.getenv();\r
- Set<String> set = env.keySet();\r
- Iterator<String> iter = set.iterator();\r
-\r
- while (iter.hasNext()) {\r
- String key = (String) iter.next();\r
- Set<Entry<String, String>> value = env.entrySet();\r
- Log.log(key + " = " + value);\r
- }\r
- Log.log("=============================================");\r
- }\r
-\r
- /**\r
- * Launch the application.\r
- * \r
- * @param args\r
- */\r
- public static void main(String args[]) {\r
- //performance measurement\r
- Performance.setIMStartTime();\r
- \r
- InstallManager.deleteTempFile();\r
- \r
- Log.open();\r
- Log.LogTitle("Installmanager start");\r
- Log.log(Platform.getPlatformInfo());\r
- Log.log(PathUtil.getCurrentDir());\r
- \r
- if (Options.propertyLogging) {\r
- loggingProperty();\r
- }\r
- \r
- try {\r
- Options.loadCmdArgs(args);\r
- } catch (IMFatalException e) {\r
- Log.err("Check your options. => " + Arrays.toString(args));\r
- System.out.println("Check your options. => " + Arrays.toString(args));\r
- return;\r
- }\r
- \r
- try { \r
- if (Options.onlyDownload) {\r
- onlyDownloadPackages();\r
- System.exit(0);\r
- } else if (Options.doInstallNoUI) {\r
- if (InstallManagerNoUI.cliInstall(Options.packages)) {\r
- Log.log("Success to command line install.");\r
- System.out.println("Success to console install.");\r
- } else {\r
- Log.log("Fail to command line install.");\r
- System.out.println("Fail to console install.");\r
- }\r
- \r
- Performance.setIMEndTime();\r
- if (Options.doTest) {\r
- Performance.printTestResultXmlFormat();\r
- Performance.printTestResult();\r
- }\r
- \r
- System.exit(0);\r
- } else if (Options.doRemoveNoUI) {\r
- if (InstallManagerNoUI.cliUninstall(Options.packages)) {\r
- Log.log("Success to command line remove.");\r
- System.out.println("Success to remove.");\r
- } else {\r
- Log.log("Fail to command line remove.");\r
- System.out.println("Fail to remove.");\r
- }\r
- \r
- Performance.setIMEndTime();\r
- if (Options.doTest) {\r
- Performance.printTestResultXmlFormat();\r
- Performance.printTestResult();\r
- }\r
- \r
- System.exit(0);\r
- } else if (Options.showVersion) {\r
- showInstallManagerVersion();\r
- System.exit(0);\r
- } else if (Options.doShowHelp) {\r
- InstallManagerNoUI.cliShowHelp();\r
- System.exit(0);\r
- }\r
- \r
- if (Platform.isMacOS()) {\r
- System.setProperty("apple.laf.useScreenMenuBar", "true");\r
- System.setProperty(\r
- "com.apple.mrj.application.apple.menu.about.name",\r
- "Emulator Manager");\r
- Display display = Display.getDefault();\r
- display.syncExec(new Runnable() {\r
- @Override\r
- public void run() {\r
- new CocoaUtil().removeTopMenuItems();\r
- }\r
- });\r
- }\r
- \r
- window = new InstallManagerWindow();\r
- window.setBlockOnOpen(true);\r
- \r
- window.init();\r
- \r
- Log.log("after init");\r
- if (Options.checkPackageUpdate) {\r
- checkMetaPackageUpdate();\r
- } else if (Options.printDepGraph) {\r
- InstallManager.getInstance().getPackageManager().printDepGraph();\r
- } else if (Options.doShowDistListNoUI) {\r
- InstallManagerNoUI.cliShowRepoInformation();\r
- } else if (Options.doShowPackageListNoUI) {\r
- InstallManagerNoUI.cliShowPackageList();\r
- } else if (Options.doShowSDKInstallStatus) {\r
- InstallManagerNoUI.cliShowInstallInformation();\r
- } else {\r
- window.open();\r
- if (Display.getCurrent() != null\r
- && !Display.getCurrent().isDisposed()) {\r
- Display.getCurrent().dispose();\r
- }\r
- }\r
- } catch (IMExitException e) {\r
- // do not remove sdk temp dir if exit for self update\r
- if (ErrorController.getExitCode() == Config.EXITCODE_HAS_SELF_UPDATE) {\r
- Options.doRemoveTempTizenSDK = false;\r
- }\r
- \r
- Log.log("Gracefully exit");\r
- } catch (Throwable e) {\r
- Log.err("Unexpected error occurred");\r
- Log.ExceptionLog(e);\r
- \r
- if (Options.doInstallNoUI || Options.doRemoveNoUI) {\r
- PathUtil.remove(Registry.REGISTRY_FILE_PATH);\r
- PathUtil.remove(Registry.MULTI_SDK_FILE_PATH);\r
- e.printStackTrace();\r
- System.out.println("Fatal error occurred.");\r
- System.exit(0);\r
- }\r
- \r
- // show error message\r
- if (window != null) {\r
- window.open();\r
- \r
- if (Display.getCurrent() != null\r
- && !Display.getCurrent().isDisposed()) {\r
- Display.getCurrent().dispose();\r
- }\r
- }\r
- \r
- ErrorController.setExitCode(Config.EXITCODE_UNKNOWN_ERROR);\r
- } finally {\r
- if (Platform.isWindows()) {\r
- ProgramController.createProgramController().removeSDKTempDir();\r
- }\r
- \r
- //performance measurement\r
- Performance.setIMEndTime();\r
- Performance.printToLogFile();\r
- \r
- if (Options.doTest) {\r
- Performance.printTestResultXmlFormat();\r
- Performance.printTestResult();\r
- }\r
- \r
- Log.LogTitle("Installmanager finish");\r
- Log.close();\r
- \r
- if (Platform.isMacOS()) {\r
- System.exit(ErrorController.getExitCode());\r
- } else {\r
- if (ErrorController.getExitCode() == Config.EXITCODE_HAS_SELF_UPDATE) {\r
- String binary = PathUtil.get(Registry.getInstalledPath(), Config.INSTALL_MANAGER_DIRECTORY, Config.EXECUTE_FILE_NAME_OF_INSTALL_MANAGER);\r
- try {\r
- Runtime.getRuntime().exec(binary);\r
- } catch (IOException e) {\r
- Log.ExceptionLog(e);\r
- }\r
- } else if (ErrorController.getExitCode() != Config.EXITCODE_NORMAL) {\r
- System.exit(ErrorController.getExitCode());\r
- }\r
- }\r
- }\r
- }\r
-\r
- @Override\r
- protected void configureShell(Shell newShell) {\r
- newShell.setBackground(getBackgroundColor());\r
- newShell.setMinimumSize(getInitialSize());\r
- newShell.setSize(getInitialSize());\r
- newShell.setImage(getWindowIconImage());\r
- super.configureShell(newShell);\r
-\r
- newShell.setText("Tizen SDK Install Manager");\r
- }\r
-\r
- @Override\r
- /**\r
- * Install manager window is close.\r
- */\r
- public boolean close() {\r
- return false;\r
- }\r
-\r
- /**\r
- * Return the initial size of the window.\r
- */\r
- @Override\r
- protected Point getInitialSize() {\r
- return POINT_MAIN_WINDOW;\r
- }\r
-\r
- /**\r
- * Show the composite depending on parameter.\r
- * @param composite\r
- */\r
- public void showComposite(Composite composite) {\r
- StackLayout layout;\r
- if (composite.getParent().getLayout() instanceof StackLayout) {\r
- layout = (StackLayout) composite.getParent().getLayout();\r
- layout.topControl = composite;\r
- }\r
- composite.getParent().layout();\r
- }\r
-\r
- private void registLicensePageListener() {\r
- compositeLicensePage.getAcceptButton()\r
- .addSelectionListener(new SelectionAdapter() {\r
-\r
- @Override\r
- public void widgetSelected(SelectionEvent e) {\r
- btnNext.setEnabled(compositeLicensePage.getAcceptButton()\r
- .getSelection());\r
- }\r
- });\r
- }\r
-\r
- private void registCompletePageListener() {\r
- compositeCompletePage.addPaintListener(new PaintListener() {\r
-\r
- @Override\r
- public void paintControl(PaintEvent arg0) {\r
- btnClose.setText("Close");\r
- }\r
- });\r
- }\r
- \r
- public void setNameOfCancelButton(String name) {\r
- btnClose.setText("Close");\r
- }\r
-\r
- /**\r
- * Get selected package names on installing\r
- * @param items\r
- * @return list of selected package names.\r
- */\r
- public List<String> getSelectedPackageNames(List<Item> items) {\r
- List<String> list = new ArrayList<String>();\r
- for (int i = 0; i < items.size(); i++) {\r
- items.get(i).getTerminalPackages(list, true);\r
- }\r
-\r
- return list;\r
- }\r
- \r
- /**\r
- * Installed packages do not have package version, installmanager will show warning dialog.\r
- * @return\r
- */\r
- private boolean checkVaildPkgVersion() {\r
- PackageSet installedPkgs = controller.getInstalledPackages();\r
- if (!installedPkgs.isEmpty()) {\r
- for (Package pkg : installedPkgs) {\r
- String vs = pkg.getVersion().toString();\r
- if (vs != "" && vs.equals("0.0.0")) {\r
- Log.err("Package version not found. ==> " + pkg.getPackageName());\r
- int confirm = MessageBoxDlg.showDlg(getShell(), \r
- "WARNING", \r
- "'" + pkg.getPackageName() + "'" + " package version is not found.\n" +\r
- "If you keep installing Tizen SDK, some unexpected may occur.\n" +\r
- "Do you want to continue?", \r
- DialogType.WARNING, false);\r
- if (confirm == MessageBoxDlg.YES) {\r
- return true;\r
- } else {\r
- return false;\r
- }\r
- }\r
- }\r
- }\r
-\r
- return true;\r
- }\r
- \r
- /**\r
- * Get install manager window object.\r
- * @return install manager window object.\r
- */\r
- public static InstallManagerWindow getInstallManagerWindow() {\r
- return window;\r
- }\r
-\r
- /**\r
- * Get complete page composite object\r
- * @return complete page composite object\r
- */\r
- public CompletePage getCompletePage() {\r
- return compositeCompletePage;\r
- }\r
- \r
- public InstallableListPage getInstallableListPage() {\r
- return compositeInstallablePage;\r
- }\r
- \r
- public WelcomePage getWelcomePage() {\r
- return compositeWelcomePage;\r
- }\r
- \r
- /**\r
- * Get setInstallDirectoryPage composite object\r
- * @return complete page composite object\r
- */\r
- public SetInstallDirectoryPage getSetInstallDirectoryPage() {\r
- return compositeSetInstallDirectoryPage;\r
- }\r
-\r
- /**\r
- * If parameter is true, 'Next' button will be enabled. but false, 'Next' button will be disabled.\r
- * @param enabled\r
- */\r
- public static void setNextBtnEnabled(boolean enabled) {\r
- btnNext.setEnabled(enabled);\r
- }\r
-\r
- /**\r
- * If parameter is true, 'Back' button will be enabled. but false, 'Back' button will be disabled.\r
- * @param enabled\r
- */\r
- public static void setBackBtnEnabled(boolean enabled) {\r
- btnBack.setEnabled(enabled);\r
- }\r
-\r
- /**\r
- * If parameter is true, 'Cancel' button will be enabled. but false, 'Cancel' button will be disabled.\r
- * @param enabled\r
- */\r
- public void setCancelBtnEnabled(boolean enabled) {\r
- btnClose.setEnabled(enabled);\r
- }\r
- \r
- public ViewController getViewController() {\r
- return controller;\r
- }\r
-}\r
+/*
+* InstallManager
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Wooyoung Cho <wooyoung1.cho@samsung.com>
+* Shihyun Kim <shihyun.kim@samsung.com>
+* Taeyoung Son <taeyoung2.son@samsung.com>
+* Yongsung kim <yongsung1.kim@samsung.com>
+*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.installmanager.ui;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
+
+import org.eclipse.jface.window.ApplicationWindow;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.layout.RowData;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.installmanager.cli.InstallManagerNoUI;
+import org.tizen.installmanager.core.Config;
+import org.tizen.installmanager.core.IMExitException;
+import org.tizen.installmanager.core.IMFatalException;
+import org.tizen.installmanager.core.InstallManager;
+import org.tizen.installmanager.core.Options;
+import org.tizen.installmanager.core.Performance;
+import org.tizen.installmanager.lib.ErrorController;
+import org.tizen.installmanager.lib.IMError;
+import org.tizen.installmanager.lib.Log;
+import org.tizen.installmanager.lib.Platform;
+import org.tizen.installmanager.lib.ProgramController;
+import org.tizen.installmanager.lib.Registry;
+import org.tizen.installmanager.lib.exception.IMNetworkException;
+import org.tizen.installmanager.lib.mac.CocoaUtil;
+import org.tizen.installmanager.pkg.lib.PackageManager;
+import org.tizen.installmanager.pkg.model.ConfigFile;
+import org.tizen.installmanager.pkg.model.PackageSet;
+import org.tizen.installmanager.ui.dialog.AddExtraRepositoryDialog;
+import org.tizen.installmanager.ui.dialog.IndeterminateProgressDialog;
+import org.tizen.installmanager.ui.dialog.MessageBoxDlg;
+import org.tizen.installmanager.ui.dialog.MessageBoxDlg.DialogType;
+import org.tizen.installmanager.ui.dialog.ProxySettingsDialog;
+import org.tizen.installmanager.ui.model.Item;
+import org.tizen.installmanager.ui.page.CompletePage;
+import org.tizen.installmanager.ui.page.InstallPage;
+import org.tizen.installmanager.ui.page.InstallableListPage;
+import org.tizen.installmanager.ui.page.InstallingPage;
+import org.tizen.installmanager.ui.page.LicensePage;
+import org.tizen.installmanager.ui.page.SetInstallDirectoryPage;
+import org.tizen.installmanager.ui.page.UninstallableListPage;
+import org.tizen.installmanager.ui.page.UninstallingPage;
+import org.tizen.installmanager.ui.page.UpdatableListPage;
+import org.tizen.installmanager.ui.page.ViewController;
+import org.tizen.installmanager.ui.page.WelcomePage;
+import org.tizen.installmanager.ui.page.InstallingPage.InstallProgressMonitor;
+import org.tizen.installmanager.ui.page.WelcomePage.INSTALLMANAGER_ACTION;
+import org.tizen.installmanager.util.PathUtil;
+import org.tizen.installmanager.pkg.model.Package;
+
+
+/**
+ * This class is main class for install manager.
+ * @author Taeyoung Son <taeyoung2.son@samsung.com>
+ */
+public class InstallManagerWindow extends ApplicationWindow {
+ private static final RGB RGB_BACKGROUND = new RGB(242, 242, 242);
+
+ private static final Point POINT_MAIN_WINDOW = new Point(628, 478);
+ private static Image IMAGE_WINDOW_ICON;
+ private static Color COLOR_BACKGROUND;
+
+ private static InstallManagerWindow window;
+
+// private StackLayout sl_composite = new StackLayout();
+ public StackLayout sl_composite = new StackLayout();
+ private static Button btnTest;
+ private static Button btnClose;
+ private static Button btnBack;
+ private static Button btnNext;
+
+ private AddExtraRepositoryDialog extraDialog = null;
+
+ private Composite pageComposite; // Page area
+ private WelcomePage compositeWelcomePage;
+ private LicensePage compositeLicensePage;
+ private InstallableListPage compositeInstallableListPage;
+ private UninstallableListPage compositeUninstallablePage;
+ private InstallingPage compositeInstallingPage;
+ private UninstallingPage compositeUninstallingPage;
+ private CompletePage compositeCompletePage;
+ private SetInstallDirectoryPage compositeSetInstallDirectoryPage;
+ public UpdatableListPage compositeUpdatableListPage;
+
+ protected static ViewController controller;
+ private SelectionAdapter cancelBtnSelectionAdapter = null;
+ private SelectionAdapter closeBtnSelectionAdapter = null;
+
+ /**
+ * Create the application window.
+ */
+ public InstallManagerWindow() {
+ super(null);
+ setShellStyle(SWT.SHELL_TRIM);
+ setShellStyle(SWT.BORDER | SWT.TITLE);
+ }
+
+ /**
+ * Get installmanager window background color.
+ * @return background color
+ */
+ public static Color getBackgroundColor() {
+ if (COLOR_BACKGROUND == null) {
+ COLOR_BACKGROUND = new Color(null, RGB_BACKGROUND);
+ }
+ return COLOR_BACKGROUND;
+ }
+
+ private static Image getWindowIconImage() {
+ if (IMAGE_WINDOW_ICON == null) {
+ IMAGE_WINDOW_ICON = PathUtil.getImageFromResource("/res/icons/SDK_icon.png");
+ }
+ return IMAGE_WINDOW_ICON;
+ }
+
+ private void init() throws IMExitException{
+ Log.log("Window init start");
+
+ //make waiting dialog.
+ final IndeterminateProgressDialog progressbar = IndeterminateProgressDialog.getInstance();
+
+ final Shell shell = progressbar.getParent();
+ shell.getDisplay().asyncExec(new Runnable(){
+ public void run() {
+ //initialize installmanager
+ progressbar.updateName("Connecting to package server.\nIt may take a minute...");
+
+ shell.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ initInstallManager();
+ }
+
+ });
+
+ //init end
+ progressbar.finish();
+ }
+ });
+
+ if (!shell.isDisposed()) {
+ progressbar.open();
+ }
+
+ Log.log("Window init end");
+ }
+
+ private void updateInstallManager(Shell shell) {
+ if (controller.canInstallManagerUpdate()) {
+ String msg = "There is a new installer on the server. \nNew install-manager will be started. \nIt may take a minute...";
+ MessageBoxDlg.showDlg(shell, "InstallManager", msg, DialogType.NOTIFY, false);
+
+ controller.updateInstallManager();
+ }
+ }
+
+ /**
+ * init IM's configuation and packages information.
+ * @return
+ */
+ public boolean initInstallManager() {
+ ErrorController.setInstallationSuccess(true);
+
+ controller = new ViewController();
+
+ if (controller.init()) {
+ if (Config.isSupportMultiSDK()) {
+ Log.log("Multi SDK installation.");
+ } else {
+ Log.log("Single SDK installation.");
+ }
+ return true;
+ } else {
+ Log.err("InstallManager init fail.");
+ ErrorController.setInstallationSuccess(false);
+
+ return false;
+ }
+ }
+
+ /**
+ * Create contents of the application window.
+ *
+ * @param parent
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+
+ parent.setSize(630, 490);
+ IMError.setComposite(parent);
+ Composite container = new Composite(parent, SWT.NONE);
+
+ // Set layout attributes.
+ RowLayout rl_container = new RowLayout(SWT.VERTICAL);
+ rl_container.spacing = 0;
+ rl_container.marginTop = 0;
+ rl_container.marginRight = 0;
+ rl_container.marginLeft = 0;
+ rl_container.marginBottom = 0;
+ container.setLayout(rl_container);
+
+ // Set page composite size. (image, label, etc.)
+ pageComposite = new Composite(container, SWT.NONE);
+ pageComposite.setLayoutData(new RowData(628, 405));
+ pageComposite.setLayout(sl_composite);
+
+ Composite composite_buttonArea = new Composite(container, SWT.NONE);
+ composite_buttonArea.setLayoutData(new RowData(628, 52));
+ composite_buttonArea.setBackground(getBackgroundColor());
+
+ setButtonClose(composite_buttonArea);
+ setButtonNext(composite_buttonArea);
+ setButtonBack(composite_buttonArea);
+
+ compositeWelcomePage = new WelcomePage(pageComposite, SWT.NONE);
+ compositeLicensePage = new LicensePage(pageComposite, SWT.NONE);
+ compositeCompletePage = new CompletePage(pageComposite, SWT.NONE);
+ compositeInstallingPage = new InstallingPage(pageComposite, SWT.NONE);
+ compositeInstallableListPage = new InstallableListPage(pageComposite, SWT.NONE);
+ compositeUninstallingPage = new UninstallingPage(pageComposite, SWT.NONE);
+ compositeUninstallablePage = new UninstallableListPage(pageComposite, SWT.NONE);
+ compositeSetInstallDirectoryPage = new SetInstallDirectoryPage(pageComposite, SWT.NONE);
+ compositeUpdatableListPage = new UpdatableListPage(pageComposite, SWT.NONE);
+
+// registLicensePageListener();
+ registCompletePageListener();
+
+ initWelcomePage();
+
+ return container;
+ }
+
+ private void setButtonClose(Composite composite) {
+ btnClose = new Button(composite, SWT.NONE);
+ btnClose.setText("Cancel");
+ cancelBtnSelectionAdapter = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int result = MessageBoxDlg.NO;
+ if (sl_composite.topControl == compositeInstallingPage) {
+ InstallProgressMonitor mon = compositeInstallingPage.getInstallProgressMonitor();
+ mon.setCancelRequested(true);
+ result = MessageBoxDlg.showDlg(
+ e.display.getActiveShell(),
+ "Tizen SDK Install Manager",
+ "Are you sure you want to quit Install Manager?\n\nIf you click \"Yes\", the installation is stopped.",
+ DialogType.WARNING, false);
+ if (result == MessageBoxDlg.YES) {
+ mon.setCanceled(true);
+ } else {
+ mon.setCancelRequested(false);
+ }
+ return;
+ } else if (sl_composite.topControl == compositeUninstallingPage) {
+ result = MessageBoxDlg.showDlg(
+ e.display.getActiveShell(),
+ "Tizen SDK Install Manager",
+ "Are you sure to quit Install Manager?\n\nIf you click \"Yes\", the uninstallation is stopped.",
+ DialogType.WARNING, false);
+ } else if (sl_composite.topControl == compositeCompletePage) {
+ controller.showChangeLog();
+
+ if (!Options.doResumeDownloading) {
+ controller.cleanUpTargetDirectory();
+ }
+
+ result = MessageBoxDlg.YES;
+ } else {
+ result = MessageBoxDlg.showDlg(e.display.getActiveShell(),
+ "Tizen SDK Install Manager",
+ "Are you sure to quit Install Manager?",
+ DialogType.WARNING, false);
+ }
+
+ if (result == MessageBoxDlg.YES) {
+ e.display.close();
+ }
+ }
+ };
+
+ closeBtnSelectionAdapter = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent arg0) {
+ arg0.display.close();
+ }
+ };
+
+ btnClose.addSelectionListener(cancelBtnSelectionAdapter);
+ btnClose.setBounds(531, 10, 78, 29);
+ }
+
+ private void setButtonNext(Composite composite) {
+ btnNext = new Button(composite, SWT.NONE);
+ btnNext.setText("Next");
+ btnNext.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (sl_composite.topControl == compositeWelcomePage) {
+ updateInstallManager(e.display.getActiveShell());
+ btnNext.setVisible(false);
+ if (compositeWelcomePage.getSelectedButton() == INSTALLMANAGER_ACTION.INSTALL) {
+ if (!checkVaildPkgVersion()) {
+ return;
+ }
+
+ if (!controller.isNewInstallation()) {// Update case
+ compositeUpdatableListPage.loadPage(controller);
+ btnBack.setVisible(true);
+ showComposite(compositeUpdatableListPage);
+ if (controller.existRemovablePackage()) {
+ btnNext.setText("Install");
+ }
+ btnBack.setVisible(true);
+ } else {
+ boolean hasItem = compositeInstallableListPage.loadPage(controller);
+ if (hasItem) {
+ showComposite(compositeInstallableListPage);
+ btnNext.setVisible(true);
+ btnNext.setEnabled(hasItem);
+ btnBack.setVisible(hasItem);
+ if (controller.existRemovablePackage()) {
+ btnNext.setText("Install");
+ }
+ } else {
+ Log.err("Installable packages do not exist. This is error.");
+ //TODO
+ }
+ }
+ } else if (compositeWelcomePage.getSelectedButton() == INSTALLMANAGER_ACTION.UPDATE) {
+// btnNext.setEnabled(compositeLicensePage.getAcceptButton().getSelection());
+ btnNext.setEnabled(true);
+ PackageManager.dispose();
+ initInstallManager();
+ compositeUpdatableListPage.loadPage(controller);
+ btnBack.setVisible(true);
+ showComposite(compositeUpdatableListPage);
+ if (controller.existRemovablePackage()) {
+ btnNext.setText("Install");
+ }
+ btnBack.setVisible(true);
+ } else if (compositeWelcomePage.getSelectedButton() == INSTALLMANAGER_ACTION.UNINSTALL) {
+ int resultDialog = MessageBoxDlg.NO;
+ resultDialog = MessageBoxDlg.showDlg(
+ e.display.getActiveShell(),
+ "Tizen SDK Install Manager",
+ "Are you sure you want to remove the Tizen SDK?\n\nIf you click \"Yes\", the Tizen SDK is uninstalled.",
+ DialogType.WARNING, false);
+ if (resultDialog == MessageBoxDlg.YES) {
+ showComposite(compositeUninstallingPage);
+ btnBack.setVisible(false);
+ btnNext.setVisible(false);
+ btnClose.setEnabled(false);
+
+ if (Config.isSupportMultiSDK()) {
+ PackageManager.dispose();
+ initInstallManager();
+ }
+
+ List<Item> items = compositeUninstallablePage.getItems();
+ boolean result = compositeUninstallingPage.loadPage(getSelectedPackageNames(items) /* compositeInstallablePage.getCheckedPackageNames()*/,
+ controller,
+ window);
+ if (!result) {
+ showComposite(compositeWelcomePage);
+ btnBack.setVisible(true);
+ btnNext.setVisible(true);
+ btnClose.setEnabled(true);
+ }
+ } else {
+ return;
+ }
+ }
+ } else if (sl_composite.topControl == compositeInstallableListPage) {
+// btnNext.setEnabled(compositeLicensePage.getAcceptButton().getSelection());
+ btnNext.setEnabled(true);
+ if (Config.isSupportMultiSDK()) {
+ showComposite(compositeLicensePage);
+ btnBack.setVisible(true);
+ } else {
+ if (!controller.isNewInstallation()) {// Update case
+ compositeUpdatableListPage.loadPage(controller);
+ btnBack.setVisible(true);
+ showComposite(compositeUpdatableListPage);
+ if (controller.existRemovablePackage()) {
+ btnNext.setText("Install");
+ }
+ btnBack.setVisible(true);
+ } else {
+ //License page button status setting.
+ showComposite(compositeLicensePage);
+ btnNext.setText("I agree");
+ btnNext.setEnabled(true);
+ btnNext.setFocus();
+ btnBack.setVisible(true);
+ }
+ }
+ } else if (sl_composite.topControl == compositeLicensePage) {
+ List<Item> items = compositeInstallableListPage.getItems();
+ if (getSelectedPackageNames(items).size() <= 0) {
+ return;
+ }
+ if (Config.isSupportMultiSDK()) {
+ showComposite(compositeSetInstallDirectoryPage);
+ compositeSetInstallDirectoryPage.loadPage(
+ controller, compositeInstallableListPage.getCheckedPackageSize(false));
+// btnNext.setText("Install");
+ } else {
+ if (controller.existRemovablePackage()) { // update case
+ btnBack.setVisible(false);
+ btnNext.setVisible(false);
+ showComposite(compositeInstallingPage);
+ boolean result = compositeInstallingPage.loadPage(getSelectedPackageNames(items),
+ controller,
+ Registry.getInstalledPath(),
+ window, true);
+ if (!result) {
+ showComposite(compositeInstallableListPage);
+ btnBack.setVisible(true);
+ btnNext.setVisible(true);
+ btnClose.setEnabled(true);
+ }
+ } else {
+ showComposite(compositeSetInstallDirectoryPage);
+ compositeSetInstallDirectoryPage.loadPage(
+ controller, compositeInstallableListPage.getCheckedPackageSize(false));
+ btnNext.setText("Install");
+// btnNext.setVisible(false);
+// btnBack.setBounds(447, 10, 78, 29);
+ }
+ }
+ } else if (sl_composite.topControl == compositeUpdatableListPage) {
+ List<Item> items = compositeUpdatableListPage.getItems();
+ if (getSelectedPackageNames(items).size() <= 0) {
+ return;
+ }
+
+ btnBack.setVisible(false);
+ btnNext.setVisible(false);
+ showComposite(compositeInstallingPage);
+ boolean result = compositeInstallingPage.loadPage(getSelectedPackageNames(items), controller, Registry.getInstalledPath(), window, true);
+
+ if (!result) {
+ showComposite(compositeUpdatableListPage);
+ btnBack.setVisible(true);
+ btnNext.setVisible(true);
+ btnClose.setEnabled(true);
+ }
+ } else if (sl_composite.topControl == compositeSetInstallDirectoryPage) {
+ boolean installable = compositeSetInstallDirectoryPage.isInstallablePath();
+
+ Config.USER_CONFIG_HOME_PATH = compositeSetInstallDirectoryPage.getSDKWorkSpacePath();
+ Registry.sdkDataPath = controller.getSDKWorkSpacePath();
+ Registry.targetPath = controller.getInstallPath();
+ Registry.saveSDKInfo(Registry.targetPath);
+
+ InstallManager.getInstance().initPackageList();
+
+ if (!installable) {
+ MessageBoxDlg.showDlg(
+ Display.getCurrent().getShells()[0],
+ "Error",
+ "Not enough disk space for the installation. Select a different installation path.",
+ DialogType.ERROR, false);
+ return;
+ }
+
+ if (!compositeSetInstallDirectoryPage.isWorkSpaceDuplicate()) {
+ int result = MessageBoxDlg.showDlg(
+ Display.getCurrent().getShells()[0],
+ "Warning",
+ "Tizen SDK data directory is used already. Do you want to continue?",
+ DialogType.WARNING, false);
+ if (result == MessageBoxDlg.NO) {
+ return;
+ }
+ }
+
+ btnBack.setVisible(false);
+ btnNext.setVisible(false);
+ List<Item> items = compositeInstallableListPage.getItems();
+ showComposite(compositeInstallingPage);
+ boolean result = compositeInstallingPage.loadPage(getSelectedPackageNames(items),
+ controller,
+ compositeSetInstallDirectoryPage.getInstallPath(),
+ window, false);
+ if (!result) {
+ showComposite(compositeInstallableListPage);
+ btnBack.setVisible(true);
+ btnNext.setVisible(true);
+ btnClose.setEnabled(true);
+ }
+ } else if (sl_composite.topControl == compositeUninstallablePage) {
+ showComposite(compositeUninstallingPage);
+ btnBack.setVisible(false);
+ btnNext.setVisible(false);
+ btnClose.setEnabled(false);
+ List<Item> items = compositeUninstallablePage.getItems();
+ boolean result = compositeUninstallingPage.loadPage(getSelectedPackageNames(items) /* compositeInstallablePage.getCheckedPackageNames()*/,
+ controller,
+ window);
+ if (!result) {
+ showComposite(compositeUninstallablePage);
+ btnBack.setVisible(true);
+ btnNext.setVisible(true);
+ btnClose.setEnabled(true);
+ }
+ }
+ }
+ });
+ btnNext.setBounds(447, 10, 78, 29);
+ }
+
+ private void setButtonBack(Composite composite) {
+ btnBack = new Button(composite, SWT.NONE);
+ btnBack.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (sl_composite.topControl == compositeLicensePage) {
+ btnNext.setEnabled(true);
+ btnBack.setVisible(false);
+ btnNext.setFocus();
+ showComposite(compositeWelcomePage);
+ } else if (sl_composite.topControl == compositeInstallableListPage || sl_composite.topControl == compositeUpdatableListPage) {
+ compositeInstallableListPage.getItems().clear();
+ if (controller.existRemovablePackage()) {
+ btnBack.setVisible(false);
+ showComposite(compositeWelcomePage);
+ } else {
+ showComposite(compositeLicensePage);
+ }
+ btnNext.setEnabled(true);
+ btnNext.setText("Next");
+ } else if (sl_composite.topControl == compositeSetInstallDirectoryPage) {
+ showComposite(compositeInstallableListPage);
+ btnNext.setText("Next");
+ btnNext.setEnabled(true);
+ } else if (sl_composite.topControl == compositeUninstallablePage) {
+ showComposite(compositeWelcomePage);
+ btnNext.setText("Next");
+ btnNext.setEnabled(true);
+ btnBack.setVisible(false);
+ }
+ }
+ });
+ btnBack.setBounds(363, 10, 78, 29);
+ btnBack.setText("Back");
+ btnBack.setVisible(false);
+ }
+
+ private void initWelcomePage() {
+ compositeWelcomePage.setViewController(controller);
+
+ if (ErrorController.checkInstallationSuccess()) {
+// compositeWelcomePage.setTitle(WelcomePage.STRING_TITLE);
+// compositeWelcomePage.setSubTitleBounds(20, 190, 600, 40);
+// compositeWelcomePage.setSubTitle(WelcomePage.STRING_SUBTITLE1);
+//
+// compositeWelcomePage.setVisibleRadioButton(true);
+// btnNext.setEnabled(true);
+ btnNext.setVisible(false);
+ btnClose.setText("Cancel");
+
+ btnClose.removeSelectionListener(closeBtnSelectionAdapter);
+ btnClose.removeSelectionListener(cancelBtnSelectionAdapter);
+ btnClose.addSelectionListener(cancelBtnSelectionAdapter);
+
+// compositeWelcomePage.setButtonStatus();
+ } else {
+ compositeWelcomePage.setVisibleRadioButton(false);
+ btnNext.setVisible(false);
+
+ compositeWelcomePage.setTitle("Cannot start Tizen SDK Install Manager.");
+
+ String errMsg = ErrorController.getErrorMessage();
+ String repository = Config.getInstance().getConfigFile().getRepository();
+
+ if (repository != null && !repository.isEmpty()) {
+ errMsg = errMsg + "\n(" + repository + ")";
+ }
+ compositeWelcomePage.setSubTitleBounds(20, 190, 600, 100);
+ compositeWelcomePage.setErrorSubTitle(errMsg);
+
+ btnClose.setText("Close");
+
+ btnClose.removeSelectionListener(closeBtnSelectionAdapter);
+ btnClose.removeSelectionListener(cancelBtnSelectionAdapter);
+ btnClose.addSelectionListener(closeBtnSelectionAdapter);
+ }
+ btnNext.setFocus();
+ sl_composite.topControl = compositeWelcomePage;
+ }
+
+ /**
+ * Refresh InstallManager.
+ * Refresh packages and configuration information.
+ */
+ public void refresh() {
+ final IndeterminateProgressDialog progressbar = IndeterminateProgressDialog.getInstance();
+ final Shell shell = progressbar.getParent();
+ shell.getDisplay().asyncExec(new Runnable(){
+ public void run() {
+ progressbar.updateName("Initializing...");
+
+ shell.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ PackageManager.dispose();
+ initInstallManager();
+ initWelcomePage();
+ }
+ });
+
+ //init end
+ progressbar.finish();
+ }
+ });
+
+ if (!shell.isDisposed()) {
+ progressbar.open();
+ }
+
+ Log.log("Window refresh end");
+ }
+
+ /**
+ * Checks if there's updatable meta package.
+ * Then print "updatable" to stdout.
+ */
+ private static void checkMetaPackageUpdate() {
+ if (PackageManager.getInstance().getUpdatableMetaPackages().size() != 0) {
+ System.out.println("updatable");
+ }
+ }
+
+ /**
+ * There is no UI, just download packages.
+ * @throws IMExitException
+ */
+ private static void onlyDownloadPackages() throws IMExitException {
+ ViewController controller = new ViewController();
+ controller.init();
+
+ InstallManager installManager = InstallManager.getInstance();
+ PackageManager packageManager = installManager.getPackageManager();
+
+ // Get all meta packages list by boundary.(eg. public, partner, all....)
+ PackageSet filteredMeta = filterPackageSet();
+ PackageSet downloadablePkgs = packageManager.getDependsPackagesFromRepository(filteredMeta);
+
+ // Download all meta packages.
+ boolean filteredPackages = false;
+ try {
+ filteredPackages = installManager.downloadPackages(
+ downloadablePkgs, null);
+ } catch (IMNetworkException e) {
+ Log.ExceptionLog(e);
+ return;
+ }
+
+ if (filteredPackages) {
+ Log.log("Success to download packages from repository");
+ } else {
+ Log.err("Fail to download packages from repository");
+ return;
+ }
+ }
+
+ private static PackageSet filterPackageSet() {
+ PackageManager pm = PackageManager.getInstance();
+
+ PackageSet downloadPackageList = pm.getLeafMetaPackages();
+
+ String boundary = Options.boundary;
+ if (boundary.equalsIgnoreCase("public")) {
+ PackageSet partnerMetaPackages = pm.getPartnerMetaPackages();
+
+ if (!partnerMetaPackages.isEmpty()) {
+ downloadPackageList.removeAll(partnerMetaPackages);
+ }
+ } else if (boundary.equalsIgnoreCase("partner")) {
+ PackageSet publicMetaPackages = pm.getPublicMetaPackages();
+
+ if (!publicMetaPackages.isEmpty()) {
+ downloadPackageList.removeAll(publicMetaPackages);
+ }
+ }
+
+ return downloadPackageList;
+ }
+
+ private static void showInstallManagerVersion() {
+ System.out.println("InstallManager Version : " +
+ Config.getInstance().getInstallManagerVersion().toString());
+ }
+
+ /**
+ * Logging all system information.
+ */
+ private static void loggingProperty() {
+ Log.log("=========== System properties ===========");
+ Properties sysprops = System.getProperties();
+ for (Enumeration e = sysprops.propertyNames(); e.hasMoreElements();) {
+ String key = (String) e.nextElement();
+ String value = sysprops.getProperty(key);
+ Log.log(key + " = " + value);
+ }
+
+ Log.log("=========== Environment variables ===========");
+
+ Map<String, String> env = System.getenv();
+ Set<String> set = env.keySet();
+ Iterator<String> iter = set.iterator();
+
+ while (iter.hasNext()) {
+ String key = (String) iter.next();
+ Set<Entry<String, String>> value = env.entrySet();
+ Log.log(key + " = " + value);
+ }
+ Log.log("=============================================");
+ }
+
+ /**
+ * Launch the application.
+ *
+ * @param args
+ */
+ public static void main(String args[]) {
+ //performance measurement
+ Performance.setIMStartTime();
+
+ InstallManager.deleteTempFile();
+
+ Log.open();
+ Log.LogTitle("Installmanager start");
+ Log.log(Platform.getPlatformInfo());
+ Log.log(PathUtil.getCurrentDir());
+
+ if (Options.propertyLogging) {
+ loggingProperty();
+ }
+
+ try {
+ Options.loadCmdArgs(args);
+ } catch (IMFatalException e) {
+ Log.err("Check your options. => " + Arrays.toString(args));
+ System.out.println("Check your options. => " + Arrays.toString(args));
+ return;
+ }
+
+ try {
+ if (Options.onlyDownload) {
+ onlyDownloadPackages();
+ System.exit(0);
+ } else if (Options.doInstallNoUI) {
+ if (InstallManagerNoUI.cliInstall(Options.packages)) {
+ Log.log("Success to command line install.");
+ System.out.println("Success to console install.");
+ } else {
+ Log.log("Fail to command line install.");
+ System.out.println("Fail to console install.");
+ }
+
+ Performance.setIMEndTime();
+ if (Options.doTest) {
+ Performance.printTestResultXmlFormat();
+// Performance.printTestResultXmlFormat2();
+ }
+
+ System.exit(0);
+ } else if (Options.doRemoveNoUI) {
+ if (InstallManagerNoUI.cliUninstall(Options.packages)) {
+ Log.log("Success to command line remove.");
+ System.out.println("Success to remove.");
+ } else {
+ Log.log("Fail to command line remove.");
+ System.out.println("Fail to remove.");
+ }
+
+ Performance.setIMEndTime();
+ if (Options.doTest) {
+ Performance.printTestResultXmlFormat();
+// Performance.printTestResultXmlFormat2();
+ }
+
+ System.exit(0);
+ } else if (Options.showVersion) {
+ showInstallManagerVersion();
+ System.exit(0);
+ } else if (Options.doShowHelp) {
+ InstallManagerNoUI.cliShowHelp();
+ System.exit(0);
+ }
+
+ if (Platform.isMacOS()) {
+ System.setProperty("apple.laf.useScreenMenuBar", "true");
+ System.setProperty(
+ "com.apple.mrj.application.apple.menu.about.name",
+ "Emulator Manager");
+ Display display = Display.getDefault();
+ display.syncExec(new Runnable() {
+ @Override
+ public void run() {
+ new CocoaUtil().removeTopMenuItems();
+ }
+ });
+ }
+
+ window = new InstallManagerWindow();
+ window.setBlockOnOpen(true);
+
+ window.init();
+
+ Log.log("after init");
+ if (Options.checkPackageUpdate) {
+ checkMetaPackageUpdate();
+ } else if (Options.printDepGraph) {
+ InstallManager.getInstance().getPackageManager().printDepGraph();
+ } else if (Options.doShowDistListNoUI) {
+ InstallManagerNoUI.cliShowRepoInformation();
+ } else if (Options.doShowPackageListNoUI) {
+ InstallManagerNoUI.cliShowPackageList();
+ } else if (Options.doShowSDKInstallStatus) {
+ InstallManagerNoUI.cliShowInstallInformation();
+ } else {
+ window.open();
+ if (Display.getCurrent() != null
+ && !Display.getCurrent().isDisposed()) {
+ Display.getCurrent().dispose();
+ }
+ }
+ } catch (IMExitException e) {
+ // do not remove sdk temp dir if exit for self update
+ if (ErrorController.getExitCode() == Config.EXITCODE_HAS_SELF_UPDATE) {
+ Options.doRemoveTempTizenSDK = false;
+ }
+
+ Log.log("Gracefully exit");
+ } catch (Throwable e) {
+ Log.err("Unexpected error occurred");
+ Log.ExceptionLog(e);
+
+ if (Options.doInstallNoUI || Options.doRemoveNoUI) {
+ PathUtil.remove(Registry.REGISTRY_FILE_PATH);
+ PathUtil.remove(Registry.MULTI_SDK_FILE_PATH);
+ System.out.println("Fatal error occurred.");
+ System.exit(0);
+ }
+
+ // show error message
+ if (window != null) {
+ window.open();
+
+ if (Display.getCurrent() != null
+ && !Display.getCurrent().isDisposed()) {
+ Display.getCurrent().dispose();
+ }
+ }
+
+ ErrorController.setExitCode(Config.EXITCODE_UNKNOWN_ERROR);
+ } finally {
+ if (Platform.isWindows()) {
+ ProgramController.createProgramController().removeSDKTempDir();
+ }
+
+ //performance measurement
+ Performance.setIMEndTime();
+ Performance.printToLogFile();
+
+ if (Options.doTest) {
+ Performance.printTestResultXmlFormat();
+// Performance.printTestResultXmlFormat2();
+ }
+
+ Log.LogTitle("Installmanager finish");
+ Log.close();
+
+ if (Platform.isMacOS()) {
+ System.exit(ErrorController.getExitCode());
+ } else {
+ if (ErrorController.getExitCode() == Config.EXITCODE_HAS_SELF_UPDATE) {
+ String binary = PathUtil.get(Registry.getInstalledPath(), Config.INSTALL_MANAGER_DIRECTORY, Config.EXECUTE_FILE_NAME_OF_INSTALL_MANAGER);
+ try {
+ Runtime.getRuntime().exec(binary);
+ } catch (IOException e) {
+ Log.ExceptionLog(e);
+ }
+ } else if (ErrorController.getExitCode() != Config.EXITCODE_NORMAL) {
+ System.exit(ErrorController.getExitCode());
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ newShell.setBackground(getBackgroundColor());
+ newShell.setMinimumSize(getInitialSize());
+ newShell.setSize(getInitialSize());
+ newShell.setImage(getWindowIconImage());
+ super.configureShell(newShell);
+
+ newShell.setText("Tizen SDK Install Manager");
+ }
+
+ @Override
+ /**
+ * Install manager window is close.
+ */
+ public boolean close() {
+ return false;
+ }
+
+ /**
+ * Return the initial size of the window.
+ */
+ @Override
+ protected Point getInitialSize() {
+ return POINT_MAIN_WINDOW;
+ }
+
+ /**
+ * Show the composite depending on parameter.
+ * @param composite
+ */
+ public void showComposite(Composite composite) {
+ StackLayout layout;
+ if (composite.getParent().getLayout() instanceof StackLayout) {
+ layout = (StackLayout) composite.getParent().getLayout();
+ layout.topControl = composite;
+ }
+ composite.getParent().layout();
+ }
+
+// private void registLicensePageListener() {
+// compositeLicensePage.getAcceptButton()
+// .addSelectionListener(new SelectionAdapter() {
+//
+// @Override
+// public void widgetSelected(SelectionEvent e) {
+// btnNext.setEnabled(compositeLicensePage.getAcceptButton()
+// .getSelection());
+// }
+// });
+// }
+
+ private void registCompletePageListener() {
+ compositeCompletePage.addPaintListener(new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent arg0) {
+ btnClose.setText("Close");
+ }
+ });
+ }
+
+ public void setNameOfCancelButton(String name) {
+ btnClose.setText("Close");
+ }
+
+ /**
+ * Get selected package names on installing
+ * @param items
+ * @return list of selected package names.
+ */
+ public List<String> getSelectedPackageNames(List<Item> items) {
+ List<String> list = new ArrayList<String>();
+ for (int i = 0; i < items.size(); i++) {
+ items.get(i).getTerminalPackages(list, true);
+ }
+
+ return list;
+ }
+
+ /**
+ * Installed packages do not have package version, installmanager will show warning dialog.
+ * @return
+ */
+ private boolean checkVaildPkgVersion() {
+ PackageSet installedPkgs = controller.getInstalledPackages();
+ if (!installedPkgs.isEmpty()) {
+ for (Package pkg : installedPkgs) {
+ String vs = pkg.getVersion().toString();
+ if (vs != "" && vs.equals("0.0.0")) {
+ Log.err("Package version not found. ==> " + pkg.getPackageName());
+ int confirm = MessageBoxDlg.showDlg(getShell(),
+ "WARNING",
+ "'" + pkg.getPackageName() + "'" + " package version is not found.\n" +
+ "If you keep installing Tizen SDK, some unexpected may occur.\n" +
+ "Do you want to continue?",
+ DialogType.WARNING, false);
+ if (confirm == MessageBoxDlg.YES) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Get install manager window object.
+ * @return install manager window object.
+ */
+ public static InstallManagerWindow getInstallManagerWindow() {
+ return window;
+ }
+
+ /**
+ * Get complete page composite object
+ * @return complete page composite object
+ */
+ public CompletePage getCompletePage() {
+ return compositeCompletePage;
+ }
+
+ public LicensePage getLicensePage() {
+ return compositeLicensePage;
+ }
+
+ public InstallableListPage getComponentSelectionPage() {
+ return compositeInstallableListPage;
+ }
+
+ public WelcomePage getWelcomePage() {
+ return compositeWelcomePage;
+ }
+
+ /**
+ * Get setInstallDirectoryPage composite object
+ * @return complete page composite object
+ */
+ public SetInstallDirectoryPage getSetInstallDirectoryPage() {
+ return compositeSetInstallDirectoryPage;
+ }
+
+ public Button getNextButton() {
+ return btnNext;
+ }
+
+ /**
+ * If parameter is true, 'Next' button will be enabled. but false, 'Next' button will be disabled.
+ * @param enabled
+ */
+ public static void setNextBtnEnabled(boolean enabled) {
+ btnNext.setEnabled(enabled);
+ }
+
+ /**
+ * If parameter is true, 'Back' button will be enabled. but false, 'Back' button will be disabled.
+ * @param enabled
+ */
+ public static void setBackBtnEnabled(boolean enabled) {
+ btnBack.setEnabled(enabled);
+ }
+
+ /**
+ * If parameter is true, 'Cancel' button will be enabled. but false, 'Cancel' button will be disabled.
+ * @param enabled
+ */
+ public void setCancelBtnEnabled(boolean enabled) {
+ btnClose.setEnabled(enabled);
+ }
+
+ public ViewController getViewController() {
+ return controller;
+ }
+}
+
--- /dev/null
+package org.tizen.installmanager.ui.lib;
+
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseTrackAdapter;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+
+public class IMButton extends Canvas{
+ Image displayImage = null;
+ Image sourceImage = null;
+ Image hoverImage = null;
+ boolean selected_flag = false;
+
+ public IMButton(Composite parent, int style) {
+ super(parent, style);
+ init();
+ }
+
+ public void setSize(Rectangle rect){
+ setBounds(rect);
+ }
+
+ public void setBounds(int x, int y, int width, int height) {
+ setBounds(x, y, width, height);
+ }
+
+ public void setImage(String sourceImagePath){
+ sourceImage = new Image(Display.getDefault(), sourceImagePath);
+ displayImage = sourceImage;
+ }
+
+ public void setImage(String sourceImagePath,String hoverImagePath){
+ sourceImage = new Image(Display.getDefault(), sourceImagePath);
+ hoverImage = new Image(Display.getDefault(), hoverImagePath);
+ displayImage = sourceImage;
+ }
+
+ public void setImage(Image image){
+ sourceImage = image;
+ displayImage = sourceImage;
+ }
+
+ public void setImage(Image image, Image hover_image){
+ sourceImage = image;
+ hoverImage = hover_image;
+ displayImage = sourceImage;
+ }
+
+ public void setSelection(boolean selected) {
+ selected_flag = selected;
+ }
+
+ public boolean getSelection() {
+ return selected_flag;
+ }
+
+ private void init(){
+ this.addPaintListener(new PaintListener() {
+ public void paintControl(PaintEvent e) {
+ GC gc = e.gc;
+ if(displayImage != null){
+ gc.drawImage(displayImage, 0, 0, displayImage.getImageData().width, displayImage.getImageData().height, 0, 0, displayImage.getImageData().width, displayImage.getImageData().height);
+ }
+ }
+ });
+
+ this.addMouseTrackListener(new MouseTrackAdapter() {
+ @Override
+ public void mouseEnter(MouseEvent e) {
+ if (hoverImage != null) {
+ displayImage = hoverImage;
+ }
+ redraw();
+ }
+ @Override
+ public void mouseExit(MouseEvent e) {
+ displayImage = sourceImage;
+ redraw();
+ }
+ });
+
+// this.addMouseListener(new MouseAdapter(){
+// @Override
+// public void mouseUp(MouseEvent e) {
+//
+// }
+//
+// @Override
+// public void mouseDown(MouseEvent e) {
+// // TODO Auto-generated method stub
+// System.out.println("button is pushed.");
+// super.mouseDown(e);
+// }
+//
+// @Override
+// public void mouseDoubleClick(MouseEvent e) {
+// // TODO Auto-generated method stub
+// System.out.println("double click.");
+// super.mouseDoubleClick(e);
+// }
+// });
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * InstallManager
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Wooyoung Cho <wooyoung1.cho@samsung.com>
+ * Shihyun Kim <shihyun.kim@samsung.com>
+ * Taeyoung Son <taeyoung2.son@samsung.com>
+ * Yongsung kim <yongsung1.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.installmanager.ui.lib;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.tizen.installmanager.core.IMFatalException;
+import org.tizen.installmanager.lib.Log;
+import org.tizen.installmanager.ui.InstallManagerWindow;
+
+public class IMCircularGraph extends Composite {
+
+ private static final int DEFAULT_ANGLE = 90;
+ public static final int TYPE_PERCENT = 0;
+ public static final int TYPE_CUSTOM = 1;
+
+ private Canvas canvas;
+ private Label label;
+ private Label emptyLabel;
+
+ private Font labelFont = getShell().getDisplay().getSystemFont();
+ private Font valueFont = getShell().getDisplay().getSystemFont();
+ private Font measureFont = getShell().getDisplay().getSystemFont();
+
+ private long max = 100;
+ private long value = 0;
+
+ public Color COLOR_LIGHT_BLUE = new Color(null, new RGB(131, 196, 218));
+ public Color COLOR_LIGHT_GRAY = new Color(null, new RGB(189, 189, 189));
+ public Color COLOR_WHITE = new Color(null, new RGB(255, 255, 255));
+
+ private Color graphColor = COLOR_LIGHT_BLUE;
+ private Color bgColor = COLOR_LIGHT_GRAY;
+ private Color centerColor = COLOR_WHITE;
+ private Color textColor = COLOR_LIGHT_BLUE;
+
+ private String measure;
+ private int type = TYPE_PERCENT;
+
+ private Image centerImage;
+
+// private static final int DEFAULT_WIDTH = 74;
+// private static final int DEFAULT_HEIGHT = 74;
+
+ private static final int DEFAULT_WIDTH = 78;
+ private static final int DEFAULT_HEIGHT = 78;
+
+ public IMCircularGraph(Composite parent, int style, int type) {
+ super(parent, style);
+ this.setLayout(new FormLayout());
+ this.type = type;
+
+ if (type == TYPE_PERCENT) {
+ measure = "%"; //$NON-NLS-1$
+ } else {
+ measure = ""; //$NON-NLS-1$
+ }
+
+ canvas = new Canvas(this, SWT.DOUBLE_BUFFERED);
+ canvas.addPaintListener(paintListener);
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 0);
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ // data.bottom = new FormAttachment(100, -25);
+ // data.width = 74;
+ data.height = 78;
+ canvas.setLayoutData(data);
+
+ emptyLabel = new Label(this, SWT.TRANSPARENT);
+ data = new FormData();
+ data.top = new FormAttachment(canvas, 0);
+ data.left = new FormAttachment(0, 0);
+ data.height = 3;
+ data.right = new FormAttachment(100, 0);
+ emptyLabel.setLayoutData(data);
+
+ label = new Label(this, SWT.TRANSPARENT);
+ label.setForeground(textColor);
+ label.setFont(labelFont);
+ label.setAlignment(SWT.CENTER);
+ data = new FormData();
+ data.top = new FormAttachment(emptyLabel, 0);
+ data.left = new FormAttachment(0, 0);
+ data.height = 25;
+ data.right = new FormAttachment(100, 0);
+ label.setLayoutData(data);
+ }
+
+ private PaintListener paintListener = new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ Rectangle rect = canvas.getBounds();
+ int x = rect.x;
+ int y = rect.y;
+ int width = rect.width;
+ int height = rect.height;
+
+// x = (width > DEFAULT_WIDTH) ? x + (width - DEFAULT_WIDTH) / 2 : x;
+// y = (height > DEFAULT_HEIGHT) ? y + (height - DEFAULT_HEIGHT) / 2 : y;
+// x = 37;
+// y = 37;
+ // if (width > height) {
+ // x += (rect.width - rect.height) / 2;
+ // width = height;
+ // } else if (width < height) {
+ // y += (rect.height - rect.width) / 2;
+ // height = width;
+ // }
+
+// x = y = 0;
+// width = height = 78;
+ e.gc.setAntialias(SWT.ON);
+ e.gc.setBackground(bgColor);
+ e.gc.fillOval(x, y, width, height);
+ e.gc.setBackground(graphColor);
+ e.gc.fillArc(x, y, width, height, DEFAULT_ANGLE, calculateAngle());
+ // e.gc.setBackground(ColorResources.BLACK);
+ e.gc.setBackground(centerColor);
+ e.gc.fillOval(x + 11, y + 11, 56, 56);
+
+ if (type == TYPE_PERCENT) {
+ // Draws text.
+ String centerText = getCenterText();
+
+ e.gc.setFont(valueFont);
+ e.gc.setForeground(graphColor);
+ Point textSize = e.gc.textExtent(centerText, SWT.DRAW_MNEMONIC);
+ e.gc.drawText(centerText, (rect.width - textSize.x) / 2,
+ 28 - 6 + 1, true);
+ // (rect.height - textSize.y) / 2 - 5, true);
+
+ e.gc.setFont(measureFont);
+ e.gc.setForeground(graphColor);
+ Point measureSize = e.gc.textExtent(measure, SWT.DRAW_MNEMONIC);
+ e.gc.drawText(measure, (rect.width - measureSize.x) / 2,
+ 46 - 4 + 1, true);
+ // (rect.height - measureSize.y) / 2 - 5 + textSize.y, true);
+ } else if (type == TYPE_CUSTOM) {
+ e.gc.drawImage(centerImage, x + 11, y + 11);
+ } else {
+ Log.log("Unsupported circle style.");
+ throw new IMFatalException("Unsupported circle style.");
+ }
+ }
+ };
+
+ public void setMax(long max) {
+ this.max = max;
+ canvas.redraw();
+ }
+
+ public void update(long max, long value) {
+ this.max = max;
+ this.value = value;
+ canvas.redraw();
+ canvas.update();
+ }
+
+ public void update(long value) {
+ this.value = value;
+ canvas.redraw();
+ }
+
+ private int calculateAngle() {
+ int angle = (int) (360 * ((float) value / max)) * (-1);
+ return angle;
+ }
+
+ public void setText(String text) {
+ label.setForeground(textColor);
+ label.setText(text);
+ }
+
+ public void setLabelFont(Font font) {
+ label.setFont(font);
+ this.labelFont = font;
+ }
+
+ public void setValueFont(Font font) {
+ this.valueFont = font;
+ }
+
+ public void setMeasureFont(Font font) {
+ this.measureFont = font;
+ }
+
+ public void setLabelBg(Color color) {
+ label.setBackground(color);
+ emptyLabel.setBackground(color);
+ }
+
+ public void setTextColor(Color color) {
+ textColor = color;
+ }
+
+ private String getCenterText() {
+ String str = null;
+ if (type == TYPE_PERCENT) {
+ int percent = (int) (((float) value / max) * 100);
+ str = Integer.toString(percent);
+ } else {
+ // type : memory size
+ if (value >= 1024) {
+ double dValue = (value) / 1024.;
+ if (dValue >= 1024. * 1024) {
+ dValue = (dValue) / 1024. * 1024;
+ setMeasure("GB"); //$NON-NLS-1$
+ } else if (dValue >= 1024.) {
+ dValue = (dValue) / 1024.0;
+ setMeasure("MB"); //$NON-NLS-1$
+ } else {
+ setMeasure("KB"); //$NON-NLS-1$
+ }
+ str = toDoubleFormat1(Double.toString(dValue));
+ } else {
+ str = Long.toString(value);
+ }
+ }
+ return str;
+ }
+
+ public void setMeasure(String m) {
+ measure = m;
+ }
+
+ public void setGraphColor(Color color) {
+ graphColor = color;
+ }
+
+ public void setGraphBgColor(Color color) {
+ bgColor = color;
+ }
+
+ public void setCenterColor(Color color) {
+ centerColor = color;
+ }
+
+ public void setCanvasColor(Color color) {
+ canvas.setBackground(color);
+ }
+
+ public void setCenterImage(Image image) {
+ centerImage = image;
+ }
+
+ public static String toDoubleFormat1(String value) {
+ if (null == value || value.isEmpty()) {
+ return null;
+ }
+
+ try {
+ double data = Double.parseDouble(value);
+ return String.format("%.1f", data); //$NON-NLS-1$
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ return value;
+ }
+ }
+}
+
* @param style
*/
public CompletePage(Composite parent, int style) {
- super(parent, style);
+ super(parent, style, true);
setLeftImageFromResource(RSC_PATH_INSTALL_IMAGE);
setTitle(STRING_TITLE);
* @param style
*/
public ConfigPathPage(Composite parent, int style) {
- super(parent, style);
+ super(parent, style, true);
setLeftImageFromResource(RSC_PATH_IMAGE);
setTitle(STRING_TITLE);
setSubTitle(STRING_SUBTITLE);
--- /dev/null
+package org.tizen.installmanager.ui.page;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.tizen.installmanager.core.IMFatalException;
+import org.tizen.installmanager.lib.Log;
+import org.tizen.installmanager.ui.InstallManagerWindow;
+import org.tizen.installmanager.ui.lib.IMCircularGraph;
+import org.tizen.installmanager.util.PathUtil;
+
+public class InstallPage extends PageTemplate {
+ static final String RSC_PATH_IMAGE_NEW = RESOURCE_PATH_NEW + "/05_ready_to_install_bg.png";
+ static final String RSC_PROGRESS_IMAGE_START = RESOURCE_PATH_NEW + "/progress_start.png";
+ static final String RSC_PROGRESS_IMAGE_CENTER = RESOURCE_PATH_NEW + "/progress_center.png";
+ static final String RSC_PROGRESS_IMAGE_BACKGROUND = RESOURCE_PATH_NEW + "/progress_center_bg.png";
+ static final Color PROGRESS_CIRCLE_BACKGROUND = new Color(null, new RGB(189, 189, 189)); // light gray
+ static final Color PROGRESS_CIRCLE_COLOR = new Color(null, new RGB(131, 196, 218)); // light blue
+ static final Color PROGRESS_CIRCLE_CENTER = new Color(null, new RGB(255, 255, 255)); // white
+ protected Label titleLabel;
+ private IMCircularGraph progressGrapgh;
+// private int circularType = 0; // 0 is percentage, 1 is custom.
+
+ protected enum CIRCULAR_TYPE { PERCENTAGE, CUSTOM };
+
+ public InstallPage(Composite parent, int style, boolean isTemplateUsed) {
+ super(parent, style, isTemplateUsed);
+
+ setLeftImageFromResource(RSC_PATH_IMAGE_NEW);
+ setTitleLabel(getCustomComposite());
+// setProgressImage(getCustomComposite());
+ }
+
+ private void setTitleLabel(Composite composite) {
+ titleLabel = new Label(composite, SWT.NONE);
+ titleLabel.setBounds(10, 6, 200, 23);
+ titleLabel.setBackground(InstallManagerWindow.getBackgroundColor());
+ }
+
+ protected void setProgressCircle(Composite composite, CIRCULAR_TYPE circularType) {
+// Composite processComp = new Composite(composite, SWT.NONE);
+// FormData data = new FormData();
+// data.top = new FormAttachment(0, 0);
+// data.right = new FormAttachment(100, 0);
+// data.width = 90;
+// data.height = 90;
+// progressGrapgh.setLayoutData(data);
+// progressGrapgh.setBackground(ColorResources.WHITE);
+// progressGrapgh.setLayout(new FillLayout());
+
+ if (circularType == CIRCULAR_TYPE.PERCENTAGE) {
+ progressGrapgh = new IMCircularGraph(composite, SWT.NONE, IMCircularGraph.TYPE_PERCENT);
+ } else if (circularType == CIRCULAR_TYPE.CUSTOM) {
+ progressGrapgh = new IMCircularGraph(composite, SWT.NONE, IMCircularGraph.TYPE_CUSTOM);
+ progressGrapgh.setCanvasColor(new Color(null, new RGB(34, 116, 28)));
+ progressGrapgh.setGraphBgColor(PROGRESS_CIRCLE_BACKGROUND);
+ progressGrapgh.setBounds(275, 42, 78, 78);
+ progressGrapgh.setCenterColor(PROGRESS_CIRCLE_CENTER);
+ } else {
+ Log.err("Unsupported circular style.");
+ throw new IMFatalException("Unsupported circular style.");
+ }
+// progressGrapgh.setCenterImage(PathUtil.getImageFromResource(RSC_PROGRESS_IMAGE_START));
+// progressGrapgh.setBackground(InstallManagerWindow.getBackgroundColor());
+
+// progressGrapgh.setCanvasColor(InstallManagerWindow.getBackgroundColor());
+
+// progressGrapgh.setGraphBgColor(ColorResources.BAR_GRAY1);
+// progressGrapgh.setGraphBgColor(InstallManagerWindow.getBackgroundColor());
+
+// progressGrapgh.setGraphColor(PROGRESS_CIRCLE_COLOR);
+
+// progressGrapgh.setMeasure(InformationViewLabels.SNAPSHOT_VIEW_BYTE);
+// progressGrapgh.setGraphColor(ColorResources.PROCESS_GRAPH_COLOR);
+// progressGrapgh.update(maxMem, processMem);
+// progressGrapgh.setTextColor(ColorResources.PROCESS_GRAPH_COLOR);
+// progressGrapgh.setText(InformationViewLabels.SNAPSHOT_VIEW_PROCESS);
+// progressGrapgh.setLabelBg(ColorResources.VIEW_BG_COLOR);
+// progressGrapgh.setLabelFont(FontResources.CIRCULAR_LABEL_FONT);
+// progressGrapgh.setMeasureFont(FontResources.CIRCULAR_GRAPH_MEASURE_FONT);
+// progressGrapgh.setValueFont(FontResources.CIRCULAR_GRAPH_VALUE_FONT);
+ }
+
+ protected void setTitleLabelText(String title) {
+ titleLabel.setText(title);
+ }
+
+ protected void setCircularCenterImage(Image image) {
+ progressGrapgh.setCenterImage(image);
+ }
+}
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.tizen.installmanager.lib.IMError;
import org.tizen.installmanager.lib.Log;
import org.tizen.installmanager.ui.InstallManagerWindow;
+import org.tizen.installmanager.ui.dialog.AddExtraRepositoryDialog;
import org.tizen.installmanager.ui.model.Item;
+import org.tizen.installmanager.util.PathUtil;
import org.tizen.installmanager.pkg.lib.PackageManager;
import org.tizen.installmanager.pkg.model.Package;
*/
public class InstallableListPage extends PackageListPage {
- static final String RSC_PATH_IMAGE = RESOURCE_PATH
+ private static final String RSC_PATH_IMAGE = RESOURCE_PATH
+ "/install_manager_graphicmotif_002.png";
- static final String STRING_TITLE = "Install Type";
+ private static final String RSC_PATH_IMAGE_NEW = RESOURCE_PATH_NEW + "/02_installation_option_bg.png";
+ private static final String RSC_PATH_BUTTON_NORMAL = RESOURCE_PATH_NEW + "/btn_01_normal.png";
+ private static final String RSC_PATH_BUTTON_HOVER = RESOURCE_PATH_NEW + "/btn_01_hover.png";
+ private static final String RSC_PATH_BUTTON_PUSHED = RESOURCE_PATH_NEW + "/btn_01_pushed.png";
+ private static final String RSC_PATH_BUTTON_SELECTED = RESOURCE_PATH_NEW + "/btn_01_selected.png";
+
+ private static final String STRING_TITLE = "Select installation type";
// Web, Native minimal packages name.
- static final String TYPICAL_PACKAGE_NAME = "TYPICAL";
- static final String MINIMAL_PACKAGE_NAME = "MINIMAL";
- static final String WEB_MINIMAL_PACKAGE_NAME = "WEB-MINIMAL";
- static final String NATIVE_MINIMAL_PACKAGE_NAME = "NATIVE-MINIMAL";
+ private static final String TYPICAL_PACKAGE_NAME = "TYPICAL";
+ private static final String MINIMAL_PACKAGE_NAME = "MINIMAL";
+ private static final String WEB_MINIMAL_PACKAGE_NAME = "WEB-MINIMAL";
+ private static final String NATIVE_MINIMAL_PACKAGE_NAME = "NATIVE-MINIMAL";
// UI button names
- static final String TYPICAL_BUTTON_NAME = "Typical";
- static final String MINIMAL_BUTTON_NAME = "Minimal";
- static final String CUSTOM_BUTTON_NAME = "Custom";
- static final String WEB_MINIMAL_BUTTON_NAME = "Web app tools";
- static final String NATIVE_MINIMAL_BUTTON_NAME = "Native app tools";
+ private static final String TYPICAL_BUTTON_NAME = "Typical";
+ private static final String MINIMAL_BUTTON_NAME = "Minimal";
+ private static final String CUSTOM_BUTTON_NAME = "Custom";
+ private static final String WEB_MINIMAL_BUTTON_NAME = "Web app";
+ private static final String NATIVE_MINIMAL_BUTTON_NAME = "Native app";
private Composite buttonComposite;
private Button customButton;
private Button webMinimalButton;
private Button nativeMinimalButton;
+ private Button addExtraButton;
- // Install Type Explain Label
- private Label typicalLabel;
- private Label minimalLabel;
+ private AddExtraRepositoryDialog extraDialog = null;
/**
* @param parent
*/
public InstallableListPage(Composite parent, int style) {
super(parent, style, Type.INSTALL);
- setLeftImageFromResource(RSC_PATH_IMAGE);
- setTitleBounds(160, 3, 468, 20);
- disableSubtitleBounds();
- setTitle(STRING_TITLE);
- buttonComposite = new Composite(this, SWT.NONE);
+ setLeftImageFromResource(RSC_PATH_IMAGE_NEW);
+ disableTitleBounds();
+ disableSubtitleBounds();
+
+ buttonComposite = new Composite(getCustomComposite(), SWT.NONE);
- buttonComposite.setSize(468, 60);
- buttonComposite.setLocation(160, 27);
+// buttonComposite.setSize(10, 60);
+// buttonComposite.setLocation(160, 27);
+ buttonComposite.setBounds(10, 31, 134, 268);
buttonComposite.setBackground(InstallManagerWindow.getBackgroundColor());
-
+// buttonComposite.setBackground(new Color(null, new RGB(159, 201, 60)));
+
setButtons();
}
* Set Install Type radio buttons.
*/
private void setButtons() {
+ setTitleLabelText(STRING_TITLE);
setTypicalButton();
setMinimalButton();
setCustomButton();
+ setAddRepositoryButton();
setWebMinimalButton();
setNativeMinimalButton();
*/
private void setTypicalButton() {
if (typicalButton == null) {
- typicalButton = new Button(buttonComposite, SWT.RADIO);
+ typicalButton = new Button(buttonComposite, SWT.PUSH | SWT.LEFT);
}
typicalButton.setSelection(true);
public void widgetSelected(SelectionEvent e) {
refreshByType(InstallType.TYPICAL);
- if (viewController.hasWebNativeMinimal()) {
- minimalLabel.setVisible(true);
-
- webMinimalButton.setVisible(false);
- nativeMinimalButton.setVisible(false);
-
- // These checkbox button can be enabled for only Minimal button.
- webMinimalButton.setEnabled(false);
- nativeMinimalButton.setEnabled(false);
- }
-
+// if (viewController.hasWebNativeMinimal()) {
+// minimalLabel.setVisible(true);
+//
+// webMinimalButton.setVisible(false);
+// nativeMinimalButton.setVisible(false);
+//
+// // These checkbox button can be enabled for only Minimal button.
+// webMinimalButton.setEnabled(false);
+// nativeMinimalButton.setEnabled(false);
+// }
+
+ customButton.setBounds(0, 76, 134, 34);
+ addExtraButton.setBounds(0, 114, 133, 34);
String description = viewController.getDescription(TYPICAL_PACKAGE_NAME);
setComponentDescriptionText(description);
}
});
- typicalButton.setBounds(0, 0, 82, 17);
- typicalButton.setText(TYPICAL_BUTTON_NAME + ":");
+ typicalButton.setBounds(0, 0, 134, 34);
+ typicalButton.setText(TYPICAL_BUTTON_NAME);
typicalButton.setBackground(InstallManagerWindow.getBackgroundColor());
+ typicalButton.setBackgroundImage(PathUtil.getImageFromResource(RSC_PATH_BUTTON_NORMAL));
- typicalLabel = new Label(buttonComposite, SWT.NONE);
- typicalLabel.setBounds(84, 0, 410, 17);
+// typicalLabel = new Label(buttonComposite, SWT.NONE);
+// typicalLabel.setBounds(84, 0, 410, 17);
}
/**
*/
private void setMinimalButton() {
if (minimalButton == null) {
- minimalButton = new Button(buttonComposite, SWT.RADIO);
+ minimalButton = new Button(buttonComposite, SWT.PUSH | SWT.LEFT);
}
minimalButton.addSelectionListener(new SelectionAdapter() {
} else if (webMinimalButton.getSelection() && nativeMinimalButton.getSelection()) {
refreshByType(InstallType.MINIMAL);
}
-
- minimalLabel.setVisible(false);
-
webMinimalButton.setVisible(true);
webMinimalButton.setEnabled(true);
-
+
nativeMinimalButton.setVisible(true);
- nativeMinimalButton.setEnabled(true);
+ nativeMinimalButton.setEnabled(true);
} else {
refreshByType(InstallType.MINIMAL);
}
+ customButton.setBounds(0, 152, 134, 34);
+ addExtraButton.setBounds(0, 190, 134, 34);
String description = viewController.getDescription(MINIMAL_PACKAGE_NAME);
setComponentDescriptionText(description);
}
});
- minimalButton.setBounds(0, 20, 82, 17);
- minimalButton.setText(MINIMAL_BUTTON_NAME + ":");
+ minimalButton.setBounds(0, 38, 134, 34);
+ minimalButton.setText(MINIMAL_BUTTON_NAME);
minimalButton.setBackground(InstallManagerWindow.getBackgroundColor());
-
- minimalLabel = new Label(buttonComposite, SWT.NONE);
- minimalLabel.setBounds(84, 20, 410, 17);
+ minimalButton.setBackgroundImage(PathUtil.getImageFromResource(RSC_PATH_BUTTON_NORMAL));
}
/**
webMinimalButton = new Button(buttonComposite, SWT.CHECK);
}
- webMinimalButton.setBounds(100, 20, 150, 17);
+ webMinimalButton.setBounds(14, 76, 120, 34);
webMinimalButton.setText(WEB_MINIMAL_BUTTON_NAME);
webMinimalButton.setBackground(InstallManagerWindow.getBackgroundColor());
webMinimalButton.setVisible(false);
nativeMinimalButton = new Button(buttonComposite, SWT.CHECK);
}
- nativeMinimalButton.setBounds(250, 20, 150, 17);
+ nativeMinimalButton.setBounds(14, 114, 120, 34);
nativeMinimalButton.setText(NATIVE_MINIMAL_BUTTON_NAME);
nativeMinimalButton.setBackground(InstallManagerWindow.getBackgroundColor());
nativeMinimalButton.setVisible(false);
nativeMinimalButton.setEnabled(false);
+// nativeMinimalButton.setSelection(false);
nativeMinimalButton.addSelectionListener(new SelectionAdapter() {
@Override
*/
private void setCustomButton() {
if (customButton == null) {
- customButton = new Button(buttonComposite, SWT.RADIO);
+ customButton = new Button(buttonComposite, SWT.PUSH | SWT.LEFT);
}
- customButton.setBounds(0, 40, 80, 17);
+ customButton.setBounds(0, 76, 134, 34);
customButton.setText(CUSTOM_BUTTON_NAME);
customButton.setBackground(InstallManagerWindow.getBackgroundColor());
customButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- if (viewController.hasWebNativeMinimal()) {
- minimalLabel.setVisible(true);
-
- webMinimalButton.setVisible(false);
- nativeMinimalButton.setVisible(false);
-
- // These checkbox button can be enabled for only Minimal button.
- webMinimalButton.setEnabled(false);
- nativeMinimalButton.setEnabled(false);
-
- setComponentDescriptionText("Position your mouse pointer over an item to view its description.");
- }
+// if (viewController.hasWebNativeMinimal()) {
+// minimalLabel.setVisible(true);
+//
+// webMinimalButton.setVisible(false);
+// nativeMinimalButton.setVisible(false);
+//
+// // These checkbox button can be enabled for only Minimal button.
+// webMinimalButton.setEnabled(false);
+// nativeMinimalButton.setEnabled(false);
+//
+// setComponentDescriptionText("Position your mouse pointer over an item to view its description.");
+// }
checkboxTreeViewer.getTree().setEnabled(true);
+ setComponentDescriptionText("Position your mouse pointer over an item to view its description.");
+ }
+ });
+ }
+
+ /**
+ * Set add Repository button.
+ */
+ private void setAddRepositoryButton() {
+ if (addExtraButton == null) {
+ addExtraButton = new Button(buttonComposite ,SWT.NONE | SWT.LEFT);
+ }
+
+ addExtraButton.setBounds(0, 114, 133, 34);
+ addExtraButton.setText("Extra repository");
+ addExtraButton.setBackground(InstallManagerWindow.getBackgroundColor());
+
+ addExtraButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ extraDialog = new AddExtraRepositoryDialog(buttonComposite.getShell(), viewController);
+ extraDialog.open();
+
+// if (sl_composite.topControl == compositeComponentSelectionPage) {
+// compositeComponentSelectionPage.loadPage(controller);
+// } else if (sl_composite.topControl == compositeUpdatableListPage) {
+// compositeUpdatableListPage.loadPage(controller);
+// }
}
});
}
* Initialize minimal selection when installable page is re-loaded.
*/
private void initMinimalSetting() {
- minimalLabel.setVisible(true);
-
webMinimalButton.setSelection(true);
nativeMinimalButton.setSelection(false);
typicalExplain = typicalPackage.getDescription();
}
- typicalLabel.setText(typicalExplain);
- typicalLabel.setBackground(InstallManagerWindow.getBackgroundColor());
-
//set minimal description
String minimalExplain = "";
Package minimalPackage = pm.getPackageByName(MINIMAL_PACKAGE_NAME);
minimalExplain = minimalPackage.getDescription();
}
- minimalLabel.setText(minimalExplain);
- minimalLabel.setBackground(InstallManagerWindow.getBackgroundColor());
-
String description = viewController.getDescription(TYPICAL_PACKAGE_NAME);
setComponentDescriptionText(description);
}
* @author Taeyoung Son <taeyoung2.son@samsung.com>\r
* \r
*/\r
-public class InstallingPage extends PageTemplate {\r
- static final String RSC_PATH_IMAGE = RESOURCE_PATH\r
- + "/install_manager_graphicmotif_003.png";\r
- static final String STRING_TITLE = "Installation Progress";\r
- static final String STRING_SUBTITLE = "Wait while the Tizen SDK installation is being processed.";\r
+public class InstallingPage extends InstallPage {\r
+ static final String STRING_TITLE = "Installing...";\r
\r
static final double KB_SIZE = 1;\r
static final double MB_SIZE = KB_SIZE * 1024;\r
* @param style\r
*/\r
public InstallingPage(Composite parent, int style) {\r
- super(parent, style);\r
+ super(parent, style, true);\r
+ disableTitleBounds();\r
+ disableSubtitleBounds();\r
+ \r
+ setTitleLabelText(STRING_TITLE);\r
\r
- setLeftImageFromResource(RSC_PATH_IMAGE);\r
- setTitle(STRING_TITLE);\r
- setSubTitle(STRING_SUBTITLE);\r
+// setLeftImageFromResource(RSC_PATH_IMAGE);\r
+// setTitle(STRING_TITLE);\r
+// setSubTitle(STRING_SUBTITLE);\r
\r
// download progress bar\r
downloadProgressBar = new ProgressBar(customComposite, SWT.NONE);\r
installRemainingTimeLabel.setForeground(new Color(null, 0, 108, 209));\r
installRemainingTimeLabel.setText("Remaining time");\r
}\r
+ \r
+// private void setRequiredSpaceLabel() {\r
+// spaceRequiredLabel = new Label(customComposite, SWT.CENTER);\r
+// spaceRequiredLabel.setBounds(10, 133, 628, 20);\r
+// spaceRequiredLabel.setBackground(InstallManagerWindow.getBackgroundColor());\r
+// }\r
\r
/**\r
* First of all this function check package whether update or not and check\r
}\r
}\r
\r
- new InstallThread(monitor).start();\r
+// new InstallThread(monitor).start();\r
\r
return true;\r
}\r
}\r
}\r
}\r
+//=======
+///*
+//* InstallManager
+//*
+//* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+//*
+//* Contact:
+//* Wooyoung Cho <wooyoung1.cho@samsung.com>
+//* Shihyun Kim <shihyun.kim@samsung.com>
+//* Taeyoung Son <taeyoung2.son@samsung.com>
+//* Yongsung kim <yongsung1.kim@samsung.com>
+//*
+// * Licensed under the Apache License, Version 2.0 (the "License");
+//* you may not use this file except in compliance with the License.
+//* You may obtain a copy of the License at
+//*
+//* http://www.apache.org/licenses/LICENSE-2.0
+//*
+//* Unless required by applicable law or agreed to in writing, software
+//* distributed under the License is distributed on an "AS IS" BASIS,
+//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//* See the License for the specific language governing permissions and
+//* limitations under the License.
+//*
+//* Contributors:
+//* - S-Core Co., Ltd
+//*
+//*/
+//
+//package org.tizen.installmanager.ui.page;
+//
+//import java.text.DecimalFormat;
+//import java.util.List;
+//
+//import org.eclipse.swt.SWT;
+//import org.eclipse.swt.graphics.Color;
+//import org.eclipse.swt.widgets.Composite;
+//import org.eclipse.swt.widgets.Display;
+//import org.eclipse.swt.widgets.Label;
+//import org.eclipse.swt.widgets.ProgressBar;
+//import org.tizen.installmanager.core.Config;
+//import org.tizen.installmanager.core.IMExitException;
+//import org.tizen.installmanager.core.IMFatalException;
+//import org.tizen.installmanager.core.IMInstallCancelException;
+//import org.tizen.installmanager.lib.ErrorController;
+//import org.tizen.installmanager.lib.ErrorController.InfoCode;
+//import org.tizen.installmanager.lib.IIMProgressMonitor;
+//import org.tizen.installmanager.lib.Log;
+//import org.tizen.installmanager.lib.Platform;
+//import org.tizen.installmanager.lib.ProgramController;
+//import org.tizen.installmanager.lib.Registry;
+//import org.tizen.installmanager.lib.ErrorController.ErrorCode;
+//import org.tizen.installmanager.ui.InstallManagerWindow;
+//import org.tizen.installmanager.ui.dialog.MessageBoxDlg;
+//import org.tizen.installmanager.ui.dialog.MessageBoxDlg.DialogType;
+//
+///**
+// * @author Taeyoung Son <taeyoung2.son@samsung.com>
+// *
+// */
+//public class InstallingPage extends PageTemplate {
+// static final String RSC_PATH_IMAGE = RESOURCE_PATH
+// + "/install_manager_graphicmotif_003.png";
+// static final String STRING_TITLE = "Installation Progress";
+// static final String STRING_SUBTITLE = "Wait while the Tizen SDK installation is being processed.";
+//
+// static final double KB_SIZE = 1;
+// static final double MB_SIZE = KB_SIZE * 1024;
+// static final double GB_SIZE = MB_SIZE * 1024;
+//
+// static final int SEC = 1;
+// static final int MIN = SEC * 60;
+// static final int HOUR = MIN * 60;
+// static final int DAY = HOUR * 24;
+//
+// private static String totalSize;
+// private static String currentSize;
+//
+// private List<String> selectedList;
+// private ProgressBar progressBar;
+// private Label statusLabel;
+// private Label mSubTitleOfProgress;
+// private Label installedNumberLabel;
+// private Label mDownloadVelocity;
+//
+// private ViewController viewController;
+// private String installPath;
+// private InstallProgressMonitor monitor;
+// private InstallManagerWindow mainWindow;
+// Display display;
+//
+// /**
+// * Set basic environment of installing page.
+// * @param parent
+// * @param style
+// */
+// public InstallingPage(Composite parent, int style) {
+// super(parent, style, true);
+//
+// setLeftImageFromResource(RSC_PATH_IMAGE);
+// setTitle(STRING_TITLE);
+// setSubTitle(STRING_SUBTITLE);
+//
+// progressBar = new ProgressBar(customComposite, SWT.NONE);
+// progressBar.setBounds(30, 110, 406, 20);
+//
+// statusLabel = new Label(customComposite, SWT.NONE);
+// statusLabel.setBounds(30, 65, 340, 23);
+// statusLabel.setBackground(InstallManagerWindow.getBackgroundColor());
+//
+// mSubTitleOfProgress = new Label(customComposite, SWT.NONE);
+// mSubTitleOfProgress.setBounds(30, 138, 260, 23);
+// mSubTitleOfProgress.setForeground(new Color(null, 96, 96, 96));
+// mSubTitleOfProgress
+// .setBackground(InstallManagerWindow.getBackgroundColor());
+// mSubTitleOfProgress.setText("");
+//
+// installedNumberLabel = new Label(customComposite, SWT.NONE);
+// installedNumberLabel.setAlignment(SWT.RIGHT);
+// installedNumberLabel.setBounds(275, 90, 160, 23);
+// installedNumberLabel.setForeground(new Color(null, 0, 108, 209));
+// installedNumberLabel
+// .setBackground(InstallManagerWindow.getBackgroundColor());
+// installedNumberLabel.setText("");
+//
+// mDownloadVelocity = new Label(customComposite, SWT.NONE);
+// mDownloadVelocity.setAlignment(SWT.RIGHT);
+// mDownloadVelocity.setBounds(295, 138, 140, 23);
+// mDownloadVelocity.setBackground(InstallManagerWindow.getBackgroundColor());
+// mDownloadVelocity.setForeground(new Color(null, 0, 108, 209));
+// mDownloadVelocity.setText("");
+// }
+//
+// /**
+// * First of all this function check package whether update or not and check install path(target directory)
+// * is empty.
+// * @param selectedList
+// * @param viewController
+// * @param installPath
+// * @param mainWindow
+// * @param isUpdate
+// * @return true is success to install<br>false is fail to install
+// */
+// public boolean loadPage(List<String> selectedList,
+// ViewController viewController, String installPath,
+// InstallManagerWindow mainWindow, boolean isUpdate) {
+// this.selectedList = selectedList;
+// this.viewController = viewController;
+// this.installPath = installPath;
+// this.mainWindow = mainWindow;
+// monitor = new InstallProgressMonitor();
+// display = customComposite.getDisplay();
+//
+// if (isUpdate == true) {
+// ProgramController controller = ProgramController
+// .createProgramController();
+//
+// if (controller.runningProgramExists()) {
+// int confirm = MessageBoxDlg
+// .showDlg(
+// getShell(),
+// "Warning",
+// "The SDK is already running. If you update it, the current version will stop. Are you sure you want to update the SDK?",
+// DialogType.WARNING, false);
+// if (confirm == MessageBoxDlg.YES) {
+// controller.terminateRunningProgram();
+// } else if (confirm == MessageBoxDlg.NO) {
+// return false;
+// }
+// }
+// }
+//
+// new InstallThread(monitor).start();
+//
+// return true;
+// }
+//
+// /**
+// * This class controls process to install.
+// * @author Shihyun Kim <shihyun.kim@samsung.com>
+// */
+// class InstallThread extends Thread {
+//
+// private InstallProgressMonitor monitor;
+//
+// public InstallThread(InstallProgressMonitor monitor) {
+// this.monitor = monitor;
+// }
+//
+// /**
+// * Installing thread run
+// */
+// @Override
+// public void run() {
+// boolean bResult = false;
+// try {
+// bResult = installProcess(monitor);
+// ErrorController.setInstallationSuccess(bResult);
+// } catch (IMFatalException e) {
+// Log.err("internal error occurred");
+// Log.ExceptionLog(e);
+// ErrorController.setInstallationSuccess(false);
+// } catch (Exception e) {
+// Log.err("Unexpected exception occurred");
+// Log.ExceptionLog(e);
+// ErrorController.setInstallationSuccess(false);
+// } finally {
+// monitor.done();
+// }
+// Log.log("finish install thread");
+// }
+// }
+//
+// /**
+// * After set selected package list and install path, start to install.
+// * @param monitor
+// * @throws IMExitException
+// */
+// public boolean installProcess(InstallProgressMonitor monitor) throws IMExitException {
+// boolean bResult = false;
+//
+// try {
+// bResult = viewController.install(selectedList, installPath, monitor);
+//// ErrorController.setError(ErrorCode.INSTALLATION_FAIL);
+// } catch (IMInstallCancelException e) {
+// bResult = false;
+// ErrorController.setError(ErrorCode.INSTALL_CANCELED);
+// Log.log("Installation canceled");
+//
+// return false;
+// }
+//
+// return bResult;
+// }
+//
+// /**
+// * Get install progress monitor object
+// * @return install progress monitor object
+// */
+// public InstallProgressMonitor getInstallProgressMonitor() {
+// return monitor;
+// }
+//
+// /**
+// * @author Shihyun Kim <shihyun.kim@samsung.com>
+// */
+// public class InstallProgressMonitor implements IIMProgressMonitor {
+//
+// private long totalWork;
+// private double mProgressSize = 0;
+// private String mProgressTitle;
+// private String mSubTitle;
+// private String status;
+// private long downloadStartTime = 0;
+// private boolean isCanceled = false;
+//
+// private static final int MAX_LENGTH = 40;
+// private static final String STRING_ETC = "...";
+// private boolean cancelRequested;
+//
+// /**
+// * Set start time to download.
+// */
+// public void setDownloadStartTime(long startTime) {
+// this.downloadStartTime = startTime;
+// }
+//
+// @Override
+// public void beginTask(String name, int totalWork) {
+// if (display == null || display.isDisposed()) {
+// setCanceled(true);
+// return;
+// }
+// this.totalWork = totalWork;
+// this.status = name;
+// display.asyncExec(new Runnable() {
+// @Override
+// public void run() {
+// statusLabel.setText(status);
+// downloadStartTime = System.currentTimeMillis();
+// }
+// });
+// }
+//
+// private boolean retContinue = false;
+//
+// /**
+// * Check cancel button
+// * @return
+// * true : user press a cancel button
+// * false : user do nothing
+// */
+// public boolean checkCancelAndDisableCancelButton() {
+// retContinue = false;
+// if (display == null || display.isDisposed()) {
+// setCanceled(true);
+// return false;
+// }
+// display.syncExec(new Runnable() {
+// @Override
+// public void run() {
+// if (!cancelRequested) {
+// mainWindow.setCancelBtnEnabled(false);
+// mDownloadVelocity.setVisible(false);
+// mSubTitleOfProgress.setBounds(30, 138, 360, 23);
+// retContinue = true;
+// }
+// }
+// });
+// return retContinue;
+// }
+//
+// /**
+// * Control to finish install process
+// */
+// @Override
+// public void done() {
+// if (display == null || display.isDisposed()) {
+// setCanceled(true);
+// return;
+// }
+//
+// if (Config.status == Config.Status.INSTALL) {
+// Registry.saveSDKInfo(installPath);
+// }
+//
+// display.asyncExec(new Runnable() {
+// @Override
+// public void run() {
+// progressBar.setSelection(100);
+//
+// CompletePage completePage = mainWindow.getCompletePage();
+//
+// if (ErrorController.checkInstallationSuccess()) {
+// completePage.setTitle("Installation Completed");
+//
+// String customMessage = "";
+//
+// if (Platform.isUbuntu()) {
+// if (viewController.isUnityEnvironment()) {
+// customMessage = "Thank you for installing the Tizen SDK. \n\n" +
+// "To use the SDK, search and select 'Tizen IDE' on your unity dash. ";
+// } else {
+// customMessage = "Thank you for installing the Tizen SDK. \n\n" +
+// "To use the SDK, go to Application > Tizen SDK > Tizen IDE. ";
+// }
+// } else if (Platform.isWindows()) {
+// customMessage = "Thank you for installing the Tizen SDK. " +
+// "To use the SDK, go to Start > All Programs > Tizen SDK > Tizen IDE. \n\n";
+// } else {
+// customMessage = "Thank you for installing the Tizen SDK. ";
+// }
+//
+// completePage.setCustomMessage(customMessage);
+// completePage.setErrorTextMsg();
+//
+//// if (ErrorController.existInfoMessage()) {
+// completePage.setInfoMessage(InfoCode.RESTART_THE_COMPUTER.getInfoMessage()/*ErrorController.getInfoMessage()*/);
+//// }
+//
+// Log.log("installation complete");
+// } else {
+// Log.log("(un)installation failed");
+// completePage.setTitle("(Un)Installation failed");
+// completePage.setCustomErrorMessage(ErrorController.getErrorMessage() + "\n");
+// mainWindow.getCompletePage().showCheckButton(false);
+// }
+//
+// mainWindow.setNameOfCancelButton("Close");
+// mainWindow.setCancelBtnEnabled(true);
+// mainWindow.showComposite(completePage);
+// }
+// });
+// }
+//
+// @Override
+// public void internalWorked(double work) {
+// // Do nothing.
+// }
+//
+// @Override
+// public boolean isCanceled() {
+// return isCanceled;
+// }
+//
+// @Override
+// public void setCanceled(boolean value) {
+// isCanceled = value;
+// }
+//
+// @Override
+// public void setTaskName(String name) {
+// // Do nothing.
+// }
+//
+// @Override
+// public void subTask(String name) {
+// // Do nothing.
+// }
+//
+// /**
+// * set working package name to show during installing
+// */
+// @Override
+// public void worked(final int work) {
+// if (display == null || display.isDisposed()) {
+// setCanceled(true);
+// return;
+// }
+// display.syncExec(new Runnable() {
+// @Override
+// public void run() {
+// installedNumberLabel.setText(work + "/" + (totalWork));
+// progressBar.setSelection(100 * work / (int) totalWork);
+// }
+// });
+// }
+//
+// /**
+// * set working file name to show during installing
+// */
+// @Override
+// public void workedTitle(String title) {
+// mProgressTitle = title;
+//
+// if (display == null || display.isDisposed()) {
+// setCanceled(true);
+// return;
+// }
+//
+// display.syncExec(new Runnable() {
+// @Override
+// public void run() {
+// statusLabel.setText(mProgressTitle);
+// }
+// });
+// }
+//
+// /**
+// * set working file name to show during installing
+// */
+// @Override
+// public void workedSubTitle(String subTitle) {
+// if (subTitle.length() > MAX_LENGTH) {
+// mSubTitle = subTitle.substring(0, MAX_LENGTH - 2);
+// mSubTitle = mSubTitle + STRING_ETC;
+// } else {
+// mSubTitle = subTitle;
+// }
+//
+// if (display == null || display.isDisposed()) {
+// setCanceled(true);
+// return;
+// }
+//
+// display.syncExec(new Runnable() {
+// @Override
+// public void run() {
+// mSubTitleOfProgress.setText(mSubTitle);
+// }
+// });
+// }
+//
+// @Override
+// public void workedProcess(String title) {
+// if (title == null || title.isEmpty()) {
+// return;
+// }
+//
+// String processTitle = "Processing : package \"" + title + "\"";
+// workedTitle(processTitle);
+// }
+//
+// @Override
+// public void workedDownload(String title) {
+// if (title == null || title.isEmpty()) {
+// return;
+// }
+//
+// workedTitle("Downloading : " + title);
+// }
+//
+// @Override
+// public void workedChecksum(String title) {
+// if (title == null || title.isEmpty()) {
+// return;
+// }
+//
+// workedTitle("File checking : " + title);
+// }
+//
+// /**
+// * check validation of download
+// */
+// public void workedChecksum(final long size) {
+// if (display == null || display.isDisposed()) {
+// setCanceled(true);
+// return;
+// }
+// display.asyncExec(new Runnable() {
+// private String pattern = ".##";
+// private DecimalFormat dformat = new DecimalFormat(pattern);
+//
+// public void run() {
+// /* set total size */
+// mProgressSize += size / (double) 1024;
+// if (totalWork >= GB_SIZE) {
+// totalSize = dformat.format((totalWork / GB_SIZE)) + "GB";
+// } else if (totalWork >= MB_SIZE) {
+// totalSize = dformat.format((totalWork / MB_SIZE)) + "MB";
+// } else {
+// totalSize = totalWork + "KB";
+// }
+//
+// /* set current download size */
+// if (mProgressSize >= GB_SIZE) {
+// currentSize = dformat.format((mProgressSize / GB_SIZE)) + "GB";
+// } else if (mProgressSize >= MB_SIZE) {
+// currentSize = dformat.format((mProgressSize / MB_SIZE)) + "MB";
+// } else {
+// currentSize = dformat.format(mProgressSize) + "KB";
+// }
+//
+// installedNumberLabel.setText(currentSize + "/" + totalSize);
+// mSubTitleOfProgress.setText("");
+// mDownloadVelocity.setText("");
+// progressBar.setSelection((int) (100 * mProgressSize / totalWork));
+//
+// }
+// });
+// }
+//
+// /**
+// * Control download and show download information.
+// */
+// @Override
+// public void workedDownload(final long size) {
+// if (display == null || display.isDisposed()) {
+// setCanceled(true);
+// return;
+// }
+// display.asyncExec(new Runnable() {
+// private String pattern = ".00";
+// private DecimalFormat dformat = new DecimalFormat(pattern);
+// private String remainTimeStr = "";
+// private String downloadVelocityStr = "";
+//
+// @Override
+// public void run() {
+// /* set total size */
+// mProgressSize += size / (double) 1024;
+// if (totalWork >= GB_SIZE) {
+// totalSize = dformat.format((totalWork / GB_SIZE)) + "GB";
+// } else if (totalWork >= MB_SIZE) {
+// totalSize = dformat.format((totalWork / MB_SIZE)) + "MB";
+// } else {
+// totalSize = totalWork + "KB";
+// }
+//
+// /* set current download size */
+// if (mProgressSize >= GB_SIZE) {
+// currentSize = dformat.format((mProgressSize / GB_SIZE)) + "GB";
+// } else if (mProgressSize >= MB_SIZE) {
+// currentSize = dformat.format((mProgressSize / MB_SIZE)) + "MB";
+// } else {
+// currentSize = dformat.format(mProgressSize) + "KB";
+// }
+//
+// long pastTimes = System.currentTimeMillis()
+// - downloadStartTime;
+//
+// /* set download velocity */
+//
+// double downloadVelocity = 0;
+//
+// if (pastTimes > 5000) {
+// downloadVelocity = mProgressSize / (double) (pastTimes / (double) 1000);
+//
+// if (downloadVelocity >= GB_SIZE) {
+// downloadVelocityStr = dformat.format(downloadVelocity / GB_SIZE) + "GB/s";
+// } else if (downloadVelocity >= MB_SIZE) {
+// downloadVelocityStr = dformat.format(downloadVelocity / MB_SIZE) + "MB/s";
+// } else {
+// downloadVelocityStr = dformat.format(downloadVelocity / KB_SIZE) + "KB/s";
+// }
+// }
+// /* set remain time */
+// double remainTime = 0;
+// if (downloadVelocity == 0) {
+// remainTimeStr = "estimating...";
+// } else {
+// double remainSize = totalWork - mProgressSize;
+// remainTime = remainSize / downloadVelocity;
+//
+// int day = (int) (remainTime / DAY);
+// int hour = (int) ((remainTime % DAY) / HOUR);
+// int min = (int) ((remainTime % HOUR) / MIN);
+// int sec = (int) (remainTime % MIN);
+//
+// if (day > 0) {
+// remainTimeStr = day + "day ";
+// }
+//
+// if (hour > 0) {
+// remainTimeStr += hour + "hour ";
+// }
+//
+// if (min > 0) {
+// remainTimeStr += min + "min ";
+// }
+//
+// if (sec > 0) {
+// remainTimeStr += sec + "sec";
+// }
+// }
+//
+// installedNumberLabel.setText(currentSize + "/" + totalSize);
+// mSubTitleOfProgress.setText("Remaining time : " + remainTimeStr);
+// mDownloadVelocity.setText(downloadVelocityStr);
+// progressBar.setSelection((int) (100 * mProgressSize / totalWork));
+// }
+// });
+// }
+//
+//
+// /**
+// * Show percentage for progress bar
+// */
+// @Override
+// public void workedProgressbar(final int percent) {
+// if (display == null || display.isDisposed()) {
+// setCanceled(true);
+// return;
+// }
+// display.asyncExec(new Runnable() {
+// @Override
+// public void run() {
+// progressBar.setSelection(percent);
+// }
+// });
+// }
+//
+// public void setCancelRequested(boolean b) {
+// cancelRequested = b;
+// }
+//
+// @Override
+// public void workedRefresh() {
+// mProgressSize = 0;
+// }
+//
+// @Override
+// public void setError(int errorCode) {
+// // TODO Auto-generated method stub
+//
+// }
+// }
+//}
+//>>>>>>> Stashed changes
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.tizen.installmanager.ui.InstallManagerWindow;
import org.tizen.installmanager.util.PathUtil;
*
*/
public class LicensePage extends PageTemplate {
- private static final String RSC_PATH_IMAGE = RESOURCE_PATH + "/install_manager_graphicmotif_001.png";
- private static final String STRING_TITLE = "License Agreement";
- private static final String STRING_SUBTITLE = "To continue, accept the terms of this agreement.";
+ private static final String RSC_PATH_IMAGE_NEW = RESOURCE_PATH_NEW + "/03_software_license_agreement_bg.png";
private StyledText txtLicense;
- private Button btnAccept;
/**
* Set basic environment of license page.
* @param style
*/
public LicensePage(Composite parent, int style) {
- super(parent, style);
+ super(parent, style, true);
- setLeftImageFromResource(RSC_PATH_IMAGE);
- setTitle(STRING_TITLE);
- setSubTitle(STRING_SUBTITLE);
+ setLeftImageFromResource(RSC_PATH_IMAGE_NEW);
+ disableTitleBounds();
+ disableSubtitleBounds();
txtLicense = new StyledText(
customComposite, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
- txtLicense.setBounds(0, 0, 437, 264);
-
- btnAccept = new Button(customComposite, SWT.CHECK);
- btnAccept.setBounds(7, 275, 428, 22);
- btnAccept.setSelection(false);
- btnAccept.setText("I agree to the License Agreement.");
- btnAccept.setBackground(InstallManagerWindow.getBackgroundColor());
+ txtLicense.setBounds(10, 14, 608, 282);
String txt = PathUtil.readAllTextFromResource("/res/COPYING");
txtLicense.setText(txt);
txtLicense.setLineAlignment(1, 1, SWT.CENTER);
}
-
- /**
- * Get accept button object
- * @return accept button object
- */
- public Button getAcceptButton() {
- return btnAccept;
- }
}
private StyledText mDescriptionText;
protected Tree tree;
- private Label lblSelectPackage;
+ protected Label titleLabel;
protected Label lblRequiredSize;
protected Label lblUncompressedSize;
protected List<Item> items;
CheckboxTreeViewer checkboxTreeViewer;
ViewController viewController = null;
- Type mType = null;
-
private static final String EXTRAS_OF_TREE_ITEM = "EXTRAS";
public enum Type {
INSTALL, UNINSTALL, UPDATE
* @param style
*/
public PackageListPage(Composite parent, int style, final Type type) {
- super(parent, style);
-
- mType = type;
+ super(parent, style, true);
items = new ArrayList<Item>();
- setDescriptionText(customComposite);
-
- lblDescriptions = new Label(getCustomComposite(), SWT.NONE);
- lblDescriptions.setBounds(0, 235, 124, 17);
- if (Platform.isUbuntu()) {
- lblDescriptions.setFont((new Font(Display.getCurrent(), new FontData("Dejavu Sans", 11, SWT.BOLD))));
- } else if (Platform.isWindows()) {
- lblDescriptions.setFont((new Font(Display.getCurrent(), new FontData("Verdana", 11, SWT.BOLD))));
+ setTitleLabel(getCustomComposite());
+ setDescriptionText(getCustomComposite());
+ setTree(getCustomComposite());
+ setCheckboxTreeViewer(type);
+ }
+
+ private void setTitleLabel(Composite composite) {
+ titleLabel = new Label(composite, SWT.NONE);
+ titleLabel.setBounds(10, 6, 200, 23);
+ }
+
+ private void setSizeLabel(Composite composite) {
+ if (Config.status == Config.Status.INSTALL) {
+ lblRequiredSize = new Label(getCustomComposite(), SWT.NONE);
+ lblRequiredSize.setBounds(300, 6, 170, 23);
+ lblRequiredSize.setBackground(InstallManagerWindow.getBackgroundColor());
+
+ lblUncompressedSize = new Label(getCustomComposite(), SWT.NONE);
+ lblUncompressedSize.setBounds(475, 6, 170, 23);
+ lblUncompressedSize.setBackground(InstallManagerWindow.getBackgroundColor());
}
- lblDescriptions.setText("Description");
- lblDescriptions.setBackground(InstallManagerWindow.getBackgroundColor());
-
+ }
+
+ private void setTree(Composite composite) {
checkboxTreeViewer = new CheckboxTreeViewer(customComposite, SWT.BORDER | SWT.H_SCROLL | SWT.LEFT);
tree = checkboxTreeViewer.getTree();
- tree.setBounds(0, 0, 447, 230);
+ tree.setBounds(150, 31, 468, 213);
tree.setHeaderVisible(true);
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
TreeColumn trclmnC = new TreeColumn(tree, SWT.CENTER);
trclmnC.setWidth(70);
trclmnC.setText("Install size");
-
+ }
+
+ private void setCheckboxTreeViewer(final Type type) {
checkboxTreeViewer = new CheckboxTreeViewer(tree);
ColumnViewerToolTipSupport.enableFor(checkboxTreeViewer);
- lblSelectPackage = new Label(getCustomComposite(), SWT.NONE);
- lblSelectPackage.setBounds(0, 225, 402, 17);
- lblSelectPackage.setText("");
- lblSelectPackage.setBackground(InstallManagerWindow.getBackgroundColor());
- lblSelectPackage.setVisible(false);
-
- if (Config.status == Config.Status.INSTALL) {
- lblRequiredSize = new Label(getCustomComposite(), SWT.NONE);
- lblRequiredSize.setBounds(130, 235, 170, 23);
- lblRequiredSize.setBackground(InstallManagerWindow.getBackgroundColor());
-
- lblUncompressedSize = new Label(getCustomComposite(), SWT.NONE);
- lblUncompressedSize.setBounds(305, 235, 170, 23);
- lblUncompressedSize.setBackground(InstallManagerWindow.getBackgroundColor());
- }
+ setSizeLabel(getCustomComposite());
checkboxTreeViewer.setContentProvider(new ItemTreeContentProvider());
checkboxTreeViewer.setLabelProvider(new ItemLabelProvider());
mDescriptionText.setFont((new Font(Display.getCurrent(), new FontData("Verdana", 9, SWT.NONE))));
}
- if (mType == Type.INSTALL) {
- mDescriptionText.setBounds(0, 257, 447, 45);
- } else if (mType == Type.UPDATE) {
- mDescriptionText.setBounds(0, 287, 447, 45);
- }
+ mDescriptionText.setBounds(150, 248, 468, 47);
+// if (mType == Type.INSTALL) {
+// mDescriptionText.setBounds(0, 257, 447, 45);
+// } else if (mType == Type.UPDATE) {
+// mDescriptionText.setBounds(0, 287, 447, 45);
+// }
}
protected void setComponentDescriptionText(String text) {
mDescriptionText.setText(newText.toString());
mDescriptionText.setStyleRanges(styles.toArray(new StyleRange[0]));
}
+
+ protected void setTitleLabelText(String title) {
+ titleLabel.setText(title);
+ }
protected void setNextBtnEnabledAboutCheckedPackageCount() {
if (getCheckedPackageNumber() > 0) {
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
import org.tizen.installmanager.lib.Platform;
import org.tizen.installmanager.ui.InstallManagerWindow;
import org.tizen.installmanager.util.PathUtil;
public class PageTemplate extends Composite {
public static final String RESOURCE_PATH = "/res/images";
+ public static final String RESOURCE_PATH_NEW = "/res/new_images";
private Label imgLabel;
private Label titleLabel;
private Label subtitleLabel;
public Composite customComposite;
+
+ private boolean usePageTemplate = true;
/**
* Set basic environment of child pages.
* @param parent
* @param style
*/
- public PageTemplate(Composite parent, int style) {
+ public PageTemplate(Composite parent, int style, boolean isTemplateUsed) {
super(parent, style);
setLayout(null);
setBackground(InstallManagerWindow.getBackgroundColor());
- imgLabel = new Label(this, SWT.NONE);
- imgLabel.setBounds(0, 0, 160, 398);
- imgLabel.setBackground(InstallManagerWindow.getBackgroundColor());
-
- titleLabel = new Label(this, SWT.NONE);
-
- if (Platform.isUbuntu()) {
- titleLabel.setFont((new Font(Display.getCurrent(), new FontData("Dejavu Sans", 11, SWT.BOLD))));
- } else if (Platform.isWindows()) {
- titleLabel.setFont((new Font(Display.getCurrent(), new FontData("Verdana", 11, SWT.BOLD))));
+ if (isTemplateUsed) {
+ imgLabel = new Label(this, SWT.NONE);
+ imgLabel.setBounds(0, 0, 628, 108);
+ imgLabel.setBackground(InstallManagerWindow.getBackgroundColor());
+// imgLabel.setBackground(new Color(null, new RGB(80, 80, 80)));
+
+ titleLabel = new Label(this, SWT.NONE);
+
+ if (Platform.isUbuntu()) {
+ titleLabel.setFont((new Font(Display.getCurrent(), new FontData("Dejavu Sans", 11, SWT.BOLD))));
+ } else if (Platform.isWindows()) {
+ titleLabel.setFont((new Font(Display.getCurrent(), new FontData("Verdana", 11, SWT.BOLD))));
+ }
+
+ titleLabel.setBounds(0, 114, 300, 25);
+ titleLabel.setText("New Label");
+ titleLabel.setBackground(InstallManagerWindow.getBackgroundColor());
+// titleLabel.setBackground(new Color(null, new RGB(180, 180, 180)));
+
+ subtitleLabel = new Label(this, SWT.WRAP);
+ subtitleLabel.setBounds(305, 114, 451, 40);
+ subtitleLabel.setText("");
+ subtitleLabel.setBackground(InstallManagerWindow.getBackgroundColor());
+// subtitleLabel.setBackground(new Color(null, new RGB(140, 140, 140)));
+
+ customComposite = new Composite(this, SWT.NONE);
+
+// customComposite.setSize(468, 304);
+// customComposite.setLocation(160, 90);
+ customComposite.setBounds(0, 108, 628, 297);
+// customComposite.setBackground(InstallManagerWindow.getBackgroundColor());
+ customComposite.setBackground(new Color(null, new RGB(100, 100, 100)));
+ } else {
+ customComposite = new Composite(this, SWT.NONE);
+
+ customComposite.setSize(468, 304);
+ customComposite.setLocation(160, 90);
+// customComposite.setBackground(InstallManagerWindow.getBackgroundColor());
+ customComposite.setBackground(new Color(null, new RGB(100, 100, 100)));
}
-
- titleLabel.setBounds(160, 17, 468, 20);
- titleLabel.setText("New Label");
- titleLabel.setBackground(InstallManagerWindow.getBackgroundColor());
-
- subtitleLabel = new Label(this, SWT.WRAP);
- subtitleLabel.setBounds(160, 43, 451, 40);
- subtitleLabel.setText("");
- subtitleLabel.setBackground(InstallManagerWindow.getBackgroundColor());
-
- customComposite = new Composite(this, SWT.NONE);
-
- customComposite.setSize(468, 304);
- customComposite.setLocation(160, 90);
- customComposite.setBackground(InstallManagerWindow.getBackgroundColor());
}
/**
customComposite.setLocation(nX, nY);
}
+ public void disableTitleBounds() {
+ titleLabel.dispose();
+ }
+
public void disableSubtitleBounds() {
subtitleLabel.dispose();
}
+
+ public void setBackgroundImage(Image image, Composite composite) {
+ Shell shell = composite.getShell();
+ shell.setBackgroundImage(image);
+ shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
+ }
}
import java.util.regex.PatternSyntaxException;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseTrackAdapter;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
import org.tizen.installmanager.core.Config;
import org.tizen.installmanager.core.IMFatalException;
import org.tizen.installmanager.core.InstallManagerConstants;
* @author Taeyoung Son <taeyoung2.son@samsung.com>
*
*/
-public class SetInstallDirectoryPage extends PageTemplate {
+public class SetInstallDirectoryPage extends InstallPage {
+ private static final String RSC_PROGRESS_IMAGE_START = RESOURCE_PATH_NEW + "/progress_start.png";
+ private static final String STRING_TITLE = "Ready to install?";
+ private static final String STRING_INSTALL_DIR = "Installation Location";
+ private static final String STRING_SDK_DATA_DIR = "Data Location";
- private static final String RSC_PATH_IMAGE = RESOURCE_PATH + "/install_manager_graphicmotif_002.png";
- private static final String STRING_TITLE = "Location";
- private static final String STRING_SUBTITLE = "Select the installation location.";
-
- private Text installDirectoryText;
private Label installDirectoryLabel;
-
- private Text sdkWorkSpaceText;
- private Label sdkWorkSpaceLabel;
+ private StyledText installDirectoryText;
+
+ private Label sdkDataLabel;
+ private StyledText sdkDataText;
private Label installErrLabel;
+ private Button installButton;
private Label spaceRequiredLabel;
- private Label spaceAvailableLabel;
- private Button selectPathBtn;
- private Button selectDataPathBtn;
private long requiredSpace = 0;
private File selectedDisk = null;
boolean availableWorkSpacePath = false;
boolean isWorkSpaceDuplicate = false;
+ private String defaultInstallDir = "";
+ private String defaultSDKDataDir = "";
+
+ private long requiredSize = 0;
+
private enum SDKLABEL {
TARGET,
DATAPATH
* @param style
*/
public SetInstallDirectoryPage(Composite parent, int style) {
- super(parent, style);
+ super(parent, style, true);
initPage();
}
/**
+ * Set basic environment of complete page. and check available space to install.
+ */
+ public void initPage() {
+ disableTitleBounds();
+ disableSubtitleBounds();
+
+ setDirectoryLabel();
+ setSDKDataLabel();
+ setErrLabel();
+ setRequiredSpaceLabel();
+ setInstallButton();
+
+ setDefaultTargetDirectory();
+ setDefaultSDKDataDirctory();
+
+ setTitleLabelText(STRING_TITLE);
+ setProgressCircle(customComposite, CIRCULAR_TYPE.CUSTOM);
+ setCircularCenterImage(PathUtil.getImageFromResource(RSC_PROGRESS_IMAGE_START));
+ }
+
+ /**
* Set default install target directory depends on platform.
*/
- private void setTargetDirectory() {
+ private void setDefaultTargetDirectory() {
if (Platform.isLinux() || Platform.isMacOS()) {
- installDirectoryText.setText(System.getProperty("user.home") + File.separator + Config.SDK_DIRECTORY);
+ defaultInstallDir = System.getProperty("user.home") + File.separator + Config.SDK_DIRECTORY;
} else if (Platform.isWindows()) {
- installDirectoryText.setText(InstallManagerConstants.WINDOWS_DEFAULT_TARGET_PATH);
+ defaultInstallDir = InstallManagerConstants.WINDOWS_DEFAULT_TARGET_PATH;
} else {
throw new IMFatalException(ErrorCode.UNSUPPORTED_PLATFORM);
}
+ setTextStyle(installDirectoryText, defaultInstallDir);
}
/**
* Set default configuration directory depends on platform.
*/
- private void setConfigDirectory() {
+ private void setDefaultSDKDataDirctory() {
if (Platform.isLinux() || Platform.isMacOS()) {
- sdkWorkSpaceText.setText(Config.getConfigHome());
+ defaultSDKDataDir = Config.getConfigHome();
} else if (Platform.isWindows()){
if (Config.isNewPackageServer) {
- sdkWorkSpaceText.setText(InstallManagerConstants.WINDOWS_DEFAULT_DATA_PATH);
+ defaultSDKDataDir = InstallManagerConstants.WINDOWS_DEFAULT_DATA_PATH;
} else {
- sdkWorkSpaceText.setText(Config.getConfigHome());
+ defaultSDKDataDir = Config.getConfigHome();
}
}
+ setTextStyle(sdkDataText, defaultSDKDataDir);
}
-
- /**
- * Set basic environment of complete page. and check available space to install.
- */
- public void initPage() {
- setLeftImageFromResource(RSC_PATH_IMAGE);
- setTitle(STRING_TITLE);
- setSubTitle(STRING_SUBTITLE);
-
- setDirectoryLabel();
- setWorkSpaceLabel();
- setErrLabel();
- setRequiredSpaceLabel();
- setSelectionPathButton();
- setSDKWorkSpacePathButton();
- setTargetDirectory();
- setConfigDirectory();
+
+ private void setInstallButton() {
+ installButton = new Button(customComposite, SWT.CENTER);
+ installButton.setBounds(247, 161, 134, 34);
+ installButton.setText("INSTALL");
+
+ installButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ System.out.println("Start installing");
+// mainWindow.getNextButton().notifyListeners(SWT.Selection, new Event());
+ }
+ });
}
private void setDirectoryLabel() {
- installDirectoryLabel = new Label(customComposite, SWT.NONE);
- installDirectoryLabel.setBounds(20, 30, 150, 17);
- installDirectoryLabel.setText("Install " + Config.SDK_NAME + " to :");
+ installDirectoryLabel = new Label(customComposite, SWT.LEFT);
+ installDirectoryLabel.setBounds(144, 226, 151, 20);
+ installDirectoryLabel.setFont(getShell().getDisplay().getSystemFont());
+ installDirectoryLabel.setText(STRING_INSTALL_DIR);
+
installDirectoryLabel.setBackground(InstallManagerWindow.getBackgroundColor());
-
- installDirectoryText = new Text(customComposite, SWT.BORDER);
- installDirectoryText.setBounds(10, 55, 390, 27);
+
+ installDirectoryText = new StyledText(customComposite, SWT.LEFT);
+ installDirectoryText.setBounds(305, 226, 250, 20);
+ installDirectoryText.setEditable(false);
+ installDirectoryText.setBackground(InstallManagerWindow.getBackgroundColor());
+
installDirectoryText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
availableInstallPath = false;
}
- InstallManagerWindow.setNextBtnEnabled(availableInstallPath && availableWorkSpacePath);
+ installButton.setEnabled(availableInstallPath && availableWorkSpacePath);
}
});
- }
-
- private void setSelectionPathButton() {
- selectPathBtn = new Button(customComposite, SWT.NONE);
- selectPathBtn.setImage(PathUtil.getImageFromResource("/res/icons/icon_directory_open.png"));
- selectPathBtn.setBounds(408, 55, 35, 29);
- selectPathBtn.addSelectionListener(new SelectionAdapter() {
+
+ installDirectoryText.addMouseListener(new MouseAdapter(){
@Override
- public void widgetSelected(SelectionEvent e) {
+ public void mouseDown(MouseEvent e) {
boolean isAvailablePath = true;
do {
String strDir = showSettingInstallPathDlg();
}
if (isAvailablePath == true) {
File strFile = new File(strDir + File.separator + Config.SDK_DIRECTORY);
- installDirectoryText.setText(strFile.getAbsolutePath());
+ setTextStyle(installDirectoryText, strFile.getAbsolutePath());
setAvailableSpace(strDir);
- spaceAvailableLabel.setText("Space available : " + convertToVolumeSize(selectedDisk.getUsableSpace()));
+ spaceRequiredLabel.setText("Download size : " + convertToVolumeSize(requiredSize)
+ + " / Space available : " + convertToVolumeSize(selectedDisk.getUsableSpace()));
}
} else {
isAvailablePath = true;
} while (isAvailablePath == false);
}
});
+
+ final Cursor handCur = new Cursor(getDisplay(), SWT.CURSOR_HAND);
+ final Cursor arrowCur = new Cursor(getDisplay(), SWT.CURSOR_ARROW);
+
+ installDirectoryText.addMouseTrackListener(new MouseTrackAdapter() {
+ @Override
+ public void mouseEnter(MouseEvent e) {
+ installDirectoryText.setCursor(handCur);
+ String tooltipText = installDirectoryText.getText();
+
+ if (tooltipText == "") {
+ installDirectoryText.setToolTipText(defaultInstallDir);
+ } else {
+ installDirectoryText.setToolTipText(installDirectoryText.getText());
+ }
+ }
+ @Override
+ public void mouseExit(MouseEvent e) {
+ installDirectoryText.setCursor(arrowCur);
+ }
+ });
}
- private void setWorkSpaceLabel() {
- sdkWorkSpaceLabel = new Label(customComposite, SWT.NONE);
- sdkWorkSpaceLabel.setBounds(20, 100, 220, 17);
- sdkWorkSpaceLabel.setText(Config.SDK_NAME + " data to :");
- sdkWorkSpaceLabel.setBackground(InstallManagerWindow.getBackgroundColor());
-
- sdkWorkSpaceText = new Text(customComposite, SWT.BORDER);
- sdkWorkSpaceText.setBounds(10, 125, 390, 27);
+ private void setSDKDataLabel() {
+ sdkDataLabel = new Label(customComposite, SWT.LEFT);
+ sdkDataLabel.setBounds(144, 246, 151, 20);
+ sdkDataLabel.setFont(getShell().getDisplay().getSystemFont());
+ sdkDataLabel.setText(STRING_SDK_DATA_DIR);
+ sdkDataLabel.setBackground(InstallManagerWindow.getBackgroundColor());
+
+ sdkDataText = new StyledText(customComposite, SWT.NONE);
+ sdkDataText.setBounds(305, 246, 250, 20);
+ sdkDataText.setEditable(false);
+ sdkDataText.setToolTipText(sdkDataText.getText());
+ sdkDataText.setBackground(InstallManagerWindow.getBackgroundColor());
- if (!Config.isNewPackageServer) {
- sdkWorkSpaceText.setEnabled(false);
- }
-
- sdkWorkSpaceText.addModifyListener(new ModifyListener() {
+ sdkDataText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
if (checkPattern(SDKLABEL.DATAPATH)) {
availableWorkSpacePath = false;
}
- if (checkDuplicatePath(sdkWorkSpaceText.getText(), SDKLABEL.DATAPATH)) {
+ if (checkDuplicatePath(sdkDataText.getText(), SDKLABEL.DATAPATH)) {
isWorkSpaceDuplicate = true;
} else {
isWorkSpaceDuplicate = false;
availableInstallPath = false;
}
- InstallManagerWindow.setNextBtnEnabled(availableInstallPath && availableWorkSpacePath);
+ installButton.setEnabled(availableInstallPath && availableWorkSpacePath);
}
});
- }
-
- private void setSDKWorkSpacePathButton() {
- selectDataPathBtn = new Button(customComposite, SWT.NONE);
- selectDataPathBtn.setImage(PathUtil.getImageFromResource("/res/icons/icon_directory_open.png"));
- selectDataPathBtn.setBounds(408, 125, 35, 29);
-
- if (!Config.isNewPackageServer) {
- selectDataPathBtn.setEnabled(false);
+
+ if (Config.isNewPackageServer) { // Old sdk cannot change SDK data path.
+ sdkDataText.addMouseListener(new MouseAdapter(){
+ @Override
+ public void mouseDown(MouseEvent e) {
+ String strDir = showSettingSDKWorkSpacePathDlg();
+ if (strDir != null) {
+ File strFile = new File(strDir + File.separator + Config.CONFIG_DIRECTORY_NAME);
+ setTextStyle(sdkDataText, strFile.getAbsolutePath());
+ }
+ }
+ });
}
- selectDataPathBtn.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- String strDir = showSettingSDKWorkSpacePathDlg();
- if (strDir != null) {
- File strFile = new File(strDir + File.separator + Config.CONFIG_DIRECTORY_NAME);
- sdkWorkSpaceText.setText(strFile.getAbsolutePath());
- }
- }
+ final Cursor handCur = new Cursor(getDisplay(), SWT.CURSOR_HAND);
+ final Cursor arrowCur = new Cursor(getDisplay(), SWT.CURSOR_ARROW);
+
+ sdkDataText.addMouseTrackListener(new MouseTrackAdapter() {
+ @Override
+ public void mouseEnter(MouseEvent e) {
+ sdkDataText.setCursor(handCur);
+ String tooltipText = sdkDataText.getText();
+
+ if (tooltipText == "") {
+ sdkDataText.setToolTipText(defaultSDKDataDir);
+ } else {
+ sdkDataText.setToolTipText(sdkDataText.getText());
+ }
+ }
+ @Override
+ public void mouseExit(MouseEvent e) {
+ sdkDataText.setCursor(arrowCur);
+ }
});
}
+ private void setRequiredSpaceLabel() {
+ spaceRequiredLabel = new Label(customComposite, SWT.CENTER);
+ spaceRequiredLabel.setBounds(10, 133, 628, 20);
+ spaceRequiredLabel.setBackground(InstallManagerWindow.getBackgroundColor());
+ }
+
private void setErrLabel() {
- installErrLabel = new Label(customComposite, SWT.WRAP);
- installErrLabel.setBounds(20, 190, 400, 50);
+ installErrLabel = new Label(customComposite, SWT.WRAP | SWT.CENTER);
+ installErrLabel.setBounds(0, 276, 628, 20);
installErrLabel.setBackground(InstallManagerWindow.getBackgroundColor());
installErrLabel.setForeground(new Color(null, 255, 0, 0));
}
-
- private void setRequiredSpaceLabel() {
- spaceRequiredLabel = new Label(customComposite, SWT.NONE);
- spaceRequiredLabel.setBounds(20, 240, 250, 17);
- spaceRequiredLabel.setBackground(InstallManagerWindow.getBackgroundColor());
- spaceAvailableLabel = new Label(customComposite, SWT.NONE);
- spaceAvailableLabel.setBounds(20, 265, 250, 17);
- spaceAvailableLabel.setBackground(InstallManagerWindow.getBackgroundColor());
- }
-
private boolean checkDuplicatePath(String path, SDKLABEL sdkLabel) {
- File installedPackageListFile = new File(
- PathUtil.get(path, InstallManagerConstants.SDK_INSTALLED_PACKAGE_LIST_PATH));
-
if (sdkLabel == SDKLABEL.TARGET) {
+ File installedPackageListFile = new File(
+ PathUtil.get(path, InstallManagerConstants.SDK_INSTALLED_PACKAGE_LIST_PATH));
if (installedPackageListFile.exists()) {
installErrLabel.setText("The input SDK install path is used already. you must input another path.");
return false;
return true;
}
} else if (sdkLabel == SDKLABEL.DATAPATH) {
- if (installedPackageListFile.exists()) {
+ File dataPath = new File(path);
+ if (dataPath.exists()) {
return false;
} else {
return true;
if (sdkLabel == SDKLABEL.TARGET) {
text = installDirectoryText.getText();
} else if (sdkLabel == SDKLABEL.DATAPATH) {
- text = sdkWorkSpaceText.getText();
+ text = sdkDataText.getText();
} else {
Log.err("Unknown label in set install path page.");
return false;
private boolean checkAvailablePath(SDKLABEL sdkLabel) {
if (installDirectoryText.getText().equals("")) {
installErrLabel.setText("Set the installation path.");
- spaceAvailableLabel.setText("Space available : ");
return false;
}
if (sdkLabel == SDKLABEL.TARGET) {
text = installDirectoryText.getText();
} else if (sdkLabel == SDKLABEL.DATAPATH) {
- text = sdkWorkSpaceText.getText();
+ text = sdkDataText.getText();
} else {
Log.err("Unknown label in set install path page.");
return false;
long availableSize = getAvailableSpaceSize(installDirectoryText.getText());
if (availableSize >= 0) {
- spaceAvailableLabel.setText("Space available : " + convertToVolumeSize(availableSize));
+ spaceRequiredLabel.setText("Download size : " + convertToVolumeSize(requiredSize)
+ + " / Space available : " + convertToVolumeSize(selectedDisk.getUsableSpace()));
} else {
installErrLabel.setText("Set the installation path correctly.");
- spaceAvailableLabel.setText("Space available : ");
return false;
}
* @param requiredSize
* @return
*/
- public boolean loadPage(ViewController controller, long requiredSize) {
+ public boolean loadPage(ViewController controller, long required) {
boolean result = true;
- requiredSpace = requiredSize;
-
- sdkWorkSpaceText.setEnabled(Config.isNewPackageServer);
- selectDataPathBtn.setEnabled(Config.isNewPackageServer);
+ requiredSize = required;
- InstallManagerWindow.setNextBtnEnabled(checkAvailablePath(SDKLABEL.TARGET) &&
- checkDuplicatePath(installDirectoryText.getText(), SDKLABEL.TARGET));
- setAvailableSpace(installDirectoryText.getText());
+ sdkDataText.setEnabled(Config.isNewPackageServer);
- spaceRequiredLabel.setText("Download size : " + convertToVolumeSize(requiredSize));
+ setAvailableSpace(installDirectoryText.getText());
+ installButton.setEnabled(checkAvailablePath(SDKLABEL.TARGET) &&
+ checkDuplicatePath(installDirectoryText.getText(), SDKLABEL.TARGET));
if (selectedDisk != null) {
- spaceAvailableLabel.setText("Space available : " + convertToVolumeSize(selectedDisk.getUsableSpace()));
+ spaceRequiredLabel.setText("Download size : " + convertToVolumeSize(requiredSize)
+ + " / Space available : " + convertToVolumeSize(selectedDisk.getUsableSpace()));
} else {
MessageBoxDlg.showDlg(
Display.getCurrent().getShells()[0], "Notify",
* @return SDK workspace path.
*/
public String getSDKWorkSpacePath() {
- String temp = sdkWorkSpaceText.getText();
- String installPath = sdkWorkSpaceText.getText();
+ String temp = sdkDataText.getText();
+ String installPath = sdkDataText.getText();
if (temp.startsWith("~")) {
installPath = temp.replaceFirst("~", System.getProperty("user.home"));
}
return true;
}
}
+
+ private void setTextStyle(StyledText styledText, String text) {
+ styledText.setText(text);
+ StyleRange styleRange = new StyleRange();
+ styleRange.start = 0;
+ styleRange.length = text.length();
+ styleRange.underline = true;
+ styledText.setStyleRange(styleRange);
+ }
}
* @param style\r
*/\r
public UninstallingPage(Composite parent, int style) {\r
- super(parent, style);\r
+ super(parent, style, true);\r
setLeftImageFromResource(RSC_PATH_IMAGE);\r
setTitle(STRING_TITLE);\r
setSubTitle(STRING_SUBTITLE);\r
}\r
}\r
}\r
+//=======
+///*
+//* InstallManager
+//*
+//* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+//*
+//* Contact:
+//* Wooyoung Cho <wooyoung1.cho@samsung.com>
+//* Shihyun Kim <shihyun.kim@samsung.com>
+//* Taeyoung Son <taeyoung2.son@samsung.com>
+//* Yongsung kim <yongsung1.kim@samsung.com>
+//*
+// * Licensed under the Apache License, Version 2.0 (the "License");
+//* you may not use this file except in compliance with the License.
+//* You may obtain a copy of the License at
+//*
+//* http://www.apache.org/licenses/LICENSE-2.0
+//*
+//* Unless required by applicable law or agreed to in writing, software
+//* distributed under the License is distributed on an "AS IS" BASIS,
+//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//* See the License for the specific language governing permissions and
+//* limitations under the License.
+//*
+//* Contributors:
+//* - S-Core Co., Ltd
+//*
+//*/
+//
+//package org.tizen.installmanager.ui.page;
+//
+//import java.util.ArrayList;
+//import java.util.List;
+//
+//import org.eclipse.swt.SWT;
+//import org.eclipse.swt.graphics.Color;
+//import org.eclipse.swt.widgets.Composite;
+//import org.eclipse.swt.widgets.Display;
+//import org.eclipse.swt.widgets.Label;
+//import org.eclipse.swt.widgets.ProgressBar;
+//import org.tizen.installmanager.core.IMFatalException;
+//import org.tizen.installmanager.core.InstallManager;
+//import org.tizen.installmanager.lib.ErrorController;
+//import org.tizen.installmanager.lib.IIMProgressMonitor;
+//import org.tizen.installmanager.lib.Log;
+//import org.tizen.installmanager.lib.ProgramController;
+//import org.tizen.installmanager.pkg.model.PackageSet;
+//import org.tizen.installmanager.ui.InstallManagerWindow;
+//import org.tizen.installmanager.ui.dialog.MessageBoxDlg;
+//import org.tizen.installmanager.ui.dialog.MessageBoxDlg.DialogType;
+//import org.tizen.installmanager.pkg.model.Package;
+//
+///**
+// * @author Taeyoung Son <taeyoung2.son@samsung.com>
+// * @author Shihyun Kim <shihyun.kim@samsung.com>
+// */
+//public class UninstallingPage extends PageTemplate {
+// static final String RSC_PATH_IMAGE = RESOURCE_PATH + "/uninstaller_graphicmotif_002.png";
+// static final String STRING_TITLE = "Uninstalling...";
+// static final String STRING_SUBTITLE = "";
+//
+//
+// private ProgressBar progressBar;
+// private Label statusLabel;
+// private Label uninstalledNumberLabel;
+// private Label mSubTitleOfProgress;
+//
+// private ViewController viewController;
+// private UninstallProgressMonitor monitor;
+// private InstallManagerWindow mainWindow;
+// Display display;
+//
+// /**
+// * Set basic environment of uninstalling page.
+// * @param parent
+// * @param style
+// */
+// public UninstallingPage(Composite parent, int style) {
+// super(parent, style, true);
+// setLeftImageFromResource(RSC_PATH_IMAGE);
+// setTitle(STRING_TITLE);
+// setSubTitle(STRING_SUBTITLE);
+//
+// progressBar = new ProgressBar(customComposite, SWT.NONE);
+// progressBar.setBounds(40, 110, 396, 20);
+//
+// statusLabel = new Label(customComposite, SWT.NONE);
+// statusLabel.setBounds(40, 80, 343, 23);
+// statusLabel.setForeground(new Color(null, 96, 96, 96));
+// statusLabel.setBackground(InstallManagerWindow.getBackgroundColor());
+//
+// mSubTitleOfProgress = new Label(customComposite, SWT.NONE);
+// mSubTitleOfProgress.setBounds(40, 138, 250, 23);
+// mSubTitleOfProgress.setBackground(InstallManagerWindow.getBackgroundColor());
+// mSubTitleOfProgress.setText("");
+//
+// uninstalledNumberLabel = new Label(customComposite, SWT.CENTER);
+// uninstalledNumberLabel.setBounds(353, 138, 80, 23);
+// uninstalledNumberLabel.setBackground(InstallManagerWindow.getBackgroundColor());
+// uninstalledNumberLabel.setText("");
+// }
+//
+// /**
+// * Display uninstalling page, if sdk is running during uninstalling, page will show warning dialog.
+// * @param selectedList
+// * @param vController
+// * @param mainWindow
+// * @return
+// */
+// public boolean loadPage(
+// List<String> selectedList, ViewController vController,
+// InstallManagerWindow mainWindow) {
+// this.viewController = vController;
+// this.mainWindow = mainWindow;
+// monitor = new UninstallProgressMonitor();
+// display = customComposite.getDisplay();
+//
+// //kill running process.
+// ProgramController controller = ProgramController.createProgramController();
+// if (controller.runningProgramExists()) {
+// int confirm = MessageBoxDlg.showDlg(
+// getShell(),
+// "Warning",
+// "The SDK is already running. If you uninstall it, the current version will stop. Are you sure you want to uninstall the SDK?",
+// DialogType.WARNING, false);
+// if (confirm == MessageBoxDlg.YES) {
+// controller.terminateRunningProgram();
+// } else if (confirm == MessageBoxDlg.NO) {
+// return false;
+// }
+// }
+//
+// //start uninstall.
+// final UninstallThread uninstallThread = new UninstallThread(monitor);
+// uninstallThread.start();
+//
+// return true;
+// }
+//
+// /**
+// * This class controls process to uninstall.
+// * @author Shihyun Kim <Shihyun.kim@samsung.com>
+// */
+// class UninstallThread extends Thread {
+// private IIMProgressMonitor monitor;
+//
+// public UninstallThread(IIMProgressMonitor monitor) {
+// this.monitor = monitor;
+// }
+//
+// /**
+// * Uninstalling thread run
+// */
+// @Override
+// public void run() {
+// try {
+// uninstallProcess(monitor);
+// } catch (IMFatalException e) {
+// Log.err("internal error occurred");
+// Log.ExceptionLog(e);
+// ErrorController.setInstallationSuccess(false);
+// } catch (Exception e) {
+// Log.err("Unexpected exception occurred");
+// Log.ExceptionLog(e);
+// ErrorController.setInstallationSuccess(false);
+// } finally {
+// monitor.done();
+// }
+// Log.log("finish uninstall thread");
+// }
+// }
+//
+// /**
+// * After check selected package list size, start to uninstall.
+// * @param monitor
+// */
+// public void uninstallProcess(IIMProgressMonitor monitor) { boolean result = false;
+// Log.log("****** Uninstall SDK ******");
+// PackageSet pkgs = InstallManager.getInstance().getPackageManager().getInstalledPackages();
+// List<String> installedList = new ArrayList<String>();
+// for (Package pkg : pkgs) {
+// installedList.add(pkg.getPackageName());
+// }
+//
+// if (installedList.size() <= 0) {
+// return;
+// } else {
+// Log.log("Uninstalling SDK : " + viewController.getInstalledPath());
+// result = viewController.uninstall(installedList, monitor);
+// }
+//
+// ErrorController.setInstallationSuccess(result);
+// }
+//
+// /**
+// * @author Shihyun Kim <shihyun.kim@samsung.com>
+// */
+// public class UninstallProgressMonitor implements IIMProgressMonitor {
+//
+// private int totalWork;
+// private String mProgressTitle = "";
+// private String mSubTitle = "";
+//
+// private static final int MAX_LENGTH = 40;
+// private static final String STRING_ETC = "...";
+//
+// @Override
+// public void beginTask(final String name, int totalWork) {
+// this.mProgressTitle = name;
+// this.totalWork = totalWork;
+// display.asyncExec(new Runnable() {
+//
+// @Override
+// public void run() {
+// statusLabel.setText(name);
+// }
+// });
+// }
+//
+// /**
+// * Control to finish uninstall process
+// */
+// @Override
+// public void done() {
+// display.asyncExec(new Runnable() {
+// @Override
+// public void run() {
+// progressBar.setSelection(100);
+//
+// CompletePage completePage = mainWindow.getCompletePage();
+// completePage.setLeftImageFromResource(CompletePage.RSC_PATH_UNINSTALL_IMAGE);
+// completePage.showCheckButton(false);
+// mainWindow.setCancelBtnEnabled(true);
+// mainWindow.showComposite(completePage);
+//
+// if (ErrorController.checkInstallationSuccess()) {
+// completePage.setTitle("Uninstallation Completed!");
+// if (!viewController.existRemovablePackage()) {
+// completePage.removeTargetDir();
+// }
+//
+// String msg = "Thank you for using Tizen SDK. ";
+// completePage.setCustomMessage(msg);
+//
+// if (ErrorController.existInfoMessage()) {
+// completePage.setInfoMessage(ErrorController.getInfoMessage());
+// }
+// } else {
+// completePage.setTitle("Uninstallation Failed!");
+// completePage.setCustomErrorMessage("Sorry, Uninstallation was not success. Please try uninstall again.\n"
+// + "Datail : " + ErrorController.getErrorMessage());
+// }
+// }
+// });
+// }
+//
+// @Override
+// public void internalWorked(double work) {
+// // Do nothing.
+// }
+//
+// @Override
+// public boolean isCanceled() {
+// return false;
+// }
+//
+// @Override
+// public void setCanceled(boolean value) {
+// // Do nothing.
+// }
+//
+// @Override
+// public void setTaskName(String name) {
+// // Do nothing.
+// }
+//
+// @Override
+// public void subTask(String name) {
+// // Do nothing.
+// }
+//
+// /**
+// * set working package name to show during uninstalling
+// */
+// @Override
+// public void worked(final int work) {
+// display.asyncExec(new Runnable() {
+// @Override
+// public void run() {
+// mSubTitleOfProgress.setText(mSubTitle);
+// uninstalledNumberLabel.setText(work + "/" + totalWork);
+// progressBar.setSelection(100 * work / totalWork);
+// }
+// });
+// }
+//
+// /**
+// * set working file name to show during installing
+// */
+// @Override
+// public void workedTitle(String title) {
+// mProgressTitle = title;
+//
+// if (display == null || display.isDisposed()) {
+// setCanceled(true);
+// return;
+// }
+//
+// display.syncExec(new Runnable() {
+// @Override
+// public void run() {
+// statusLabel.setText(mProgressTitle);
+// }
+// });
+// }
+//
+// /**
+// * set working file name to show during uninstalling
+// */
+// @Override
+// public void workedSubTitle(String subTitle) {
+// if (subTitle.length() > MAX_LENGTH) {
+// mSubTitle = subTitle.substring(0, MAX_LENGTH - 2);
+// mSubTitle = mSubTitle + STRING_ETC;
+// } else {
+// mSubTitle = subTitle;
+// }
+//
+// if (display == null || display.isDisposed()) {
+// setCanceled(true);
+// return;
+// }
+//
+// display.asyncExec(new Runnable() {
+// @Override
+// public void run() {
+// mSubTitleOfProgress.setText(mSubTitle);
+// }
+// });
+// }
+//
+// @Override
+// public void workedProcess(String title) {
+// if (title == null || title.isEmpty()) {
+// return;
+// }
+//
+// workedTitle("Processing : package \"" + mProgressTitle + "\"");
+// }
+//
+// @Override
+// public void workedDownload(long size) {
+// //Do nothing
+// }
+//
+// @Override
+// public void setDownloadStartTime(long startTime) {
+// //Do nothing
+// }
+//
+// @Override
+// public void workedChecksum(long size) {
+// //Do nothing
+// }
+//
+// @Override
+// public void workedProgressbar(int percent) {
+// progressBar.setSelection(percent);
+// }
+//
+// @Override
+// public void workedRefresh() {
+// //Do nothing
+//
+// }
+//
+// @Override
+// public void setError(int errorCode) {
+// //Do nothing
+//
+// }
+//
+// @Override
+// public void workedDownload(String title) {
+// //Do nothing
+// }
+//
+// @Override
+// public void workedChecksum(String title) {
+// //Do nothing
+//
+// }
+// }
+//}
+//>>>>>>> Stashed changes
setSubTitleFont(new FontData("Dejavu Sans", 9, SWT.NONE));
tree.setBounds(0, 0, 447, 260);
lblRequiredSize.setBounds(300, 265, 210, 23);
- lblDescriptions.setBounds(0, 265, 124, 17);
+// lblDescriptions.setBounds(0, 265, 124, 17);
}
/**
import java.util.ArrayList;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseTrackAdapter;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
import org.tizen.installmanager.core.Config;
import org.tizen.installmanager.core.IMFatalException;
import org.tizen.installmanager.core.InstallManager;
import org.tizen.installmanager.core.Options;
import org.tizen.installmanager.lib.ErrorController;
import org.tizen.installmanager.lib.Log;
+import org.tizen.installmanager.lib.Platform;
import org.tizen.installmanager.lib.Registry;
import org.tizen.installmanager.pkg.model.ConfigFile;
import org.tizen.installmanager.ui.InstallManagerWindow;
import org.tizen.installmanager.ui.dialog.ConfigurationDialog;
+import org.tizen.installmanager.ui.dialog.ProxySettingsDialog;
+import org.tizen.installmanager.ui.lib.IMButton;
+import org.tizen.installmanager.util.PathUtil;
/**
* This class displays welcome page.
public class WelcomePage extends PageTemplate {
static final String RSC_PATH_IMAGE = RESOURCE_PATH + "/install_manager_graphicmotif_welcome.png";
+ static final String RSC_PATH_IMAGE_NEW = RESOURCE_PATH_NEW + "/01_welcome_page_bg.png";
+ static final String RSC_INSTALL_BUTTON_NORMAL = RESOURCE_PATH_NEW + "/btn_welcome_page_install_normal.png";
+ static final String RSC_INSTALL_BUTTON_NORMAL_BACKGROUND = RESOURCE_PATH_NEW + "/btn_welcome_page_install_normal_background.png";
+ static final String RSC_INSTALL_BUTTON_ICON = RESOURCE_PATH_NEW + "/btn_welcome_page_install_icon.png";
+ static final String RSC_INSTALL_BUTTON_HOVER = RESOURCE_PATH_NEW + "/btn_welcome_page_install_hover.png";
+ static final String RSC_INSTALL_BUTTON_HOVER_BACKGROUND = RESOURCE_PATH_NEW + "/btn_welcome_page_install_hover_background.png";
+ static final String RSC_UNINSTALL_BUTTON_NORMAL = RESOURCE_PATH_NEW + "/btn_welcome_page_uninstall_normal.png";
+ static final String RSC_UNINSTALL_BUTTON_NORMAL_BACKGROUND = RESOURCE_PATH_NEW + "/btn_welcome_page_uninstall_normal_background.png";
+ static final String RSC_UNINSTALL_BUTTON_ICON = RESOURCE_PATH_NEW + "/btn_welcome_page_uninstall_icon.png";
+ static final String RSC_UNINSTALL_BUTTON_HOVER = RESOURCE_PATH_NEW + "/btn_welcome_page_uninstall_hover.png";
+ static final String RSC_UNINSTALL_BUTTON_HOVER_BACKGROUND = RESOURCE_PATH_NEW + "/btn_welcome_page_uninstall_hover_background.png";
public static final String STRING_TITLE = "Welcome to Tizen SDK";
- public static final String STRING_SUBTITLE = "Tizen SDK will be installed on your computer. " +
- "Close all other applications before starting the installation.";
+ public static final String STRING_SUBTITLE1 = "Tizen SDK will be installed on your computer.";
+ public static final String STRING_SUBTITLE2 = "Close all other applications before starting the installation.";
- private RADIO_ACTION selectedRadioBtn = RADIO_ACTION.INSTALL;
- Button buttonInstall = null;
- Button buttonUninstall = null;
+ private INSTALLMANAGER_ACTION selectedButton = INSTALLMANAGER_ACTION.INSTALL;
+ IMButton buttonInstall = null;
+ IMButton buttonUninstall = null;
Button buttonUpdate = null;
Button configurationButton = null;
+ Label installIconLabel = null;
+ Label installTextLabel = null;
+ Label installSubTextLabel = null;
+
+ Label unInstallIconLabel = null;
+ Label unInstallTextLabel = null;
+ Label unInstallSubTextLabel = null;
+
+ Label advancedLabel = null;
+ Label proxyLabel = null;
+
Combo updateCombo = null;
Combo uninstallCombo = null;
ConfigurationDialog rDialog = null;
+ InstallManagerWindow mainWindow = InstallManagerWindow.getInstallManagerWindow();
+
boolean isMultiSdk = false;
- public enum RADIO_ACTION {
+ public enum INSTALLMANAGER_ACTION {
INSTALL,
UNINSTALL,
UPDATE
* @param style
*/
public WelcomePage(Composite parent, int style) {
- super(parent, style);
- setImageBounds(0, 0, 630, 144);
- setTitleBounds(20, 160, 400, 20);
- setSubTitleBounds(20, 190, 600, 40);
- setCustomCompositeBounds(0, 220, 620, 173);
- setLeftImageFromResource(RSC_PATH_IMAGE);
- setTitle(STRING_TITLE);
- setSubTitle(STRING_SUBTITLE);
+ super(parent, style, false);
+// setImageBounds(0, 0, 630, 144);
+// setImageBounds(0, 0, 150, 405);
+// setTitleBounds(20, 160, 400, 20);
+// setSubTitleBounds(20, 190, 600, 40);
+// setCustomCompositeBounds(0, 220, 620, 173);
+// setLeftImageFromResource(RSC_PATH_IMAGE_NEW);
+// setTitle(STRING_TITLE);
+// setSubTitle(STRING_SUBTITLE);
isMultiSdk = Config.isSupportMultiSDK();
- setButton();
+// setButton();
+
+ setCustomCompositeBounds(0, 0, 628, 405);
+ Image welcomeImg = new Image(Display.getCurrent(),
+ "/home/reuentar/Work/dev_source/install-newUI/install-manager/InstallManager_java/src/res/new_images/01_welcome_page_bg.png");
+ customComposite.setBackgroundImage(welcomeImg);
+
+// Shell shell = parent.getShell();
+// shell.setBackgroundImage(welcomeImg);
+// shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
+
+ setWelcomeInfoLabel(customComposite);
+ setInstallButton(customComposite);
+ setUninstallButton(customComposite);
+
+// parent.setLayout(null);
+// parent.pack();
+ System.out.println("asdfasdf");
}
private void setButton() {
- setInstallButton();
- setUninstallButton();
+// setInstallButton();
+// setUninstallButton();
setConfigurationButton();
if (isMultiSdk) {
setUpdateButton();
}
}
- private void setInstallButton() {
- buttonInstall = new Button(customComposite, SWT.RADIO);
- buttonInstall.setSelection(true);
- buttonInstall.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (isMultiSdk) {
- updateCombo.setEnabled(false);
- uninstallCombo.setEnabled(false);
- }
- selectedRadioBtn = RADIO_ACTION.INSTALL;
+ private void setWelcomeInfoLabel(Composite composite) {
+ Label label_1 = new Label(composite, SWT.TRANSPARENT);
+ label_1.setBounds(18, 109, 400, 22);
+ label_1.setText(STRING_SUBTITLE1);
+ label_1.setForeground(new Color(null, new RGB(255, 255, 255)));
+
+ Label label_2 = new Label(composite, SWT.NONE);
+ label_2.setBounds(18, 131, 400, 22);
+ label_2.setText(STRING_SUBTITLE2);
+ label_2.setForeground(new Color(null, new RGB(255, 255, 255)));
+
+ if (Platform.isUbuntu()) {
+ label_1.setFont((new Font(Display.getCurrent(), new FontData("Dejavu Sans", 9, SWT.BOLD))));
+ label_2.setFont((new Font(Display.getCurrent(), new FontData("Dejavu Sans", 9, SWT.BOLD))));
+ } else if (Platform.isWindows()) {
+ label_1.setFont((new Font(Display.getCurrent(), new FontData("Verdana", 9, SWT.BOLD))));
+ label_2.setFont((new Font(Display.getCurrent(), new FontData("Verdana", 9, SWT.BOLD))));
+ }
+ }
+
+ private void setInstallButton(Composite composite) {
+ setAdvancedLabel(composite);
+ setProxyLabel(composite);
+ installIconLabel = new Label(composite, SWT.NONE);
+ installIconLabel.setImage(PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_ICON));
+ installIconLabel.setBounds(56, 204, 55, 55);
+ installIconLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_NORMAL_BACKGROUND));
+
+ installTextLabel = new Label(composite, SWT.NONE);
+ installTextLabel.setText("Install");
+ installTextLabel.setBounds(132, 200, 100, 30);
+ installTextLabel.setForeground(new Color(null, new RGB(255, 255, 255)));
+ installTextLabel.setFont((new Font(Display.getCurrent(), new FontData("Dejavu Sans", 24, SWT.NONE))));
+ installTextLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_NORMAL_BACKGROUND));
+
+ installSubTextLabel = new Label(composite, SWT.NONE);
+ installSubTextLabel.setText("Install the latest version of Tizen SDK");
+ installSubTextLabel.setBounds(132, 240, 230, 25);
+ installSubTextLabel.setForeground(new Color(null, new RGB(255, 255, 255)));
+ installSubTextLabel.setFont((new Font(Display.getCurrent(), new FontData("Dejavu Sans", 9, SWT.NONE))));
+ installSubTextLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_NORMAL_BACKGROUND));
+
+ buttonInstall = new IMButton(composite, SWT.NONE);
+ buttonInstall.setImage(PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_NORMAL),
+ PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_HOVER));
+ buttonInstall.setSize(new Rectangle(33, 188, 558, 86));
+
+ buttonInstall.addMouseTrackListener(new MouseTrackAdapter() {
+ @Override
+ public void mouseEnter(MouseEvent e) {
+ installIconLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_HOVER_BACKGROUND));
+ installTextLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_HOVER_BACKGROUND));
+ installSubTextLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_HOVER_BACKGROUND));
+// proxyLabel.setBackgroundImage(
+// PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_HOVER_BACKGROUND));
+ }
+ @Override
+ public void mouseExit(MouseEvent e) {
+ installIconLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_NORMAL_BACKGROUND));
+ installTextLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_NORMAL_BACKGROUND));
+ installSubTextLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_NORMAL_BACKGROUND));
+// proxyLabel.setBackgroundImage(
+// PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_NORMAL_BACKGROUND));
+ }
+ });
+
+ buttonInstall.addMouseListener(new MouseAdapter(){
+ @Override
+ public void mouseUp(MouseEvent e) {
+
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ System.out.println("button is pushed.");
+ mainWindow.getNextButton().notifyListeners(SWT.Selection, new Event());
+ buttonInstall.setSelection(true);
+// mainWindow.showComposite(mainWindow.getComponentSelectionPage());
+ selectedButton = INSTALLMANAGER_ACTION.INSTALL;
Config.status = Config.Status.INSTALL;
- }
+ }
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ System.out.println("double click.");
+ }
+ });
+ }
+
+ private void setAdvancedLabel(Composite composite) {
+ advancedLabel = new Label(composite, SWT.RIGHT | SWT.UNDERLINE_SINGLE);
+ advancedLabel.setText("Advanced");
+ advancedLabel.setBounds(475, 205, 100, 25);
+ advancedLabel.setForeground(new Color(null, new RGB(255, 255, 255)));
+ advancedLabel.setFont((new Font(Display.getCurrent(), new FontData("Dejavu Sans", 9, SWT.NONE))));
+// proxyLabel.setBackgroundImage(
+// PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_NORMAL_BACKGROUND));
+
+ final Cursor handCur = new Cursor(getDisplay(), SWT.CURSOR_HAND);
+ final Cursor arrowCur = new Cursor(getDisplay(), SWT.CURSOR_ARROW);
+ advancedLabel.addMouseTrackListener(new MouseTrackAdapter() {
+ @Override
+ public void mouseEnter(MouseEvent e) {
+ advancedLabel.setCursor(handCur);
+ }
+ @Override
+ public void mouseExit(MouseEvent e) {
+ advancedLabel.setCursor(arrowCur);
+ }
+ });
+
+ advancedLabel.addMouseListener(new MouseAdapter(){
+ @Override
+ public void mouseUp(MouseEvent e) {
+
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ rDialog = new ConfigurationDialog(customComposite.getShell());
+
+ //set information to configuration dialog.
+ ConfigFile confFile = Config.getInstance().getConfigFile();
+ rDialog.setRepository(confFile.getRepository());
+ rDialog.setCurrentDistribution(confFile.getDistribution());
+ rDialog.setSnapshotPath(confFile.getSnapshotPath());
+
+ int ret = rDialog.open();
+ if (ret == 0){
+ viewController.saveSnapshotSettings(rDialog.getRepository(), rDialog.getCurrentDistribution(), rDialog.getServerType(), rDialog.getSnapshotPath());
+ Log.log("SDK image setting is successful. InstallManager will be refreshed");
+ InstallManagerWindow.getInstallManagerWindow().refresh();
+ } else {
+ Log.log("Configuration dialog is canceled.");
+ }
+ rDialog.clear();
+ }
+ });
+ }
+
+ private void setProxyLabel(Composite composite) {
+ proxyLabel = new Label(composite, SWT.RIGHT | SWT.UNDERLINE_SINGLE);
+ proxyLabel.setText("Proxy settings");
+ proxyLabel.setBounds(475, 235, 100, 25);
+ proxyLabel.setForeground(new Color(null, new RGB(255, 255, 255)));
+ proxyLabel.setFont((new Font(Display.getCurrent(), new FontData("Dejavu Sans", 9, SWT.NONE))));
+// proxyLabel.setBackgroundImage(
+// PathUtil.getImageFromResource(RSC_INSTALL_BUTTON_NORMAL_BACKGROUND));
+
+ final Cursor handCur = new Cursor(getDisplay(), SWT.CURSOR_HAND);
+ final Cursor arrowCur = new Cursor(getDisplay(), SWT.CURSOR_ARROW);
+ proxyLabel.addMouseTrackListener(new MouseTrackAdapter() {
+ @Override
+ public void mouseEnter(MouseEvent e) {
+ proxyLabel.setCursor(handCur);
+ }
+ @Override
+ public void mouseExit(MouseEvent e) {
+ proxyLabel.setCursor(arrowCur);
+ }
+ });
+
+ proxyLabel.addMouseListener(new MouseAdapter(){
+ @Override
+ public void mouseUp(MouseEvent e) {
+
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ // TODO Auto-generated method stub
+ System.out.println("button is pushed.");
+ ConfigFile configFile = Config.getInstance().getConfigFile();
+ ProxySettingsDialog psDialog = new ProxySettingsDialog(getShell());
+
+ psDialog.setProxySettings(configFile.getProxyType(),
+ configFile.getProxyHost(),
+ configFile.getProxyPort());
+
+ psDialog.open();
+ }
+ });
+ }
+
+ private void setUninstallButton(Composite composite) {
+ unInstallIconLabel = new Label(composite, SWT.NONE);
+ unInstallIconLabel.setImage(PathUtil.getImageFromResource(RSC_UNINSTALL_BUTTON_ICON));
+ unInstallIconLabel.setBounds(56, 311, 55, 55);
+ unInstallIconLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_UNINSTALL_BUTTON_NORMAL_BACKGROUND));
+
+ unInstallTextLabel = new Label(composite, SWT.NONE);
+ unInstallTextLabel.setText("Uninstall");
+ unInstallTextLabel.setBounds(132, 307, 140, 30);
+ unInstallTextLabel.setForeground(new Color(null, new RGB(255, 255, 255)));
+ unInstallTextLabel.setFont((new Font(Display.getCurrent(), new FontData("Dejavu Sans", 24, SWT.NONE))));
+ unInstallTextLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_UNINSTALL_BUTTON_NORMAL_BACKGROUND));
+
+ unInstallSubTextLabel = new Label(composite, SWT.NONE);
+ unInstallSubTextLabel.setText("Uninstall the Tizen SDK");
+ unInstallSubTextLabel.setBounds(132, 347, 230, 25);
+ unInstallSubTextLabel.setForeground(new Color(null, new RGB(255, 255, 255)));
+ unInstallSubTextLabel.setFont((new Font(Display.getCurrent(), new FontData("Dejavu Sans", 9, SWT.NONE))));
+ unInstallSubTextLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_UNINSTALL_BUTTON_NORMAL_BACKGROUND));
+
+ buttonUninstall = new IMButton(composite, SWT.NONE);
+ buttonUninstall.setImage(PathUtil.getImageFromResource(RSC_UNINSTALL_BUTTON_NORMAL),
+ PathUtil.getImageFromResource(RSC_UNINSTALL_BUTTON_HOVER));
+
+ buttonUninstall.setSize(new Rectangle(33, 295, 558, 86));
+
+ buttonUninstall.addMouseTrackListener(new MouseTrackAdapter() {
+ @Override
+ public void mouseEnter(MouseEvent e) {
+ unInstallIconLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_UNINSTALL_BUTTON_HOVER_BACKGROUND));
+ unInstallTextLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_UNINSTALL_BUTTON_HOVER_BACKGROUND));
+ unInstallSubTextLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_UNINSTALL_BUTTON_HOVER_BACKGROUND));
+ }
+ @Override
+ public void mouseExit(MouseEvent e) {
+ unInstallIconLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_UNINSTALL_BUTTON_NORMAL_BACKGROUND));
+ unInstallTextLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_UNINSTALL_BUTTON_NORMAL_BACKGROUND));
+ unInstallSubTextLabel.setBackgroundImage(
+ PathUtil.getImageFromResource(RSC_UNINSTALL_BUTTON_NORMAL_BACKGROUND));
+ }
+ });
+
+ buttonUninstall.addMouseListener(new MouseAdapter(){
+ @Override
+ public void mouseUp(MouseEvent e) {
+
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ System.out.println("button is pushed.");
+ buttonUninstall.setSelection(true);
+ Config.status = Config.Status.UNINSTALL;
+ selectedButton = INSTALLMANAGER_ACTION.UNINSTALL;
+ }
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ System.out.println("double click.");
+ }
});
- buttonInstall.setBounds(26, 40, 250, 22);
- buttonInstall.setText("Install the new " + Config.SDK_NAME + " version.");
- buttonInstall.setBackground(InstallManagerWindow.getBackgroundColor());
}
private void setUpdateButton() {
buttonUpdate.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- selectedRadioBtn = RADIO_ACTION.UPDATE;
+ selectedButton = INSTALLMANAGER_ACTION.UPDATE;
Config.status = Config.Status.UPDATE;
updateCombo.setEnabled(true);
uninstallCombo.setEnabled(false);
buttonUpdate.setBackground(InstallManagerWindow.getBackgroundColor());
}
- private void setUninstallButton() {
- buttonUninstall = new Button(customComposite, SWT.RADIO);
- buttonUninstall.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (isMultiSdk) {
- updateCombo.setEnabled(false);
- uninstallCombo.setEnabled(true);
- }
- Config.status = Config.Status.UNINSTALL;
- selectedRadioBtn = RADIO_ACTION.UNINSTALL;
- }
- });
- if (isMultiSdk) {
- buttonUninstall.setBounds(26, 130, 250, 22);
- } else {
- buttonUninstall.setBounds(26, 85, 250, 22);
- }
- buttonUninstall.setText("Uninstall the " + Config.SDK_NAME);
- buttonUninstall.setBackground(InstallManagerWindow.getBackgroundColor());
- }
-
private void setUpdateCombo() {
updateCombo = new Combo(customComposite, SWT.READ_ONLY);
if (Options.doRemoveOldSDK) {
setErrorSubTitle("Old version SDK(Tizen SDK) is installed. " +
"Tizen SDK can be installed after removing old Tizen SDK.");
- buttonInstall.setSelection(false);
- buttonUninstall.setSelection(true);
+// buttonInstall.setSelection(false);
+// buttonUninstall.setSelection(true);
buttonInstall.setEnabled(false);
buttonUninstall.setEnabled(true);
- selectedRadioBtn = RADIO_ACTION.UNINSTALL;
+ selectedButton = INSTALLMANAGER_ACTION.UNINSTALL;
return;
}
}
if (!viewController.existRemovablePackage()) {
- buttonInstall.setText("Install the new " + Config.SDK_NAME + " version.");
+// buttonInstall.setText("Install the new " + Config.SDK_NAME + " version.");
buttonInstall.setBounds(26, 40, 500, 22);
- buttonInstall.setSelection(true);
- buttonUninstall.setSelection(false);
+// buttonInstall.setSelection(true);
+// buttonUninstall.setSelection(false);
buttonInstall.setEnabled(true);
buttonUninstall.setEnabled(false);
Config.status = Config.Status.UNINSTALL;
}*/ else {
if (isMultiSdk) {
- buttonInstall.setText("Install the new " + Config.SDK_NAME + " version.");
+// buttonInstall.setText("Install the new " + Config.SDK_NAME + " version.");
buttonUpdate.setSelection(false);
buttonUpdate.setEnabled(true);
} else {
- buttonInstall.setText("Install or update the " + Config.SDK_NAME);
+// buttonInstall.setText("Install or update the " + Config.SDK_NAME);
Config.status = Config.Status.UPDATE;
}
- buttonInstall.setSelection(true);
- buttonUninstall.setSelection(false);
+// buttonInstall.setSelection(true);
+// buttonUninstall.setSelection(false);
buttonInstall.setEnabled(true);
buttonUninstall.setEnabled(true);
* Get selected radio button object.
* @return radio button object
*/
- public RADIO_ACTION getSelectedRadioButton() {
- RADIO_ACTION result = this.selectedRadioBtn;
+ public INSTALLMANAGER_ACTION getSelectedButton() {
+ INSTALLMANAGER_ACTION result = this.selectedButton;
return result;
}