1 17 package org.eclipse.emf.ecore.sdo.action; 18 19 20 import org.eclipse.jface.action.IAction; 21 import org.eclipse.jface.viewers.ISelection; 22 import org.eclipse.jface.viewers.IStructuredSelection; 23 import org.eclipse.ui.IActionDelegate; 24 import org.eclipse.ui.actions.ActionDelegate; 25 26 import commonj.sdo.ChangeSummary; 27 28 29 32 public class BeginLoggingAction 33 extends ActionDelegate 34 implements IActionDelegate 35 { 36 protected ChangeSummary changeSummary; 37 38 public BeginLoggingAction() 39 { 40 } 41 42 public void run(IAction action) 43 { 44 changeSummary.beginLogging(); 45 } 46 47 public void selectionChanged(IAction action, ISelection selection) 48 { 49 if (selection instanceof IStructuredSelection) 50 { 51 Object object = ((IStructuredSelection)selection).getFirstElement(); 52 if (object instanceof ChangeSummary) 53 { 54 changeSummary = (ChangeSummary)object; 55 if (!changeSummary.isLogging()) 56 { 57 action.setEnabled(true); 58 return; 59 } 60 } 61 } 62 changeSummary = null; 63 action.setEnabled(false); 64 } 65 66 } 67 | Popular Tags |