Extension debugging with Eclipse

Post here questions and problems related to oXygen frameworks/document types.
tmakita
Posts: 107
Joined: Fri Apr 08, 2011 7:58 am

Extension debugging with Eclipse

Post by tmakita »

I'm developing custom element insertion framework extension via Java & Eclipse. By following the below URL I tried to debug my extension in Eclipse from Oxygen.
Debugging an Oxygen SDK Extension Using the Eclipse Workbench
https://www.oxygenxml.com/doc/versions/ ... g-sdk.html
The XML file that describes the extension.
xxx-frameworks\externalAuthorActions\bookref.xml

Code: Select all

<a:authorAction xmlns:a="http://www.oxygenxml.com/ns/author/external-action"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.oxygenxml.com/ns/author/external-action http://www.oxygenxml.com/ns/author/external-action/authorAction.xsd"
	id="bookRef">
	<a:name>分冊間参照</a:name>
	<a:description>分冊間参照を挿入します</a:description>
	<a:largeIconPath href="./icons/bookref.png"/>
	<a:smallIconPath href="./icons/bookref-small.png"/>
	<a:operations>
		<a:operation id="com.antennahouse.oxyutil.operation.ExtXrefOperation">
			<a:xpathCondition>//*</a:xpathCondition>
			<a:arguments>
				<a:argument name="bookrefpath">${xpath_eval(concat("${pd}", '/../../book-ref/book-ref.xml'))}</a:argument>
				<a:argument name="fragment">
					<extxref volref="${extxrefVolref}" ref-style="${extxrefFormat}" refid="${extxrefId}" pattern="${pattern}">${extxrefTitle}</extxref>
				</a:argument>				
				<a:argument name="insertLocation"></a:argument>
				<a:argument name="insertPosition"></a:argument>
			</a:arguments>
		</a:operation>
	</a:operations>
	<a:accessKey/>
</a:authorAction>
bookref.png is displayed in the Oxygen toolbar, so I assume that this framework is surely recognized from Oxygen,
The class that implements AuthorOperation:

Code: Select all

public class ExtXrefOperation implements AuthorOperation{
    ExtXrefDlg exd = null;
    private static final String ARG_FILEPATH = "bookrefpath";
    private static final String ARG_INSERT_FRAGMENT = "fragment";
	@Override
	public void doOperation(AuthorAccess authorAccessarg, ArgumentsMap arguments)
			throws IllegalArgumentException, AuthorOperationException {
		Dialog.informationDlg(null, "Hello World!");
		if (exd == null) {
			String bookrefPathString = (String)arguments.getArgumentValue(ARG_FILEPATH);
			String fragmentExtxref = (String)arguments.getArgumentValue(ARG_INSERT_FRAGMENT);
			//exd = new ExtXrefDlg(bookrefPathString);
		} else {
			exd.setVisible(true);
		}
	}
	@Override
	public String getDescription() {
        return "Insert \"extxref\" element from dialog";
	}
	@Override
	public ArgumentDescriptor[] getArguments() {
	    ArgumentDescriptor args[] = new ArgumentDescriptor[] {
	    		new ArgumentDescriptor(ARG_FILEPATH, ArgumentDescriptor.TYPE_STRING, "The relative path of book-ref.xml from project path."),
	    		new ArgumentDescriptor(ARG_INSERT_FRAGMENT, ArgumentDescriptor.TYPE_STRING, "extxref placeholder template")
	    };
	    return args;
	}
}
The .class files folder is directly assigned in the Document Association Class path dialog.



But one I invoke extension class form Oxygen toolbar icon, I got the following error message.
2024-03-08-1.png
2024-03-08-1.png (12.19 KiB) Viewed 1022 times
When I generates .jar file from Eclipse and set it framework resources folder, I could get my extension work.
2024-03-08-6.png
2024-03-08-6.png (6.4 KiB) Viewed 1022 times
Are there any advices to debug extenion in Eclipse IDE from Oxygen??
Any suggestions are welcome!
Thanks and regards,
Attachments
2024-03-08-9.png
2024-03-08-9.png (63.65 KiB) Viewed 1022 times
2024-03-08-1.png
2024-03-08-1.png (12.19 KiB) Viewed 1022 times
2024-03-08-9.png
2024-03-08-9.png (63.65 KiB) Viewed 1022 times
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
Radu
Posts: 9258
Joined: Fri Jul 09, 2004 5:18 pm

Re: Extension debugging with Eclipse

Post by Radu »

Hi,
So the documentation you linked says:
In the Classpath tab, add a reference to your Project's classes directory and in the Extensions tab,
This would mean you just need to add in the Classpath list a reference to your "bin" folder, but instead you seem to refer individual subfolders from the bin folder.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tmakita
Posts: 107
Joined: Fri Apr 08, 2011 7:58 am

Re: Extension debugging with Eclipse

Post by tmakita »

> This would mean you just need to add in the Classpath list a reference to your "bin" folder
After changing the classpath to bin folder, I could get the "Hello World!" dialog.
> Add a breakpoint in one of the source Java classes.
However, the break point of Eclipse did not seem to work.
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
Radu
Posts: 9258
Joined: Fri Jul 09, 2004 5:18 pm

Re: Extension debugging with Eclipse

Post by Radu »

Hi,
However, the break point of Eclipse did not seem to work.
Not sure about this one, Oxygen loads these extensions in a separate class loader, maybe this breaks Eclipse's ability to know in which class the breakpoint is.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tmakita
Posts: 107
Joined: Fri Apr 08, 2011 7:58 am

Re: Extension debugging with Eclipse

Post by tmakita »

> Oxygen loads these extensions in a separate class loader, maybe this breaks Eclipse's ability to know in which class the breakpoint is.
Thank you, I got it!
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
Post Reply