1 11 package org.eclipse.jdt.internal.debug.ui.actions; 12 13 import org.eclipse.jface.action.IAction; 14 import org.eclipse.jface.preference.IPreferenceStore; 15 import org.eclipse.jface.viewers.StructuredViewer; 16 import org.eclipse.jface.viewers.Viewer; 17 import org.eclipse.swt.custom.BusyIndicator; 18 19 22 public abstract class ToggleBooleanPreferenceAction extends ViewFilterAction { 23 24 30 public boolean select(Viewer viewer, Object parentElement, Object element) { 31 return false; 32 } 33 34 37 public void run(IAction action) { 38 final StructuredViewer viewer = getStructuredViewer(); 39 BusyIndicator.showWhile(viewer.getControl().getDisplay(), new Runnable () { 40 public void run() { 41 IPreferenceStore store = getPreferenceStore(); 43 store.setValue(getPreferenceKey(), getValue()); 44 viewer.refresh(); 45 } 46 }); 47 } 48 49 protected String getCompositeKey() { 50 return getPreferenceKey(); 51 } 52 53 54 } 55 | Popular Tags |