using resultsmanager in workspaceaccessplugin
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 13
- Joined: Mon Oct 23, 2017 3:42 pm
using resultsmanager in workspaceaccessplugin
hi,
how can i use the ResultsManager in a javascript-based workspace access plugin?
i can't figure out how to add the right Listener to check if an operation produces results. So if someone runs an Xpath Operation, i would like to use the results in my plugin view.
and if i would be able to use the ResultsManager.getAllResults method, whats an example for the tabKey param?
thanks,
barbara
how can i use the ResultsManager in a javascript-based workspace access plugin?
i can't figure out how to add the right Listener to check if an operation produces results. So if someone runs an Xpath Operation, i would like to use the results in my plugin view.
and if i would be able to use the ResultsManager.getAllResults method, whats an example for the tabKey param?
thanks,
barbara
-
- Posts: 417
- Joined: Mon May 09, 2016 9:37 am
Re: using resultsmanager in workspaceaccessplugin
Post by sorin_carbunaru »
Hello Barbara,
For getting access to the results manager you have to call getResultsManager() on the pluginWorkspaceAccess object:
But getAllResults() will only return the results that were previously presented to the user by calling resultsManager.setResults() or resultsManager.addResult(s)(), so I don't know if this is what you are looking for.
What XPath operation are you referring to? Have you created your own operation by extending AuthorOperation? If not, how do you execute the XPath?
Kind regards,
Sorin Carbunaru
oXygen XML
For getting access to the results manager you have to call getResultsManager() on the pluginWorkspaceAccess object:
Code: Select all
function applicationStarted(pluginWorkspaceAccess) {
var resultsManager = pluginWorkspaceAccess.getResultsManager();
}
What XPath operation are you referring to? Have you created your own operation by extending AuthorOperation? If not, how do you execute the XPath?
Kind regards,
Sorin Carbunaru
oXygen XML
-
- Posts: 13
- Joined: Mon Oct 23, 2017 3:42 pm
Re: using resultsmanager in workspaceaccessplugin
Hi Sorin,
thanks for your quick response.
sorry, i guess i misunderstood the ResultManager.
I would like to use the results produced by operations run from Oxygens Xpath Toolbar.
Here's a screenshot: https://drive.google.com/file/d/0B1jIsa ... 9icFk/view
Best wishes,
Barbara
thanks for your quick response.
sorry, i guess i misunderstood the ResultManager.
I would like to use the results produced by operations run from Oxygens Xpath Toolbar.
Here's a screenshot: https://drive.google.com/file/d/0B1jIsa ... 9icFk/view
Best wishes,
Barbara
-
- Posts: 417
- Joined: Mon May 09, 2016 9:37 am
Re: using resultsmanager in workspaceaccessplugin
Post by sorin_carbunaru »
Hi Barbara,
If you use our toolbar for executing XPath expressions, the results are presented in a panel at the bottom of the editor. That's perfect, because you can use the results manager. In my previous post, instead of saying that getAllResults() returns the results presented when calling some other methods of the manager, I should have said that it returns all the results that are presented in a results panel. My bad...
To use the results presented at the bottom of oXygen after executing an XPath expression in the designated toolbar, you have to write something like this (in Java):
For the exact JavaScript/Rhino syntax, please consult the resources from https://developer.mozilla.org/en-US/doc ... ects/Rhino (mainly https://developer.mozilla.org/en-US/doc ... pting_Java). You can also take a look at some of our JavaScript plug-in samples from GitHub (https://github.com/oxygenxml/wsaccess-j ... le-plugins).
Sorin C.
If you use our toolbar for executing XPath expressions, the results are presented in a panel at the bottom of the editor. That's perfect, because you can use the results manager. In my previous post, instead of saying that getAllResults() returns the results presented when calling some other methods of the manager, I should have said that it returns all the results that are presented in a results panel. My bad...
To use the results presented at the bottom of oXygen after executing an XPath expression in the designated toolbar, you have to write something like this (in Java):
Code: Select all
WSEditor currentEditorAccess = pluginWorkspaceAccess.getCurrentEditorAccess(PluginWorkspace.MAIN_EDITING_AREA);
if (currentEditorAccess != null) {
URL editorLocation = currentEditorAccess.getEditorLocation();
String fileName = URLUtil.extractFileName(editorLocation);
ResultsManager resultsManager = pluginWorkspaceAccess.getResultsManager();
List<DocumentPositionedInfo> allResults = resultsManager.getAllResults("XPath - " + fileName);
}
Sorin C.
-
- Posts: 13
- Joined: Mon Oct 23, 2017 3:42 pm
Re: using resultsmanager in workspaceaccessplugin
wow, now i feel stupid
should have been able to figure that out by myself.
just one last question and then i'll stop bothering you.
my goal is to display the results in a table in my plugin-view (so the use case would be: user runs xpath => reviews results, maybe deletes some => clicks a button in the plugin view => gets the remaining results presented in a table => the table displays the result nodes attribute values and allows the user to modify them)
so i guess it's a mix of the refactoring tool and gridview.
is there an "easy" way to get nodes/elements/tags from results at the right offset? or do i need to detect first, if the current page is type author or text and - depending on that - either find the corresponding author nodes or the right text to modify?
(sorry if i'm not explaining it well enough - if necessary i could provide a mock up)
thanks again and best wishes,
barbara

should have been able to figure that out by myself.
just one last question and then i'll stop bothering you.
my goal is to display the results in a table in my plugin-view (so the use case would be: user runs xpath => reviews results, maybe deletes some => clicks a button in the plugin view => gets the remaining results presented in a table => the table displays the result nodes attribute values and allows the user to modify them)
so i guess it's a mix of the refactoring tool and gridview.
is there an "easy" way to get nodes/elements/tags from results at the right offset? or do i need to detect first, if the current page is type author or text and - depending on that - either find the corresponding author nodes or the right text to modify?
(sorry if i'm not explaining it well enough - if necessary i could provide a mock up)
thanks again and best wishes,
barbara
-
- Posts: 417
- Joined: Mon May 09, 2016 9:37 am
Re: using resultsmanager in workspaceaccessplugin
Post by sorin_carbunaru »
Hello Barbara,
You need to check what page you are in, Author or Text, and based on that work in a certain way.
If you are in the Author page, then you can cast the DocumentPositionedInfo (DPI) objects returned by the results manager to AuthorDocumentPositionedInfo and call AuthorDocumentPositionedInfo#getNode().
For the Text page... Well... I don't have much experience with the Text page API. But I can tell you that you have to work with WSTextEditorPage and WSTextEditorPage#getDocument(). What I've seen exploring the text page API is that, to get the start and end offsets of a DPI, you can use WSTextBasedEditorPage.getStartEndOffsets(DocumentPositionedInfo), and you can get the text from between the offset using Document.getText(int, int). You might find this to be helpful at some point.
Sorin C.
You need to check what page you are in, Author or Text, and based on that work in a certain way.
If you are in the Author page, then you can cast the DocumentPositionedInfo (DPI) objects returned by the results manager to AuthorDocumentPositionedInfo and call AuthorDocumentPositionedInfo#getNode().
For the Text page... Well... I don't have much experience with the Text page API. But I can tell you that you have to work with WSTextEditorPage and WSTextEditorPage#getDocument(). What I've seen exploring the text page API is that, to get the start and end offsets of a DPI, you can use WSTextBasedEditorPage.getStartEndOffsets(DocumentPositionedInfo), and you can get the text from between the offset using Document.getText(int, int). You might find this to be helpful at some point.
Sorin C.
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ 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