MCPcopy Create free account
hub / github.com/SpartanJ/eepp / createDocDoesNotExistsInFSAlert

Method createDocDoesNotExistsInFSAlert

src/tools/ecode/ecode.cpp:2459–2499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2457}
2458
2459void App::createDocDoesNotExistsInFSAlert( UICodeEditor* editor ) {
2460 UILinearLayout* docAlert = editor->findByClass<UILinearLayout>( "doc_alert" );
2461
2462 if ( docAlert )
2463 return;
2464
2465 const auto msg = R"xml(
2466 <hbox class="doc_alert" layout_width="wrap_content" layout_height="wrap_content" layout_gravity="top|right" gravity-owner="true">
2467 <TextView id="doc_alert_text" layout_width="wrap_content" layout_height="wrap_content" margin-right="24dp"
2468 text='@string(reload_current_file, "The file does not exists anymore on the disk. You are editing a non-existent file.&#xA;Do you want to continue editing the saved buffer?")'
2469 />
2470 <PushButton id="file_continue_editing" layout_width="wrap_content" layout_height="18dp" text='@string("continue_editing", "Continue Editing")' margin-right="4dp"
2471 tooltip='@string(tooltip_continue_editing_file, "Continue editing the text document buffer.")' />
2472 <PushButton id="file_close" layout_width="wrap_content" layout_height="18dp" text='@string("close_file", "Close File")'
2473 tooltip='@string(tooltip_close_unexistent_file, "Closes the edited buffer")' />
2474 </hbox>
2475 )xml";
2476 docAlert = mUISceneNode->loadLayoutFromString( msg, editor )->asType<UILinearLayout>();
2477
2478 editor->enableReportSizeChangeToChildren();
2479
2480 docAlert->find( "file_continue_editing" )->onClick( [docAlert, editor]( const MouseEvent* ) {
2481 editor->disableReportSizeChangeToChildren();
2482 docAlert->close();
2483 editor->setFocus();
2484 } );
2485
2486 docAlert->find( "file_close" )->onClick( [this, editor, docAlert]( const MouseEvent* ) {
2487 editor->disableReportSizeChangeToChildren();
2488 docAlert->close();
2489 mSplitter->closeTab( editor, UITabWidget::FocusTabBehavior::Default );
2490 } );
2491
2492 docAlert->runOnMainThread(
2493 [docAlert, editor] {
2494 editor->disableReportSizeChangeToChildren();
2495 docAlert->close();
2496 editor->setFocus();
2497 },
2498 Seconds( 30.f ) );
2499}
2500
2501std::map<std::string, std::string>& App::getCurrentLanguageExtensionsPriorities() {
2502 if ( !mCurrentProject.empty() && mCurrentProject != getPlaygroundPath() )

Callers 1

loadDocumentsMethod · 0.80

Calls 10

SecondsFunction · 0.85
loadLayoutFromStringMethod · 0.80
closeTabMethod · 0.80
runOnMainThreadMethod · 0.80
closeMethod · 0.65
onClickMethod · 0.45
findMethod · 0.45
setFocusMethod · 0.45

Tested by

no test coverage detected