Search in sources :

Example 1 with CaptionSelection

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

the class UngroupRowsColumnsAction method update.

@Override
public void update(final AnActionEvent e) {
    super.update(e);
    CaptionSelection selection = CaptionSelection.DATA_KEY.getData(e.getDataContext());
    if (selection != null) {
        e.getPresentation().setEnabled(selection.getContainer() != null && selection.getContainer().getLayout() instanceof FormLayout && GroupRowsColumnsAction.isGrouped(selection));
    }
}
Also used : CaptionSelection(com.intellij.uiDesigner.CaptionSelection) FormLayout(com.jgoodies.forms.layout.FormLayout)

Example 2 with CaptionSelection

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

the class GroupRowsColumnsAction method update.

@Override
public void update(final AnActionEvent e) {
    super.update(e);
    CaptionSelection selection = CaptionSelection.DATA_KEY.getData(e.getDataContext());
    if (selection != null) {
        e.getPresentation().setEnabled(selection.getContainer() != null && selection.getContainer().getLayout() instanceof FormLayout && getCellsToGroup(selection).length > 1 && !isGrouped(selection));
    }
}
Also used : CaptionSelection(com.intellij.uiDesigner.CaptionSelection) FormLayout(com.jgoodies.forms.layout.FormLayout)

Example 3 with CaptionSelection

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

the class DeleteAction method update.

public void update(final AnActionEvent e) {
    final Presentation presentation = e.getPresentation();
    CaptionSelection selection = CaptionSelection.DATA_KEY.getData(e.getDataContext());
    if (selection == null || selection.getContainer() == null) {
        presentation.setVisible(false);
        return;
    }
    presentation.setVisible(true);
    if (selection.getSelection().length > 1) {
        presentation.setText(!selection.isRow() ? UIDesignerBundle.message("action.delete.columns") : UIDesignerBundle.message("action.delete.rows"));
    } else {
        presentation.setText(!selection.isRow() ? UIDesignerBundle.message("action.delete.column") : UIDesignerBundle.message("action.delete.row"));
    }
    int minCellCount = selection.getContainer().getGridLayoutManager().getMinCellCount();
    if (selection.getContainer().getGridCellCount(selection.isRow()) - selection.getSelection().length < minCellCount) {
        presentation.setEnabled(false);
    } else if (selection.getFocusedIndex() < 0) {
        presentation.setEnabled(false);
    } else {
        presentation.setEnabled(true);
    }
}
Also used : CaptionSelection(com.intellij.uiDesigner.CaptionSelection) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 4 with CaptionSelection

use of com.intellij.uiDesigner.CaptionSelection 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 5 with CaptionSelection

use of com.intellij.uiDesigner.CaptionSelection 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)

Aggregations

CaptionSelection (com.intellij.uiDesigner.CaptionSelection)6 Presentation (com.intellij.openapi.actionSystem.Presentation)2 GuiEditor (com.intellij.uiDesigner.designSurface.GuiEditor)2 FormLayout (com.jgoodies.forms.layout.FormLayout)2