Search in sources :

Example 1 with EditableArea

use of com.intellij.designer.designSurface.EditableArea in project intellij-community by JetBrains.

the class CommonEditActionsProvider method deleteElement.

@Override
public void deleteElement(@NotNull final DataContext dataContext) {
    myDesigner.getToolProvider().execute(() -> {
        EditableArea area = getArea(dataContext);
        List<RadComponent> selection = area.getSelection();
        if (selection.isEmpty()) {
            return;
        }
        myDesigner.getToolProvider().loadDefaultTool();
        List<RadComponent> components = RadComponent.getPureSelection(selection);
        updateSelectionBeforeDelete(area, components.get(0), selection);
        handleDeletion(components);
    }, DesignerBundle.message("command.delete.selection"), true);
}
Also used : EditableArea(com.intellij.designer.designSurface.EditableArea) RadComponent(com.intellij.designer.model.RadComponent)

Example 2 with EditableArea

use of com.intellij.designer.designSurface.EditableArea in project intellij-community by JetBrains.

the class DesignerActionPanel method createSelectActionGroup.

@NotNull
private ActionGroup createSelectActionGroup(DesignerEditorPanel designer) {
    final DefaultActionGroup group = new DefaultActionGroup("_Select", true);
    AnAction selectParent = new AnAction("Select Parent", "Select Parent", null) {

        @Override
        public void actionPerformed(AnActionEvent e) {
            myDesigner.getToolProvider().processKeyEvent(new KeyEvent(myDesigner.getSurfaceArea().getNativeComponent(), KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_ESCAPE, (char) KeyEvent.VK_ESCAPE), myDesigner.getSurfaceArea());
        }
    };
    selectParent.registerCustomShortcutSet(KeyEvent.VK_ESCAPE, 0, null);
    EditableArea area = designer.getSurfaceArea();
    AnAction selectSiblings = new SelectSiblingsAction(area);
    AnAction selectSameType = new SelectSameTypeAction(area);
    AnAction deselectAllAction = new DeselectAllAction(area);
    AnAction selectAllAction = createSelectAllAction(area);
    registerAction(selectAllAction, "$SelectAll");
    group.add(selectParent);
    group.add(selectSiblings);
    group.add(selectSameType);
    group.addSeparator();
    group.add(selectAllAction);
    group.add(deselectAllAction);
    return group;
}
Also used : KeyEvent(java.awt.event.KeyEvent) EditableArea(com.intellij.designer.designSurface.EditableArea) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

EditableArea (com.intellij.designer.designSurface.EditableArea)2 RadComponent (com.intellij.designer.model.RadComponent)1 KeyEvent (java.awt.event.KeyEvent)1 NotNull (org.jetbrains.annotations.NotNull)1