12
12
13
13
package org .eclipse .ui .ide .fileSystem .zip ;
14
14
15
- import java .lang .reflect .InvocationTargetException ;
16
15
import java .net .URISyntaxException ;
17
16
18
17
import org .eclipse .core .commands .AbstractHandler ;
19
18
import org .eclipse .core .commands .ExecutionEvent ;
20
19
import org .eclipse .core .resources .IFile ;
21
20
import org .eclipse .core .resources .ZipFileTransformer ;
22
21
import org .eclipse .core .runtime .CoreException ;
23
- import org .eclipse .core .runtime .IProgressMonitor ;
24
22
import org .eclipse .jface .dialogs .MessageDialog ;
25
- import org .eclipse .jface .dialogs .ProgressMonitorDialog ;
26
- import org .eclipse .jface .operation .IRunnableWithProgress ;
27
23
import org .eclipse .jface .viewers .ISelection ;
28
24
import org .eclipse .jface .viewers .IStructuredSelection ;
29
25
import org .eclipse .swt .widgets .Shell ;
@@ -45,33 +41,21 @@ public class OpenZipFileHandler extends AbstractHandler {
45
41
@ Override
46
42
public Object execute (ExecutionEvent event ) {
47
43
Shell shell = HandlerUtil .getActiveShell (event );
48
- ProgressMonitorDialog dialog = new ProgressMonitorDialog (shell );
49
44
ISelection selection = HandlerUtil .getCurrentSelection (event );
50
45
if (!(selection instanceof IStructuredSelection )) {
51
46
return null ;
52
47
}
53
48
54
49
Object element = ((IStructuredSelection ) selection ).getFirstElement ();
55
-
56
50
if (!(element instanceof IFile )) {
57
51
return null ;
58
52
}
59
- try {
60
- dialog .run (true , false , new IRunnableWithProgress () {
61
- @ Override
62
- public void run (IProgressMonitor monitor ) throws InterruptedException {
63
- monitor .beginTask ("Opening Zip File" , 5 ); //$NON-NLS-1$
64
- try {
65
- ZipFileTransformer .openZipFile ((IFile ) element , monitor , true );
66
- } catch (URISyntaxException | CoreException e ) {
67
- throw new InterruptedException (e .getMessage ());
68
- }
69
- monitor .worked (1 );
70
- }
71
- });
72
- } catch (InterruptedException | InvocationTargetException e ) {
73
- MessageDialog .openError (shell , "Error opening zip file" , e .getMessage ()); //$NON-NLS-1$
74
- }
53
+
54
+ try {
55
+ ZipFileTransformer .openZipFile ((IFile ) element , true );
56
+ } catch (CoreException | URISyntaxException e ) {
57
+ MessageDialog .openError (shell , "Error opening zip file" , e .getMessage ()); //$NON-NLS-1$
58
+ }
75
59
return null ;
76
60
}
77
61
}
0 commit comments