mirror of
https://github.com/enso-org/enso.git
synced 2024-12-24 09:42:40 +03:00
Searcher uses node editor's controller to add nodes (https://github.com/enso-org/ide/pull/642)
Original commit: ab9272a856
This commit is contained in:
parent
42252a925d
commit
11e326e65f
@ -106,11 +106,10 @@ impl ViewLayout {
|
||||
let logger = Logger::sub(logger,"ViewLayout");
|
||||
let world = &application.display;
|
||||
let text_editor = TextEditor::new(&logger,world,text_controller,kb_actions,fonts);
|
||||
let graph = graph_controller.graph().clone_ref();
|
||||
let node_editor = NodeEditor::new
|
||||
(&logger,application,graph_controller,project_controller,visualization_controller);
|
||||
let node_editor = node_editor.await?;
|
||||
let node_searcher = NodeSearcher::new(world,&logger,node_editor.clone_ref(),graph,fonts);
|
||||
let node_searcher = NodeSearcher::new(world,&logger,node_editor.clone_ref(),fonts);
|
||||
world.add_child(&text_editor.display_object());
|
||||
world.add_child(&node_editor);
|
||||
world.add_child(&node_searcher);
|
||||
|
@ -127,6 +127,11 @@ impl GraphEditorIntegratedWithController {
|
||||
pub fn graph_editor(&self) -> GraphEditor {
|
||||
self.model.editor.clone_ref()
|
||||
}
|
||||
|
||||
/// Get the controller associated with this graph editor.
|
||||
pub fn controller(&self) -> &controller::ExecutedGraph {
|
||||
&self.model.controller
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -23,7 +23,6 @@ pub struct NodeSearcher {
|
||||
display_object : display::object::Instance,
|
||||
node_editor : NodeEditor,
|
||||
text_field : TextField,
|
||||
controller : controller::graph::Handle,
|
||||
logger : Logger,
|
||||
}
|
||||
|
||||
@ -32,7 +31,6 @@ impl NodeSearcher {
|
||||
( world : &World
|
||||
, logger : impl AnyLogger
|
||||
, node_editor : NodeEditor
|
||||
, controller : controller::graph::Handle
|
||||
, fonts : &mut font::Registry)
|
||||
-> Self {
|
||||
let scene = world.scene();
|
||||
@ -48,7 +46,7 @@ impl NodeSearcher {
|
||||
};
|
||||
let text_field = TextField::new(world,properties);
|
||||
display_object.add_child(&text_field.display_object());
|
||||
let searcher = NodeSearcher{node_editor,display_object,text_field,controller,logger};
|
||||
let searcher = NodeSearcher{node_editor,display_object,text_field,logger};
|
||||
searcher.initialize()
|
||||
}
|
||||
|
||||
@ -67,7 +65,7 @@ impl NodeSearcher {
|
||||
let location_hint = LocationHint::End;
|
||||
let expression = expression.to_string();
|
||||
let new_node = NewNodeInfo { expression,metadata,id,location_hint };
|
||||
node_searcher.controller.add_node(new_node);
|
||||
node_searcher.node_editor.graph.controller().graph().add_node(new_node);
|
||||
node_searcher.hide();
|
||||
} else {
|
||||
// Keep only one line.
|
||||
|
Loading…
Reference in New Issue
Block a user