[oXygen-user] Shortcut Problem

Dan Caprioara
Thu May 8 07:10:15 CDT 2008


Hello Philipp,
The only built-in actions that can be used from a document type are the 
one inserting an XML fragment and the one inserting a text. If you need 
more advanced features, like inserting an XML fragment and then moving 
the caret after the inserted block, you should write your action in 
Java, then refer it from the document type. For more details, see:

http://www.oxygenxml.com/doc/ug-standalone/dg_java_api.html
http://www.oxygenxml.com/InstData/Developer/oxygenAuthorSDK.zip

You will have to create a Java class that implements: 
ro.sync.ecss.extensions.api.AuthorOperation, something like this:

class InsertLB implements ro.sync.ecss.extensions.api.AuthorOperation{

public void doOperation(
   AuthorAccess authorAccess,
   ArgumentsMap arguments)
            throws IllegalArgumentException,
   AuthorOperationException {

    String fragment = "<lb/>";
   
    // Inserts this fragment at the caret position.
    int caretPosition = authorAccess.getCaretOffset();       
    authorAccess.insertXMLFragment(fragment, caretPosition);
    // Moves the caret after the start tag and end tag of <lb/>
    authorAccess.setCaretPosition(caretPosition + 2);
}
       
/**
 * Has no arguments.
 *
 * @return null.
 */
public ArgumentDescriptor[] getArguments() {
    return null;
}

/**
 * @return A description of the operation.
 */
public String getDescription() {
    return "Inserts a line break. Moves the caret after the inserted 
fragment.";
}
}

After creating the Java file, you should follow the steps from the User 
Guide and deploy this action into your Document Type association.

Regarding the shortcuts, I have tested the "Bold" action using the 
shortcut "CTRL-SHIFT-B" and it works. I have change it to "CTRL-SHIFT-K" 
and worked also. Can you try to reopen the edited document after 
changing the shortcut?

Please check that the action you created is inserted in the Document 
Type menu (should appear in the main menu bar), before the menu 
"Document". If it is included only in the toolbar, the shortcut is 
ignored! Also you can check  in the menu to see if the listed actions 
have the expected shortcuts.
Another problem might be duplicated shortcuts (actions from the editor 
menus that have the same key combination) .

Best regards,
Dan



Philipp Steinkrüger wrote:
 > Dear Oxy-users,
 >
 > I am currently trying to learn how to do DocType Associations and I 
experienced two problems, a minor and a major one.
 >
 > Heres the minor problem: I created a new button to insert a <lb/> 
element. Inserting works fine, i.e. after clicking the button,
 > a <lb/> appears in the code. But in author mode, i guess because 
<lb/> is defined as a block element (to actually make the
 > linebreak appear) it is shown as <lb></lb> and the cursor in placed 
inside the <lb></lb> after inserting it. So if the editor
 > continues to write, he fills the <lb> which is of course not allowed 
by the schema. What I would like to do is to position the cursor
 > behind the element after inserting it. is that possible?
 >
 > The major problem concerns shortcuts: i defined a shortcut for the 
button, but it just doesn't work. Thats also true for predefined
 > buttons, not only for my newly created ones. I tried to use the TEI 
Doctype and no shortcut works. I have no idea how to approach
 > this problem. What could I do?
 >
 > Thanks!
 > Philipp
 >
 > PS: It's Oxygen Standalone 9.1 for Windows, btw...
 >
 >
 >
 >
 > --
 > Philipp Steinkrüger M.A.
 > Thomas-Institut der Universität zu Köln
 > Universitätsstraße 22
 > 50923 Köln
 > +49 221 4702394
 >
 > 
 > http://www.thomasinstitut.uni-koeln.de
 > http://www.philosophie.uni-koeln.de
 > http://www.ide.de
 >
 >
 >
 >
 >
 >
 >
 >
 > _______________________________________________
 > oXygen-user mailing list
 > 
 > http://www.oxygenxml.com/mailman/listinfo/oxygen-user




More information about the oXygen-user mailing list