de.netcomputing.anyj.scripting
Class AJExternalService
java.lang.Object
|
+--de.netcomputing.anyj.scripting.AJExternalService
- public abstract class AJExternalService
- extends java.lang.Object
Services are a basic concept of AnyJ's application architecture.
-
AnyJ tracks the current set of selections. E.g. when you activate an editor
by clicking into it the selection will be
{ String at the carets position, AJSTextDocument of the activated editor, File of the activated editor }
Use 'Tools|Scripting|Show Selected Objects' to dump the list of selected Objects.
- If the user opens a menu or presses a shortcut, AnyJ asks all registered services if
they can process one of the selected classes ('canProcess( selection[i] )' ? ). If the service returns true,
the menu item gets enabled (PopupMenus: gets visible).
- If the user chooses the menu item, 'doProcess' is called on the appropriate service.
This class is abstract, you need to define 'canProcessSelection' and 'doProcess'. See the example
scripts/Tutorials on how to develop a service interactively and on how to register a user-written service.
Method Summary |
abstract boolean |
canProcessSelection(java.lang.Object selection)
tell AnyJ wether this service is capable to process the given selection.
|
abstract void |
doProcess(java.lang.Object selection)
the user choosed to execute this service, do it ! |
java.lang.String |
getCategory()
return the Category, determines the position of the service in a menu.
|
java.lang.String |
getMenuName()
return the name as it appears in a menu |
void |
setCategory(java.lang.String category)
|
void |
setMenuName(java.lang.String menuName)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AJExternalService
public AJExternalService()
AJExternalService
public AJExternalService(java.lang.String name)
setMenuName
public void setMenuName(java.lang.String menuName)
setCategory
public void setCategory(java.lang.String category)
canProcessSelection
public abstract boolean canProcessSelection(java.lang.Object selection)
- tell AnyJ wether this service is capable to process the given selection.
The selection can be a String, AJSTextDocument or a File (currently).
doProcess
public abstract void doProcess(java.lang.Object selection)
- the user choosed to execute this service, do it !
getMenuName
public java.lang.String getMenuName()
- return the name as it appears in a menu
getCategory
public java.lang.String getCategory()
- return the Category, determines the position of the service in a menu.
See Preferences,Menus & Shortcuts to obtain all categories (=directory level treenodes in
the 'Menus & Shortcuts' panel).