use of com.android.tools.idea.uibuilder.surface.ScreenView in project android by JetBrains.
the class NlActionsToolbar method updateViewActions.
private void updateViewActions(@NotNull List<NlComponent> newSelection) {
ScreenView screenView = mySurface.getCurrentScreenView();
if (screenView == null) {
return;
}
myActionToolbar.getComponent().setVisible(mySurface.getLayoutType().isSupportedByDesigner());
// TODO: Perform caching
myDynamicGroup.removeAll();
NlComponent parent = findSharedParent(newSelection);
if (parent != null) {
mySurface.getActionManager().addViewActions(myDynamicGroup, null, parent, newSelection, true);
}
}
use of com.android.tools.idea.uibuilder.surface.ScreenView in project android by JetBrains.
the class NlPreviewForm method setActiveModel.
public void setActiveModel(@Nullable NlModel model) {
myPendingFile = null;
ScreenView currentScreenView = mySurface.getCurrentScreenView();
if (currentScreenView != null) {
currentScreenView.getModel().deactivate();
Disposer.dispose(currentScreenView.getModel());
}
if (model == null) {
setEditor(null);
myWorkBench.setToolContext(null);
} else {
myFile = model.getFile();
mySurface.setModel(model);
if (!mySurface.isCanvasResizing() && mySurface.isZoomFitted()) {
// If we are resizing, keep the zoom level constant
// only if the zoom was previously set to FIT
mySurface.zoomToFit();
} else {
mySurface.updateScrolledAreaSize();
}
setEditor(myManager.getActiveLayoutXmlEditor());
model.activate();
myWorkBench.setToolContext(mySurface);
myWorkBench.setFileEditor(myEditor);
myActionsToolbar.setModel(model);
if (!model.getType().isSupportedByDesigner()) {
myScreenMode = mySurface.getScreenMode();
mySurface.setScreenMode(DesignSurface.ScreenMode.SCREEN_ONLY, false);
myWorkBench.setMinimizePanelsVisible(false);
} else if (myScreenMode != null && mySurface.getScreenMode() == DesignSurface.ScreenMode.SCREEN_ONLY) {
mySurface.setScreenMode(myScreenMode, false);
myWorkBench.setMinimizePanelsVisible(true);
}
}
}
use of com.android.tools.idea.uibuilder.surface.ScreenView in project android by JetBrains.
the class NlPreviewForm method updateCaret.
private void updateCaret() {
if (myCaretModel != null && !myIgnoreListener && myUseInteractiveSelector) {
ScreenView screenView = mySurface.getCurrentScreenView();
if (screenView != null) {
int offset = myCaretModel.getOffset();
if (offset != -1) {
List<NlComponent> views = screenView.getModel().findByOffset(offset);
if (views == null || views.isEmpty()) {
views = screenView.getModel().getComponents();
}
try {
myIgnoreListener = true;
SelectionModel selectionModel = screenView.getSelectionModel();
selectionModel.setSelection(views);
myRenderingQueue.queue(new Update("Preview update") {
@Override
public void run() {
mySurface.repaint();
}
@Override
public boolean canEat(Update update) {
return true;
}
});
} finally {
myIgnoreListener = false;
}
}
}
}
}
use of com.android.tools.idea.uibuilder.surface.ScreenView in project android by JetBrains.
the class NlLintHighlightingPass method applyInformationToEditor.
@Override
public void applyInformationToEditor() {
ScreenView screenView = mySurface.getCurrentScreenView();
if (screenView == null) {
return;
}
screenView.getModel().setLintAnnotationsModel(myLintAnnotationsModel);
// Ensure that the layers are repainted to reflect the latest model
// (updating the lint annotations associated with a model doesn't actually rev the model
// version.)
screenView.getSurface().repaint();
}
use of com.android.tools.idea.uibuilder.surface.ScreenView in project android by JetBrains.
the class NlLintHighlightingPass method collectInformation.
@Override
public void collectInformation(@NotNull ProgressIndicator progress) {
ScreenView screenView = mySurface.getCurrentScreenView();
if (screenView == null) {
return;
}
myLintAnnotationsModel = getAnnotations(screenView.getModel(), progress);
}
Aggregations