Page 1 of 1

Resolve Xref in Custom Document Standard

Posted: Mon Jun 29, 2015 12:08 pm
by Denis
Hi,
we are using the Eclipse Oxygen Author in Version 15.2.

We have created a oxygen extension for a document standard called PiMod. Now we have a problem to resolve a xref inside a topic. In the CSS I added this:

Code: Select all


link[href]:before {
content: '[ Click ';
link:attr(href);
}
When I create a link element with a href target inside the topic, the editor opens a second tab in the Author-Mode. The result-view shows a warning, that the reference was not found.
Now I want to know, which classes I have to customize, to get the same behaviour like DITA-XRef. There the click jumps to the element inside the same tab.

Best regards,
Denis

Re: Resolve Xref in Custom Document Standard

Posted: Mon Jun 29, 2015 2:26 pm
by Radu
Hello Denis,

The CSS looks OK.
Could you tell me how the XML content for the <link> element looks like?
Especially the value of that "@href" attribute.
As it is a link in the same document I would expect it to start with "#", if so, Oxygen would try to find the element with that ID from the document.
If the value does not start with "#" but it refers to an ID in the same document the CSS could be re-written like:

Code: Select all

link[href]:before {
content: '[ Click ';
link:"#" attr(href);
}
Regards,
Radu

Re: Resolve Xref in Custom Document Standard

Posted: Thu Sep 24, 2015 7:34 pm
by Denis
Hi Radu,

it know it comes late but thank you the the missing hashtag will do it!

FYI: The href do not start with the hashtag.

Best Regards
Denis

Re: Resolve Xref in Custom Document Standard

Posted: Fri Sep 25, 2015 8:15 am
by Radu
Hi Denis,

No problem, when you are posting on the forum you can check the Notify me when a reply is posted checkbox to automatically receive an email when the forum thread is updated.

Regards,
Radu

Re: Resolve Xref in Custom Document Standard

Posted: Fri Sep 25, 2015 3:52 pm
by Denis
Hi Radu,
I have to revoke my last post. Today I worked further on this feature and I run in a similar problem. The link opens again a second tab with the equal document in the editor. Everytime I click the link from the first document, the editor jumps to the second tab to the element, which is refered. If I click the link in the seconed tab, the editor jumps to the element and stays in the seconed tab.

The content of the document is:

Code: Select all


<descriptive langcode="de_DE" nodeid="010915">
<descriptive_body>
// the nodeid is the uniqe identifier
<note nodeid="identifier">
<paragraph/>
</note>
<footnote><link href="identifier"></link></footnote>
</descriptive_body></descriptive>
The CSS:

Code: Select all


link[href]:before {
content: '[ Click ';
link:"#" attr(href);
}

I saw the ElementLocatorProvider Interface. Could a implementation of this interface help me?

Best regards,
Denis

Re: Resolve Xref in Custom Document Standard

Posted: Fri Sep 25, 2015 4:23 pm
by Radu
Hi Denis,

A custom ElementLocatorProvider will not work. The decision whether to open a new XML or to search for the target in the current XML document is not made via that API. That API is used once the other XML was opened in order to find the target.
Do you happen to have an xml:base attribute in the XML file? If so, what is its value?
What Oxygen does when you click the link is to try and create an absolute URL for it. For this, it uses the xml base location (looks for xml:base attributes defined on ancestor elements) and if no such attributes are defined, it uses the current editor URL location.
When the URL to open is equal to the URL which is already opened, Oxygen will not open a new tab, it will try to find the target in the already opened editor. Somehow in your case Oxygen considers that the URL to open is different from the one already opened.

If you go to the Window menu->Show view->Editor properties, the editor properties shows the Path of current file location.
If you copy that from the original opened editor and compare it with the one from the second opened editor we should find a difference there, difference which tricks Oxygen into opening the new tab.

Regards,
Radu

Re: Resolve Xref in Custom Document Standard

Posted: Fri Sep 25, 2015 7:46 pm
by Denis
Hi,

we have not defined a xml:base attribute. A dtd is used to define the structure.
Beetween this two instances are no difference in the properties view. The paths a equal and all other properties, too.
The ExtensionBundle that we are using is extended from the DocBook4ExtensionBundle. I can break into the DocbookLinkTextResover class, which method activated(AuthorAccess) will be called two times (I think from the from the AuthorEditorPage class). First time when I opening the document and a seconed time by clicking on the link. The authorAccess is not the same instance!

Regards
Denis

Re: Resolve Xref in Custom Document Standard

Posted: Mon Sep 28, 2015 10:08 am
by Radu
Hi Denis,

So:
Beetween this two instances are no difference in the properties view. The paths a equal and all other properties, too.
Just to make sure, could you copy the paths from both opened editors, paste them somewhere (in Notepad for example) and compare them character by character?
The ExtensionBundle that we are using is extended from the DocBook4ExtensionBundle.
I'm not sure how much you customized.
Could you try to disable your custom framework, test the same situation with the Docbook 4 framework bundled by default with Oxygen?
I can break into the DocbookLinkTextResover class, which method activated(AuthorAccess) will be called two times (I think from the from the AuthorEditorPage class). First time when I opening the document and a seconed time by clicking on the link. The authorAccess is not the same instance!
Yes, as there are two opened editors, each has its own authorAccess. Also the DocbookLinkTextResover is not the same instance, an object individual is created for both editors. The role of the DocbookLinkTextResover is to provide some description text for a link.

Regards,
Radu

Re: Resolve Xref in Custom Document Standard

Posted: Mon Sep 28, 2015 3:32 pm
by Denis
Hi Radu,

thank you for your support and your investigated time! I have found the bug on our side. We have extended the FileStoreEditorInput, which contains the filepath and override the equals method. In the equals method we are added some more conditions, which are responsible for this weird behaviour.

Best regards and thanks again,
Denis

Re: Resolve Xref in Custom Document Standard

Posted: Wed Sep 30, 2015 10:20 am
by Denis
Hi Radu,
I have a further question to this topic. Do I have a option to customize the FileStoreEditorInput, which do you give to open the file?

Best regards,
Denis

Re: Resolve Xref in Custom Document Standard

Posted: Wed Sep 30, 2015 10:43 am
by Radu
Hi Denis,

If you look in our plugin's plugin.xml there is an extension called "customEditorInputCreator" which can return an implementation of com.oxygenxml.editor.editors.CustomEditorInputCreator.
That implementation would allow you to return your own IEditorInput implementation.
I'm not sure if that helps you or not, I do not know your use case.

Regards,
Radu

Re: Resolve Xref in Custom Document Standard

Posted: Wed Sep 30, 2015 6:06 pm
by Denis
Hi Radu,

thank you again! This extension point give me the possibilty to compare the URIĀ“s, where I can decide, if the files are equal or not.

Best regards
Denis