[Title] Enable cancel button for apt-get update action
authordonghyuk.yang <donghyuk.yang@samsung.com>
Wed, 22 Feb 2012 06:19:24 +0000 (15:19 +0900)
committerdonghyuk.yang <donghyuk.yang@samsung.com>
Wed, 22 Feb 2012 06:19:24 +0000 (15:19 +0900)
[Type] enhancement
[Module] package manager

Change-Id: I441a13b3556bced1591c528ad410a7172bad5b88

org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageAction.java [deleted file]
org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageManager.java

diff --git a/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageAction.java b/org.tizen.nativeplatform/src/org/tizen/nativeplatform/pkgInstall/PackageAction.java
deleted file mode 100644 (file)
index f46db20..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-*  Inhouse
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: 
-* Taejun Ha <taejun.ha@samsung.com>
-* Jiil Hyoun <jiil.hyoun@samsung.com>
-* Donghyuk Yang <donghyuk.yang@samsung.com>
-* Hoon Kang <h245.kang@samsung.com>  
-* DongHee Yang <donghee.yang@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.nativeplatform.pkgInstall;
-
-
-public class PackageAction {
-       
-}
-/*
-public class PackageAction implements IExtensionPointAction {
-       
-       private ImageDescriptor imgDescriptor;
-       private String actionText;
-
-       public PackageAction() {
-               imgDescriptor = Activator.getImageDescriptor("/icons/package_installer.gif");
-               actionText = "Package Manager";
-       }
-
-       @Override
-       public ImageDescriptor getImageDescriptor() {
-               return imgDescriptor;
-       }
-
-       @Override
-       public void createDialog( Shell shell, String target ) {
-               boolean enableRootstrap = true;
-               IProject project = CurrentEnabledProject.getCurrentProject();
-               if (project == null) {                  
-                       enableRootstrap = false;                        
-               } else {                
-                       IConfiguration cfg =ManagedBuildManager.getBuildInfo( project ).getDefaultConfiguration();
-                       IManagedProject managedProject = cfg.getManagedProject();
-                       String projectTypeName = managedProject.getName();
-                       if (!projectTypeName.equals(SLPInhouseConfigurationManager.CUSTOM_DEBIAN_PROJECT_TYPE) &&
-                                       !projectTypeName.equals(SLPInhouseConfigurationManager.CUSTOM_DEBIAN_PROJECT_TYPE_OLD)) {                               
-                               enableRootstrap = false;
-                       }
-               }
-               PackageManager  pkgdlg = new PackageManager(shell, target, enableRootstrap, true);      
-               
-               pkgdlg.open();
-       }
-
-       @Override
-       public String getActionText() {
-               return actionText;
-       }
-}
-*/
\ No newline at end of file
index 25934b6..aa02f4d 100644 (file)
@@ -344,11 +344,15 @@ public class PackageManager extends Dialog {
                                ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());           
                                
                                try {
-                                       dialog.run(true, false, new IRunnableWithProgress() {
+                                       dialog.run(true, true, new IRunnableWithProgress() {
                                                @Override
                                                public void run(IProgressMonitor monitor) throws InvocationTargetException,
                                                                InterruptedException {
-                                                       monitor.beginTask("apt-get update", -1);                                
+                                                       monitor.beginTask("apt-get update", -1);                        
+                                                       
+                                                       CheckCancelJob cancelJob = new CheckCancelJob(monitor);
+                                                       Thread checkCancelThread = new Thread(cancelJob);
+                                                       checkCancelThread.start();
                                                        
                                                        ConsoleManager cm = new ConsoleManager( "Package Installer", true);
                                                        cm.clear();
@@ -421,6 +425,7 @@ public class PackageManager extends Dialog {
                                                                e.printStackTrace();
                                                        }
                                                        
+                                                       checkCancelThread.interrupt();
                                                        //monitor.worked(1);
                                                        monitor.done();
                                                }