Issue with DITA Extension Bundle

Post here questions and problems related to oXygen frameworks/document types.
krishna
Posts: 6
Joined: Mon May 20, 2019 5:24 pm

Issue with DITA Extension Bundle

Post by krishna » Mon May 20, 2019 8:11 pm

Hi,

I have created a plugin for Oxygen XML Editor and in that, I have created a custom attribute value editor class and tried to add it to Oxygen in the following way :

Approach 1 :

1) Go to Options > Preferences > Document Type Association and extend the DITA Document type.
2) In this DITA Extension, Go to Classpath tab and load plugin using "Use parent classloader from plugin with ID : <my plugin ID>"
3) Go to Extensions tab and under Individual extensions click Choose for Author Custom Attribute Value Editor field and select the custom attribute value editor class
4) Click OK on all open dialogs

But this approach doesn't seem to work.

Approach 2 :

So I tried to create a DITA Extension Bundle class and implemented the function createCustomAttributeValueEditor() which returns an instance of my custom attribute value editor class.

I configured the plugin in the same manner as above but in this case, under the Extensions tab, I chose my DITA Extension Bundle class for the Extensions Bundle field and clicked OK on all open dialogs.
This approach worked fine for the custom attribute value editor but now the conref's are not getting resolved.

Can someone please let me know what is wrong with both of my approaches?
In Approach 2, should we have to implement a custom reference resolver also as part of the DITA Extension Bundle class?

alex_jitianu
Posts: 697
Joined: Wed Nov 16, 2005 11:11 am

Re: Issue with DITA Extension Bundle

Post by alex_jitianu » Tue May 21, 2019 4:19 pm

Hello,

I think I know why Approach 2 has that side effect. Your extension bundle should extend ro.sync.ecss.extensions.dita.DITAExtensionsBundle . This implementation is present inside {oxygenInstallDir}/frameworks/dita/dita.jar so you can put this jar inside your project to resolve compilation errors and to be able to extend DITAExtensionsBundle . If you are extending ro.sync.ecss.extensions.api.ExtensionsBundle then you will lose a lot of specific DITA support.

I will try Approach 1 myself and I will return with an answer.

alex_jitianu
Posts: 697
Joined: Wed Nov 16, 2005 11:11 am

Re: Issue with DITA Extension Bundle

Post by alex_jitianu » Wed May 22, 2019 3:10 pm

Hello,

I've managed to test Approach 1 myself and it worked as expected. Here is how I did it:
1. In my plugin I've created a class:

Code: Select all

package com.oxygenxml.samples.framework;

import javax.swing.JComponent;
import javax.swing.JOptionPane;

import ro.sync.ecss.extensions.api.CancelledByUserException;
import ro.sync.ecss.extensions.api.CustomAttributeValueEditor;
import ro.sync.ecss.extensions.api.EditedAttribute;

public class MyAttrValueEditor extends CustomAttributeValueEditor {

	@Override
	public String getDescription() {
		return "A sample";
	}

	@Override
	public String getAttributeValue(EditedAttribute attribute, Object parentComponent) throws CancelledByUserException {
		return JOptionPane.showInputDialog((JComponent) parentComponent, "Value for " + attribute.getAttributeQName());
	}

	@Override
	public boolean shouldHandleAttribute(EditedAttribute attribute) {
		return attribute.getAttributeQName().equals("dir");
	}

}
2. I've edited my framework and on the Classpath tab, I've specified my plugin ID in the text field "Use parent classloader from plugin with ID:"
3. I've went to the Extensions tab and clicked Choose for the "Author custom attribute value editor" section and selected "com.oxygenxml.samples.framework.MyAttrValueEditor" as the implementation.

I believe that you've done things similarly.
4. I closed all dialogs with OK, went to the Attributes panel and tried to edit the "dir" attribute. My dialog appeared.

Do you notice something different than what you've tried?

Best regards,
Alex

krishna
Posts: 6
Joined: Mon May 20, 2019 5:24 pm

Re: Issue with DITA Extension Bundle

Post by krishna » Thu May 23, 2019 9:26 am

Hi Alex,

Thanks for the help.

For Approach 1, what do you mean by "edited my framework" in step 2? Can you elaborate on this?
I don't think we have created/modified any framework file.
If you're talking about the Storage option in Document Type dialog we chose it as "Internal"

Regards,
Krishna

alex_jitianu
Posts: 697
Joined: Wed Nov 16, 2005 11:11 am

Re: Issue with DITA Extension Bundle

Post by alex_jitianu » Thu May 23, 2019 12:59 pm

Hi,
For Approach 1, what do you mean by "edited my framework" in step 2? Can you elaborate on this?
In the "Document Type Association" preferences page, I've selected my framework (document type) and clicked "Edit".
If you write us an email on support@oxygenxml.com I can send you my test plugin/framework to compare it with yours.

Best regards,
Alex

krishna
Posts: 6
Joined: Mon May 20, 2019 5:24 pm

Re: Issue with DITA Extension Bundle

Post by krishna » Fri May 24, 2019 8:25 am

Thanks, Alex.
We will try to debug if there is an issue with our code and will email support@oxygenxml.com if we require the test plugin.

krishna
Posts: 6
Joined: Mon May 20, 2019 5:24 pm

Re: Issue with DITA Extension Bundle

Post by krishna » Fri May 24, 2019 12:43 pm

Hi Alex,

Actually, there is an issue with our code i.e we have to choose our Custom Extension Bundle in place of default DITAExtensionBundle provided by oxygen.

So, we are trying to create the custom extension bundle by extending the DITAExtensionBundle and in order to do this, we need to import the dita.jar from the Oxygen installation directory.

Can you please let me know if the dita.jar is backward compatible?

I mean if we create a plugin using the dita.jar from Oxygen 21.0 and install this plugin in Oxygen 16.0, will there any version compatibility issues?

Also what about forward compatibility?

alex_jitianu
Posts: 697
Joined: Wed Nov 16, 2005 11:11 am

Re: Issue with DITA Extension Bundle

Post by alex_jitianu » Mon May 27, 2019 11:29 am

Hi,
I mean if we create a plugin using the dita.jar from Oxygen 21.0 and install this plugin in Oxygen 16.0, will there any version compatibility
issues?
You don't actually distribute dita.jar inside your plugin (double check that it isn't present in the plugin package because it will lead to class loader issues). You just need it at compile time for the Custom Extension Bundle. When your code deploys into Oxygen, there will be a proper dita.jar at runtime. As long as you don't extend methods from ro.sync.ecss.extensions.api.ExtensionsBundle that weren't present in Oxygen 16, your plugin will run in that version as well.

Best regards,
Alex

Post Reply