1 11 package org.eclipse.debug.internal.ui.views.memory; 12 13 import org.eclipse.debug.ui.memory.IMemoryRenderingSite; 14 import org.eclipse.debug.ui.memory.IMemoryRenderingSynchronizationService; 15 import org.eclipse.jface.action.IAction; 16 import org.eclipse.jface.viewers.ISelection; 17 import org.eclipse.ui.IViewActionDelegate; 18 import org.eclipse.ui.IViewPart; 19 20 23 public class LinkRenderingPanesAction implements IViewActionDelegate{ 24 25 IMemoryRenderingSite fRenderingSite; 26 private MemoryViewSynchronizationService fMemSyncService; 27 28 31 public void init(IViewPart view) { 32 33 if (view instanceof IMemoryRenderingSite) 34 { 35 fRenderingSite = (IMemoryRenderingSite)view; 36 37 IMemoryRenderingSynchronizationService syncService = fRenderingSite.getSynchronizationService(); 38 39 if (syncService instanceof MemoryViewSynchronizationService) 40 fMemSyncService = (MemoryViewSynchronizationService)syncService; 41 } 42 } 43 44 47 public void run(IAction action) { 48 49 if (fMemSyncService == null) 50 return; 51 52 fMemSyncService.setEnabled(!fMemSyncService.isEnabled()); 53 updateActionState(action); 54 } 55 56 59 private void updateActionState(IAction action) { 60 61 if (fMemSyncService == null) 62 return; 63 64 if (fMemSyncService.isEnabled()) 65 action.setChecked(true); 66 else 67 action.setChecked(false); 68 } 69 70 73 public void selectionChanged(IAction action, ISelection selection) { 74 updateActionState(action); 75 } 76 } 77 | Popular Tags |