See How to use STM32CubeMX to generate code.
Open the IDE.
Import the project. File > Import
Select Existing Projects into Workspace .
Select the folder.
Now the project is imported. Add some code.
To debug/flash follow this. Project > Target > Program chip
Select the executable.
Configure the debugger. Select ST-LinkV2-1 for built in debugger. Select ST-LinkV2 for external debugger.
Debug > Debug Configurations
Select your executable under Ac6 STM32 Debugging. Then select Debugger. Click on Manual spec in Script.
Then configure the debugger.
Hit Apply and then Debug.
OpenSTM32 should flash the chip and enter debug mode.