Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mulander committed Aug 26, 2012
0 parents commit 60b0223
Show file tree
Hide file tree
Showing 27 changed files with 968 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
*.cache
46 changes: 46 additions & 0 deletions Commands/Describe Selection or Word.tmCommand
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>query=${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}
. "$TM_SUPPORT_PATH/lib/webpreview.sh"
html_header "Describe $query"
NLS_LANG=AMERICAN_AMERICA.UTF8
export NLS_LANG
sqlplus -S -L /NOLOG &lt;&lt;EOF
set define off
whenever sqlerror exit failure rollback
prompt &lt;pre&gt;
connect "$ORA_USER"/"$ORA_PWD"@"$ORA_CONNECT"
show user
prompt &lt;/pre&gt;
set markup html on
desc $query
set markup html off
EOF
echo "SQL*Plus exited."
html_footer
</string>
<key>fallbackInput</key>
<string>word</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
<string>@d</string>
<key>name</key>
<string>Describe Selection or Word</string>
<key>output</key>
<string>showAsHTML</string>
<key>scope</key>
<string>source.plsql.oracle</string>
<key>uuid</key>
<string>65257C54-A07C-4764-961C-B892F28A89DF</string>
</dict>
</plist>
54 changes: 54 additions & 0 deletions Commands/Find Procedure.tmCommand
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>#!/usr/bin/env ruby
require ENV['TM_SUPPORT_PATH'] + '/lib/textmate'
require ENV['TM_SUPPORT_PATH'] + '/lib/exit_codes'
proj = ENV['TM_PROJECT_DIRECTORY']
file = ENV['TM_FILEPATH']
line = ENV['TM_CURRENT_LINE']
proc = ENV['TM_CURRENT_WORD']
if line.match(%r{\b([-a-z0-9_]+)\.#{proc}}i)
pkg = $1
file = %x{egrep -il -r "create.*package *body *#{pkg}\\b" "#{proj}"}.split(/\n/).last
if file
res = %x{egrep -in "(function|procedure) *#{proc}" "#{file}"}.split(/\n/).last
else
TextMate.exit_show_tool_tip "Package #{pkg} not available"
end
else
res = %x{egrep -in "(function|procedure) *#{proc}" "#{file}"}.split(/\n/).last
end
if res
data = res.split(/:/)
TextMate.go_to :file =&gt; file, :line =&gt; data[0], :column =&gt; 0
else
file = file.sub(%r{#{proj}/?}, '')
TextMate.exit_show_tool_tip "Procedure #{proc} not found in #{file}"
end
</string>
<key>fallbackInput</key>
<string>word</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
<string>^f</string>
<key>name</key>
<string>Find Procedure</string>
<key>output</key>
<string>showAsTooltip</string>
<key>scope</key>
<string>source.plsql.oracle</string>
<key>uuid</key>
<string>1222BE8A-15D8-4C06-8965-F139A153DD97</string>
</dict>
</plist>
78 changes: 78 additions & 0 deletions Commands/Help.tmCommand
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>. "$TM_SUPPORT_PATH/lib/webpreview.sh"
html_header "Oracle PL/SQL Bundle Help" "Oracle"
Markdown.pl &lt;&lt;'EOF'
# Help for the Oracle PL/SQL Bundle
## Search Oracle Docs for Selection or Word
The _Search Oracle Docs for Selection or Word_ command searches for the selected text or current word in the Oracle online documentation.
## Run Script
The _Run Script_ command takes the current file and runs it using SQL*Plus.
## Run Selection or Line
The _Run Selection or Line_ command takes the selected text or current line and submits it as a query using SQL*Plus.
## Describe Selection or Word
The _Describe Selection or Word_ command takes the selected text or current word and submits a describe command to SQL*Plus.
## Open SQL*Plus
The _Open SQL*Plus_ command opens up SQL*Plus in the project folder and logs in using the username, password and connectstring supplied as environment variables. Useful for running "interactive" SQL-scripts.
## Find Procedure
The _Find Procedure_ command will search for a procedure or function in a package body with the name of the current word. If it is found, the file containing it is shown and the cursor moves to the start of the procedure or function.
### Environment Variables
The commands assumes the following environment variables are properly set:
* `$ORA_USER` - schema/username e.g. SCOTT
* `$ORA_PWD ` - password, e.g. TIGER
* `$ORA_CONNECT` - connect string, e.g. localhost:1521/ORCL
These variables may be set in the parent shell of TextMate, global variables in TextMate preferences, or as project local variables.
The commands all assume UTF-8 formatted files.
## Extras
### Importing a File
You can import the contents of another file into the currently open file by dragging
it into the window. The contents will appear at the place you release it.
### Tab Triggers
There are a number of "tab triggers" defined which will insert useful code snippets into the current file. Look at the Oracle menu to see what these are and how to activate them.
EOF
html_footer
</string>
<key>input</key>
<string>none</string>
<key>keyEquivalent</key>
<string>^H</string>
<key>name</key>
<string>Help</string>
<key>output</key>
<string>showAsHTML</string>
<key>scope</key>
<string>source.plsql.oracle</string>
<key>uuid</key>
<string>69B47504-F6E5-44BB-A758-51DB35270B9C</string>
</dict>
</plist>
44 changes: 44 additions & 0 deletions Commands/Run Script.tmCommand
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>. "$TM_SUPPORT_PATH/lib/webpreview.sh"
html_header "Run ‘${TM_FILENAME}’"
cd "$TM_DIRECTORY"
NLS_LANG=AMERICAN_AMERICA.UTF8
export NLS_LANG
sqlplus -S -L /NOLOG &lt;&lt;EOF
set define off
whenever sqlerror exit failure rollback
prompt &lt;pre&gt;
connect "$ORA_USER"/"$ORA_PWD"@"$ORA_CONNECT"
show user
prompt Running $TM_FILENAME
@"$TM_FILENAME"
show errors
prompt &lt;/pre&gt;
EOF
echo "SQL*Plus exited."
html_footer
</string>
<key>input</key>
<string>none</string>
<key>keyEquivalent</key>
<string>@r</string>
<key>name</key>
<string>Run Script</string>
<key>output</key>
<string>showAsHTML</string>
<key>scope</key>
<string>source.plsql.oracle</string>
<key>uuid</key>
<string>BA59AADC-85C6-4215-BEFA-DF6BAAEFC7F5</string>
</dict>
</plist>
49 changes: 49 additions & 0 deletions Commands/Run Selection or Line.tmCommand
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>query=${TM_SELECTED_TEXT:-$TM_CURRENT_LINE}
. "$TM_SUPPORT_PATH/lib/webpreview.sh"
html_header "Run Selection or Line"
NLS_LANG=AMERICAN_AMERICA.UTF8
export NLS_LANG
sqlplus -S -L /NOLOG &lt;&lt;EOF
set define off
whenever sqlerror exit failure rollback
prompt &lt;pre&gt;
connect "$ORA_USER"/"$ORA_PWD"@"$ORA_CONNECT"
show user
prompt &lt;/pre&gt;
set markup html on
$query
set markup html off
prompt &lt;pre&gt;
show errors
prompt &lt;/pre&gt;
EOF
echo "SQL*Plus exited."
html_footer
</string>
<key>fallbackInput</key>
<string>line</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
<string>@R</string>
<key>name</key>
<string>Run Selection or Line</string>
<key>output</key>
<string>showAsHTML</string>
<key>scope</key>
<string>source.plsql.oracle</string>
<key>uuid</key>
<string>57DAAB63-8B29-4599-B25C-0A2661A702E3</string>
</dict>
</plist>
28 changes: 28 additions & 0 deletions Commands/Search Oracle Docs for Selection or Word.tmCommand
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>query=${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}
. "$TM_SUPPORT_PATH/lib/html.sh"
redirect "http://www.oracle.com/pls/db111/search?remark=quick_search&amp;word=$query"
</string>
<key>fallbackInput</key>
<string>word</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
<string>^h</string>
<key>name</key>
<string>Search Oracle Docs for Selection or Word</string>
<key>output</key>
<string>showAsHTML</string>
<key>scope</key>
<string>source.plsql.oracle</string>
<key>uuid</key>
<string>2D735CC6-DF05-4725-A4FD-08DE33AAD9E4</string>
</dict>
</plist>
24 changes: 24 additions & 0 deletions DragCommands/Import File.tmDragCommand
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>command</key>
<string>cat "$TM_DROPPED_FILE"</string>
<key>draggedFileExtensions</key>
<array>
<string>sql</string>
</array>
<key>input</key>
<string>selection</string>
<key>name</key>
<string>Import File</string>
<key>output</key>
<string>insertAsSnippet</string>
<key>scope</key>
<string>source.plsql.oracle</string>
<key>uuid</key>
<string>7CFC443C-623B-405B-8691-F109033BEA39</string>
</dict>
</plist>
19 changes: 19 additions & 0 deletions Preferences/Indent.tmPreferences
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Indent</string>
<key>scope</key>
<string>source.plsql.oracle</string>
<key>settings</key>
<dict>
<key>decreaseIndentPattern</key>
<string>(?i)^\s*(is|as|begin|end|then|else|elsif|exception)\b</string>
<key>increaseIndentPattern</key>
<string>(?i)^\s*(is|as|begin|if|then|else|elsif|loop|exception)\b</string>
</dict>
<key>uuid</key>
<string>6A30BCDD-20CB-4E24-A1DC-5187E6AA36A6</string>
</dict>
</plist>
33 changes: 33 additions & 0 deletions Snippets/New Function.tmSnippet
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>content</key>
<string>FUNCTION ${1:func_name}(
po_result_code OUT NUMBER)
RETURN ${2:RETURN_TYPE}
IS
l_procname VARCHAR2(30) := '${1/_(.)/\u$1/g}';
BEGIN
Corelogger.Log_Open_Print_Close(pi_pkg_name, l_procname,
${3:INITIAL STATE});
po_result_code := Corecontainertask.c_result_success;
$0
EXCEPTION
WHEN OTHERS THEN
Corelogger.Log_Open_PrintError_Close(pi_pkg_name, l_procname,
'Exception: ' || SUBSTR(SQLERRM(SQLCODE), 1, 100));
po_result_code := Corecontainertask.c_result_failure;
END $1;</string>
<key>name</key>
<string>New Function</string>
<key>scope</key>
<string>source.plsql.oracle</string>
<key>tabTrigger</key>
<string>func</string>
<key>uuid</key>
<string>5873A2DA-C72C-40DB-8859-368CA8B3809E</string>
</dict>
</plist>

0 comments on commit 60b0223

Please sign in to comment.