oXygene Editor Events

Oxygen general issues.
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

Sorry, missed the line before "Source - Target".

Is it possible to get Target out of Source using insertMultipleElements?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: oXygene Editor Events

Post by sorin_ristache »

Hello,

Yes, we should dig this problem. It seems impossible for an insertMultipleElements() call on a selected word to take 15 seconds. Please send us a zip archive with your framework and the Java source code of the action that takes 15 seconds.


Regards,
Sorin
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

ok.. give me some time to prepare the package!
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

The package have been send.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: oXygene Editor Events

Post by sorin_ristache »

Hello,

Thank you for the files. Your action InsertImageOperation needs such a long time because AuthorDocumentController.insertXMLFragment() is called many times (about 200 times). This call parses your strings <MyTag_red>word1</MyTag_red>, <MyTag_green>word2</MyTag_green> and <MyTag_blue>word3</MyTag_blue> as XML fragments for all the 200 strings which needs more than 10 seconds. The call insertXMLFragment() should be used for inserting one more complex XML fragment. In your case with many simple XML elements (200 elements) inserted in the same Author action that surrounds every word of a paragraph with an XML tag I think you should use insertMultipleElements() and insertText().


Regards,
Sorin
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

Hello Sorin.

Please, cite an example of using the function insertMultipleElements() for inserting tags <MyTag_red> , </MyTag_red>, <MyTag_green>,</MyTag_green> around the words word1, word2

Regards,
Max
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: oXygene Editor Events

Post by sorin_ristache »

The javadoc of the methods included in the Author SDK should tell you about how they should be used. If you need an example I will try to post an example here.


Regards,
Sorin
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

Yes, please, post an example here.
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

Hello Sorin,

We are searching for the fastest way of surrounding words with <MyTag_color> tags.
Does insertMultipleElements() support inserting both opening and closing tags simultaneously to surround a word designated by the offset?
If not, can you please give us as sample of the fastest code which can do that?

Regards,
Max
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: oXygene Editor Events

Post by sorin_ristache »

Method insertMultipleElements insert empty elements and after that you have to insert the words (Pruning, process, removing) inside the new elements. I think this is the fastest way because it does not create an XML fragment. In method doOperation() of your action InsertImageOperation you have the offset of each word that you want to surround and you should call documentController.insertMultipleElements() on the following elements as parent element: /task/taskbody/context, /task/taskbody/steps/step with the following parameters:
  • the Author node for the parent element (one of the above elements)
  • the list of all names of the new elements (MyTag_color) in the order from left to right
  • the offsets where the new elements will be inserted
  • the namespace of the new elements
You have an alternative with the method documentController.surroundInFragment() but that will insert XML fragments which is slower.


Regards,
Sorin
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

Hello Sorin,

Is it possible to highlight each word with a different color as at After.png with the help of Processing Instructions?

Regards,
Max
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: oXygene Editor Events

Post by sorin_ristache »

Hello,

Yes it is possible. You can insert the processing instructions using AuthorDocumentController.createDocumentFragmentInContext() or AuthorDocumentController.insertXMLFragment() and you set the color in the CSS with:

Code: Select all

oxy|processing-instruction {
color: rgb(139, 38, 201) !important;
}

Regards,
Sorin
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

Hi,

Thank you for the example.
Do you think using PIs may speed the process up or it'll be same slow?

Regards,
Max
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: oXygene Editor Events

Post by sorin_ristache »

I think it will not be faster because it is still a kind of XML markup that is inserted in the edited XML document.


Regards,
Sorin
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

Hello Sorin,

Thanx for answers!

How to make plugin catch "on save document" event?

Regards,
Max
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: oXygene Editor Events

Post by sorin_ristache »

Hello,

Do you mean catch save event when the user will save the edited document? You cannot catch this event in an Author extension. You can save the document with a call authorAccess.getEditorAccess().save() and you can catch events for document modification but you cannot catch the user save event. Can you specify more details about your usecase? Do you want to stop the save action?


Regards,
Sorin
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

Hi Sorin,

Imagine that you add some modifications to an open document which are temporary.
So if a users decides to save the document the modifications must be cleared first.
This is why we need the event.. Every time the document is about to be saved, we need to make sure that our modifications to the document are cleared.

Regards,
Max
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: oXygene Editor Events

Post by sorin_ristache »

Hello,

I think we need to change the Author API for that. Maybe a save notification is not the best solution but we need more details about your application, what you did so far and what you plan to implement in your Author extension for integration with your application. If we know more about the context of your Author extension we can find together a solution. Can you send these details to our support email address or using our online form for texhnical support?


Regards,
Sorin
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

My Boss has sent the details.

Regards,
Max
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

Hello Sorin,

How to get form Java a path to CSS file with the help of which XML document is rendering?

Image

Regards,
Max
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: oXygene Editor Events

Post by sorin_ristache »

Hello,

That is not possible in an extension using the Author API. What do you want to do with the path of CSS file?


Regards,
Sorin
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

We want to edit CSS file while "doOperation(...)" is running

Regards,
Max
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

And the second question is:
How to get Win32 Window Handle (WHND) from authorAccess.getParentFrame() ?

Regards,
Max
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

Hello Sorin,

The third question is:

How to make plugin catch "on close oxygen" event?


This code is not working:

Code: Select all

((JFrame)authorAccess.getParentFrame()).addWindowListener(new WindowAdapter() 
{
public void windowClosed(WindowEvent e) {
//Some code "on close"
}
}
);
Regards,
Max
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: oXygene Editor Events

Post by sorin_ristache »

Hello,

We sent you details about a test build of Oxygen that includes new API for adding and removing highlights from an Author extension. Does that help you with the highlights that you want to remove on document save? What processing do you want to do in the event for close Oxygen window?


Regards,
Sorin
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

Hello, Sorin

Thank you very-very much for your help.
Using highlights instead of inserting the colouring tags has solved almost all problems, well done!
Image

But we still seem to have a couple of minor questions, both related to using our windows.
1. To be able to correctly display our information windows on top of the oXygene editor, we need to have the handle of the main oXygene window. So far we tried to use authorAccess.getParentFrame() but it doesnt seem to give us access to niether VLC nor MFC window handles. Please help.

2. Another related problem concerns window events. We create all windows in a java thread which is initiated by the menu click. The problem is that if later on we show one of those previously created windows, it appears but then ever responds to any events which, as we think, is eplained by the fact that the original java thread is inactive. Can you suggest a workaround for that?

Best Regards,
Max
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: oXygene Editor Events

Post by sorin_ristache »

Max wrote:1. To be able to correctly display our information windows on top of the oXygene editor, we need to have the handle of the main oXygene window. So far we tried to use authorAccess.getParentFrame() but it doesnt seem to give us access to niether VLC nor MFC window handles. Please help.
authorAccess.getWorkspaceAccess().getParentFrame() returns a javax.swing.JFrame object as you can read in the javadoc of getParentFrame(). You can use this JFrame object as a parent for your Java dialogs. If you just want to display information messages or error messages you can use authorAccess.getWorkspaceAccess().showInformationMessage() or authorAccess.getWorkspaceAccess().showErrorMessage().
Max wrote:2. Another related problem concerns window events. We create all windows in a java thread which is initiated by the menu click. The problem is that if later on we show one of those previously created windows, it appears but then ever responds to any events which, as we think, is eplained by the fact that the original java thread is inactive. Can you suggest a workaround for that?
What do you mean ever responds to any events? What is the thread that you call original Java thread? I think these are Java programming issues. Your extension classes are called on the Java AWT thread and you can do any processing that you want using Java code that calls the Author API.


Regards,
Sorin
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

1. Unfortunately our dialogs are not java based. We use ordinary win32 dialog from our kernel DLL. So we need a win32 sollution here. A windows handle
2. Sorry for the typo.. I mean NEVER responds. We show up the window from our DLL, it correctly displays, but clicking on the window controls has no effect. We suspect it happense because the java thread in which we created the window is inactive and does not process messages sent to the window

Regards,
Max
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: oXygene Editor Events

Post by sorin_ristache »

You have to write JNI code (that is C code) that is called from your Author extension (that is Java code) and that will find the handle of the Oxygen frame, will display a window from a DLL, etc. I sent to your email address some example code that you can use for getting the Win32 window handle of a Java frame and for displaying a dialog from a Windows DLL that responds to user events without locking.


Regards,
Sorin
Max
Posts: 55
Joined: Tue Jun 09, 2009 4:47 pm

Re: oXygene Editor Events

Post by Max »

Hello, Sorin.

I’ve sent you the archive. See “Read_Me” file.

Regards,
Max
Post Reply