|
16 | 16 | *******************************************************************************/ |
17 | 17 | package org.eclipse.ui.navigator; |
18 | 18 |
|
19 | | -import org.eclipse.core.commands.AbstractHandler; |
20 | | -import org.eclipse.core.commands.ExecutionEvent; |
21 | 19 | import org.eclipse.core.runtime.IProgressMonitor; |
22 | 20 | import org.eclipse.core.runtime.PerformanceStats; |
23 | 21 | import org.eclipse.core.runtime.SafeRunner; |
|
31 | 29 | import org.eclipse.jface.viewers.TreeViewer; |
32 | 30 | import org.eclipse.jface.viewers.ViewerFilter; |
33 | 31 | import org.eclipse.swt.SWT; |
34 | | -import org.eclipse.swt.events.KeyAdapter; |
35 | | -import org.eclipse.swt.events.KeyEvent; |
36 | 32 | import org.eclipse.swt.widgets.Composite; |
37 | 33 | import org.eclipse.ui.IEditorInput; |
38 | 34 | import org.eclipse.ui.IMemento; |
39 | | -import org.eclipse.ui.IPartListener2; |
40 | 35 | import org.eclipse.ui.ISaveablePart; |
41 | 36 | import org.eclipse.ui.ISaveablesLifecycleListener; |
42 | 37 | import org.eclipse.ui.ISaveablesSource; |
43 | 38 | import org.eclipse.ui.IViewSite; |
44 | | -import org.eclipse.ui.IWorkbenchCommandConstants; |
45 | | -import org.eclipse.ui.IWorkbenchPartReference; |
46 | 39 | import org.eclipse.ui.PartInitException; |
47 | 40 | import org.eclipse.ui.PlatformUI; |
48 | 41 | import org.eclipse.ui.Saveable; |
49 | 42 | import org.eclipse.ui.SaveablesLifecycleEvent; |
50 | 43 | import org.eclipse.ui.actions.ActionGroup; |
51 | | -import org.eclipse.ui.handlers.IHandlerActivation; |
52 | | -import org.eclipse.ui.handlers.IHandlerService; |
53 | 44 | import org.eclipse.ui.internal.navigator.CommonNavigatorActionGroup; |
54 | 45 | import org.eclipse.ui.internal.navigator.NavigatorContentService; |
55 | 46 | import org.eclipse.ui.internal.navigator.NavigatorPlugin; |
@@ -169,8 +160,6 @@ public class CommonNavigator extends ViewPart implements ISetSelectionTarget, IS |
169 | 160 |
|
170 | 161 | private LinkHelperService linkService; |
171 | 162 |
|
172 | | - private IPartListener2 partListener; |
173 | | - |
174 | 163 | public CommonNavigator() { |
175 | 164 | super(); |
176 | 165 | } |
@@ -266,47 +255,6 @@ public void handleLifecycleEvent(SaveablesLifecycleEvent event) { |
266 | 255 | ColumnViewerToolTipSupport.enableFor(commonViewer); |
267 | 256 | } |
268 | 257 |
|
269 | | - // Immediate fallback: handle Ctrl+A at the Tree level |
270 | | - commonViewer.getTree().addKeyListener(new KeyAdapter() { |
271 | | - @Override |
272 | | - public void keyPressed(KeyEvent e) { |
273 | | - // MOD1 = Ctrl on Win/Linux, Command on macOS |
274 | | - if ((e.stateMask & SWT.MOD1) != 0 && (e.keyCode == 'a' || e.keyCode == 'A')) { |
275 | | - commonViewer.getTree().selectAll(); |
276 | | - e.doit = false; |
277 | | - } |
278 | | - } |
279 | | - }); |
280 | | - |
281 | | - // Activate the 'Select All' command handler when the view is active |
282 | | - partListener = new IPartListener2() { |
283 | | - private IHandlerActivation activation; |
284 | | - |
285 | | - @Override |
286 | | - public void partActivated(IWorkbenchPartReference ref) { |
287 | | - if (ref.getPart(false) == CommonNavigator.this) { |
288 | | - IHandlerService hs = getSite().getService(IHandlerService.class); |
289 | | - activation = hs.activateHandler(IWorkbenchCommandConstants.EDIT_SELECT_ALL, new AbstractHandler() { |
290 | | - @Override |
291 | | - public Object execute(ExecutionEvent event) { |
292 | | - commonViewer.getTree().selectAll(); |
293 | | - return null; |
294 | | - } |
295 | | - }); |
296 | | - } |
297 | | - } |
298 | | - |
299 | | - @Override |
300 | | - public void partDeactivated(IWorkbenchPartReference ref) { |
301 | | - if (ref.getPart(false) == CommonNavigator.this && activation != null) { |
302 | | - IHandlerService hs = getSite().getService(IHandlerService.class); |
303 | | - hs.deactivateHandler(activation); |
304 | | - activation = null; |
305 | | - } |
306 | | - } |
307 | | - }; |
308 | | - getSite().getPage().addPartListener(partListener); |
309 | | - |
310 | 258 | stats.endRun(); |
311 | 259 | } |
312 | 260 |
|
@@ -360,17 +308,13 @@ public String getFrameToolTipText(Object anElement) { |
360 | 308 | */ |
361 | 309 | @Override |
362 | 310 | public void dispose() { |
363 | | - try { |
364 | | - getSite().getPage().removePartListener(partListener); |
365 | | - if (commonManager != null) { |
366 | | - commonManager.dispose(); |
367 | | - } |
368 | | - if (commonActionGroup != null) { |
369 | | - commonActionGroup.dispose(); |
370 | | - } |
371 | | - } finally { |
372 | | - super.dispose(); |
| 311 | + if (commonManager != null) { |
| 312 | + commonManager.dispose(); |
| 313 | + } |
| 314 | + if (commonActionGroup != null) { |
| 315 | + commonActionGroup.dispose(); |
373 | 316 | } |
| 317 | + super.dispose(); |
374 | 318 | } |
375 | 319 |
|
376 | 320 | /** |
|
0 commit comments