use of com.intellij.designer.model.RadComponentVisitor in project intellij-community by JetBrains.
the class DecorationLayer method paintStaticDecorators.
private void paintStaticDecorators(Graphics2D g) {
final List<StaticDecorator> decorators = new ArrayList<>();
final List<RadComponent> selection = myArea.getSelection();
myArea.getRootComponent().accept(new RadComponentVisitor() {
@Override
public void endVisit(RadComponent component) {
component.addStaticDecorators(decorators, selection);
}
}, true);
for (StaticDecorator decorator : decorators) {
decorator.decorate(this, g);
}
}
use of com.intellij.designer.model.RadComponentVisitor in project intellij-community by JetBrains.
the class SelectAllAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
RadComponent rootComponent = myArea.getRootComponent();
if (rootComponent != null) {
final List<RadComponent> components = new ArrayList<>();
rootComponent.accept(new RadComponentVisitor() {
@Override
public void endVisit(RadComponent component) {
if (!component.isBackground()) {
components.add(component);
}
}
}, true);
myArea.setSelection(components);
}
}
use of com.intellij.designer.model.RadComponentVisitor in project intellij-community by JetBrains.
the class SelectSameTypeAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
RadComponent rootComponent = myArea.getRootComponent();
if (rootComponent != null) {
final List<RadComponent> selection = myArea.getSelection();
final List<RadComponent> components = new ArrayList<>();
rootComponent.accept(new RadComponentVisitor() {
@Override
public void endVisit(RadComponent component) {
if (!component.isBackground()) {
for (RadComponent selected : selection) {
if (selected.isSameType(component)) {
components.add(component);
break;
}
}
}
}
}, true);
myArea.setSelection(components);
}
}
use of com.intellij.designer.model.RadComponentVisitor in project intellij-community by JetBrains.
the class SelectSiblingsAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
RadComponent rootComponent = myArea.getRootComponent();
if (rootComponent != null) {
final Set<RadComponent> parents = RadComponent.getParents(myArea.getSelection());
final List<RadComponent> components = new ArrayList<>();
rootComponent.accept(new RadComponentVisitor() {
@Override
public void endVisit(RadComponent component) {
if (parents.contains(component.getParent())) {
components.add(component);
}
}
}, true);
myArea.setSelection(components);
}
}
use of com.intellij.designer.model.RadComponentVisitor in project intellij-community by JetBrains.
the class MarqueeTracker method performMarqueeSelect.
private void performMarqueeSelect() {
final Rectangle selectionRectangle = getSelectionRectangle();
final List<RadComponent> newSelection = new ArrayList<>();
RadComponent rootComponent = myArea.getRootComponent();
if (rootComponent != null) {
rootComponent.accept(new RadComponentVisitor() {
@Override
public void endVisit(RadComponent component) {
if (selectionRectangle.contains(component.getBounds(myArea.getNativeComponent())) && !component.isBackground()) {
newSelection.add(component);
}
}
}, true);
if (newSelection.isEmpty() && mySelectBackground) {
rootComponent.accept(new RadComponentVisitor() {
@Override
public void endVisit(RadComponent component) {
// Only select the bottom-most background
if (newSelection.isEmpty() && component.getBounds(myArea.getNativeComponent()).contains(selectionRectangle.x, selectionRectangle.y) && component.isBackground()) {
newSelection.add(component);
}
}
}, true);
}
}
if (mySelectionMode == TOGGLE_MODE) {
List<RadComponent> selection = new ArrayList<>(myArea.getSelection());
for (RadComponent component : newSelection) {
int index = selection.indexOf(component);
if (index == -1) {
selection.add(component);
} else {
selection.remove(index);
}
}
myArea.setSelection(selection);
} else if (mySelectionMode == APPEND_MODE) {
for (RadComponent component : newSelection) {
myArea.appendSelection(component);
}
} else {
myArea.setSelection(newSelection);
}
}
Aggregations