SQL Developer的编辑器扩展

时间:2014-01-02 19:21:59

标签: plugins oracle-sqldeveloper jdeveloper

我正在尝试为Oracle SQL Developer编写(编辑器)扩展。我无法找到有关它的信息,但我已经从我发现的一些教程和博客条目中拼凑出以下内容:

<?xml version="1.0" encoding="UTF-8"?>
<displays>
    <display enable="true" objectType="SEQUENCE" style="null" type="editor">
        <name><![CDATA[Details]]></name>
        <query>
            <sql>
                <![CDATA[
SELECT 'sequence_name' AS "NAME", sequence_name AS "VALUE" FROM :NAME
UNION
SELECT 'last_value' AS "NAME", CAST(last_value AS text) AS "VALUE" FROM :NAME
UNION
SELECT 'start_value' AS "NAME", CAST(start_value AS text) AS "VALUE" FROM :NAME
UNION
SELECT 'increment_by' AS "NAME", CAST(increment_by AS text) AS "VALUE" FROM :NAME
UNION
SELECT 'max_value' AS "NAME", CAST(max_value AS text) AS "VALUE" FROM :NAME
UNION
SELECT 'min_value' AS "NAME", CAST(min_value AS text) AS "VALUE" FROM :NAME
UNION
SELECT 'cache_value' AS "NAME", CAST(cache_value AS text) AS "VALUE" FROM :NAME
UNION
SELECT 'log_cnt' AS "NAME", CAST(log_cnt AS text) "VALUE" FROM :NAME
UNION
SELECT 'is_cycled' AS "NAME", CAST(is_cycled AS text) AS "VALUE" FROM :NAME
UNION
SELECT 'is_called' AS "NAME", CAST(is_called AS text) AS "VALUE" FROM :NAME
                ]]>
            </sql>
        </query>
        <CustomValues>
            <TYPE>vertical</TYPE>
        </CustomValues>
    </display>
</displays>

这样可行,因为额外的选项卡会显示Oracle数据库连接上的序列。但是,它们不会显示Postgres数据库连接。对于甚至在SQL Dev中的pg数据库中显示的序列,我必须使用第二个扩展脚本:

<?xml version="1.0" encoding="windows-1252" ?>
<navigator RESOURCE_FILE="oracle.dbtools.raptor.navigator.OracleNavigatorResource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="navigator.xsd">
    <objectType connType="PostgreSQL" id="SEQUENCE" includesSyns="true" weight="100.0">
        <folder>
            <icon RSKEY="SEQUENCE_FOLDER_ICON"/>
            <label RSKEY="Sequences"/>
            <queries>
                <query minversion="8">
                    <sql constrained="true"><![CDATA[SELECT relname, nspname FROM pg_class JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace WHERE relkind = 'S' AND nspname = :SCHEMA]]></sql>
                </query>
                <columns>
                    <column filterable="true" id="SEQUENCENAME" sortable="true">
                        <colName><![CDATA[relname]]></colName>
                    </column>
                    <column filterable="true" id="NAME" sortable="true">
                        <colName><![CDATA[relname]]></colName>
                    </column>
                </columns>
            </queries>
        </folder>
        <node>
            <icon RSKEY="OracleIcons.SEQUENCE"/>
        </node>
    </objectType>
</navigator>

有没有办法指定此扩展仅适用于Postgres序列,而不适用于Oracle序列?

1 个答案:

答案 0 :(得分:2)

这里的正确答案似乎是在display元素中有一个connType="PostgreSQL"属性。这将其限制为仅Postgres序列。这是试验和错误,我找不到editor.xsd,似乎Oracle没有提供它。