Skip to content

Commit 8d83b0f

Browse files
committed
WIP: Verify project setup
1 parent 5619125 commit 8d83b0f

File tree

1 file changed

+105
-0
lines changed
  • sqldeveloper/extension/java/WorksheetAction

1 file changed

+105
-0
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# SQL Developer Examples
2+
## Worksheet Action
3+
4+
Actions for the worksheet context menu and/or toolbar can be added via an ActionProvider registered in the extension.xml.
5+
6+
``` xml
7+
<extension xmlns="http://jcp.org/jsr/198/extension-manifest" id="@@extension.id@@" version="@@extension.version@@.@@extension.build@@" esdk-version="1.0"
8+
. . .
9+
<hook>
10+
<sqldev-worksheet-hook xmlns="http://xmlns.oracle.com/sqldeveloper/sqldev-worksheet">
11+
<provider>my.great.MysteryActionProvider</provider>
12+
</sqldev-worksheet-hook>
13+
</hook>
14+
</extension>
15+
```
16+
17+
``` java
18+
package oracle.dbtools.worksheet;
19+
20+
import oracle.dbtools.worksheet.extension.WorksheetHook;
21+
22+
/**
23+
* The <code>ActionProvider</code> interface provides a mechanism for
24+
* registering actions in the Worksheet. Worksheet actions can be registered for
25+
* either the toolbar, the context menu, or both. Panels can be registered for
26+
* displaying the results of actions.
27+
* <p>
28+
* ActionProvider instances are responsible for determining the enabled state of
29+
* an action as well as creating Tasks to execute the action.
30+
* <p>
31+
* Registration occurs through the use of an extension hook.
32+
* <p>
33+
*
34+
* @author jmcginni
35+
* @param <V>
36+
* @see WorksheetHook
37+
*
38+
*/
39+
public interface ActionProvider<V> {
40+
/**
41+
* Returns the number of actions supported by this provider.
42+
*
43+
* @return the number of supported actions
44+
*/
45+
int getActionsCount();
46+
47+
/**
48+
* Returns the action at the specified location.
49+
*
50+
* @param i
51+
* the index of the action
52+
* @return the WorksheetAction at the location
53+
* @throws IndexOutOfBoundsException
54+
* if the specified location is out of range
55+
*/
56+
WorksheetAction getActionAt(int i);
57+
58+
/**
59+
* Returns the number of panels supported by this provider.
60+
*
61+
* @return the number of supported panels
62+
*/
63+
int getPanelCount();
64+
65+
/**
66+
* Returns the panel at the specified location.
67+
*
68+
* @param i
69+
* the index of the panel
70+
* @return the WorksheetResultPanel at the location
71+
* @throws IndexOutOfBoundsException
72+
* if the specified location is out of range
73+
*/
74+
WorksheetResultPanel getPanelAt(int i);
75+
76+
/**
77+
* Returns a task that can be used to execute the action.
78+
*
79+
* @param id
80+
* a String identifying the action to perform
81+
* @param ctx
82+
* the WorksheetContext describing the current Worksheet
83+
* environment
84+
* @return a RaptorTask that encapsulates the running of the action
85+
*/
86+
WorksheetTaskWrapper<V> doAction(String id, WorksheetContext ctx);
87+
88+
/**
89+
* Returns whether the specified action should be enabled based on the
90+
* specified context.
91+
*
92+
* @param id
93+
* a String identifying the action to perform
94+
* @param ctx
95+
* the WorksheetContext describing the current Worksheet
96+
* environment
97+
* @return whether the action should be enabled.
98+
*/
99+
boolean checkActionEnabled(String id, WorksheetContext ctx);
100+
}
101+
102+
```
103+
104+
105+

0 commit comments

Comments
 (0)