1 11 12 package org.eclipse.pde.internal.ui.editor.cheatsheet.comp.actions; 13 14 import org.eclipse.jface.action.Action; 15 import org.eclipse.pde.internal.core.icheatsheet.comp.ICompCSConstants; 16 import org.eclipse.pde.internal.core.icheatsheet.comp.ICompCSObject; 17 import org.eclipse.pde.internal.core.icheatsheet.comp.ICompCSTaskGroup; 18 import org.eclipse.pde.internal.core.icheatsheet.comp.ICompCSTaskObject; 19 import org.eclipse.pde.internal.ui.PDEUIMessages; 20 21 25 public class CompCSRemoveTaskObjectAction extends Action { 26 27 private ICompCSTaskObject fTaskObject; 28 29 private ICompCSObject fObjectToSelect; 30 31 34 public CompCSRemoveTaskObjectAction() { 35 setText(PDEUIMessages.SimpleCSRemoveSubStepAction_0); 36 fTaskObject = null; 37 fObjectToSelect = null; 38 } 39 40 43 public void setTaskObject(ICompCSTaskObject taskObject) { 44 fTaskObject = taskObject; 45 } 46 47 50 public void run() { 51 if (fTaskObject != null) { 52 ICompCSObject parent = fTaskObject.getParent(); 53 if (parent.getType() == ICompCSConstants.TYPE_TASKGROUP) { 54 ICompCSTaskGroup group = (ICompCSTaskGroup)parent; 56 determineItemToSelect(group); 59 group.removeFieldTaskObject(fTaskObject); 61 } 62 } 63 } 64 65 68 private void determineItemToSelect(ICompCSTaskGroup group) { 69 fObjectToSelect = group.getNextSibling(fTaskObject); 71 if (fObjectToSelect == null) { 72 fObjectToSelect = group.getPreviousSibling(fTaskObject); 75 if (fObjectToSelect == null) { 76 fObjectToSelect = group; 79 } 80 } 81 } 82 83 86 public ICompCSObject getObjectToSelect() { 87 return fObjectToSelect; 88 } 89 90 } 91 | Popular Tags |