use of io.flutter.editor.PropertyEditorPanel in project flutter-intellij by flutter.
the class TextOnlyActionWrapper method updateOutline.
private void updateOutline(@NotNull FlutterOutline outline) {
currentOutline = outline;
final DefaultMutableTreeNode rootNode = getRootNode();
rootNode.removeAllChildren();
outlinesWithWidgets.clear();
outlineToNodeMap.clear();
if (outline.getChildren() != null) {
computeOutlinesWithWidgets(outline);
updateOutlineImpl(rootNode, outline.getChildren());
}
getTreeModel().reload(rootNode);
tree.expandAll();
if (currentEditor != null) {
final Caret caret = currentEditor.getCaretModel().getPrimaryCaret();
applyEditorSelectionToTree(caret);
}
if (FlutterSettings.getInstance().isEnableHotUi() && propertyEditPanel == null) {
propertyEditSplitter = new Splitter(false, 0.75f);
propertyEditPanel = new PropertyEditorPanel(inspectorGroupManagerService, project, flutterAnalysisServer, false, false, project);
propertyEditPanel.initalize(null, activeOutlines, currentFile);
propertyEditToolbarGroup = new DefaultActionGroup();
final ActionToolbar windowToolbar = ActionManager.getInstance().createActionToolbar("PropertyArea", propertyEditToolbarGroup, true);
final SimpleToolWindowPanel window = new SimpleToolWindowPanel(true, true);
window.setToolbar(windowToolbar.getComponent());
final JScrollPane propertyScrollPane = ScrollPaneFactory.createScrollPane(propertyEditPanel);
window.setContent(propertyScrollPane);
propertyEditSplitter.setFirstComponent(window.getComponent());
final InspectorGroupManagerService.Client inspectorStateServiceClient = new InspectorGroupManagerService.Client(project) {
@Override
public void onInspectorAvailabilityChanged() {
super.onInspectorAvailabilityChanged();
// the inspector supports the neccessary apis.
if (getInspectorService() != null && getInspectorService().isHotUiScreenMirrorSupported()) {
// Wait to create the preview area until it is needed.
if (previewArea == null) {
previewArea = new PreviewArea(project, outlinesWithWidgets, project);
}
propertyEditSplitter.setSecondComponent(previewArea.getComponent());
} else {
propertyEditSplitter.setSecondComponent(null);
}
}
};
inspectorGroupManagerService.addListener(inspectorStateServiceClient, project);
splitter.setSecondComponent(propertyEditSplitter);
}
// TODO(jacobr): this is the wrong spot.
if (propertyEditToolbarGroup != null) {
final TitleAction propertyTitleAction = new TitleAction("Properties");
propertyEditToolbarGroup.removeAll();
propertyEditToolbarGroup.add(propertyTitleAction);
}
}
Aggregations