Search in sources :

Example 6 with SelectionModel

use of com.android.tools.idea.uibuilder.model.SelectionModel in project android by JetBrains.

the class SelectAllAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    ScreenView screenView = mySurface.getCurrentScreenView();
    if (screenView != null) {
        SelectionModel selectionModel = screenView.getSelectionModel();
        selectionModel.selectAll(screenView.getModel());
        mySurface.repaint();
    }
}
Also used : ScreenView(com.android.tools.idea.uibuilder.surface.ScreenView) SelectionModel(com.android.tools.idea.uibuilder.model.SelectionModel)

Example 7 with SelectionModel

use of com.android.tools.idea.uibuilder.model.SelectionModel in project android by JetBrains.

the class SelectParentAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    ScreenView screenView = mySurface.getCurrentScreenView();
    if (screenView != null) {
        SelectionModel selectionModel = screenView.getSelectionModel();
        List<NlComponent> selection = selectionModel.getSelection();
        if (selection.size() == 1) {
            NlComponent first = selection.get(0);
            NlComponent parent = first.getParent();
            if (parent != null) {
                selectionModel.setSelection(Collections.singletonList(parent));
            }
        }
        mySurface.repaint();
    }
}
Also used : ScreenView(com.android.tools.idea.uibuilder.surface.ScreenView) NlComponent(com.android.tools.idea.uibuilder.model.NlComponent) SelectionModel(com.android.tools.idea.uibuilder.model.SelectionModel)

Aggregations

SelectionModel (com.android.tools.idea.uibuilder.model.SelectionModel)7 ScreenView (com.android.tools.idea.uibuilder.surface.ScreenView)6 NlComponent (com.android.tools.idea.uibuilder.model.NlComponent)4 NlModel (com.android.tools.idea.uibuilder.model.NlModel)2 XmlFile (com.intellij.psi.xml.XmlFile)1 XmlTag (com.intellij.psi.xml.XmlTag)1 Update (com.intellij.util.ui.update.Update)1 Transferable (java.awt.datatransfer.Transferable)1 Language (org.intellij.lang.annotations.Language)1