How to implement an extension like this
Closed this issue · 3 comments
Jeff Smith sent me here.
Is it possible to create a sql developer extension for the package_parent (function, procedure)? It should provide a way inserting code into an existing and/or new code page (sql worksheet, new package, new function etc.).
Because this is not possible with templates (inserting comments, date and user) i'd like to create an extension for this issue. I did not find an example for this or any further information about this.
Could someone give me a hint on this ? If possible, i'd like to create this extension only with xml.
I'll have to think about the XML case, but I think this Context Menu Example in java is similar to what you are trying to do.
XML only is going to be tough. Any data needed will have to be collected either via query to the associated db connection or interactively from the user. Any action is typically done via sql or pl/sql script (again on the associated connection), but javascript is also available so maybe accessing the editor directly in a manner similar to the java example or getting the text you want into the clipboard for pasting would be possible.
Can you provide a more detailed user story on what you want to achieve? For example, Add a context menu entry to ALL CODE EDITORS[1] that will add a comment block AT THE CURRENT CARET POSITION[2] containing the following ...[3]
[1] Attached to:
- ALL_CODE_EDITORS (has to be java to include the worksheet -- which has no associated db object)
- CODE EDITOR FOR e.g., FUNCTION, PROCEDURE, ... (worksheet excluded)
[2] Insertion point - AT THE CURRENT CARET POSITION (java, javascript?)
- PREPENDED TO THE CURRENT DEFINITION (java, javascript?, should be possible with pl/sql as long as creating/updating the db definition of the object is OK.)
- COPIED TO SYSTEM CLIPBOARD (java, javascript?)
[3] Using data from - where the information comes from will also constrain the deployment choices.
Hi Brian,
thank you for your quick response!
Answering your question is not that easy, because i do not know what's possible in the sql dev after all.
What i have in mind is helping the developer to create code following the rules of our company. These rules can change over time. So it should be possible to edit those "templates" easily.
Usually we do not use standalone procedures or functions. 99% of our job is to create packages and methods within.
So, I am not sure what's the best way implementing this. A flexible approach inserting a statement at the current caret would possibly be the most open way achieving this.
Answering your three points with this in mind i would say:
1: ALL_CODE_EDITORS
2: at the current position
3: the Data should be stored in a kind of text file (xml) easily to maintain. best way would be accessing it via an uri.
As i am also a part time java dev since two years i can of course do this with java. It just seemed to be more complicated.
Again, thank you very much for your support!
Kind regards,
André