1 11 12 package org.eclipse.pde.internal.ui.editor.cheatsheet.simple.actions; 13 14 import org.eclipse.jface.action.Action; 15 import org.eclipse.pde.internal.core.icheatsheet.simple.ISimpleCS; 16 import org.eclipse.pde.internal.core.icheatsheet.simple.ISimpleCSItem; 17 import org.eclipse.pde.internal.core.icheatsheet.simple.ISimpleCSObject; 18 import org.eclipse.pde.internal.ui.PDEUIMessages; 19 20 24 public class SimpleCSRemoveStepAction extends Action { 25 26 private ISimpleCSItem fItem; 27 28 private ISimpleCSObject fObjectToSelect; 29 30 33 public SimpleCSRemoveStepAction() { 34 setText(PDEUIMessages.SimpleCSRemoveStepAction_0); 35 fItem = null; 39 fObjectToSelect = null; 40 } 41 42 45 public void setItem(ISimpleCSItem item) { 46 fItem = item; 47 } 48 49 52 public void run() { 53 if (fItem != null) { 54 ISimpleCS cheatsheet = (ISimpleCS)fItem.getParent(); 56 determineItemToSelect(cheatsheet); 58 cheatsheet.removeItem(fItem); 60 } 61 } 62 63 66 private void determineItemToSelect(ISimpleCS cheatsheet) { 67 fObjectToSelect = cheatsheet.getNextSibling(fItem); 69 if (fObjectToSelect == null) { 70 fObjectToSelect = cheatsheet.getPreviousSibling(fItem); 73 if (fObjectToSelect == null) { 74 fObjectToSelect = cheatsheet; 77 } 78 } 79 } 80 81 84 public ISimpleCSObject getObjectToSelect() { 85 return fObjectToSelect; 86 } 87 } 88 | Popular Tags |