1 11 package org.eclipse.compare.internal; 12 13 import org.eclipse.jface.action.IAction; 14 import org.eclipse.jface.viewers.ISelection; 15 import org.eclipse.ui.IActionDelegate; 16 17 18 public abstract class BaseCompareAction implements IActionDelegate { 19 20 private ISelection fSelection; 21 22 25 final public void run(IAction action) { 26 run(fSelection); 27 } 28 29 32 final public void selectionChanged(IAction action, ISelection selection) { 33 fSelection= selection; 34 if (action != null) 35 action.setEnabled(isEnabled(fSelection)); 36 } 37 38 protected boolean isEnabled(ISelection selection) { 39 return false; 40 } 41 42 abstract protected void run(ISelection selection); 43 } 44 | Popular Tags |