| @@ -72,10 +72,10 @@ pub struct CloseAllItems { · 71 unmodified lines |
| 72 | pub save_intent: Option<SaveIntent>, | 72 | pub save_intent: Option<SaveIntent>, |
| 73 | } | 73 | } |
| 74 | | 74 | |
| 75 | #[derive(Clone, PartialEq, Debug, Deserialize)] | 75 | #[derive(Clone, PartialEq, Debug, Deserialize, Default)] |
| 76 | #[serde(rename_all = "camelCase")] | 76 | #[serde(rename_all = "camelCase")] |
| 77 | pub struct RevealInProjectPanel { | 77 | pub struct RevealInProjectPanel { |
| 78 | pub entry_id: u64, | 78 | pub entry_id: Option<u64>, |
| 79 | } | 79 | } |
| 80 | | 80 | |
| 81 | impl_actions!( | 81 | impl_actions!( |
| @@ -1442,7 +1442,9 @@ impl Pane { · 1360 unmodified lines |
| 1442 | let entry_id = entry.to_proto(); | 1442 | let entry_id = entry.to_proto(); |
| 1443 | menu = menu.separator().entry( | 1443 | menu = menu.separator().entry( |
| 1444 | "Reveal In Project Panel", | 1444 | "Reveal In Project Panel", |
| 1445 | Some(Box::new(RevealInProjectPanel { entry_id })), | 1445 | Some(Box::new(RevealInProjectPanel { |
| | 1446 | entry_id: Some(entry_id), |
| | 1447 | })), |
| 1446 | cx.handler_for(&pane, move |pane, cx| { | 1448 | cx.handler_for(&pane, move |pane, cx| { |
| 1447 | pane.project.update(cx, |_, cx| { | 1449 | pane.project.update(cx, |_, cx| { |
| 1448 | cx.emit(project::Event::RevealInProjectPanel( | 1450 | cx.emit(project::Event::RevealInProjectPanel( |
| @@ -1807,11 +1809,15 @@ impl Render for Pane { · 358 unmodified lines |
| 1807 | ) | 1809 | ) |
| 1808 | .on_action( | 1810 | .on_action( |
| 1809 | cx.listener(|pane: &mut Self, action: &RevealInProjectPanel, cx| { | 1811 | cx.listener(|pane: &mut Self, action: &RevealInProjectPanel, cx| { |
| 1810 | pane.project.update(cx, |_, cx| { | 1812 | let entry_id = action |
| 1811 | cx.emit(project::Event::RevealInProjectPanel( | 1813 | .entry_id |
| 1812 | ProjectEntryId::from_proto(action.entry_id), | 1814 | .map(ProjectEntryId::from_proto) |
| 1813 | )) | 1815 | .or_else(|| pane.active_item()?.project_entry_ids(cx).first().copied()); |
| 1814 | }) | 1816 | if let Some(entry_id) = entry_id { |
| | 1817 | pane.project.update(cx, |_, cx| { |
| | 1818 | cx.emit(project::Event::RevealInProjectPanel(entry_id)) |
| | 1819 | }); |
| | 1820 | } |
| 1815 | }), | 1821 | }), |
| 1816 | ) | 1822 | ) |
| 1817 | .when(self.active_item().is_some(), |pane| { | 1823 | .when(self.active_item().is_some(), |pane| { |