Modify Link Action
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 157
- Joined: Mon Aug 18, 2014 4:11 pm
Modify Link Action
Hi Alex,
We are working in one more functionality as "Modify inserted Link" in oxygen eclipse. What is required is if user select a link and by selecting "Modify Link" option from menu or toolbar, he should get the link in the proper text box and he should be able to edit it. This is similar to "Edit Attributes", but difference is our link is a mixture of many fields.
For eg :- Consider the link is as below,
<xref topicname#sectionname>
Now user selects Modify Link from toolbar (this we have done using framework changes), then we need to get 'topicname' in one field and 'sectionname' in another.
How can we do this. How can we read character from the editor using java code.
Regards,
Shabeer
We are working in one more functionality as "Modify inserted Link" in oxygen eclipse. What is required is if user select a link and by selecting "Modify Link" option from menu or toolbar, he should get the link in the proper text box and he should be able to edit it. This is similar to "Edit Attributes", but difference is our link is a mixture of many fields.
For eg :- Consider the link is as below,
<xref topicname#sectionname>
Now user selects Modify Link from toolbar (this we have done using framework changes), then we need to get 'topicname' in one field and 'sectionname' in another.
How can we do this. How can we read character from the editor using java code.
Regards,
Shabeer
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: Modify Link Action
Post by alex_jitianu »
Hi,
I suspect that there is an href attribute there, that contains the topicName#sectionName value, right? You can get it and set it back like this:
You can learn more about the Author document model by reading about the AuthorNode and AuthorElement.
best regards,
Alex
I suspect that there is an href attribute there, that contains the topicName#sectionName value, right? You can get it and set it back like this:
Code: Select all
int caretOffset = authorAccess.getEditorAccess().getCaretOffset();
AuthorNode xrefNode = authorAccess.getDocumentController().getNodeAtOffset(caretOffset);
if (xrefNode.getType() == AuthorNode.NODE_TYPE_ELEMENT) {
AuthorElement authorElement = (AuthorElement) xrefNode;
// How to get/set an attribute value
AttrValue attribute = authorElement.getAttribute("href");
String[] topicNameAndSection = attribute.getValue().split("#");
// TODO ......
// To set the value back you must use the controller
authorAccess.getDocumentController().setAttribute("href", new AttrValue("newValue"), authorElement);
}
best regards,
Alex
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service