use of com.android.tools.idea.uibuilder.api.ViewEditor in project android by JetBrains.
the class PreferenceCategoryDragHandlerTest method newPreferenceCategoryDragHandler.
@NotNull
private static PreferenceGroupDragHandler newPreferenceCategoryDragHandler(@NotNull NlComponent category) {
ViewEditor editor = PreferenceScreenTestFactory.mockEditor();
List<NlComponent> preferences = Collections.singletonList(Mockito.mock(NlComponent.class));
return new PreferenceCategoryDragHandler(editor, new ViewGroupHandler(), category, preferences, DragType.MOVE);
}
use of com.android.tools.idea.uibuilder.api.ViewEditor in project android by JetBrains.
the class NlActionManager method addViewActions.
public void addViewActions(@NotNull DefaultActionGroup group, @Nullable NlComponent component, @Nullable NlComponent parent, @NotNull List<NlComponent> newSelection, boolean toolbar) {
ScreenView screenView = mySurface.getCurrentScreenView();
if (screenView == null || (parent == null && component == null)) {
return;
}
ViewEditor editor = new ViewEditorImpl(screenView);
// TODO: Perform caching
if (component != null) {
ViewHandler handler = ViewHandlerManager.get(mySurface.getProject()).getHandler(component);
addViewActionsForHandler(group, component, newSelection, editor, handler, toolbar);
}
if (parent != null) {
ViewHandler handler = ViewHandlerManager.get(mySurface.getProject()).getHandler(parent);
List<NlComponent> selectedChildren = Lists.newArrayListWithCapacity(newSelection.size());
for (NlComponent selected : newSelection) {
if (selected.getParent() == parent) {
selectedChildren.add(selected);
}
}
addViewActionsForHandler(group, parent, selectedChildren, editor, handler, toolbar);
}
}
Aggregations