Search in sources :

Example 16 with GuiEditor

use of com.intellij.uiDesigner.designSurface.GuiEditor in project intellij-community by JetBrains.

the class DeleteAction method actionPerformed.

public void actionPerformed(final AnActionEvent e) {
    final GuiEditor editor = FormEditingUtil.getEditorFromContext(e.getDataContext());
    CaptionSelection selection = CaptionSelection.DATA_KEY.getData(e.getDataContext());
    if (editor == null || selection == null || selection.getFocusedIndex() < 0)
        return;
    FormEditingUtil.deleteRowOrColumn(editor, selection.getContainer(), selection.getSelection(), selection.isRow());
    selection.getContainer().revalidate();
}
Also used : CaptionSelection(com.intellij.uiDesigner.CaptionSelection) GuiEditor(com.intellij.uiDesigner.designSurface.GuiEditor)

Example 17 with GuiEditor

use of com.intellij.uiDesigner.designSurface.GuiEditor in project intellij-community by JetBrains.

the class ExpandSelectionAction method actionPerformed.

public void actionPerformed(final AnActionEvent e) {
    final GuiEditor editor = FormEditingUtil.getEditorFromContext(e.getDataContext());
    assert editor != null;
    final SelectionState selectionState = editor.getSelectionState();
    selectionState.setInsideChange(true);
    ComponentTreeBuilder builder = DesignerToolWindowManager.getInstance(editor).getComponentTreeBuilder();
    if (builder != null) {
        builder.beginUpdateSelection();
    }
    final Stack<ComponentPtr[]> history = selectionState.getSelectionHistory();
    try {
        final ComponentPtr[] ptrs = history.peek();
        for (int i = ptrs.length - 1; i >= 0; i--) {
            // Skip invalid components
            final ComponentPtr ptr = ptrs[i];
            ptr.validate();
            if (!ptr.isValid()) {
                continue;
            }
            // Extend selection
            final RadComponent component = ptr.getComponent();
            final RadContainer parent = component.getParent();
            if (parent == null) {
                // skip components without parents
                continue;
            }
            boolean shouldSelectParent = true;
            for (int j = parent.getComponentCount() - 1; j >= 0; j--) {
                final RadComponent sibling = parent.getComponent(j);
                if (!sibling.isSelected()) {
                    shouldSelectParent = false;
                    sibling.setSelected(true);
                }
            }
            if (shouldSelectParent) {
                parent.setSelected(true);
            }
        }
        // Store new selection
        history.push(SelectionState.getSelection(editor));
    } finally {
        if (builder != null) {
            builder.endUpdateSelection();
        }
        selectionState.setInsideChange(false);
    }
}
Also used : RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) GuiEditor(com.intellij.uiDesigner.designSurface.GuiEditor) ComponentPtr(com.intellij.uiDesigner.componentTree.ComponentPtr) SelectionState(com.intellij.uiDesigner.SelectionState) RadContainer(com.intellij.uiDesigner.radComponents.RadContainer) ComponentTreeBuilder(com.intellij.uiDesigner.componentTree.ComponentTreeBuilder)

Example 18 with GuiEditor

use of com.intellij.uiDesigner.designSurface.GuiEditor in project intellij-community by JetBrains.

the class ReloadCustomComponentsAction method update.

@Override
public void update(AnActionEvent e) {
    final GuiEditor editor = FormEditingUtil.getActiveEditor(e.getDataContext());
    e.getPresentation().setVisible(editor != null && haveCustomComponents(editor));
}
Also used : GuiEditor(com.intellij.uiDesigner.designSurface.GuiEditor)

Example 19 with GuiEditor

use of com.intellij.uiDesigner.designSurface.GuiEditor in project intellij-community by JetBrains.

the class RowColumnAction method actionPerformed.

public void actionPerformed(final AnActionEvent e) {
    GuiEditor editor = FormEditingUtil.getEditorFromContext(e.getDataContext());
    CaptionSelection selection = CaptionSelection.DATA_KEY.getData(e.getDataContext());
    if (editor == null || selection == null || !editor.ensureEditable()) {
        return;
    }
    actionPerformed(selection);
    selection.getContainer().revalidate();
    editor.refreshAndSave(true);
}
Also used : CaptionSelection(com.intellij.uiDesigner.CaptionSelection) GuiEditor(com.intellij.uiDesigner.designSurface.GuiEditor)

Example 20 with GuiEditor

use of com.intellij.uiDesigner.designSurface.GuiEditor in project intellij-community by JetBrains.

the class ShowGridAction method update.

public void update(final AnActionEvent e) {
    super.update(e);
    GuiEditor editor = FormEditingUtil.getEditorFromContext(e.getDataContext());
    e.getPresentation().setEnabled(editor != null);
}
Also used : GuiEditor(com.intellij.uiDesigner.designSurface.GuiEditor)

Aggregations

GuiEditor (com.intellij.uiDesigner.designSurface.GuiEditor)21 RadComponent (com.intellij.uiDesigner.radComponents.RadComponent)8 QuickFix (com.intellij.uiDesigner.quickFixes.QuickFix)4 SelectionState (com.intellij.uiDesigner.SelectionState)3 IComponent (com.intellij.uiDesigner.lw.IComponent)3 RadContainer (com.intellij.uiDesigner.radComponents.RadContainer)3 Presentation (com.intellij.openapi.actionSystem.Presentation)2 Project (com.intellij.openapi.project.Project)2 ListPopup (com.intellij.openapi.ui.popup.ListPopup)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 CaptionSelection (com.intellij.uiDesigner.CaptionSelection)2 FormEditingUtil (com.intellij.uiDesigner.FormEditingUtil)2 ComponentTreeBuilder (com.intellij.uiDesigner.componentTree.ComponentTreeBuilder)2 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)2 IProperty (com.intellij.uiDesigner.lw.IProperty)2 ComponentItem (com.intellij.uiDesigner.palette.ComponentItem)2 NotNull (org.jetbrains.annotations.NotNull)2 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)1 CommandProcessor (com.intellij.openapi.command.CommandProcessor)1