Hooks in the menu

gulhaugen

Member²
Hi

Is it possible to execute something when I click "Edit spec and body"?

I want to do something like "stored_proc(:name_of_object,user);" whenever someone clicks that button (if setup at that particular users station).

In addition I would need an additional context menu item which will have to do "another_stored_proc(:name_of_object,user);"

I see that browser extender could perhaps provide me with the last one, and perhaps also the first one if BE could tell PLSQLDev to load a package into the editor.

Thanks

Morten
 
Below is an example how to edit Package specification and body using Browser Extender.
Please save code to a file and place it in Browser Extender extension's folder.

------ cut -----
PL/SQL Developer Browser Extender Command

[MAIN]
NAME=PL/SQL - Edit Spec and Body
CAPTION=Edit Spec and Body
OTYPE=Package
OOWNER=%
ONAME=%
SEPARATOR_ABOVE=N
SEPARATOR_BELOW=N
LOAD_AND_EXECUTE=N
LOAD_COMMAND=Y
LOAD_AFTER=EXECUTE
LOAD_WIN_TYPE=3
EXECUTE_AND_CLOSE=Y
PRIVILEGE_REQ=N
PRIVILEGE=
ORACLE_VERSION_REQ=N
ORACLE_VERSION=7.0.0
ONCLICK_CONFIRM=N
ONCLICK_CONFIRM_MSG=
ONCLICK_SPLASH=N
ONCLICK_SPLASH_MSG=
ONCLICK_SPLASH_MSG_BL=N
ONCLICK_SPLASH_MSG_AFTER=
ONCLICK_SPLASH_DELAY=0
ONCLICK_IGNORE_EXCEPTIONS=N
ONPOPUP_IGNORE_EXCEPTIONS=Y

ONCLICK_CODE_TYPE=1
ONCLICK_EXTERNAL_CODE_FILE=
[ONCLICK]
select 'create or replace '
from dual
union all
select * from
(
select replace(t.text,chr(10),'')
from all_source t
where t.name = '#oname'
and t.owner = '#oowner'
and t.type = 'PACKAGE'
order by t.line)
union all
select '/'
from dual
union all
select 'create or replace '
from dual
union all
select * from
(
select replace(t.text,chr(10),'')
from all_source t
where t.name = '#oname'
and t.owner = '#oowner'
and t.type = 'PACKAGE BODY'
order by t.line)
union all
select '/'
from dual

[ONPOPUP]

------ cut -----
 
Ah, perfect, but could I additionally call stored_proc(:name_of_object,user); as part of the Edit spec and body command?

UPDATE:
I got it to work with union all at the top with my stored proc. The two remaining issues are:
1. The package now opens as modified (yellow icon)
2. The editor does not jump to the last position

I can live without 2 but 1 is a bit more serious

Morten
 
1. The package now opens as modified (yellow icon)
The yellow icon does not mean "modified", it simply means "Not compiled". The upper blue means exactly "not saved = modified". It is a PL/SQL Developer issue, it does not know that you just start to edit a code opened from db. The behavior is similar to opening a file from file system.
2. The editor does not jump to the last position
The behavior is the same like standard "Edit Spec & Body" and other edit or view popup items. I can't see the difference.
 
Back
Top