@API(type=INTERNAL,
src=PUBLIC)
public class JSOperation
extends java.lang.Object
implements AuthorOperation
It must have a function called doOperation(), which can use the predefined authorAccess variable.
The authorAccess variable has access to the AuthorAccess instance.
The following example is a script that can be used to move the caret location after the current element:
function doOperation(){
caretOffset = authorAccess.getEditorAccess().getCaretOffset();
currentNode = authorAccess.getDocumentController().getNodeAtOffset(caretOffset);
//Move caret after current node
authorAccess.getEditorAccess().setCaretPosition(currentNode.getEndOffset() + 1);
}
Note: If you have a script called commons.js in the framework directory, you can call functions defined inside it from your custom script content so that you can use that external script file as a library of functions.
NAMESPACE_ARGUMENT, NAMESPACE_ARGUMENT_DESCRIPTOR, SCHEMA_AWARE_ARGUMENT, SCHEMA_AWARE_ARGUMENT_DESCRIPTOR| Constructor and Description |
|---|
JSOperation() |
| Modifier and Type | Method and Description |
|---|---|
void |
doOperation(AuthorAccess authorAccess,
ArgumentsMap args)
Perform the actual operation.
|
ArgumentDescriptor[] |
getArguments() |
java.lang.String |
getDescription() |
public java.lang.String getDescription()
getDescription in interface ExtensionExtension.getDescription()public void doOperation(AuthorAccess authorAccess, ArgumentsMap args) throws java.lang.IllegalArgumentException, AuthorOperationException
AuthorOperationWorkspace.getPlatform().
To get to the Workspace you may use: AuthorAccess.getWorkspaceAccess().doOperation in interface AuthorOperationauthorAccess - The author access.
Provides access to specific informations and actions for
editor, document, workspace, tables, change tracking, utility a.s.o.args - The map of arguments. All the arguments defined by method
AuthorOperation.getArguments() must be present in the map of arguments.java.lang.IllegalArgumentException - Thrown when one or more arguments are illegal.AuthorOperationException - Thrown when the operation fails.AuthorOperation.doOperation(ro.sync.ecss.extensions.api.AuthorAccess, ro.sync.ecss.extensions.api.ArgumentsMap)public ArgumentDescriptor[] getArguments()
getArguments in interface AuthorOperationArgumentDescriptor representing
the arguments this operation uses.AuthorOperation.getArguments()© Copyright SyncRO Soft SRL 2002 - 2016. All rights reserved.