Most likely you have a bad low oil switch. You can either "assume" based on the odds (I hate doing that), or the switch can be tested by removing it and pumping it up to 10psi and doing a resistance reading between the contact and body. It should be closed (no resistance) with no pressure, and open (infinite resistance) when it's pumped up.
If you really do have low oil pressure, then switch is doing it's job. You might have a plugged oil filter (if equipped)? You can test the oil pump and internal pickup screen by plugging a gauge into the hole the switch came out of to see if you have at least 10 psi when the engine is running.
As far as shutting off, when you hit the idle switch, Since you say it's running a bit rough, I would suspect a plugged idle passage. Cleaning the carbureto will likely cause that problem to go away. You might also check to see if the coil is working right. If you look near the carburetor, you'll see a coil about 2" long that pulls a flapper on the carbureretor to it when energized. Basically, it become an electromagnet when they're no load on the generator. If the carb cleaning doesn't do it, then check it for proper function and adjustment.
Did you use an aerosol cleaner? Sometimes that still leaves residue. What about the fuel filter? Here's some general tips I think with be useful:
First, is your air filter clean? If it's partially blocked, please repalce it and you should see a big difference.
I also always like to mention fuel. I recommend using fuel no older than three weeks. Likely 70% of the problems like this we see are fuel or carburetor related. Today's fuels with MTBE and alcohol are nowhere as stable as the fuels we had a few years ago. I recommend against purchasing fuel from some of the smaller stores that sell fuel for less than the well-known stations such as Chevron, Shell, etc. These smaller companies get a price break on fuel from the distributors because they are buying fuel that is near the 30-day mark. Distributors cannot sell the fuel past that age so they offer a discount to these buyers. Result is that you may be getting fuel that's nearly stale right from the pump.
Because of the fuel another likely culprit is your carburetor. It should be cleaned and rebuilt if you suspect plugging may be your issue. If you don't feel comfortable with this kind of repair I would suggest sending it to a reputable shop. If you do the work yourself, take pictures or at least make a drawing of where all the linkages, gaskets, and component parts go. Correct reassembly is critical. Take it completely apart and clean every metal part with carburetor cleaner and blow out all the small holes and passageways with compressed air or use soft tag wire to make sure they're not blocked, them blow through them. Do not allow carburetor cleaner to get on the non-metallic parts since it may decompose these parts and cause further plugging. Wash all the metal parts in warm soapy water and then rinse them with clean washer to remove all residue of cleaner and soap. Dry them thoroughly. Then reassemble and remount. Always replace the gaskets with new ones.
If this is the case, make sure to also drain the fuel tank and fuel line, and replace the fuel filter. Rinse the tank out with some fresh gasoline, since you don't want the problem to repeat itself.