Issue 133985.
Language support such as PHP can provide a snippet (code generation feature similar to the Alt+Insert one in the Java editor) for creating a SQL statement.
----------- Generate ----------- ... SQL... ... -----------
When the SQL item is invoked, an empty SQL editor is opened. The user can then use the SQL editor in an usual way (edit the statement, use the code completion, execute the statement, etc.). Especially, the user can invoke the code generation features in the SQL editor (TBD: link to SQL snippets page) such as a code generation feature for a SELECT statement.
When the user is done, (s)he pressed an "Update PHP editor" button in the SQL editor, which closes the editor and inserts the statement in the PHP editor.
Should the SQL editor be a modal dialog, or should it be the default (non-modal) SQL editor? The former makes it easy for the user to understand that after editing the statement, (s)he needs to press OK to insert the statement in the PHP editor. The latter, being non-model, is more flexible -- the user can browse the database structure, connect to another database, copy-paste the SQL statement from another PHP file, etc.