1 26 package org.nightlabs.editor2d.actions.order; 27 28 import org.nightlabs.editor2d.AbstractEditor; 29 import org.nightlabs.editor2d.DrawComponentContainer; 30 import org.nightlabs.editor2d.EditorPlugin; 31 32 35 public class ChangeOrderOneUp 36 extends AbstractChangeOrderSelectionAction 37 { 38 public static final String ID = ChangeOrderOneUp.class.getName(); 39 40 44 public ChangeOrderOneUp(AbstractEditor editor, int style) { 45 super(editor, style); 46 } 47 48 51 public ChangeOrderOneUp(AbstractEditor editor) { 52 super(editor); 53 } 54 55 public void init() 56 { 57 setText(EditorPlugin.getResourceString("action.changeOrderOneUp.text")); 58 setToolTipText(EditorPlugin.getResourceString("action.changeOrderOneUp.text")); 59 setId(ID); 60 } 61 62 66 public int getNewIndex() 67 { 68 int index = primarySelected.getParent().getDrawComponents().indexOf(primarySelected); 69 int highestIndex = getLastIndex(primarySelected.getParent()); 70 if (index < highestIndex) 71 return index + 1; 72 else 73 return highestIndex; 74 } 75 76 80 public DrawComponentContainer getContainer() 81 { 82 return primarySelected.getParent(); 83 } 84 85 } 86 | Popular Tags |