@Override public void update(final AnActionEvent e) { final Presentation presentation = e.getPresentation(); final GuiEditor editor = FormEditingUtil.getEditorFromContext(e.getDataContext()); if(editor == null) { presentation.setEnabled(false); return; } final SelectionState selectionState = editor.getSelectionState(); selectionState.setInsideChange(true); final Stack<ComponentPtr[]> history = selectionState.getSelectionHistory(); presentation.setEnabled(!history.isEmpty()); }
public static ComponentPtr[] getSelection(final GuiEditor editor){ final ArrayList<RadComponent> selection = FormEditingUtil.getAllSelectedComponents(editor); final ComponentPtr[] ptrs = new ComponentPtr[selection.size()]; for(int i = selection.size() - 1; i >= 0; i--){ ptrs[i] = new ComponentPtr(editor, selection.get(i)); } return ptrs; }
public static void restoreSelection(final GuiEditor editor, final ComponentPtr[] ptrs) { FormEditingUtil.clearSelection(editor.getRootContainer()); for(int i = ptrs.length - 1; i >= 0; i--){ final ComponentPtr ptr = ptrs[i]; ptr.validate(); if(ptr.isValid()){ ptr.getComponent().setSelected(true); } } }
public void update(final AnActionEvent e) { final Presentation presentation = e.getPresentation(); final GuiEditor editor = FormEditingUtil.getEditorFromContext(e.getDataContext()); if(editor == null){ presentation.setEnabled(false); return; } final SelectionState selectionState = editor.getSelectionState(); selectionState.setInsideChange(true); final Stack<ComponentPtr[]> history = selectionState.getSelectionHistory(); presentation.setEnabled(!history.isEmpty()); }
public void update(final AnActionEvent e) { final Presentation presentation = e.getPresentation(); final GuiEditor editor = FormEditingUtil.getEditorFromContext(e.getDataContext()); if(editor == null){ presentation.setEnabled(false); return; } final Stack<ComponentPtr[]> history = editor.getSelectionState().getSelectionHistory(); presentation.setEnabled(history.size() > 1); }
@Override public void update(final AnActionEvent e) { final Presentation presentation = e.getPresentation(); final GuiEditor editor = FormEditingUtil.getEditorFromContext(e.getDataContext()); if(editor == null) { presentation.setEnabled(false); return; } final Stack<ComponentPtr[]> history = editor.getSelectionState().getSelectionHistory(); presentation.setEnabled(history.size() > 1); }
public SelectionState(@NotNull final GuiEditor editor) { mySelectionHistory = new Stack<ComponentPtr[]>(); editor.addComponentSelectionListener(new MyComponentSelectionListener()); }
public Stack<ComponentPtr[]> getSelectionHistory() { return mySelectionHistory; }
public void setSelectionAnchor(final RadComponent component) { mySelectionAnchor = new ComponentPtr(this, component); }
public void setSelectionLead(final RadComponent component) { mySelectionLead = new ComponentPtr(this, component); }