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));
}
}
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));
}
}
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);
}
}
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();
}
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);
}
Aggregations